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 / Readers / readchar.asm < prev    next >
Assembly Source File  |  1989-11-20  |  683b  |  31 lines

  1.  
  2. *    ReadChar.asm (of PCQ Pascal runtime library)
  3. *    Copyright (c) 1989 Patrick Quaid
  4.  
  5. *    This reads one character from a text file.
  6.  
  7.     INCLUDE    ":runtime/FileRec.i"
  8.  
  9.     SECTION    ONE
  10.  
  11.     XREF    _p%ReadOneChar
  12.     XREF    _p%GetThatChar
  13.     XREF    _p%IOResult
  14.  
  15. *    Upon entry we expect a0 to hold the variable address, and
  16. *    the top of the stack should be the file record address.
  17.  
  18.     XDEF    _p%ReadChar
  19. _p%ReadChar
  20.     tst.l    _p%IOResult        ; is IO OK?
  21.     bne.s    1$
  22.     move.l    a0,-(sp)        ; save the variable address
  23.     move.l    8(sp),a0        ; get the file record address
  24.     jsr    _p%ReadOneChar        ; read a character
  25.     jsr    _p%GetThatChar        ; eat it
  26.     move.l    (sp)+,a0        ; restore var address
  27.     move.b    d0,(a0)            ; save the character
  28. 1$    rts
  29.  
  30.     END
  31.