36 lines
559 B
NASM
36 lines
559 B
NASM
; Planned commands:
|
|
; i insert
|
|
; a append
|
|
; l prints lines
|
|
; w save to disk
|
|
; q quit
|
|
ed:
|
|
pusha
|
|
mov si, ed_welcome
|
|
call os_print_string
|
|
.main_loop:
|
|
mov ax, ed_prompt
|
|
mov bx, 40
|
|
call keyboard_display_input ; AX = string location, BX = max prompt length
|
|
mov si, ed_prompt
|
|
jmp .get_token
|
|
|
|
; Types of tokens:
|
|
; Number: eg 123
|
|
; Doller (refers to the last line) $
|
|
; Comma ,
|
|
; Command: eg i
|
|
; 123
|
|
.get_token:
|
|
xor ax,ax
|
|
lodsb
|
|
call check_is_number
|
|
jmp .exit
|
|
|
|
.exit:
|
|
popa
|
|
ret
|
|
|
|
ed_prompt: times 40 db 0
|
|
ed_welcome: db "This is ED\n", 0
|