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 | ;
|
---|
9 | ; XTIDE Universal BIOS and Associated Tools
|
---|
10 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
|
---|
11 | ;
|
---|
12 | ; This program is free software; you can redistribute it and/or modify
|
---|
13 | ; it under the terms of the GNU General Public License as published by
|
---|
14 | ; the Free Software Foundation; either version 2 of the License, or
|
---|
15 | ; (at your option) any later version.
|
---|
16 | ;
|
---|
17 | ; This program is distributed in the hope that it will be useful,
|
---|
18 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
20 | ; GNU General Public License for more details.
|
---|
21 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
22 | ;
|
---|
23 |
|
---|
24 |
|
---|
25 | ; DOS Critical Error Handler return values
|
---|
26 | struc CRITICAL_ERROR_ACTION
|
---|
27 | .ignoreErrorAndContinueProcessingRequest resb 1
|
---|
28 | .retryOperation resb 1
|
---|
29 | .terminateProgramAsThoughInt21hAH4ChCalled resb 1
|
---|
30 | .failSystemCallInProgress resb 1
|
---|
31 | endstruc
|
---|
32 |
|
---|
33 |
|
---|
34 | ; Section containing code
|
---|
35 | SECTION .text
|
---|
36 |
|
---|
37 | ;--------------------------------------------------------------------
|
---|
38 | ; DosCritical_InstallNewHandlerFromCSDX
|
---|
39 | ; Parameters:
|
---|
40 | ; CS:DX: New Critical Error Handler
|
---|
41 | ; Returns:
|
---|
42 | ; Nothing
|
---|
43 | ; Corrupts registers:
|
---|
44 | ; AX
|
---|
45 | ;--------------------------------------------------------------------
|
---|
46 | ALIGN JUMP_ALIGN
|
---|
47 | DosCritical_InstallNewHandlerFromCSDX:
|
---|
48 | push ds
|
---|
49 |
|
---|
50 | push cs
|
---|
51 | pop ds
|
---|
52 | mov ax, (SET_INTERRUPT_VECTOR<<8) | DOS_CRITICAL_ERROR_HANDLER_24h
|
---|
53 | int DOS_INTERRUPT_21h
|
---|
54 |
|
---|
55 | pop ds
|
---|
56 | ret
|
---|
57 |
|
---|
58 |
|
---|
59 | ;--------------------------------------------------------------------
|
---|
60 | ; DosCritical_RestoreDosHandler
|
---|
61 | ; Parameters:
|
---|
62 | ; Nothing
|
---|
63 | ; Returns:
|
---|
64 | ; Nothing
|
---|
65 | ; Corrupts registers:
|
---|
66 | ; Nothing
|
---|
67 | ;--------------------------------------------------------------------
|
---|
68 | ALIGN JUMP_ALIGN
|
---|
69 | DosCritical_RestoreDosHandler:
|
---|
70 | push ds
|
---|
71 | push dx
|
---|
72 | push ax
|
---|
73 |
|
---|
74 | lds dx, [cs:PSP.fpInt24hCriticalError]
|
---|
75 | mov ax, (SET_INTERRUPT_VECTOR<<8) | DOS_CRITICAL_ERROR_HANDLER_24h
|
---|
76 | int DOS_INTERRUPT_21h
|
---|
77 |
|
---|
78 | pop ax
|
---|
79 | pop dx
|
---|
80 | pop ds
|
---|
81 | ret
|
---|
82 |
|
---|
83 |
|
---|
84 | ;--------------------------------------------------------------------
|
---|
85 | ; DosCritical_HandlerToIgnoreAllErrors
|
---|
86 | ; Parameters:
|
---|
87 | ; Nothing
|
---|
88 | ; Returns:
|
---|
89 | ; AL: CRITICAL_ERROR_ACTION
|
---|
90 | ; Corrupts registers:
|
---|
91 | ; Nothing
|
---|
92 | ;--------------------------------------------------------------------
|
---|
93 | ALIGN JUMP_ALIGN
|
---|
94 | DosCritical_HandlerToIgnoreAllErrors:
|
---|
95 | mov al, CRITICAL_ERROR_ACTION.ignoreErrorAndContinueProcessingRequest
|
---|
96 | iret
|
---|