Skip to content
Snippets Groups Projects
Commit ff79c9ad authored by Stephen D's avatar Stephen D
Browse files

text editor additions

parent 15c8f344
No related branches found
No related tags found
No related merge requests found
;; Steve16 text editor
%define SEDIT_EDITOR_BUFFER 0x8000 ;Store the text buffer here for now
sedit_init:
pusha
......@@ -13,6 +12,26 @@ sedit_loop:
int 0x16 ;Read kb
cmp al, 0x1B ;Esc pressed
je sedit_exit
;; Compare with other special characters
cmp al, ' '
jl sedit_loop ;al is less than space
cmp al, 0x7F
jg sedit_loop ;al is greater than ~
;; At this point, we know it's a regular character
mov bx, SEDIT_EDITOR_BUFFER
add bx, [SEDIT_CURSOR_POSITION]
mov [bx], al ;Append character to text buffer
call print_char ;pretty temporary
;; Increment cursor position
add [SEDIT_CURSOR_POSITION], byte 1
jmp sedit_loop
......@@ -25,7 +44,8 @@ sedit_exit:
ret
;; Varibles
SEDIT_CURSOR_POSITION: db 0
SEDIT_CURSOR_POSITION: dw 0
;; Messages
SEDIT_INIT_MSG: db "Steve16 Text Editor", 0xD, 0xA, 0
;; SHORTENED to save space
SEDIT_INIT_MSG: db "Steve16 TE", 0xD, 0xA, 0
SEDIT_EXIT_MSG: db "Goodbye!", 0xD, 0xA, 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment