home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / utils / asmutl / buffers.lbr / TEST1.MZC / TEST1.MAC
Encoding:
Text File  |  1987-01-14  |  896 b   |  50 lines

  1. ; test buffers module.  Copy file to console
  2. ;
  3. ; SEE BUFFERS.DOC for linking instructions
  4. ;
  5. boot    equ    0
  6. tfcb    equ    boot+05ch
  7. ;
  8. @cout    equ    2
  9. ;
  10.     extrn    .dos, .bfgetc, .bfropen
  11. ;
  12. begin:    lhld    6
  13.     mvi    l,0
  14.     sphl
  15.     lxi    d,-buffer-128;    allow 128 bytes stack & overhead
  16.     dad    d;        form buffer size available
  17.     mov b,h    ! mov c,l
  18.     lxi    d,tfcb
  19.     lxi    h,buffer
  20.     xra    a;        default user
  21.     call    .bfropen;    open for read
  22.     jc    nofile
  23. ;    "    "
  24. loop:    call    .bfgetc
  25.     jc    done
  26.     cpi    01ah;        for text files, omit
  27.     jz    done;            for binary files
  28.     call    couta;        Can use .bfputc here
  29.     jmp    loop
  30. ;
  31. nofile:    mvi    a,9
  32.     lxi    d,nofmsg
  33.     call    .dos
  34. ;    "    "
  35. done:    jmp    boot
  36. ;
  37. nofmsg:    db    'No file$'
  38. ;
  39. couta:    push    d
  40.     mov    e,a
  41.     mvi    a,@cout
  42.     call    .dos
  43.     pop    d
  44.     ret
  45. ;
  46.     dseg
  47. buffer:    ds    0;        actually rest of memory
  48. ;
  49.     end
  50. =b