home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / GENASM / APPEND.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  831b  |  49 lines

  1. ;    APPEND.ASM
  2. ;    This is a simple program which is sometimes useful. It copies
  3. ;    a <file1> to the END of <file2>. If file2 does not exist a simple
  4. ;    copy operation is performed. It also does a fixup on a problem
  5. ;    sometimes seen, multiple carriage returns are reduced to one.
  6. ;    Unfortunately it needs MAC so if you don't have it get the COM
  7. ;    file for APPEND if you can.
  8. ;                    Jack Riley (303) 499-9169 RCPM.
  9.  
  10. ;    Useage: APPEND file1 file2
  11.  
  12.     maclib seqio22
  13. BSIZE    EQU 4096
  14.  
  15.     org 100h
  16.     LXI    H,0
  17.     DAD    SP
  18.     SHLD    STACK
  19.     LXI    SP,STACK
  20.  
  21.     file    infile,inp,,1,,BSIZE
  22.     file    append,outp,,2,,BSIZE
  23.  
  24.     xra a
  25.     mov b,a
  26.  
  27. loop:    get inp
  28.     cpi eof
  29.     jz  quit
  30.     cmp b
  31.     mov b,a
  32.     jnz cont
  33.     cpi 0dh
  34.     jz  loop    ; don't duplicate any carriage returns
  35.  
  36. cont:    put outp
  37.     jmp loop
  38.  
  39. quit:    finis outp
  40.  
  41. EXIT    LHLD    STACK
  42.     SPHL
  43.     RET
  44.  
  45.     DS    50    ;STACK
  46. STACK    DW    0
  47. buffers    EQU $
  48.     end
  49.