This is Turbo Pascal’s Write(File) function. It takes one parameter:
SYS0460: MOV BX,SP
Use BX to address items on the stack. Upon entry into this subroutine, the stack looks as follows:
Index | Contents |
---|---|
BX | Return Address (OFFSET) |
BX+02 | Return Address (SEGMENT) |
BX+04 | Pointer to File/Text Record Data (OFFSET) |
BX+06 | Pointer to File/Text Record Data (SEGMENT) |
SYS0462: PUSH DS
Save DS.
SYS0463: SS:
SYS0464: LES DI,[BX+04]
Loads the pointer to the File into ES:DI.
SYS0467: ES:
SYS0468: LDS DX,[DI:BufPtr]
Loads the pointer to buffer (BufPtr) in File into DS:DX.
SYS046B: XOR CX,CX
SYS046D: ES:
SYS046E: XCHG CX,[DI:BufPos]
Get number of bytes to write from the File’s BufPos.
SYS0471: ES:
SYS0472: MOV BX,[DI:Handle]
SYS0474: MOV AH,40
SYS0476: INT 21
Write CX bytes to File/Device using DOS Write to a File or Device INT 21h AH = 40h with parameters:
SYS0478: JB 047C
On error, return with error code in AX.
SYS047A: XOR AX,AX
AX = 0 (No errors).
SYS047C: POP DS
Restore DS.
SYS047D: RETF 0004
Return to caller with error code in AX, later to be stored in InOutRes. Pop-off FAR PTR parameter from the stack (4 bytes).
See also: Text File Type or go back