home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD1.img
/
d1xx
/
d183
/
pcq
/
runtime
/
readstring.asm
< prev
next >
Wrap
Assembly Source File
|
1989-02-25
|
785b
|
50 lines
* ReadString.asm (of PCQ Pascal runtime library)
* Copyright (c) 1989 Patrick Quaid
* This reads a string from a text file.
SECTION ONE
XREF _p%readonechar
XREF _p%getthatchar
XREF _p%readarbbuf
XREF stdinbuffed
XDEF _p%readstring
_p%readstring
move.l (a0),a1
move.l 4(sp),a0
move.l #0,d1
move.l a0,d0
bne.s readstringfile
1$ move.l a1,-(sp)
jsr _p%readonechar
bsr _p%getthatchar
move.l (sp)+,a1
move.b d0,0(a1,d1.l)
addq.l #1,d1
cmp.b #10,d0
bne 1$
move.b #0,-1(a1,d1.l)
move.b #-1,stdinbuffed
rts
readstringfile
1$ tst.b 12(a0)
bne.s 3$
move.b 4(a0),d0
move.b d0,0(a1,d1.l)
addq.l #1,d1
cmp.b #10,d0
beq.s 2$
movem.l d0-d1/a1,-(sp)
jsr _p%readarbbuf
movem.l (sp)+,d0-d1/a1
bra.s 1$
2$ move.b #0,-1(a1,d1.l)
rts
3$ move.b #0,0(a1,d1.l)
rts
END