home *** CD-ROM | disk | FTP | other *** search
- ;
- ; LULIB Module: LUREAD
- ; Author: Richard Conn
- ; Date: 8 August 85
- ; LULIB Version: 1.0
- ; LULIB Module Version: 1.0
- ;
- public luread
-
- ;
- ; LUREAD reads the next block from the file opened by LUOPEN
- ; within the current library.
- ; On input, DE = ptr to LUD
- ; On output, A is return code
- ; 0 OK
- ; 0FFH End of File
- ;
- ; Note: DMA Address may be set for reads
- ;
- ext r$read
-
- .in luddef
-
- luread:
- push hl ; save regs
- push de
- push bc
- ld hl,ludcnt ; pt to count in LUD
- add hl,de
- ld c,(hl) ; get length
- inc hl
- ld b,(hl)
- ld a,c ; check for zero
- or b
- jr z,eof
- dec bc ; decrement
- ld (hl),b ; replace
- dec hl
- ld (hl),c
- dec hl ; pt to index
- ld b,(hl) ; get index into BC
- dec hl
- ld c,(hl)
- push bc ; save index
- inc bc ; increment index for next read
- ld (hl),c ; save new index
- inc hl
- ld (hl),b
- ld de,11+3 ; pt to FCB
- add hl,de
- ex de,hl ; DE = FCB
- pop hl ; HL = index
- call r$read ; read block
- jr nz,eof ; any error? if not, A=0
- done:
- pop bc ; restore regs
- pop de
- pop hl
- or a ; set flags
- ret
- eof:
- or 0ffh ; set 0
- jr done
-
- end