Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

MSDOS 4.0 (Announce)

posted by Rugxulo Homepage, Usono, 30.04.2024, 13:36

> 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:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 256 users online (0 registered, 256 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum