A few of the common sense self checks that I have done so far:
1. I am registering the handler (it gets called the first time!)
2. The handler does read the input it is being sent and sends the EIO back to the PIC.
3. Interrupts are enabled.
4. The main loop is just a hlt statement.
Code: Select all
keyboard_handler: # 0x7d11
push %ax
push %cx
in $0x60, %al # We read from i/o port 0x60, this is the key code
mov %al, %cl
in $0x61, %al
mov %al, %ah
or $0x80, %al
xchg %al, %ah
out %al, $0x61
mov $0x20, %al
out %al, $0x20
and $0x80, %cl
push $0x1d
push $detect
call print_string
pop %bx
pop %ax
iret
main:
xor %ax, %ax
mov %ax, %ds
mov %ax, %ss
mov $0xFFFF, %bp
mov %bp, %sp
mov $0x09, %bx # The interrupt handler for keyboard
shl $2, %bx # left shift 2 = multiply by 4
cli
movw $keyboard_handler, (%bx)
mov %ax, 2(%bx)
sti
mov $0xB800, %ax
movw $0x0000, %bx
mov %ax, %gs
call clear_screen
push $0xFF
push $hello # Put the parameter on the stack
call print_string
add $4, %sp
push %ax
push $hex_array + 2 # hex_array points to the first byte ('0'), but we will only overwrite the 3rd and 4th bytes.
call convert_16_bit_num_to_hex_string
add $4, %sp
push $0x07
push $hex_array
call print_string
add $4, %sp
end:
hlt
jmp end
. = _start + 510
.byte 0x55
.byte 0xAA