* ReadCharray.asm (of PCQ Pascal runtime library) * Copyright (c) 1989 Patrick Quaid * This reads a character array, one character at a time, from * a text file. SECTION ONE XREF _p%readonechar XREF _p%getthatchar XREF stdinbuffed XREF _p%readarbbuf XDEF _p%readcharray _p%readcharray move.l a0,a1 move.l 4(sp),a0 move.l #0,d2 move.l a0,d0 bne.s readarrayfile 1$ movem.l a0-a1,-(sp) jsr _p%readonechar movem.l (sp)+,a0-a1 jsr _p%getthatchar cmp.b #10,d0 bne 2$ move.b #-1,stdinbuffed bra.s rarfill 2$ move.b d0,0(a1,d2.l) addq.l #1,d2 cmp.l d2,d3 bgt 1$ rts readarrayfile: tst.b 12(a0) bne rarfill move.b 4(a0),d0 cmp.b #10,d0 beq rarfill movem.l d0-d3/a0-a1,-(sp) jsr _p%readarbbuf movem.l (sp)+,d0-d3/a0-a1 move.b d0,0(a1,d2.l) addq.l #1,d2 cmp.l d2,d3 bgt readarrayfile rts rarfill move.b #' ',0(a1,d2.l) addq.l #1,d2 cmp.l d2,d3 bgt rarfill rts END