; ; BDOS interface for Microsoft Compiled Basic programs ; -- pst 7/29/85 ; ; The two routines are: ; BDOS - execute a bdos command, return result from reg A ; BDOSHL - execute a bdos command, return result from reg HL ; ; Format: 10 CALL BDOS(COMMAND,DATA,RESULT) ; Where: COMMAND = BDOS command number ; DATA = data to be passed to BDOS in DE register ; RESULT = data returned by BDOS (either in A or HL register) ; (all of these are DEFINT integers!) ; ;---------------------------------------------------------------- ; PUBLIC BDOS ; return data from A PUBLIC BDOSHL ; return data from HL ; ; Constants ; BDOSV EQU 0005H ;BDOS jump address ; ;******************************************************************** CSEG ;Start of routines * ;******************************************************************** ; ; BDOS - call the BDOS ; BDOS: PUSH H ;save command pointer PUSH D ;save passed data pointer PUSH B ;save returned data pointer ; MOV C,M ;C = command to send now ; MOV H,D ;DE = data to pass to bdos MOV L,E MOV E,M INX H MOV D,M ; CALL BDOSV ;execute command ; POP H ;get returned data pointer PUSH H ;save it again for stack cleanup MOV M,A INX H MVI M,0 ; POP B ;return data pointer POP D ;passed data pointer POP H ;command pointer RET ; ;**************************************************************** ; ; BDOSHL - call the BDOS ; BDOSHL: PUSH H ;save command pointer PUSH D ;save passed data pointer PUSH B ;save returned data pointer ; MOV C,M ;C = command to send now ; MOV H,D ;DE = data to pass to bdos MOV L,E MOV E,M INX H MOV D,M ; CALL BDOSV ;execute command XCHG ;move returned data to DE ; POP H ;get returned data pointer PUSH H MOV M,E INX H MOV M,D ; POP B ;return data pointer POP D ;passed data pointer POP H ;command pointer RET ; ;**************************************************************** ; End of program ; END