home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff339.lzh / PCQ / Runtime.lzh / Runtime / Writers / Put.asm < prev    next >
Assembly Source File  |  1989-11-20  |  801b  |  33 lines

  1.  
  2. *
  3. *    Put.asm (of the PCQ Pascal runtime library)
  4. *    Copyright (c) 1989 Patrick Quaid
  5. *
  6. *    This routine just advances the file ptr one record.  Presumably
  7. *    the user has put something into the buffer using FileVar^, and
  8. *    wants to get to the next one.
  9. *
  10. *    On entry, this routine wants a0 to point to the file record
  11. *
  12.  
  13.     SECTION    Put,CODE
  14.  
  15.     INCLUDE    ":runtime/FileRec.i"
  16.  
  17.     XREF    _p%FlushBuffer
  18.     XREF    _p%IOResult
  19.  
  20.     XDEF    _p%Put
  21. _p%Put
  22.     tst.l    _p%IOResult        ; is IO system OK?
  23.     bne.s    1$            ; if not, don't do anything
  24.     move.l    CURRENT(a0),a1        ; get the current position
  25.     adda.l    RECSIZE(a0),a1        ; add one record size
  26.     move.l    a1,CURRENT(a0)        ; save new position
  27.     cmpa.l    MAX(a0),a1        ; is the buffer full?
  28.     blt.s    1$            ; if not, skip
  29.     jsr    _p%FlushBuffer        ; write the whole buffer
  30. 1$    rts                ; return to the program
  31.  
  32.     END
  33.