Closed tsupplis closed 11 months ago
Hi!
Do you know of any program that needs this?
I suppose it will not hurt to merge anyways.
Thank you!
Hi again,
I tested under DOS-1.0, 1.1, 2.0, 2.1, 3.3 and 5.0.
The '/' is a file separator in DOS versions 1.0, 3.3 and 5.0. So, it seems that compatibility was lost in DOS 1.1 and then fixed in DOS 3.*
I will apply a patch.
Attached are the test binary and results, the test program source is:
; Assemble with "nasm pspfcb.asm -o pspfcb.com"
;
cpu 8086
bits 16
section .code
org 100h
start:
call open_dump
mov cx, 127
mov ax, ds
mov es, ax
; Dump filename from FCB 1
mov si, 5ch
mov cx, 12
call hex_dump
; Dump filename from FCB 2
mov si, 6ch
mov cx, 12
call hex_dump
call close_dump
xor ax, ax
int 21h
out_fcb:
db 0, 'PSPFCB LOG'
dw 0
dw 0
dq 0
dw 0
dw 0
db 0,0,0,0,0,0,0,0
db 0
dq 0
open_dump:
; open existing file
lea dx, [out_fcb]
mov ah, 0fh
int 21h
or al,al
je no_create
; Can't open existing file, create new
mov ah, 16h
int 21h
or al,al
jne err
no_create:
; setup for blocks of 1 byte
mov word [out_fcb+0eh], 1
; and point position to end of file
mov ax, [out_fcb + 10h]
mov [out_fcb + 21h], ax
mov ax, [out_fcb + 12h]
mov [out_fcb + 23h], ax
ret
err:
mov dx, err_msg
mov ah, 09h
int 21h
mov ah,0
int 21h
err_msg:
db 'Error at file open', 0dh, 0ah, '$'
close_dump:
; open
lea dx, [out_fcb]
mov ah, 10h
int 21h
or al,al
jne err
ret
; Display a memory dump of length CX, from ES:SI,
; including hex and ascii data
hex_dump:
push cx
; Cleanup DTA
mov di, 80h
mov cx, 67
mov al, ' '
clr_line:
mov [di], al
inc di
loop clr_line
mov al, '|'
mov [80h+48],al
mov [80h+65],al
mov ax, 0a0dh
mov [80h+66],ax
nxt_line:
pop cx
or cx,cx
jz ret_exit
xor bx, bx
xor di, di
nxt_char:
; Generate the bytes one at a time
or cx,cx
je end_line
dec cx
es lodsb
; print byte
mov ah,al
cmp al, ' '
jb print_dot
cmp al, 127
jb print_cok
print_dot:
mov al, '.'
; Print a character
print_cok:
mov [80h+49+bx], al
inc bx
mov al,ah
; print hex
call fill_b
inc di
cmp bx, 10h
jl nxt_char
; We have one line, print
push cx
call write_line
jmp nxt_line
fill_b:
call fdig
fdig:
rol al,1
rol al,1
rol al,1
rol al,1
mov dl,al
and dl,15
cmp dl,9
jbe .num
add dl,7
.num add dl,'0'
mov [80h+di], dl
inc di
ret_exit:
ret
fill_line:
mov al, ' '
mov [80h+49+bx], al
inc bx
mov [80h+di], al
inc di
mov [80h+di], al
inc di
inc di
end_line:
cmp bx, 10h
jl fill_line
; Write last line to file and exit
write_line:
mov ah, 28h
mov cx, 68
lea dx, [out_fcb]
int 21h
ret
'/ ' is a separator character for the FCB building on DOS > 2.X 🙁
A tested fix in (src/loader.c:21) is:
under dos >3:
under emu2: pspdump /a/b