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
/
WriteInt.asm
< prev
next >
Wrap
Assembly Source File
|
1990-03-03
|
1KB
|
48 lines
* WriteInt.asm (of PCQ Pascal runtime library)
* Copyright (c) 1989 Patrick Quaid
* Write an integer to a text file.
* Upon entry, d0 holds the value to write. The word on top of
* the stack holds the minumum field width, and the long word
* below that holds the file record address
*
SECTION one
XREF _p%PadOut
XREF i_ldiv
XREF outbuffer
XREF _p%WriteText
XREF _p%IOResult
XREF _IntToStr
XDEF _p%WriteInt
_p%WriteInt
tst.l _p%IOResult ; is IO system OK?
bne 5$ ; if not, leave
sub.l #16,sp ; allocate work space
move.l sp,-(sp) ; push this address
move.l d0,-(sp) ; push integer value
jsr _IntToStr ; fill buffer with integer
addq.l #8,sp ; pop stuff off stack
move.l d0,d3 ; move length into d3
move.l 22(sp),a0 ; a0 := file record address
move.w 20(sp),d0 ; get the field width
ext.l d0 ; make it an integer
sub.l d3,d0 ; how many extras?
ble 4$ ; if none, skip this
jsr _p%PadOut ; write d0 spaces to a0 file rec
4$ move.l sp,a1 ; point to first char
jsr _p%WriteText ; write d3 bytes at a1 to a0
add.l #16,sp ; free work space
5$ rts
END