Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

Commit

Permalink
Fix keyboard input
Browse files Browse the repository at this point in the history
  • Loading branch information
9xbt committed May 25, 2024
1 parent d4d3d9e commit 76889e4
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 47 deletions.
Binary file modified bin/kernel.bin
Binary file not shown.
Binary file modified kernel.iso
Binary file not shown.
87 changes: 40 additions & 47 deletions src/kernel.asm
Original file line number Diff line number Diff line change
Expand Up @@ -203,65 +203,58 @@ section .text
;https://www.reddit.com/r/asm/comments/jd2osj/how_could_i_implement_a_delay_in_asm/

get_string:
xor cl, cl
.loop:
mov ah, 0
int $16
cmp al, $08
je .backspace
xor cl, cl
.loop:
mov ah, 0
int 0x16

cmp al, 0x08
je .backspace
cmp al, 0x0D
je .done
cmp al, 0x0D
je .done
cmp cl, 0x4D ; 77
je .loop

mov bl, 0x0F
mov cx, 1
call set_color

mov ah, $0e
int 0x10
cmp cl, 0xFF ; amount of characters to take
je .loop
mov ah, 0x0e
int 0x10

stosb
inc cl
jmp .loop
stosb
inc cl
jmp .loop

.backspace:
cmp cl, 0
je .loop
.backspace:
cmp cl, 0
je .loop

dec di
mov byte [di], 0
dec cl
dec di
mov byte [di], 0
dec cl
; move the cursor back 1 position
mov ah, $0e
mov al, $08
int $10
mov ah, 0x0e
mov al, 0x08
int 0x10

; remove the character at the current position
mov al, ' '
int $10
mov al, ' '
int 0x10

; move the cursor back 1 position
mov al, $08
int $10
mov al, 0x08
int 0x10

jmp .loop
jmp .loop

.done:
mov al,0
stosb
.done:
mov al,0
stosb
mov ah, $0e
mov al, 0x0D
int $10
mov al, 0x0A
int $10
mov ah, 0x0e
mov al, 0x0d
int 0x10
mov al, 0x0a
int 0x10

ret
ret

cmp_string:
; usage:
Expand Down

0 comments on commit 76889e4

Please sign in to comment.