I'm playing around with my assembly code again...and again in protected mode...but I'm having a few problems...well lots of problems, trying to get the 8259 to trigger interrupts...as its suppose to count down, then trigger an interrupt to irq0...doesn't seem to be working though.
The code simple sets up the irq's and only the timer interrupt...I have put a delay in my interrupt routine of about 1 second...but I would have thought the routine would be called over and over agian...which is what I'm looking for.
Thanks,
Ben
Code: Select all
cli
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; Disable all IRQs.
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
disable_irqs:
push eax
push edx
mov al, 0xFF
mov dx, 0x21
out dx, al ; outb(0x21, 0xFF)
mov al, 0xFF
mov dx, 0xA1
out dx, al ; outb(0x21, 0xFF)
pop edx
pop eax
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mov cl, 0x20 ; PIC 1.
mov ch, 0x28 ; PIC 2.
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; Remap PICs to: CL = pic1 CH = pic2
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
remap_pics:
; IWC1
;------
mov al, 0x11
mov dx, 0x20
out dx, al ; outb(0x20, 0x11)
mov al, 0x11
mov dx, 0xA0
out dx, al ; outb(0xA0, 0x11)
; IWC2
;------
mov al, cl
mov dx, 0x21
out dx, al ; outb(0x21, pic1)
mov al, ch
mov dx, 0xA1
out dx, al ; outb(0xA1, pic2)
; IWC3
;------
mov al, 0x04
mov dx, 0x21
out dx, al ; outb(0x21, 4)
mov al, 0x02
mov dx, 0xA1
out dx, al ; outb(0xA1, 2)
; IWC4
;------
mov al, 0x01
mov dx, 0x21
out dx, al ; outb(0x21, 0x01)
mov al, 0x01
mov dx, 0xA1
out dx, al ; outb(0xA1, 0x01)
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; Enable IRQ0 (timer) at the 8259 PIC chips, disable others:
;(Port 0x21 bit 0 is timer)
mov al, 0xFE
mov dx, 0x21
out dx, al ; outb(0x21, ~0x01)
mov al, 0xFF
mov dx, 0xA1
out dx, al ; outb(0x21, ~0x00)
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;EOI for IRQ 0-7
mov al, 0x20
mov dx, 0x20
out dx, al ; outb(0x20, 0x20)
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
sti ; Interrupts back..
