I have recently converted a QuickBasic program to PB/DOS 3.50.
This program reads a disk's serial number and media type using interrupt &h21.
Obviously, something went wrong, as the results contain nothing but chr$(0).
But when I replaced the REG and CALL INTERRUPT commands by their ASM equivalents the program worked fine.
Can anybody tell me what went wrong?
Thanks a lot for your help!
Heinz Salomon
[This message has been edited by Heinz Salomon (edited May 25, 2005).]
This program reads a disk's serial number and media type using interrupt &h21.
Obviously, something went wrong, as the results contain nothing but chr$(0).
But when I replaced the REG and CALL INTERRUPT commands by their ASM equivalents the program worked fine.
Can anybody tell me what went wrong?
Thanks a lot for your help!
Heinz Salomon
Code:
' Gets a disk's media descriptor and also its serial number. ' Based on an idea by Ethan Winer (SERIAL 1.0). ' $ERROR ALL ON %UsePureAsm = 1 %UseCallInterrupt = 0 %CompileVar = %UseCallInterrupt %AX = 1 %BX = 2 %CX = 3 %DX = 4 TYPE SNType Zero AS INTEGER SerLo AS INTEGER SerHi AS INTEGER Label AS STRING * 11 Media AS STRING * 8 END TYPE DIM SN AS SNType CLS PRINT PRINT "Get a disk's media descriptor and serial number" PRINT "(based on Ethan Winer's SERIAL 1.0)" PRINT INPUT "Enter drive letter: ", DriveLetter$ Drive% = ASCII(UCASE$(DriveLetter$)) - 64 If Drive% < 1 THEN END SNoffset?? = VARPTR(SN) $IF %CompileVar ! MOV AX, &H6900 ! MOV BX, Drive% ! MOV DX, SNoffset?? ! INT &H21 $ELSE REG %AX, &H6900 REG %BX, Drive% REG %DX, SNoffset?? CALL INTERRUPT &H21 $ENDIF PRINT PRINT "Media descriptor: "; RTRIM$(SN.Media, CHR$(0)) PRINT " Serial number: "; padHex$(SN.SerHi%); "-"; padHex$(SN.SerLo%) END FUNCTION padHex$(rInt%) padHex$ = RIGHT$("000" + HEX$(rInt%), 4) END FUNCTION
[This message has been edited by Heinz Salomon (edited May 25, 2005).]
Comment