More symbolicity

This commit is contained in:
Juhani Krekelä 2021-07-30 13:20:59 +03:00
parent aef2ee578c
commit 6fa68e1fc1
1 changed files with 36 additions and 12 deletions

View File

@ -3,10 +3,28 @@ org 0x100
; FCB defines
fcb_filename equ 1
fcb_extension equ fcb_filename + 8
; PSP defines
psp_fcb_1 equ 0x005c
; Syscall defined
sys_print_string equ 9
sys_open_file equ 0xf
sys_delete_file equ 0x13
sys_create_file equ 0x16
; Special instruction encodings
%macro or_al_al 0
db 0x0a, 0xc0 ; or al, al (longer encoding)
%endmacro
%macro cmp_byteaddr_bytext 2
db 0x82, 0x3e ; cmp byte […], byte +… (extended)
dw %1
db %2
%endmacro
jmp entrypoint
__0102:
@ -28,16 +46,15 @@ entrypoint: ; 0181
mov sp, stack_end
ensure_file_argument:
db 0x82, 0x3e ; cmp byte […], byte +… (extended)
dw psp_fcb_1 + fcb_filename
db ' '
cmp_byteaddr_bytext psp_fcb_1 + fcb_filename, ' '
je print_filename_missing_error
db 0x0a, 0xc0 ; or al, al (longer encoding)
; AL at program start a flag of whether drive specifier in first parameter valid
or_al_al
mov dx, invalid_name_error
jnz _trampoline_error_1
mov si, __093e
mov si, bak_extension
mov di, psp_fcb_1 + fcb_filename + 8
mov cx, 3
repe cmpsb
@ -343,7 +360,7 @@ db 0xCD, 0x21 ; 0477 int 0x21
db 0xBA, 0xB9, 0x09 ; 0479 mov dx,0x9b9
error: ; 047c
mov ah, 9
mov ah, sys_print_string
int 0x21
int 0x20
@ -855,16 +872,16 @@ db 0xBC, 0x48, 0x0D ; 0935 mov sp,0xd48
db 0xE8, 0xE2, 0xFF ; 0938 call 0x91d
db 0xE9, 0x35, 0xF9 ; 093B jmp 0x273
__093e db "BAK"
bak_extension db "BAK" ; 093e
invalid_name_error db "Invalid drive or file name$" ; 0941
filename_missing_error db "File name must be specified$" ; 095c
__0978 db "Cannot edit .BAK file--rename file$"
__099b db "No room in directory for file$"
bak_error db "Cannot edit .BAK file--rename file$" ; 0978
directory_full_error db "No room in directory for file$" ; 099b
__09b9 db "Disk full--file write not completed$"
__09dd db 13, 10, "Insufficient memory", 13, 10, '$'
__09f5 db "Entry error", 13, 10, '$'
__0a03 db "New file", 13, 10, '$'
new_file_str db "New file", 13, 10, '$' ; 0a03
__0a0e db "Not found", 13, 10, '$'
__0a1a db "O.K.? $"
__0a21 db "Line too long", 13, 10, '$'
@ -872,7 +889,14 @@ __0a31 db "End of input file", 13, 10, '$'
__0a45 db "Abort edit (Y/N)? $"
; 0a58
section .bss
__0a58:
__0a7f equ 0x0a7f
resb 38
stack_end equ 0x0d48
__0a7e: resb 1
__0a7f: resb 1
resb 712
stack_end: ; 0d48