$TITLE(IBM DOS INTERFACE PROCEDURES)
		NAME	DOSPROCS
;
DGROUP		GROUP	DATA
CGROUP		GROUP	CODE
;
DATA		SEGMENT	PUBLIC 'DATA'
DATA		ENDS
;
PEND		EQU	20H
DOS		EQU	21H
ABSRD		EQU	25H
ABSWRT		EQU	26H
;
CODE		SEGMENT	PUBLIC 'CODE'
       		ASSUME	CS:CGROUP,DS:DGROUP
;
; 
PROGRAMEND	PROC	NEAR
		PUBLIC	PROGRAMEND
		INT	PEND
PROGRAMEND	ENDP
;
;
; ABSOLUTE$READ: PROCEDURE(DRIVE,LRECORD,NSECTORS,BUFF$PTR) BYTE EXTERNAL;
; DECLARE(DRIVE,LRECORD,NSECTORS) WORD;
; DECLARE BUFF$PTR POINTER;
; END ABSOLUTE$READ;
;
; STATUS = ABSOLUTE$READ(DRIVE,LRECORD,NSECTORS,BUFF$P);
;
;
BUFF_L		EQU	[BP+4]
BUFF_H		EQU	[BP+6]
NRECS		EQU	[BP+8]
LRECORD		EQU	[BP+10]
DRIVE		EQU	[BP+12]
;
ABSOLUTEREAD	PROC	NEAR
		PUBLIC	ABSOLUTEREAD
		PUSH	BP		; SAVE USER BP REG
		MOV	BP,SP		; GET ADDRESSABILITY TO PARAMETERS
		MOV	AL,DRIVE
		MOV	CX,NRECS
		MOV	DX,LRECORD
		MOV	BX,BUFF_H
		PUSH	DS
		MOV	DS,BX
		MOV	BX,BUFF_L
		INT	ABSRD
		POP	CX
		POP	DS
		POP	BP
		RET	10
ABSOLUTEREAD	ENDP
;
;
; ABSOLUTE$WRITE: PROCEDURE(DRIVE,LRECORD,NSECTORS,BUFF$PTR) BYTE EXTERNAL;
; DECLARE(DRIVE,LRECORD,NSECTORS) WORD;
; DECLARE BUFF$PTR POINTER;
; END ABSOLUTE$WRITE;
;
; STATUS = ABSOLUTE$WRITE(DRIVE,LRECORD,NSECTORS,BUFF$P);
;
ABSOLUTEWRITE	PROC	NEAR
		PUBLIC	ABSOLUTEWRITE
		PUSH	BP		; SAVE USER BP REG
		MOV	BP,SP		; GET ADDRESSABILITY TO PARAMETERS
		MOV	AL,DRIVE
		MOV	CX,NRECS
		MOV	DX,LRECORD
		MOV	BX,BUFF_H
		PUSH	DS
		MOV	DS,BX
		MOV	BX,BUFF_L
		INT	ABSWRT
		POP	CX
		POP	DS
		POP	BP
		RET	10
ABSOLUTEWRITE	ENDP
;
;
; KEY$IN: PROCEDURE BYTE EXTERNAL;
; DECLARE CHAR BYTE;
; END KEY$IN;
;
KEYIN		PROC	NEAR
		PUBLIC	KEYIN
		MOV	AH,1
		INT	DOS
		RET
KEYIN		ENDP
;
;
; CHAR$OUT: PROCEDURE(CHAR) EXTERNAL;
; DECLARE CHAR BYTE;
; END CHAR$OUT;
;
;
CHAR		EQU	[BP+4]
;
CHAROUT		PROC	NEAR
		PUBLIC	CHAROUT
		PUSH	BP
		MOV	BP,SP
		MOV	DL,CHAR
		MOV	AH,2
		INT	DOS
		POP	BP
		RET	2
CHAROUT		ENDP
;
;
; PRN$OUT: PROCEDURE(CHAR) EXTERNAL;
; DECLARE CHAR BYTE;
; END PRN$OUT;
;
;
;
PRNOUT		PROC	NEAR
		PUBLIC	PRNOUT
		PUSH	BP
		MOV	BP,SP
		MOV	DL,CHAR
		MOV	AH,5
		INT	DOS
		POP	BP
		RET	2
PRNOUT		ENDP
;
; DIRECT$CONSOLE: PROCEDURE BYTE EXTERNAL;
; END DIRECT$CONSOLE;
;
;
DIRECTCONSOLE	PROC	NEAR
		PUBLIC	DIRECTCONSOLE
		PUSH	BP
		MOV	BP,SP
DLOOP:		MOV	DL,0FFH
		MOV	AH,6
		INT	DOS
		JZ	DLOOP
		POP	BP
		RET
DIRECTCONSOLE	ENDP
;
;
;
; DIRECT$NOECHO: PROCEDURE BYTE EXTERNAL;
; END DIRECT$NOECHO;
; REFER TO DOS MANUAL PAGE D-8 FUNCTION 7
;
;
DIRECTNOECHO	PROC	NEAR
		PUBLIC	DIRECTNOECHO
		MOV	AH,7
		INT	DOS
		RET
DIRECTNOECHO	ENDP
;
;
;
; KEYIN$NOECHO: PROCEDURE BYTE EXTERNAL;
; END KEYIN$NOECHO;
; REFER TO DOS MANUAL PAGE D-8 FUNCTION 8
;
;
KEYINNOECHO	PROC	NEAR
		PUBLIC	KEYINNOECHO
		MOV	AH,8
		INT	DOS
		RET
KEYINNOECHO	ENDP
;
;
;
; MSG$OUT: PROCEDURE(MSG$PTR) EXTERNAL;
; DECLARE MSG$PTR POINTER;
; END MSG$OUT;
; /* NOTE: MESSAGE IS TERMINATED WITH A DOLLAR SIGN */
;
MSG_L		EQU	[BP+4]
MSG_H		EQU	[BP+6]
;
MSGOUT		PROC	NEAR
		PUBLIC	MSGOUT
;
		PUSH	BP
		MOV	BP,SP
		MOV	DX,MSG_L
		PUSH	DS
		MOV	AX,MSG_H
		MOV	DS,AX
		MOV	AH,9
		INT	DOS
		POP	DS
		POP	BP
		RET	4
MSGOUT		ENDP
;
; LINE$IN: PROCEDURE(LINE$PTR) EXTERNAL;
; DECLARE LINE$PTR POINTER;
; END LINE$IN
;
LINE_L		EQU	[BP+4]
LINE_H		EQU	[BP+6]
;
LINEIN		PROC	NEAR
		PUBLIC	LINEIN
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,LINE_H
		MOV	DS,AX
		MOV	DX,LINE_L
		MOV	AH,10
		INT	DOS
		POP	DS
		POP	BP
		RET	4
LINEIN		ENDP
;
; KEY$STAT: PROCEDURE BYTE EXTERNAL;
; END KEY$STAT;
;
KEYSTAT		PROC	NEAR
		PUBLIC	KEYSTAT
		MOV	AH,11
		INT	DOS
		RET
KEYSTAT		ENDP
;
; CLR$KBD: PROCEDURE(FUNCTION) BYTE EXTERNAL
; DECLARE FUNCTION BYTE;
; END CLR$KBD;
;
FUNCTION	EQU	[BP+4]
;
CLRKBD		PROC	NEAR
		PUBLIC	CLRKBD
		PUSH	BP
		MOV	BP,SP
		MOV	AL,FUNCTION
		MOV	AH,12
		INT	DOS
		POP	BP
		RET	2
CLRKBD		ENDP
;
;
; DISK$RESET: PROCEDURE EXTERNAL;
; END DISK$RESET;
;
DISKRESET	PROC	NEAR
		PUBLIC	DISKRESET
		MOV	AH,13
		INT	DOS
		RET
DISKRESET	ENDP
;
;
; SELECT$DISK: PROCEDURE(DISK) BYTE EXTERNAL;
; DECLARE DISK BYTE;
; END SELECT$DISK;
;
DISK		EQU	[BP+4]
;
SELECTDISK	PROC	NEAR
		PUBLIC	SELECTDISK
		PUSH	BP
		MOV	BP,SP
		MOV	DL,DISK
		MOV	AH,14
		INT	DOS
		POP	BP
		RET	2
SELECTDISK	ENDP
;
;
; OPEN$FILE: PROCEDURE(FCB$PTR) BYTE;
; DECLARE FCB$PTR POINTER;
; END OPEN$FILE;
;
FCB_L		EQU	[BP+4]
FCB_H		EQU	[BP+6]
;
OPENFILE	PROC	NEAR
		PUBLIC	OPENFILE
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,FCB_H
		MOV	DS,AX
		MOV	DX,FCB_L
		MOV	AH,15
		INT	DOS
		POP	DS
		POP	BP
		RET	4
OPENFILE	ENDP
;
;
; CLOSFILE: PROCEDURE(FCB$PTR) BYTE EXTERNAL;
; DECLARE FCB$PTR POINTER;
; END CLOSE$FILE;
;
CLOSEFILE	PROC	NEAR
		PUBLIC	CLOSEFILE
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,FCB_H
		MOV	DS,AX
		MOV	DX,FCB_L
		MOV	AH,16
		INT	DOS
		POP	DS
		POP	BP
		RET	4
CLOSEFILE	ENDP
;
;
; SEARCHFIRSTFILE: PROCEDURE(FCB$PTR) BYTE EXTERNAL;
; DECLARE FCB$PTR POINTER;
; END SEARCHFIRST$FILE;
;
SEARCHFIRSTFILE	PROC	NEAR
		PUBLIC	SEARCHFIRSTFILE
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,FCB_H
		MOV	DS,AX
		MOV	DX,FCB_L
		MOV	AH,17
		INT	DOS
		POP	DS
		POP	BP
		RET	4
SEARCHFIRSTFILE	ENDP
;
;
; SEARCHNEXTFILE: PROCEDURE(FCB$PTR) BYTE EXTERNAL;
; DECLARE FCB$PTR POINTER;
; END SEARCHNEXT$FILE;
;
SEARCHNEXTFILE	PROC	NEAR
		PUBLIC	SEARCHNEXTFILE
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,FCB_H
		MOV	DS,AX
		MOV	DX,FCB_L
		MOV	AH,18
		INT	DOS
		POP	DS
		POP	BP
		RET	4
SEARCHNEXTFILE	ENDP
;
;
; DELETEFILE: PROCEDURE(FCB$PTR) BYTE EXTERNAL;
; DECLARE FCB$PTR POINTER;
; END DELETE$FILE;
;
DELETEFILE	PROC	NEAR
		PUBLIC	DELETEFILE
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,FCB_H
		MOV	DS,AX
		MOV	DX,FCB_L
		MOV	AH,19
		INT	DOS
		POP	DS
		POP	BP
		RET	4
DELETEFILE	ENDP
;
;
; READSEQ: PROCEDURE(FCB$PTR) BYTE EXTERNAL;
; DECLARE FCB$PTR POINTER;
; END READSEQ;
;
READSEQ		PROC	NEAR
		PUBLIC	READSEQ
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,FCB_H
		MOV	DS,AX
		MOV	DX,FCB_L
		MOV	AH,20
		INT	DOS
		POP	DS
		POP	BP
		RET	4
READSEQ		ENDP
;
;
; WRITESEQ: PROCEDURE(FCB$PTR) BYTE EXTERNAL;
; DECLARE FCB$PTR POINTER;
; END WRITESEQ;
;
WRITESEQ	PROC	NEAR
		PUBLIC	WRITESEQ
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,FCB_H
		MOV	DS,AX
		MOV	DX,FCB_L
		MOV	AH,21
		INT	DOS
		POP	DS
		POP	BP
		RET	4
WRITESEQ	ENDP
;
;
; CREATEFILE: PROCEDURE(FCB$PTR) BYTE EXTERNAL;
; DECLARE FCB$PTR POINTER;
; END CREATEFILE;
;
CREATEFILE	PROC	NEAR
		PUBLIC	CREATEFILE
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,FCB_H
		MOV	DS,AX
		MOV	DX,FCB_L
		MOV	AH,22
		INT	DOS
		POP	DS
		POP	BP
		RET	4
CREATEFILE	ENDP
;
;
; RENAMEFILE: PROCEDURE(FCB$PTR) BYTE EXTERNAL;
; DECLARE FCB$PTR POINTER;
; END RENAMEFILE;
;
RENAMEFILE	PROC	NEAR
		PUBLIC	RENAMEFILE
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,FCB_H
		MOV	DS,AX
		MOV	DX,FCB_L
		MOV	AH,23
		INT	DOS
		POP	DS
		POP	BP
		RET	4
RENAMEFILE	ENDP
;
;
currentdisk	proc	near
		public	currentdisk
		mov	ah,19h
		int	21h
		ret
currentdisk	endp
;
SETDTA		PROC	NEAR
		PUBLIC	SETDTA
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		LDS	DX,DWORD PTR [BP+4]
		MOV	AH,1AH
		INT	DOS
		POP	DS
		POP	BP
		RET	4
SETDTA		ENDP
;
;
; READRANDOM: PROCEDURE(FCB$PTR) BYTE EXTERNAL;
; DECLARE FCB$PTR POINTER;
; END READRANDOM;
;
READRANDOM	PROC	NEAR
		PUBLIC	READRANDOM
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,FCB_H
		MOV	DS,AX
		MOV	DX,FCB_L
		MOV	AH,33
		INT	DOS
		POP	DS
		POP	BP
		RET	4
READRANDOM	ENDP
;
;
; WRITERANDOM: PROCEDURE(FCB$PTR) BYTE EXTERNAL;
; DECLARE FCB$PTR POINTER;
; END WRITERANDOM;
;
WRITERANDOM	PROC	NEAR
		PUBLIC	WRITERANDOM
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,FCB_H
		MOV	DS,AX
		MOV	DX,FCB_L
		MOV	AH,34
		INT	DOS
		POP	DS
		POP	BP
		RET	4
WRITERANDOM	ENDP
;
;
; FILESIZE: PROCEDURE(FCB$PTR) BYTE EXTERNAL;
; DECLARE FCB$PTR POINTER;
; END FILESIZE;
;
FILESIZE	PROC	NEAR
		PUBLIC	FILESIZE
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,FCB_H
		MOV	DS,AX
		MOV	DX,FCB_L
		MOV	AH,35
		INT	DOS
		POP	DS
		POP	BP
		RET	4
FILESIZE	ENDP
;
;
; SETRANDOM: PROCEDURE(FCB$PTR) BYTE EXTERNAL;
; DECLARE FCB$PTR POINTER;
; END SETRANDOM;
;
SETRANDOM	PROC	NEAR
		PUBLIC	SETRANDOM
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,FCB_H
		MOV	DS,AX
		MOV	DX,FCB_L
		MOV	AH,36
		INT	DOS
		POP	DS
		POP	BP
		RET	4
SETRANDOM	ENDP
;
SETVECTOR	PROC	NEAR
		PUBLIC	SETVECTOR
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		LDS	DX,DWORD PTR [BP+4]
		MOV	AL,[BP+8]
		MOV	AH,25H
		INT	21H
		POP	DS
		POP	BP
		RET	6
SETVECTOR	ENDP
;
; READBLOCK: PROCEDURE(FCB$PTR,COUNT) BYTE EXTERNAL;
; DECLARE FCB$PTR POINTER;
; END READBLOCK;
;
READBLOCK	PROC	NEAR
		PUBLIC	READBLOCK
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,[BP+8]
		MOV	DS,AX
		MOV	DX,[BP+6]
		MOV	CX,[BP+4]
		MOV	AH,39
		INT	DOS
		MOV	AX,CX
		POP	DS
		POP	BP
		RET	6
READBLOCK	ENDP
;
;
; WRITEBLOCK: PROCEDURE(FCB$PTR) BYTE EXTERNAL;
; DECLARE FCB$PTR POINTER;
; END WRITEBLOCK;
;
WRITEBLOCK	PROC	NEAR
		PUBLIC	WRITEBLOCK
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,[BP+8]
		MOV	DS,AX
		MOV	DX,[BP+6]
		MOV	CX,[BP+4]
		MOV	AH,40
		INT	DOS
		MOV	AX,CX
		POP	DS
		POP	BP
		RET	6
WRITEBLOCK	ENDP
;
; PARSE$FILE$NAME: PROCEDURE(PMODE,P$BUFF$PTR,FCB$PTR) BYTE EXTERNAL;
; DECLARE PMODE BYTE,
;	  (P$BUFF$PTR,FCB$PTR) POINTER;
; END PARSE$FILE$NAME
;
PMODE		EQU	[BP+12]
PBUFF_H		EQU	[BP+10]
PBUFF_L		EQU	[BP+8]
;
PARSEFILENAME	PROC	NEAR
		PUBLIC	PARSEFILENAME
		PUSH	BP
		MOV	BP,SP
		PUSH	DS
		MOV	AX,PBUFF_H
		MOV	DS,AX
		MOV	SI,PBUFF_L
		MOV	BX,FCB_H
		MOV	ES,BX
		MOV	DI,FCB_L
		MOV	AL,PMODE
		MOV	AH,41
		INT	DOS
		POP	DS
		POP	BP
		RET	10
PARSEFILENAME	ENDP
;
;
; GETDATE: PROCEDURE DWORD EXTERNAL;
; END GETDATE;
;
GETDATE		PROC	NEAR
		PUBLIC	GETDATE
		MOV	AH,42
		INT	21H
		MOV	AX,DX
		MOV	DX,CX
		RET
GETDATE		ENDP
;
;
; SETDATE: PROCEDURE(DATE$V) BYTE EXTERNAL;
; DECLARE DATE$V DWORD;
; END STE$DATE;
;
DAT_L		EQU	[BP+4]
DAT_H		EQU	[BP+6]
;
SETDATE		PROC	NEAR
		PUBLIC	SETDATE
		PUSH	BP
		MOV	BP,SP
		MOV	DX,DAT_H
		MOV	CX,DAT_L
		MOV	AH,43
		INT	21H
		POP	BP
		RET	4
SETDATE		ENDP
;
;
;
; GETTIME: PROCEDURE DWORD EXTERNAL;
; END GETTIME;
;
GETTIME		PROC	NEAR
		PUBLIC	GETTIME
		MOV	AH,44
		INT	21H
		MOV	AX,DX
		MOV	DX,CX
		RET
GETTIME		ENDP
;
;
; SETTIME: PROCEDURE(TIME$V) BYTE EXTERNAL;
; DECLARE TIME$V DWORD;
; END STE$TIME;
;
TIM_L		EQU	[BP+4]
TIM_H		EQU	[BP+6]
;
SETTIME		PROC	NEAR
		PUBLIC	SETTIME
		PUSH	BP
		MOV	BP,SP
		MOV	DX,TIM_H
		MOV	CX,TIM_L
		MOV	AH,45
		INT	21H
		POP	BP
		RET	4
SETTIME		ENDP
;
CODE		ENDS
		END
