Change all numbers to hex and add trailing space removing to read.

This commit is contained in:
CrazyEttin 2021-05-26 18:25:56 +03:00
parent df836219eb
commit 46691e9975
2 changed files with 28 additions and 12 deletions

View File

@ -8,16 +8,16 @@ mov ax, 0x1000
mov es, ax
mov bx, 0
mov al, 32
mov al, 0x20
mov dh, 0
mov ch, 0
mov cl, 2
mov cl, 0x2
mov ah, 2
mov ah, 0x2
int 0x13
jmp 0x1000:0
times 510-($-$$) db 0
times 0x1fe-($-$$) db 0
db 0x55
db 0xaa

View File

@ -7,6 +7,10 @@ call print
loop:
mov si, prompt
call print
mov cx, 0x4d
mov di, input
mov al, 0
rep stosb
mov di, input
call read
cmp byte [input], 0
@ -15,10 +19,6 @@ mov si, input
call print
mov si, newline
call print
mov cx, 0x4e
mov di, input
mov al, 0
rep stosb
jmp loop
print:
@ -38,7 +38,7 @@ mov ah, 0
int 0x16
cmp al, 0xd
je .return
cmp al, 8
cmp al, 0x8
je .backspace
cmp cl, 0x4d
je .loop
@ -76,6 +76,20 @@ dec di
dec cl
jmp .loop
.return:
mov di, input.end
.tspfind:
dec di
cmp byte [di], 0
je .tspfind
cmp byte [di], 0x20
je .tsperase
jmp .done
.tsperase:
mov al, 0
stosb
dec di
jmp .tspfind
.done:
mov si, newline
call print
ret
@ -83,11 +97,13 @@ ret
welcome:
db 0xd, 0xa, "Welcome to EttinOS!", 0xd, 0xa, 0xd, 0xa, 0
input:
times 78 db 0
prompt:
db "> ", 0
newline:
db 0xd, 0xa, 0
input:
times 0x4d db 0
.end:
db 0