__0a58_fcb → new_file_fcb
This commit is contained in:
parent
f5e568a6e3
commit
3ecb399a46
36
edlin.asm
36
edlin.asm
|
@ -158,8 +158,11 @@ open_file:
|
||||||
int 0x21
|
int 0x21
|
||||||
|
|
||||||
delete_old_bak: ; 01b9
|
delete_old_bak: ; 01b9
|
||||||
|
; Borrow the FCB we'll be later using to create the new file with
|
||||||
|
; Since we are done with the old .BAK before we start using it for
|
||||||
|
; its main purpose, this is safe
|
||||||
mov si, psp_fcb_1
|
mov si, psp_fcb_1
|
||||||
mov di, __0a58_fcb
|
mov di, new_file_fcb
|
||||||
mov cx, 9
|
mov cx, 9
|
||||||
rep movsb
|
rep movsb
|
||||||
|
|
||||||
|
@ -168,12 +171,19 @@ delete_old_bak: ; 01b9
|
||||||
movsb
|
movsb
|
||||||
|
|
||||||
mov ah, sys_delete_file
|
mov ah, sys_delete_file
|
||||||
mov dx, __0a58_fcb
|
mov dx, new_file_fcb
|
||||||
int 0x21
|
int 0x21
|
||||||
|
|
||||||
; TODO: Why .$$$? What is this used for?
|
create_new_file:
|
||||||
|
; Create the new file we'll be writing to. EDLIN never writes to
|
||||||
|
; the file we opened for reading, but instead renames that one to
|
||||||
|
; .BAK and then writes out the changed contents to a new file
|
||||||
|
;
|
||||||
|
; The file is called .$$$ until we either exit without saving in
|
||||||
|
; which case it's deleted, or with saving, in which case it's
|
||||||
|
; renamed to the original extension
|
||||||
mov al, '$'
|
mov al, '$'
|
||||||
mov di, __0a58_fcb + fcb_extension
|
mov di, new_file_fcb + fcb_extension
|
||||||
stosb
|
stosb
|
||||||
stosb
|
stosb
|
||||||
stosb
|
stosb
|
||||||
|
@ -194,12 +204,12 @@ setup_file_parameters: ; 01ec
|
||||||
xorw r_ax, r_ax
|
xorw r_ax, r_ax
|
||||||
mov [psp_fcb_1 + fcb_record_low], ax
|
mov [psp_fcb_1 + fcb_record_low], ax
|
||||||
mov [psp_fcb_1 + fcb_record_high], ax
|
mov [psp_fcb_1 + fcb_record_high], ax
|
||||||
mov [__0a58_fcb + fcb_record_low], ax
|
mov [new_file_fcb + fcb_record_low], ax
|
||||||
mov [__0a58_fcb + fcb_record_high], ax
|
mov [new_file_fcb + fcb_record_high], ax
|
||||||
|
|
||||||
inc ax
|
inc ax
|
||||||
mov [psp_fcb_1 + fcb_record_size], ax
|
mov [psp_fcb_1 + fcb_record_size], ax
|
||||||
mov [__0a58_fcb + fcb_record_size], ax
|
mov [new_file_fcb + fcb_record_size], ax
|
||||||
|
|
||||||
mov dx, file_buffer
|
mov dx, file_buffer
|
||||||
movw r_di, r_dx
|
movw r_di, r_dx
|
||||||
|
@ -552,7 +562,7 @@ __043f:
|
||||||
mov ah, sys_set_dta
|
mov ah, sys_set_dta
|
||||||
int 0x21
|
int 0x21
|
||||||
|
|
||||||
mov dx, __0a58_fcb
|
mov dx, new_file_fcb
|
||||||
mov ah, sys_random_block_write
|
mov ah, sys_random_block_write
|
||||||
int 0x21
|
int 0x21
|
||||||
orb r_al, r_al
|
orb r_al, r_al
|
||||||
|
@ -1248,7 +1258,7 @@ command_q: ; 08a6
|
||||||
cmp al, 'Y'
|
cmp al, 'Y'
|
||||||
jne newline
|
jne newline
|
||||||
|
|
||||||
mov dx, __0a58_fcb
|
mov dx, new_file_fcb
|
||||||
mov ah, sys_close_file
|
mov ah, sys_close_file
|
||||||
int 0x21
|
int 0x21
|
||||||
|
|
||||||
|
@ -1273,7 +1283,7 @@ command_e: ; 08cd
|
||||||
int 0x21
|
int 0x21
|
||||||
|
|
||||||
mov cx, 1
|
mov cx, 1
|
||||||
mov dx, __0a58_fcb
|
mov dx, new_file_fcb
|
||||||
mov ah, sys_random_block_write
|
mov ah, sys_random_block_write
|
||||||
int 0x21
|
int 0x21
|
||||||
|
|
||||||
|
@ -1294,11 +1304,11 @@ command_e: ; 08cd
|
||||||
int 0x21
|
int 0x21
|
||||||
|
|
||||||
mov si, psp_fcb_1
|
mov si, psp_fcb_1
|
||||||
mov di, __0a58_fcb + fcb_rename_target - 1
|
mov di, new_file_fcb + fcb_rename_target - 1
|
||||||
mov cx, 6 ; 6*2 = 12 bytes (as we copy words). 1 (drive specifier) + 8 (name) + 3 (extension)
|
mov cx, 6 ; 6*2 = 12 bytes (as we copy words). 1 (drive specifier) + 8 (name) + 3 (extension)
|
||||||
rep movsw
|
rep movsw
|
||||||
|
|
||||||
mov dx, __0a58_fcb
|
mov dx, new_file_fcb
|
||||||
int 0x21
|
int 0x21
|
||||||
|
|
||||||
int 0x20
|
int 0x20
|
||||||
|
@ -1347,7 +1357,7 @@ quit_prompt db "Abort edit (Y/N)? $" ; 0a45
|
||||||
|
|
||||||
; 0a58
|
; 0a58
|
||||||
section .bss
|
section .bss
|
||||||
__0a58_fcb resb 37 ; 0a58 … 0a7c
|
new_file_fcb resb 37 ; 0a58 … 0a7c
|
||||||
|
|
||||||
__0a7d resb 1
|
__0a7d resb 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue