home *** CD-ROM | disk | FTP | other *** search
-
- * ReadLn.asm (of PCQ Pascal runtime library)
- * Copyright (c) 1989 Patrick Quaid
-
- * Implements readln....
-
- SECTION ONE
-
- XREF _p%readonechar
- XREF _p%getthatchar
- XREF stdinbuffed
- XREF stdinbuffer
- XREF _p%readarbbuf
-
- XDEF _p%readln
- _p%readln
-
- * top of stack has file
-
- move.l 4(sp),a0 ; get file record
- move.l a0,d0
- bne readlnfile ; is not stdin, go around
- 1$ jsr _p%readonechar ; read a char
- move.b #0,stdinbuffed ; un-buffer it
- cmp.b #10,stdinbuffer ; is it LF?
- bne.s 1$ ; go to read again
- 3$ rts ; and return
-
- readlnfile:
- 1$ tst.b 12(a0) ; at eof?
- bne.s 3$ ; if so, leave
- move.b 4(a0),d0 ; get the next char
- cmp.b #10,d0 ; is it LF?
- beq.s 2$ ; go to read one more
- jsr _p%readarbbuf ; read next char
- bra 1$ ; loop
- 2$ jsr _p%readarbbuf ; eat the LF
- 3$ rts ; and return
-
- END
-