Files
low-level-programming/keyboard/keyboard.asm

60 lines
758 B
NASM
Raw Normal View History

2022-01-29 22:39:59 -08:00
%include "../common/multiboot_header.asm"
%include "../common/x86_vram.asm"
2015-09-18 02:28:34 -07:00
2015-09-18 02:56:07 -07:00
extern c_entry
2015-09-21 02:22:44 -07:00
extern print_int
2015-09-18 02:28:34 -07:00
section .bss
stack resb 0x1000
section .data
2015-09-21 02:22:44 -07:00
keyboard_scancode db 0
2015-09-18 02:56:07 -07:00
[bits 32]
2015-09-18 02:28:34 -07:00
section .text
2015-09-18 02:56:07 -07:00
2015-09-18 02:28:34 -07:00
global boot:
mov esp, stack + 0x1000
xor ebp, ebp
jmp main
main:
push word BG.BLACK | ' '
call clear
add esp, 2
2015-09-18 02:56:07 -07:00
call c_entry
2015-09-18 02:28:34 -07:00
2015-09-21 02:22:44 -07:00
.loop:
call scan
test al, al
jz .loop
push 22
push eax
call print_int
add esp, 8
jmp .loop
2015-09-18 02:28:34 -07:00
halt:
hlt
jmp halt
2015-09-21 02:22:44 -07:00
scan:
xor eax, eax
in al, 0x60
cmp al, [keyboard_scancode]
je .zero
mov [keyboard_scancode], al
ret
.zero:
xor al, al
ret
2022-01-29 22:39:59 -08:00
%include "../common/x86_vram_functions.asm"