| 1 |
ERROR_FileError: |
| 2 |
PUSH AX |
| 3 |
MOV DX, STR_ErrFile |
| 4 |
CALL DOS_PrintString |
| 5 |
POP AX |
| 6 |
|
| 7 |
CALL WriteLastDOSError |
| 8 |
JMP Exit |
| 9 |
|
| 10 |
ERROR_GeneralDOSError: |
| 11 |
; AX has the error code |
| 12 |
PUSH AX |
| 13 |
MOV DX, STR_ErrOtherDOS |
| 14 |
CALL DOS_PrintString |
| 15 |
POP AX |
| 16 |
CALL WriteLastDOSError |
| 17 |
JMP Exit |
| 18 |
|
| 19 |
ERROR_GeneralError: |
| 20 |
; AX has the error code, and it'll be a custom error, TODO: implement |
| 21 |
MOV DX, STR_ErrOther |
| 22 |
CALL DOS_PrintString |
| 23 |
JMP Exit |
| 24 |
|
| 25 |
FileCloseError: |
| 26 |
PUSH AX |
| 27 |
MOV DX, STR_ErrCloseFile |
| 28 |
CALL DOS_PrintString |
| 29 |
POP AX |
| 30 |
|
| 31 |
CALL WriteLastDOSError |
| 32 |
INT 20h ; Note the early exit |
| 33 |
|
| 34 |
|
| 35 |
WriteLastDOSError: |
| 36 |
CALL DecodeDOSError |
| 37 |
CALL DOS_PrintString |
| 38 |
RET |
| 39 |
|
| 40 |
DecodeDOSError: |
| 41 |
; All right, so |
| 42 |
MOV BX, AX ; We first copy the error code into BX |
| 43 |
SHL BX, 1 ; Then multiply it by 2 to get the proper offset in the table |
| 44 |
MOV SI, DOS_ERRORS ; Load in the table address |
| 45 |
ADD SI, BX ; And add the offset we have in BX |
| 46 |
MOV DX, [CS:SI] ; And finally, return the proper string address |
| 47 |
RET ; This needs no explanation, but I forgot the RET statement once and was wondering why in the hell is DOSBox crashing on me |
| 48 |
|
| 49 |
include 'DOSERR.ASM' |