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 / writechar.asm < prev    next >
Assembly Source File  |  1989-11-20  |  768b  |  32 lines

  1.  
  2. *    WriteChar.asm (of PCQ Pascal runtime library)
  3. *    Copyright (c) 1989 Patrick Quaid
  4.  
  5. *    This routine writes a single character to a text file
  6.  
  7.     SECTION    ONE
  8.  
  9.     XREF    outbuffer
  10.     XREF    _p%PadOut
  11.     XREF    _p%WriteText
  12.     XREF    _p%IOResult
  13.  
  14.     XDEF    _p%WriteChar
  15. _p%WriteChar:
  16.  
  17.     tst.l    _p%IOResult    ; is everything OK
  18.     bne    2$        ; if not, skip
  19.     move.b    d0,outbuffer    ; put the character into the buffer
  20.     move.l    6(sp),a0    ; load up the file record address
  21.     move.w    4(sp),d0    ; get number of pads
  22.     ext.l    d0        ; make it 32 bits for safety
  23.     subq.l    #1,d0        ; minus one for the character itself
  24.     ble.s    1$        ; if it's <= 0 then skip
  25.     jsr    _p%PadOut    ; write pad spaces
  26. 1$    move.l    #outbuffer,a1    ; get address of buffer
  27.     moveq.l    #1,d3        ; one character long
  28.     jsr    _p%WriteText    ; write the character
  29. 2$    rts
  30.  
  31.     END
  32.