Essentially what I am working on is building a simple console-based OS that is similar to MS-DOS in functionality. I understand that a project like this couldn't be easily maintained, and I don't really care ;). So here is what I have made so far:
;------------------------------------------------------
;| SMOS Shell Source |
;| Kept under GPLv3 Open Source license |
;| (https://www.gnu.org/licenses/gpl.txt) |
;------------------------------------------------------
BITS 16
start:
mov ax, 07C0h
add ax, 288
mov ss, ax
mov sp, 4096
mov ax, 07C0h
mov ds, ax
jmp kool
kool:
mov si, lineone
call print_string
mov si, linetwo
call print_string
mov si, linethree
call print_string
call newline
mov si, shellprompt
call print_string
jmp type
shell:
call newline
mov si, shellprompt
call print_string
jmp type
lineone db '----------------------',13,10,0
linetwo db '| WELCOME TO SMOS |',13,10,0
linethree db '----------------------',13,10,0
shellprompt db 'smos> ',0
break db 13,10,0
clearscreen:
mov ah, 0x06
mov al, 0
int 10h
type:
mov ah,0h
int 16h
jmp shell
print_string:
mov ah, 0Eh
.repeat:
lodsb
cmp al, 0
je done
int 10h
jmp .repeat
newline:
mov si, break
call print_string
done:
ret
times 510-($-$$) db 0
dw 0xAA55
What I would like is a way to get a keypress and print it onto the smos>
shell line. So if the user typed test
it would display smos> test
and if the user presses enter it will be able to be stored, and then acted upon. I have looked for anything similar to my question and you can see that in the type:
function it stops the process until a key is pressed, which is an attempt I found. However, I can't figure out how to continue the code to get the result I explained. Anyway, remember when you're answering I'm new to assembly so treat me like a 5-year-old when explaining things. Thanks in advance!