home *** CD-ROM | disk | FTP | other *** search
-
- ;++++++++++++++++++++++++++++++++++++++++++++++
- ;
- ; SEQUENTIAL DISK CHARACTER INPUT
- ;
- ; DISKIN.LIB - Version 1.0 - 18 SEP 77
- ;
- ; J.W. SHOOK, P.O. BOX 185, ROCKY POINT, NY 11778
- ;
- ;++++++++++++++++++++++++++++++++++++++++++++++
-
- ; Before reading a file sequentially
- ; the following initial conditions
- ; must be established.
-
- ; 1) A CP/M file control block
- ; containing the file name must
- ; start at location INFCB.
- ; 2) A 128 byte buffer area must
- ; start at location INBUF.
- ; 3) The file must be successfully
- ; opened.
- ; 4) The next record pointer in
- ; the file control block must be
- ; set to zero.
- ; 5) The word at location INPTR
- ; must be set to INBUF+128 to
- ; mark the buffer as empty.
- ; 6) To read a file again, just set
- ; next record to zero, and
- ; reset INPTR.
-
- ; READ CHARACTER FROM FILE
-
- DISKIN: LHLD INPTR ; Test buffer pointer
- LXI D,-(INBUF+128)
- DAD D
- MOV A,H
- ORA L
- CZ RDREC ; If empty, read next record
- RC ; Return on bad read
- LHLD INPTR ; Get char from buffer
- MOV A,M
- INX H ; Move buffer pointer
- SHLD INPTR
- RET
-
-
- ; REFILL DISK INPUT BUFFER
-
- RDREC: LXI D,INBUF ; Set DMA address
- MVI C,SDMA
- CALL BDOS
- LXI D,INFCB ; Read a record
- MVI C,READ
- CALL BDOS
- RAR ; Set carry on bad read
- LXI H,INBUF ; Set pointer to buffer start
- SHLD INPTR
- RET
-