source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm@ 569

Last change on this file since 569 was 540, checked in by aitotat@…, 12 years ago

Changes to XTIDE Universal BIOS:

  • Improved interrupt handling: INT 15h AH=91h is no longer called if AH=90h was not called.
File size: 2.9 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Interrupt handling 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; IdeIrq_WaitForIRQ
25; Parameters:
26; DS:DI: Ptr to DPT (in RAMVARS segment)
27; Returns:
28; Nothing
29; Corrupts registers:
30; AX
31;--------------------------------------------------------------------
32ALIGN JUMP_ALIGN
33IdeIrq_WaitForIRQ:
34 push ds
35 LOAD_BDA_SEGMENT_TO ds, ax, ! ; Zero AX
36 mov ah, OS_HOOK_DEVICE_BUSY ; Hard disk busy (AX=9000h)
37 cli ; Disable interrupts
38 dec BYTE [BDA.bHDTaskFlg] ; Clear to zero if still waiting for IRQ
39 pop ds
40 jnz SHORT .ReturnFromWaitNotify ; IRQ already! (CompactFlash was faster than CPU)
41 int BIOS_SYSTEM_INTERRUPT_15h ; OS hook, device busy
42
43.ReturnFromWaitNotify:
44 sti ; Enable interrupts
45 ret
46
47
48;--------------------------------------------------------------------
49; IDE Interrupt Service Routines.
50;
51; IdeIrq_InterruptServiceRoutineForIrqs2to7
52; IdeIrq_InterruptServiceRoutineForIrqs8to15
53; Parameters:
54; Nothing
55; Returns:
56; Nothing
57; Corrupts registers:
58; Nothing
59;--------------------------------------------------------------------
60ALIGN JUMP_ALIGN
61IdeIrq_InterruptServiceRoutineForIrqs2to7:
62 push ax
63 mov al, COMMAND_END_OF_INTERRUPT
64
65%ifdef USE_AT
66 jmp SHORT AcknowledgeMasterInterruptController
67
68ALIGN JUMP_ALIGN
69IdeIrq_InterruptServiceRoutineForIrqs8to15:
70 push ax
71 mov al, COMMAND_END_OF_INTERRUPT
72 out SLAVE_8259_COMMAND_out, al ; Acknowledge Slave 8259
73 JMP_DELAY
74AcknowledgeMasterInterruptController:
75%endif ; USE_AT
76
77 out MASTER_8259_COMMAND_out, al ; Acknowledge Master 8259
78
79 ; Set Task Flag
80 push ds
81 LOAD_BDA_SEGMENT_TO ds, ax, ! ; Clear AL and CF for INT 15h
82 dec BYTE [BDA.bHDTaskFlg] ; Set task flag (or clear if IRQ occurred before call to INT 15h AH=90h)
83 sti ; Enable interrupts
84 pop ds
85
86 ; Issue Int 15h, function AX=9100h (Interrupt ready)
87 jz SHORT .DoNotPostSinceIrqOccurredBeforeWait
88 mov ah, OS_HOOK_DEVICE_POST ; Interrupt ready, device 0 (HD)
89 int BIOS_SYSTEM_INTERRUPT_15h
90.DoNotPostSinceIrqOccurredBeforeWait:
91
92 pop ax
93 iret
Note: See TracBrowser for help on using the repository browser.