; DX = String ptr DOS_PrintString: MOV AH, DISPLAY_STRING INT 21H RET ; DX = Filename ptr ; CF = 1 Error CF = 0 Pass ; AX = File handle/Error code if CF DOS_OpenReadonly: CLC ; Technically not needed, but, uhm... MOV AL, OPEN_ACCESS_READONLY MOV AH, OPEN_FILE ; AH = 3Dh Open a file, DX = Filename ptr, AL = Access control, handle at AX if CF set INT 21H RET ; BX = File Handle DOS_CloseFile: MOV AH, CLOSE_FILE INT 21H RET ; BX = Paragraphs to allocate ; CF = 1 Error CF = 0 Pass ; AX = Segment addr/Error code if CF DOS_AllocateMemory: MOV AH, ALLOCATE_MEMORY INT 21H RET ; ES = Segment to free ; CF = 1 Error CF = 0 Pass ; AX = Error code if CF DOS_FreeMemory: MOV AH, FREE_MEMORY INT 21H RET ; BX = File Handle ; CX = Number of bytes to read ; DX = Offset in the buffer ; ES = Memory segment ; CF = 1 Error CF = 0 Pass ; AX = Number of bytes read/Error code if CF DOS_ReadFileIntoES: PUSH DS ; Store the DS for later MOV AX, ES ; Yes MOV DS, AX ; DS = allocated memory segment MOV AH, READ_FILE ; Read file INT 21H ; Magic POP DS ; Restore DS RET ; BX = File Handle ; CX = Number of bytes to read ; DS:DX = Buffer address ; CF = 1 Error CF = 0 Pass ; AX = Number of bytes read/Error code if CF DOS_ReadFile: MOV AH, READ_FILE ; Read file INT 21H ; Magic RET