|
|
@ -151,7 +151,7 @@ svim: |
|
|
|
mov dl, [global_disk_identifier] ;Drive number |
|
|
|
int 0x13 |
|
|
|
|
|
|
|
mov bx, .fileindex_for_open_file |
|
|
|
mov bx, .buffer_for_svim |
|
|
|
add bx, 510 |
|
|
|
mov ax, [bx] |
|
|
|
mov [.buffer_counter_svim], ax |
|
|
@ -161,6 +161,9 @@ svim: |
|
|
|
call print |
|
|
|
|
|
|
|
.svim_loop: |
|
|
|
xor bx, bx |
|
|
|
xor cx, cx |
|
|
|
xor dx, dx |
|
|
|
mov ax, 0x1000 ; BIOS call to wait for key |
|
|
|
int 0x16 |
|
|
|
cmp ax, 0x1c0d ; enter key |
|
|
@ -171,8 +174,8 @@ svim: |
|
|
|
.no_enter: |
|
|
|
cmp ax, 0x11b ; ESC key |
|
|
|
je .end_svim |
|
|
|
cmp ax, 0x3c00 ; f2 key |
|
|
|
je .f_key_pushed |
|
|
|
;cmp ax, 0x3c00 ; f2 key |
|
|
|
;je .f_key_pushed |
|
|
|
cmp ax, 0x0e08 ; backspace |
|
|
|
je .backspace_pushed |
|
|
|
mov bx, ax |
|
|
@ -197,7 +200,7 @@ svim: |
|
|
|
;DL Drive |
|
|
|
;ES:BX Buffer Address Pointer |
|
|
|
mov ax, [.buffer_counter_svim] |
|
|
|
mov bx, .fileindex_for_open_file |
|
|
|
mov bx, .buffer_for_svim |
|
|
|
add bx, 510 |
|
|
|
mov [bx], ax |
|
|
|
|
|
|
@ -229,16 +232,17 @@ svim: |
|
|
|
ret |
|
|
|
|
|
|
|
.backspace_pushed: |
|
|
|
pusha |
|
|
|
mov bx, [.buffer_counter_svim] |
|
|
|
cmp bx, 0 |
|
|
|
je .svim_loop |
|
|
|
;print_format .debug_buffer_counter, bx |
|
|
|
mov cx, bx |
|
|
|
sub cx, 1 |
|
|
|
mov bx, .buffer_for_svim |
|
|
|
add bx, cx |
|
|
|
mov BYTE [bx], 0 |
|
|
|
mov [.buffer_counter_svim], cx |
|
|
|
;print_format .debug_buffer_counter, cx |
|
|
|
; Go back one space |
|
|
|
mov ax, 0x0e08 ; ah=0x0e means teletype output. al=0x08 means backspace character. |
|
|
|
int 0x10 |
|
|
@ -250,22 +254,21 @@ svim: |
|
|
|
; Go back one space again as the above print of NULL pushes the cursor forward again. |
|
|
|
mov ax, 0x0e08 |
|
|
|
int 0x10 |
|
|
|
popa |
|
|
|
jmp .svim_loop |
|
|
|
|
|
|
|
|
|
|
|
.f_key_pushed: |
|
|
|
mov al, 0x01 ;arg: index 1 |
|
|
|
call os_change_screen |
|
|
|
jmp .svim_loop |
|
|
|
;.f_key_pushed: |
|
|
|
;mov al, 0x01 ;arg: index 1 |
|
|
|
;call os_change_screen |
|
|
|
;jmp .svim_loop |
|
|
|
|
|
|
|
;.load_buffer_svim: |
|
|
|
|
|
|
|
|
|
|
|
.debug_buffer_counter db 'Buffer count: %d', 13, 10, 0 |
|
|
|
.welcome_svim db 'Vim like text editor for SingOS, ESC to exit', 0 |
|
|
|
.welcome_svim_select_file db 'svim - Open file: ', 0 |
|
|
|
.welcome_svim_enter_fileindex db 'Enter fileindex: ', 0 |
|
|
|
.seperate_line db '________________________________________________________________________________', 13, 10, 0 |
|
|
|
.seperate_line db '________________________________________________________________________________', 0 |
|
|
|
.fileindex_for_open_file dw 0 |
|
|
|
.buffer_for_svim times 512 dw 0 ; db 'this is the buffer', 0, times 32 db 0 |
|
|
|
.buffer_counter_svim dw 0 |