[ORG 0x7e00] jmp start ;Calls %include "printcrlf.inc" %include "printstr.inc" %include "println.inc" %include "readstr.inc" %include "readln.inc" %include "cmpstr.inc" %include "byte2hexstr.inc" ;Commands %include "echo.inc" %include "hello.inc" %include "help.inc" %include "keycode.inc" start: ;Get the terminal width mov ah, 0xf int 0x10 mov [cpl], ah ;Print a welcome message mov si, welcome call println loop: ;Print a prompt mov si, prompt call printstr ;Read a command mov di, buffer mov al, 0xff call readln exec: ;Identify and execute the command ;Check for no command cmp byte [buffer], 0x0 je loop .echo: ;Check mov si, buffer mov di, cmd.echo call cmpstr jnc .hello ;Execute call echo jmp loop .hello: ;Check mov si, buffer mov di, cmd.hello call cmpstr jnc .help ;Execute call hello jmp loop .help: ;Check mov si, buffer mov di, cmd.help call cmpstr jnc .keycode ;Execute call help jmp loop .keycode: ;Check mov si, buffer mov di, cmd.keycode call cmpstr jnc .error ;Execute call keycode jmp loop .error: mov si, error call println jmp loop cpl: db 0x0 welcome: db 0xd, 0xa, "Welcome to EttinOS!", 0xd, 0xa, 0x0 prompt: db "> ", 0x0 cmd: .echo: db "echo", 0x0 .hello: db "hello", 0x0 .help: db "help", 0x0 .keycode: db "keycode", 0x0 error: db "Unknown command", 0x0 buffer: times 0xff db 0