HLT instruction question
Posted: Sat Jul 14, 2007 2:16 am
Hey whats up? Currently i am trying to implement a way to "wait for a keypress to continue"
Since the code can explain it better then i can, well here it is haha
So basically when interrupt 0x60 is called it waits till my new keyboardISR updates a bit saying a key was pressed. The problem is the program hangs =/ . I don't think its bochs either. Any help would be much appreciated =). - Happy Coding
*edit* hm i guess i could make a keyboardISR and have it jump to w/e address when a key is pressed...but i'm still wondering why this hangs XD
Since the code can explain it better then i can, well here it is haha
Code: Select all
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; The Kew Keyboard ISR calls the old keyboard ISR and ;;
;; updates bit 0 at 9ffff to 1 when a key is pressed ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NewKeyboardISR:
push es
push ax
mov ax,infoSegment ;infosegment:0 is original ISR for keyboard
mov es,ax
or byte [es:deviceStatus],0x1 ;changes to 1 whenever keyboard is pressed
mov ax,900
mov es,ax
pushf
call far [es:0] ;calls original keyboard ISR
pop ax
pop es
iret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Below is the main interrupt accessed by int 60h ;;
;; currently it's only function is to wait till a key ;;
;; is pressed before it returns ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MainInt:
mov WORD [messagePointer],(kerneladdr+(PressAKey-Kernel))
call 0:biosPrintString
push ax
push es
mov ax,infoSegment
mov es,ax
and byte [es:deviceStatus], 0xFE
.loop
hlt
mov byte al,[es:deviceStatus]
and al,1
cmp al,1
jne .loop
pop es
pop ax
iret
*edit* hm i guess i could make a keyboardISR and have it jump to w/e address when a key is pressed...but i'm still wondering why this hangs XD