home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / utils / asmutl / buffers.lbr / BFSWAP.MZC / BFSWAP.MAC
Text File  |  1987-01-14  |  768b  |  23 lines

  1. ;
  2. ; swap file de^, user/flags a, for the file presently attached
  3. ; to buffer hl^.  Return de a pointer to the previous file, and
  4. ; a as the previous flags lo byte setting.
  5. ; This permits use of a single buffer for fast file transfers,
  6. ; using the .BDUMP and .BLOAD routines to control user access
  7. ; during file read/writes.
  8. ; a,f,d,e
  9. .bfswap::
  10.     push    b
  11.     push    h
  12.     mov    b,m;        existing flags byte
  13.     mov    m,a;        set revised flags byte
  14.     inx h    ! inx h;    advance to size
  15.     inx h    ! inx h;    advance to fcbptr
  16.     mov a,m    ! inx h ! mov c,m;    existing fcb
  17.     mov m,d    ! dcx h    ! mov m,e;    revised fcb
  18.     mov d,c    ! mov e,a;    de := previous fcb
  19.     mov    a,b;        a := previous flags
  20.     pop    h
  21.     pop    b
  22.     ret
  23. ñí