[41] | 1 | ; File name : DosCritical.asm |
---|
| 2 | ; Project name : Assembly Library |
---|
| 3 | ; Created date : 1.9.2010 |
---|
| 4 | ; Last update : 2.9.2010 |
---|
| 5 | ; Author : Tomi Tilli |
---|
| 6 | ; Description : DOS Critical Error Handler (24h) replacements. |
---|
| 7 | |
---|
| 8 | ; DOS Critical Error Handler return values |
---|
| 9 | struc CRITICAL_ERROR_ACTION |
---|
| 10 | .ignoreErrorAndContinueProcessingRequest resb 1 |
---|
| 11 | .retryOperation resb 1 |
---|
| 12 | .terminateProgramAsThoughInt21hAH4ChCalled resb 1 |
---|
| 13 | .failSystemCallInProgress resb 1 |
---|
| 14 | endstruc |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | ; Section containing code |
---|
| 18 | SECTION .text |
---|
| 19 | |
---|
| 20 | ;-------------------------------------------------------------------- |
---|
| 21 | ; DosCritical_InstallNewHandlerFromCSDX |
---|
| 22 | ; Parameters: |
---|
| 23 | ; CS:DX: New Critical Error Handler |
---|
| 24 | ; Returns: |
---|
| 25 | ; Nothing |
---|
| 26 | ; Corrupts registers: |
---|
| 27 | ; AX |
---|
| 28 | ;-------------------------------------------------------------------- |
---|
| 29 | ALIGN JUMP_ALIGN |
---|
| 30 | DosCritical_InstallNewHandlerFromCSDX: |
---|
| 31 | push ds |
---|
| 32 | |
---|
| 33 | push cs |
---|
| 34 | pop ds |
---|
| 35 | mov ax, (SET_INTERRUPT_VECTOR<<8) | DOS_CRITICAL_ERROR_HANDLER_24h |
---|
| 36 | int DOS_INTERRUPT_21h |
---|
| 37 | |
---|
| 38 | pop ds |
---|
| 39 | ret |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | ;-------------------------------------------------------------------- |
---|
| 43 | ; DosCritical_RestoreDosHandler |
---|
| 44 | ; Parameters: |
---|
| 45 | ; Nothing |
---|
| 46 | ; Returns: |
---|
| 47 | ; Nothing |
---|
| 48 | ; Corrupts registers: |
---|
| 49 | ; Nothing |
---|
| 50 | ;-------------------------------------------------------------------- |
---|
| 51 | ALIGN JUMP_ALIGN |
---|
| 52 | DosCritical_RestoreDosHandler: |
---|
| 53 | push ds |
---|
| 54 | push dx |
---|
| 55 | push ax |
---|
| 56 | |
---|
| 57 | lds dx, [cs:PSP.fpInt24hCriticalError] |
---|
| 58 | mov ax, (SET_INTERRUPT_VECTOR<<8) | DOS_CRITICAL_ERROR_HANDLER_24h |
---|
| 59 | int DOS_INTERRUPT_21h |
---|
| 60 | |
---|
| 61 | pop ax |
---|
| 62 | pop dx |
---|
| 63 | pop ds |
---|
| 64 | ret |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | ;-------------------------------------------------------------------- |
---|
| 68 | ; DosCritical_HandlerToIgnoreAllErrors |
---|
| 69 | ; Parameters: |
---|
| 70 | ; Nothing |
---|
| 71 | ; Returns: |
---|
| 72 | ; AL: CRITICAL_ERROR_ACTION |
---|
| 73 | ; Corrupts registers: |
---|
| 74 | ; Nothing |
---|
| 75 | ;-------------------------------------------------------------------- |
---|
| 76 | ALIGN JUMP_ALIGN |
---|
| 77 | DosCritical_HandlerToIgnoreAllErrors: |
---|
| 78 | mov al, CRITICAL_ERROR_ACTION.ignoreErrorAndContinueProcessingRequest |
---|
| 79 | iret |
---|