* ASM code .MODEL LARGE .CODE Org 0h ; FP needs bins absolutely execute from address 0 main: push bx ; save bx mov ax,6900h ; get disk serial number function mov dx,bx ; our return buffer offset mov bx,ds:[bx] ; drive passed as parameter int 21h ; execute dos interrupt pop bx ; restore bx retf ; return far to FP end mainThis is Turbo assembler code. I have this .bat file I use to convert to .bin :
parameters driveletter set talk off clear mp = chr(asc(upper(driveletter))-ASC("A")+1)+chr(0)+; space(22) && 24 bytes total load serial call serial with mp && execute asm ? substr(mp,2+1) && First two bytes are always chr(0) cSerial1 = substr(mp,1+2,1) cSerial2 = substr(mp,2+2,1) cSerial3 = substr(mp,3+2,1) cSerial4 = substr(mp,4+2,1) ? asc(cSerial4) && Disk serial number ? asc(cSerial3) && is a doubleword ? asc(cSerial2) && So read in reverse order ? asc(cSerial1) && as shown in dir * Now print in hex format just like dir ? "Disk serial number is " ?? padl(dec2hex(asc(cSerial4)),2,"0") ?? padl(dec2hex(asc(cSerial3)),2,"0") ?? ":" ?? padl(dec2hex(asc(cSerial2)),2,"0") ?? padl(dec2hex(asc(cSerial1)),2,"0") ? function Dec2Hex parameters nDecimal n=0 do while floor(nDecimal/16^n) > 15 n = n+1 enddo cHEX = "" for ix=n to 0 step -1 cHEX = cHex + DecDigit2HexDigit(floor(nDecimal/16^ix)) nDecimal = nDecimal % 16 endfor return cHex function DecDigit2HexDigit parameters nDecimal return iif(ndecimal>9,chr(asc("A")+nDecimal%10),str(nDecimal,1))Cetin