diff --git a/edlin.asm b/edlin.asm index f63f60c..ac02ae3 100644 --- a/edlin.asm +++ b/edlin.asm @@ -260,11 +260,10 @@ initialize_editor: ; 0240 mov byte [__0d48], 0x0a ; magic mov word [__0a92], file_buffer mov word [current_line], 1 - mov word [__0a80], 1 ; magic + mov word [command_linenum], 1 test byte [new_file_flag], 0xff jnz editor_mainloop - call command_a editor_mainloop: ; 0273 @@ -289,7 +288,7 @@ editor_mainloop: ; 0273 mov si, input_buffer.bufstart call parse_line_specifier - mov [__0a80], dx + mov [command_linenum], dx call skip_spaces.no_load cmp al, ',' @@ -327,7 +326,7 @@ editor_mainloop: ; 0273 orw r_ax, r_ax jz __02e0 - cmp ax, [__0a80] + cmp ax, [command_linenum] jb print_entry_error __02e0: @@ -454,7 +453,7 @@ command_a: ; 0370 jnz __036d mov dx, [last_file_byte] - cmp word [__0a80], 0 + cmp word [command_linenum], 0 jnz __0388 cmp dx, [last_file_buffer_byte] @@ -481,7 +480,7 @@ __0388: __03ab: xorw r_dx, r_dx - mov bx, [__0a80] + mov bx, [command_linenum] orw r_bx, r_bx jnz __03ca @@ -541,7 +540,7 @@ _trampoline_oom_1: ; 0414 jmp oom command_w: ; 0417 - mov bx, [__0a80] + mov bx, [command_linenum] orw r_bx, r_bx jnz __043b @@ -705,7 +704,7 @@ print_bcd_digit: ; 0501 jmp print_char command_l: ; 050e - mov bx, [__0a80] + mov bx, [command_linenum] orw r_bx, r_bx jnz __0522 @@ -963,7 +962,7 @@ __0696: __06b0: mov [__0a86], cx - mov bx, [__0a80] + mov bx, [command_linenum] ; If bx = 0, add 1 to bx cmp bx, 1 @@ -1055,7 +1054,7 @@ copy_line: ; 073f jmp .loop command_d: ; 074e - mov bx, [__0a80] + mov bx, [command_linenum] orw r_bx, r_bx jnz __075a @@ -1088,7 +1087,7 @@ __0782: jmp print_entry_error command_cr: ; 0785 - mov bx, [__0a80] + mov bx, [command_linenum] orw r_bx, r_bx jnz __0792 @@ -1181,7 +1180,7 @@ command_i: ; 0816 mov dx, __087d int 0x21 - mov bx, [__0a80], + mov bx, [command_linenum] orw r_bx, r_bx jnz __082a mov bx, [current_line] @@ -1276,8 +1275,9 @@ command_q: ; 08a6 int 0x20 -__08c4: - mov word [__0a80], 0xffff ; magic +load_file_fully: ; 08c4 + ; Load 0xffff lines (= rest of file) off of disk + mov word [command_linenum], 0xffff call command_a command_e: ; 08cd @@ -1285,7 +1285,7 @@ command_e: ; 08cd mov bx, 0xffff ; magic call __043b test byte [new_file_flag], 0xff - jz __08c4 + jz load_file_fully mov dx, [last_file_byte] mov ah, sys_set_dta @@ -1373,7 +1373,7 @@ __0a7d resb 1 new_file_flag resb 1 ; 0a7e __0a7f resb 1 -__0a80 resw 1 +command_linenum resw 1 ; 0a80 __0a82 resw 1 __0a84 resw 1 __0a86 resw 1