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

Last change on this file since 578 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
RevLine 
[150]1; Project name : XTIDE Universal BIOS
2; Description : Interrupt handling related functions.
3
[376]4;
[526]5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
[376]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.
[526]12;
[376]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
[526]16; GNU General Public License for more details.
[376]17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
[526]18;
[376]19
[150]20; Section containing code
21SECTION .text
22
23;--------------------------------------------------------------------
24; IdeIrq_WaitForIRQ
25; Parameters:
26; DS:DI: Ptr to DPT (in RAMVARS segment)
27; Returns:
[535]28; Nothing
[150]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
[540]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)
[150]41 int BIOS_SYSTEM_INTERRUPT_15h ; OS hook, device busy
42
43.ReturnFromWaitNotify:
[161]44 sti ; Enable interrupts
[150]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
[540]63 mov al, COMMAND_END_OF_INTERRUPT
[150]64
[540]65%ifdef USE_AT
[150]66 jmp SHORT AcknowledgeMasterInterruptController
67
68ALIGN JUMP_ALIGN
69IdeIrq_InterruptServiceRoutineForIrqs8to15:
70 push ax
[152]71 mov al, COMMAND_END_OF_INTERRUPT
72 out SLAVE_8259_COMMAND_out, al ; Acknowledge Slave 8259
[540]73 JMP_DELAY
[150]74AcknowledgeMasterInterruptController:
[540]75%endif ; USE_AT
76
[152]77 out MASTER_8259_COMMAND_out, al ; Acknowledge Master 8259
[150]78
[540]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
[150]86 ; Issue Int 15h, function AX=9100h (Interrupt ready)
[540]87 jz SHORT .DoNotPostSinceIrqOccurredBeforeWait
88 mov ah, OS_HOOK_DEVICE_POST ; Interrupt ready, device 0 (HD)
[150]89 int BIOS_SYSTEM_INTERRUPT_15h
[540]90.DoNotPostSinceIrqOccurredBeforeWait:
[150]91
92 pop ax
93 iret
Note: See TracBrowser for help on using the repository browser.