Starting writing an ed implementation
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
; 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
|
||||
|
||||
Reference in New Issue
Block a user