Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
the processIrqList() function does some frightening stuffs with linked list of handlers to know which function should be called according to priorities and whether the current code can handle the current event or not (so that several modules can play with the same hardware event
IRQ_1: ;Keyboard
;*****************************************************
;* A sample of how to handle an interrupt from IRQ 1 *
;*****************************************************
PUSHA
IN AL, 0x60
mov [keyhold], al
CALL Keyboard_Handler
MOV AL, 0x20
OUT 0x20, AL
POPA
IRET
Keyboard_Handler:
;*******************************************************************
; *
;*******************************************************************
push si
mov si, [keyhold]
call putch
pop si
RET
keyhold dw 0
Well what goes wrong with it? What errors do you get? Does it call the routine at all? Have you unmasked IRQ1 on the PIC? Are you aware that AL is a keyboard scancode not an ASCII code, and that you get two values for each keypress (up/down)? What's putch doing? Do you have a stack set? Are you aware that AL is a byte not a word (Won't make any difference, but it would make your code clearer)?
Without a little more information there's not a huge amount anyone can do to help fix it. BTW, the code you produced there looks ok to me, so it sounds like something else.
well, even If I call a C function that gets the val of keyhold and converts it to ASCII, It does't print anything. I do know it is called because when I print "1" it prints 1 forever
Use this, it will remap the pics to interrupt on 0x20->0x2F, and mask off everything but IRQ 0 and IRQ 1. You can turn your interrupts back on then and see what happens.
MOV AL, 0x11
OUT 0x20, AL
OUT 0xA0, AL
MOV AL, 0x20
OUT 0x21, AL
ADD AL, 0x08
OUT 0xA1, AL
MOV AL, 0x04
OUT 0x21, AL
MOV AL, 0x02
OUT 0xA1, AL
MOV AL, 0x01
OUT 0x21, AL
MOV AL, 0x01
OUT 0xA1, AL
MOV AL, 0xFC
OUT 0x21, AL
MOV AL, 0xFF
OUT 0xA1, AL
Personally I turn off interrupts after enabling the A20 line, remap the pic, load the IDT/GDT, jump to pmode, setup the segments and pmode stack then turn the interrupts back on.
When I call inportb in C Code, it doesn't work, I think this is the prob in the asm code to...but when I disable ints I can use inportb or in ( in asm )
i've only tried 0x64 and 0x60 also, still no value!
Well, do you inb() from those ports after having received an IRQ1? If not, you're polling the hardware and if you don't press a key you won't get anything...
Try to inb() from another port and of which you are sure to get something...