Sfoglia il codice sorgente

Svim Upgrade

master
Jørn Guldberg 5 anni fa
parent
commit
8bc73f0a7e
2 ha cambiato i file con 39 aggiunte e 6 eliminazioni
  1. +1
    -1
      kernel.nasm
  2. +38
    -5
      lib/svim.nasm

+ 1
- 1
kernel.nasm Vedi File

@ -287,7 +287,7 @@ global_vars:
; this is the bios ID
data:
welcome db "###############################################################################", 13, 10, "# Welcome to SingOS VERSION 0.0.5.1 #", 13, 10, "# #", 13, 10, "###############################################################################", 13, 10, 'Press ESC to halt.', 13, 10, 13, 10, 0
welcome db "###############################################################################", 13, 10, "# Welcome to SingOS - Richard Stallman Edition #", 13, 10, "# This build marks the visit of Richard Stallman, SDU Odense, May 7, 2019 #", 13, 10, "###############################################################################", 13, 10, 'Press ESC to halt.', 13, 10, 13, 10, 0
exit_message db 13, 10, 'Goodbye from SingOS',13,10,'The system has halted.', 0
command_line db 13, 10, 'groot@SingOS $ ', 0
number_one_zstring db '71', 0

+ 38
- 5
lib/svim.nasm Vedi File

@ -13,6 +13,7 @@ svim:
mov WORD [svim_counter_char_in_left_buffer], 0 ; reset these to zero
mov WORD [svim_counter_char_in_right_buffer], 0
mov WORD [svim_get_cursor_distance_to_next_line_break], 0
mov BYTE [svim_save_on_exit], 0
call os_clear_screen
@ -210,8 +211,10 @@ svim:
.no_special_key_pressed:
cmp ax, 0x11b ; ESC key
je .end_svim
;cmp ax, 0x3c00 ; f2 key
;je .f_key_pushed
cmp ax, 0x3c00 ; f2 key
je .f2_key_pushed
cmp ax, 0x3d00 ; f3 key
je .f3_key_pushed
cmp ax, 0x0e08 ; backspace
je .backspace_pushed
mov bx, ax
@ -246,14 +249,31 @@ svim:
mov bx, [buffer_for_svim_base_left_of_cursor]
mov cx, [svim_counter_char_in_left_buffer]
mov dl, [svim_save_on_exit]
test dl, dl ; if zero qiut without exit
jz .svim_quit
call lsfs_write_file
.svim_quit:
call os_clear_screen
add sp, svim_magic_buffer_size
add sp, svim_magic_buffer_size
popa
ret
.f2_key_pushed:
mov al, 1
mov [svim_save_on_exit], al
call svim_redraw_window
jmp .svim_loop
.f3_key_pushed:
mov al, 0
mov [svim_save_on_exit], al
call svim_redraw_window
jmp .svim_loop
.backspace_pushed:
mov bx, [svim_counter_char_in_left_buffer]
cmp bx, 0
@ -476,6 +496,16 @@ svim_redraw_window:
mov si, welcome_svim
call print
mov al, [svim_save_on_exit]
test al, al
jz .not_save_mode
mov si, svim_string_save
jmp .after_not_safe_mode
.not_save_mode:
mov si, svim_string_not_save
.after_not_safe_mode:
call print
; move cursor to the top
xor ax, ax
xor bx, bx
@ -505,8 +535,11 @@ buffer_for_svim_base_right_of_cursor dw 0
svim_counter_char_in_left_buffer dw 0
svim_counter_char_in_right_buffer dw 0
seperate_line db '________________________________________________________________________________', 0
welcome_svim db 'Vim like text editor for SingOS, ESC to exit', 0
welcome_svim_select_file db 'svim v0.1.1 - Open file: ', 0
welcome_svim db 'Vim like text editor for SingOS, ESC to exit svim - ', 0
svim_string_save db 'save-mode', 0
svim_string_not_save db 'not-save-mode', 0
welcome_svim_select_file db 'svim v0.2.0 - Open file: ', 0
welcome_svim_enter_fileindex db 'Enter fileindex: ', 0
fileindex_for_open_file dw 0
svim_total_file_size_counter dw 0
svim_total_file_size_counter dw 0
svim_save_on_exit db 0

Caricamento…
Annulla
Salva