home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD1.img
/
d1xx
/
d183
/
pcq
/
runtime
/
readchar.asm
< prev
next >
Wrap
Assembly Source File
|
1989-02-25
|
782b
|
36 lines
* ReadChar.asm (of PCQ Pascal runtime library)
* Copyright (c) 1989 Patrick Quaid
* This reads a character from a text file.
SECTION ONE
XREF _p%readonechar
XREF _p%getthatchar
XREF stdinbuffer
XREF _p%readarbbuf
XDEF _p%readchar
_p%readchar
move.l a0,a1 ; move variable address
move.l 4(sp),a0 ; get the file record address
move.l a0,d0
bne readcharfile ; if not stdin, go around
move.l a1,-(sp) ; save address
jsr _p%readonechar ; read a character
jsr _p%getthatchar
move.l (sp)+,a1 ; get address back
move.b stdinbuffer,(a1) ; store the char
rts
readcharfile:
tst.b 12(a0) ; is it eof?
bne.s 1$ ; if so, skip all this
move.b 4(a0),d0 ; get the buffered char
move.b d0,(a1) ; store it
jsr _p%readarbbuf ; read next character
1$ rts
END