MSDOS 4.0 (Announce)
> The CRLF hit harder for some reason, so the files like
> chdir.asm will choke with either a hang or spurious errors.
>
> Using just this disk - ie just the raw DOS 4.0 files -
> I could theoretically write a program to convert
> LF to CRLF etc rather than just copying an unzip
> program across. I already have a crlffix - I could
> copy that across instead and likely compile it.
Both of these [2021] goofy kludges are very simple hacks to workaround a flaw
in [then] current versions of A72 assembler (e.g. 1.03a) where it won't read
properly from *nix-only text files (LF-only ending).
N.B. public domain, free for any use.
crlffile.asm
org 100h ; public domain, nenies proprajho
DOS equ 21h
ARGC equ 80h
ARGV equ 82h
CR equ 13
LF equ 10
OPENFILEREAD equ 3D00h
CREATEFILE equ 3Ch
CLOSEFILE equ 3Eh
Komenco:
mov si,ARGC
cmp byte[si+1],CR
jz Fino
xor bh,bh
mov bl,byte[si]
mov byte[si+bx+1],bh
OpenFiles:
mov ax,OPENFILEREAD
mov dx,ARGV
int DOS
jc Fino
mov [inhandle],ax
mov ah,CREATEFILE
xor cx,cx
mov dx,outfile
int DOS
jc Fino
mov [outhandle],ax
call main
CloseFiles:
mov ah,CLOSEFILE
mov bx,[inhandle]
int DOS
mov ah,CLOSEFILE
mov bx,[outhandle]
int DOS
dec byte[err]
Fino:
mov ax,[err]
int DOS
main:
call readbyte
test ax,ax
jz main_ret
cmp byte[buf],LF
jnz main_write
mov dl,byte[buf]
push dx
mov byte[buf],CR
call writebyte
pop dx
mov byte[buf],dl
main_write:
call writebyte
jmp short main
main_ret:
ret
readbyte:
mov ah,3Fh
mov bx,[inhandle]
mov cx,1
mov dx,buf
int DOS
readbyte_ret:
ret
writebyte:
mov ah,40h
mov bx,[outhandle]
mov cx,1
mov dx,buf
int DOS
ret
outfile db 'CRLF.OUT',0
err db 1,4Ch
inhandle dw 0
outhandle dw 0
buf db 0
; EOF
crlf.asm
org 100h ; public domain, nenies proprajho
DOS equ 21h
CR equ 13
LF equ 10
EXIT equ 4C00h
ISKEYPRESS equ 0Bh
READ equ 8
WRITE equ 2
Komenco:
mov ah,ISKEYPRESS
int DOS
test al,al
jz Fino
mov ah,READ
int DOS
cmp al,LF
jnz WriteIt
AddCR:
push ax
mov dl,CR
mov ah,WRITE
int DOS
pop ax
WriteIt:
mov dl,al
mov ah,WRITE
int DOS
jmp short Komenco
Fino:
mov ax,EXIT
int DOS
; EOF
Complete thread:
- MSDOS 4.0 - kerravon, 26.04.2024, 04:43 (Announce)
- MSDOS 4.0 - Guti, 26.04.2024, 14:06
- MSDOS 4.0 - Oso2k, 26.04.2024, 15:38
- MSDOS 4.0 - roytam, 26.04.2024, 17:05
- MSDOS 4.0 - rr, 26.04.2024, 22:00
- MSDOS 4.0 - usotsuki, 30.04.2024, 17:41
- MSDOS 4.0 - boeckmann, 30.04.2024, 21:03