home *** CD-ROM | disk | FTP | other *** search
-
- * ReadArb.asm (of PCQ Pascal runtime library)
- * Copyright (c) 1989 Patrick Quaid
-
- * This just implements reading some data element into the
- * file buffer. This is what is used for reading an integer from a
- * file of integer, for example, rather than a text file. Of course
- * it can be used for any sort of data element.
-
- SECTION ONE
-
- XREF _p%readarbbuf
-
- XDEF _p%readarb
- _p%readarb
- move.l a0,a1 ; shift var address over
- move.l 4(sp),a0 ; get address of file record
- tst.b 12(a0) ; are we at eof?
- bne 6$ ; if so, skip this stuff
- move.l 8(a0),d1 ; get buffer size
- cmp.l #1,d1 ; is it 1?
- bne.s 1$ ; if not, go around
- move.b 4(a0),d0 ; get the byte
- move.b d0,(a1) ; and save it
- bra.s 5$ ; and go
- 1$ cmp.l #2,d1 ; is it 2?
- bne.s 2$ ; if not, split
- move.w 4(a0),d0 ; get word
- move.w d0,(a1) ; save it
- bra.s 5$ ; and go
- 2$ cmp.l #4,d1 ; is it 4?
- bne.s 3$ ; if not, skip ahead
- move.l 4(a0),d0 ; get word
- move.l d0,(a1) ; save it
- bra.s 5$ ; and leave
- 3$ move.l 4(a0),a2 ; get the buffer address
- 4$ move.b (a2)+,d0 ; get a byte
- move.b d0,(a1)+ ; and store it
- dbra d1,4$ ; and loop
- 5$ jsr _p%readarbbuf ; get next item
- 6$ rts
-
- END
-