home *** CD-ROM | disk | FTP | other *** search
-
- * 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
-