__0a96 → last_file_buffer_byte
This commit is contained in:
parent
73e7beb441
commit
20de922eef
20
edlin.asm
20
edlin.asm
|
@ -236,7 +236,9 @@ setup_file_parameters: ; 01ec
|
||||||
|
|
||||||
movw r_dx, r_cx
|
movw r_dx, r_cx
|
||||||
add dx, file_buffer
|
add dx, file_buffer
|
||||||
mov [__0a96], dx
|
; File buffer is actually 1 byte more than we load from the file
|
||||||
|
; This is because we always place a ^Z after file contents
|
||||||
|
mov [last_file_buffer_byte], dx
|
||||||
|
|
||||||
read_file:
|
read_file:
|
||||||
mov dx, psp_fcb_1
|
mov dx, psp_fcb_1
|
||||||
|
@ -249,7 +251,7 @@ read_file:
|
||||||
initialize_editor: ; 0240
|
initialize_editor: ; 0240
|
||||||
cld
|
cld
|
||||||
|
|
||||||
; Put ^Z at the end of the file in memory
|
; Place ^Z after the end of file in memory
|
||||||
mov byte [di], 0x1a ; ^Z
|
mov byte [di], 0x1a ; ^Z
|
||||||
|
|
||||||
mov [__0a9a], di
|
mov [__0a9a], di
|
||||||
|
@ -422,6 +424,12 @@ command_addresses: ; 034a
|
||||||
dw command_w ; W
|
dw command_w ; W
|
||||||
dw command_q ; Q
|
dw command_q ; Q
|
||||||
|
|
||||||
|
; in:
|
||||||
|
; di = buffer
|
||||||
|
; cx = size of buffer
|
||||||
|
; out:
|
||||||
|
; cx = size of buffer upto and including the ^Z, or original passed size
|
||||||
|
; equals (zero) flag = was there a ^Z
|
||||||
find_file_end_char: ; 035e
|
find_file_end_char: ; 035e
|
||||||
push di
|
push di
|
||||||
push cx
|
push cx
|
||||||
|
@ -449,7 +457,7 @@ command_a: ; 0370
|
||||||
cmp word [__0a80], 0
|
cmp word [__0a80], 0
|
||||||
jnz __0388
|
jnz __0388
|
||||||
|
|
||||||
cmp dx, [__0a96]
|
cmp dx, [last_file_buffer_byte]
|
||||||
jnb find_file_end_char.ret
|
jnb find_file_end_char.ret
|
||||||
|
|
||||||
__0388:
|
__0388:
|
||||||
|
@ -479,10 +487,10 @@ __03ab:
|
||||||
|
|
||||||
movw r_ax, r_di
|
movw r_ax, r_di
|
||||||
addw r_ax, r_cx
|
addw r_ax, r_cx
|
||||||
cmp ax, [__0a96]
|
cmp ax, [last_file_buffer_byte]
|
||||||
jna __03ca
|
jna __03ca
|
||||||
|
|
||||||
mov di, [__0a96]
|
mov di, [last_file_buffer_byte]
|
||||||
movw r_cx, r_ax
|
movw r_cx, r_ax
|
||||||
subw r_cx, r_di
|
subw r_cx, r_di
|
||||||
mov bx, 1
|
mov bx, 1
|
||||||
|
@ -1377,7 +1385,7 @@ current_line resw 1 ; 0a90
|
||||||
__0a92 resw 1
|
__0a92 resw 1
|
||||||
|
|
||||||
__0a94 resw 1
|
__0a94 resw 1
|
||||||
__0a96 resw 1
|
last_file_buffer_byte resw 1 ; 0a96
|
||||||
last_valid_address resw 1 ; 0a98
|
last_valid_address resw 1 ; 0a98
|
||||||
|
|
||||||
__0a9a resw 1
|
__0a9a resw 1
|
||||||
|
|
Loading…
Reference in New Issue