delete old program
This commit is contained in:
parent
0e594245c2
commit
7878663268
@ -1,91 +0,0 @@
|
||||
|
||||
%define KBD_STATUS 0x1ffc
|
||||
%define KBD_CODE 0x1ffe
|
||||
%define VCD 0x2000
|
||||
|
||||
%define FL_EQ 0x2
|
||||
%define FL_EQ 0x4
|
||||
|
||||
%define KBD_FLAG_IS_RELEASE 0x1
|
||||
|
||||
mov rsp, 0x1000
|
||||
mov rbp, rsp
|
||||
|
||||
mov r0, 512
|
||||
mov r1, 1
|
||||
dskr r0, r1
|
||||
|
||||
; setup video character display (VCD)
|
||||
; descriptor table structure:
|
||||
; [addr + 0] memory map base
|
||||
mov r0, VCD
|
||||
mov [0x700], r0
|
||||
lvcd 0x700
|
||||
|
||||
; setup keyboard (KBD)
|
||||
; descriptor table structure:
|
||||
; [addr + 0] status address
|
||||
; [addr + 2] keycode address
|
||||
; [addr + 4] keyboard interrupt handler
|
||||
mov r0, KBD_STATUS
|
||||
mov [0x702], r0
|
||||
mov r0, KBD_CODE
|
||||
mov [0x704], r0
|
||||
mov r0, key_press_int
|
||||
mov [0x706], r0
|
||||
lkbd 0x702
|
||||
|
||||
; character counter
|
||||
mov r0, 0
|
||||
mov [0x600], r0
|
||||
|
||||
main_loop:
|
||||
hlt
|
||||
jmp main_loop
|
||||
|
||||
key_press_int:
|
||||
mov r0, [KBD_STATUS]
|
||||
and r0, r0, KBD_FLAG_IS_RELEASE
|
||||
jnz r0, .leave
|
||||
|
||||
mov r0, [0x600]
|
||||
add r0, r0, VCD
|
||||
mov r1, [KBC_CODE]
|
||||
cmp r1, 44 ; spacebar
|
||||
mov r2, rfl
|
||||
and r2, r2, FL_EQ
|
||||
jnz r2, .incr
|
||||
add r1, r1, 61
|
||||
mov byte [r0], r1
|
||||
.incr:
|
||||
mov r0, [0x600]
|
||||
add r0, r0, 1
|
||||
mov [0x600], r0
|
||||
.leave:
|
||||
reti
|
||||
|
||||
scancode_to_char:
|
||||
cmp r1, 61
|
||||
|
||||
mov r2, rfl
|
||||
and r2, r2, FL_LT
|
||||
jnz .not_letter
|
||||
|
||||
; if r1 > 86 { goto .not_letter }
|
||||
cmp r1, 86
|
||||
mov r2, rfl
|
||||
xor r2, 0xffff
|
||||
and r2, r2, FL_EQ | FL_LT
|
||||
|
||||
|
||||
mov r4, rfl
|
||||
and r4, r4, FL_EQ
|
||||
shr r4, r4, 2
|
||||
|
||||
.not_letter:
|
||||
|
||||
|
||||
61 >= 61
|
||||
|
||||
; vim: syntax=nasm
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user