[ORG 0x9e00] jmp start ;Calls %include "PRINTNL.INC" %include "PRINTSTR.INC" %include "PRINTLN.INC" %include "READSTR.INC" %include "READLN.INC" %include "CMPSTR.INC" %include "BYTE2HEX.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