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 / writebool.asm < prev    next >
Assembly Source File  |  1989-11-20  |  1KB  |  46 lines

  1.  
  2. *    WriteBool.asm (of PCQ Pascal runtime library)
  3. *    Copyright (c) 1989 Patrick Quaid
  4.  
  5. *    This writes boolean values.  The write routines are so much
  6. *    simpler than the read routines....
  7.  
  8.     SECTION    ONE
  9.  
  10.     XREF    _p%PadOut
  11.     XREF    _p%WriteText
  12.     XREF    _p%IOResult
  13.  
  14. *    On Entry, d0.b holds a boolean value.  The top word on the
  15. *    stack has the pad characters, and the longword below that
  16. *    has the address of the file record
  17.  
  18.     XDEF    _p%WriteBool
  19. _p%WriteBool:
  20.  
  21.     tst.l    _p%IOResult        ; first make sure we're OK
  22.     bne    4$            ; if not, leave now
  23.     move.l    6(sp),a0        ; get file record
  24.     tst.b    d0            ; what is the value to write?
  25.     beq.s    1$            ; if it's false, go around
  26.     move.l    #TrueText,a1        ; load up true text
  27.     moveq    #4,d3            ; 4 characters long
  28.     bra.s    2$            ; and skip this
  29. 1$    move.l    #FalseText,a1        ; load FALSE
  30.     moveq    #5,d3            ; 5 characters long
  31. 2$    move.w    4(sp),d0        ; get field width
  32.     ext.l    d0            ; make it 32 bits wide
  33.     sub.l    d3,d0            ; subtract text length
  34.     ble.s    3$            ; if <= 0 then skip padding
  35.     movem.l    a1/d3,-(sp)        ; save address and length
  36.     jsr    _p%PadOut        ; write pad characters
  37.     movem.l    (sp)+,a1/d3        ; restore regs
  38. 3$    jsr    _p%WriteText        ; copy into buffer
  39. 4$    rts
  40.  
  41.     SECTION    BooleanText,DATA
  42. TrueText    dc.b    'TRUE'
  43. FalseText    dc.b    'FALSE'
  44.     END
  45.  
  46.