source: xtideuniversalbios/trunk/Assembly_Library/Src/File/InterruptHandlers.asm@ 612

Last change on this file since 612 was 593, checked in by Tomi Tilli, 6 years ago

Flashing now works again.
Hack to get Windows 95 to work properly (MODULE_WIN95_CMOS_HACK included for 386 builds by default).
Edited makefile to produce large 386 build.
Fixed recovery time for QDI Vision VLB-IDE controllers.
No more warnings with Nasm 2.13.xx and later.
File dialog now properly restores default drive when file selection is cancelled.

File size: 4.5 KB
Line 
1; Project name : Assembly Library
2; Description : Interrupt handlers and related functions.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
12;
13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16; GNU General Public License for more details.
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
20; Section containing code
21SECTION .text
22
23;--------------------------------------------------------------------
24; Int2Fh_Handler
25; Parameters:
26; Nothing
27; Returns:
28; Nothing
29; Corrupts registers:
30; Nothing
31;--------------------------------------------------------------------
32ALIGN JUMP_ALIGN
33Int2Fh_Handler:
34 cmp ax, 4A00h ; DOS 5+ - FLOPPY-DISK LOGICAL DRIVE CHANGE NOTIFICATION
35 je SHORT .CallMightBeForMe
36.CallIsNotForMe:
37 db 0EAh ; Far jump opcode
38.fpPreviousInt2FhHandler:
39 dd 0 ; Pointer is filled in when handler is installed
40
41.CallMightBeForMe:
42 inc cx
43 loop .CallIsNotForMe
44 dec cx
45ReturnFromNestedCall:
46 iret
47
48
49;--------------------------------------------------------------------
50; Int23h_Handler
51; Parameters:
52; Nothing
53; Returns:
54; Nothing
55; Corrupts registers:
56; Nothing
57;--------------------------------------------------------------------
58ALIGN JUMP_ALIGN
59Int23h_Handler:
60 cmp BYTE [cs:Interrupt23hInProgress], 0
61 jne SHORT ReturnFromNestedCall
62 inc BYTE [cs:Interrupt23hInProgress]
63 push ds
64 push dx
65 push ax
66 call UnhookInterrupt2Fh
67 pop ax
68 pop dx
69 pop ds
70 dec BYTE [cs:Interrupt23hInProgress] ; Not really needed since we should not be called again
71 ; Special return to terminate program - might not work under DR-DOS (see RBIL)
72 stc
73 retf
74
75Interrupt23hInProgress: db 0
76
77
78;--------------------------------------------------------------------
79; HookInterrupt23h
80; Parameters:
81; Nothing
82; Returns:
83; Nothing
84; Corrupts registers:
85; AX, DX, DS
86;--------------------------------------------------------------------
87ALIGN JUMP_ALIGN
88HookInterrupt23h:
89 mov al, DOS_CTRL_C_CTRL_BREAK_HANDLER_23h
90 mov dx, Int23h_Handler
91 jmp SHORT HookInterruptVectorInALwithHandlerInCSDX
92
93
94;--------------------------------------------------------------------
95; HookInterrupt2Fh
96; Parameters:
97; Nothing
98; Returns:
99; Nothing
100; Corrupts registers:
101; AX, BX, DX, DS, ES
102;--------------------------------------------------------------------
103ALIGN JUMP_ALIGN
104HookInterrupt2Fh:
105 mov ax, GET_INTERRUPT_VECTOR << 8 | DOS_TSR_MULTIPLEX_INTERRUPT_2Fh
106 int DOS_INTERRUPT_21h
107 mov [cs:Int2Fh_Handler.fpPreviousInt2FhHandler], bx
108 mov [cs:Int2Fh_Handler.fpPreviousInt2FhHandler+2], es
109 mov dx, Int2Fh_Handler
110 jmp SHORT HookInterruptVectorInALwithHandlerInCSDX
111
112
113;--------------------------------------------------------------------
114; UnhookInterrupt2Fh
115; Parameters:
116; Nothing
117; Returns:
118; Nothing
119; Corrupts registers:
120; AX, DX, DS
121;--------------------------------------------------------------------
122ALIGN JUMP_ALIGN
123UnhookInterrupt2Fh:
124 lds dx, [cs:Int2Fh_Handler.fpPreviousInt2FhHandler]
125 mov ax, ds
126 or ax, dx
127 jz SHORT NotHooked ; Only hooked on DOS 5+
128 mov al, DOS_TSR_MULTIPLEX_INTERRUPT_2Fh
129 SKIP2B f
130
131;--------------------------------------------------------------------
132; HookInterruptVectorInALwithHandlerInCSDX
133; Parameters:
134; AL: Interrupt vector to hook
135; DX: Offset to handler
136; Returns:
137; Nothing
138; Corrupts registers:
139; AH, DS
140;--------------------------------------------------------------------
141HookInterruptVectorInALwithHandlerInCSDX:
142 push cs
143 pop ds
144 ; Fall to HookInterruptVectorInALwithHandlerInDSDX
145
146;--------------------------------------------------------------------
147; HookInterruptVectorInALwithHandlerInDSDX
148; Parameters:
149; AL: Interrupt vector to hook
150; DX: Offset to handler
151; DS: Segment of handler
152; Returns:
153; Nothing
154; Corrupts registers:
155; AH
156;--------------------------------------------------------------------
157HookInterruptVectorInALwithHandlerInDSDX:
158 mov ah, SET_INTERRUPT_VECTOR
159 int DOS_INTERRUPT_21h
160NotHooked:
161 ret
162
Note: See TracBrowser for help on using the repository browser.