minix.fst/device.aii
2015-08-26 11:58:17 -04:00

80 lines
856 B
Plaintext

include 'gsos.equ'
device_rw proc
; inputs: a = call num
; outputs: carry, a
with dev_parms
sta dev_callnum
loop
jsl dev_dispatcher
bcc exit
cmp #drvr_disk_sw
beq loop
cmp #drvr_busy
beq loop
sec
exit
rts
endp
device_read proc export
lda #drvr_read
bra device_rw
endp
device_write proc export
lda #drvr_write
bra device_rw
endp
;
; inputs: a = block number. (1024 byte block)
;
;
read_data_block proc export
with dev_parms
; reads a data block.
; block 0 -> all zeros (sparse support)
cmp #0
bne read_it
; a = 0!
ldy #1024-2
loop
sta [dev_buff],y
dey
dey
bpl loop
clc
rts
read_it
; a = block num (1024-byte).
; multiply x 2 for 512-byte blocks.
asl a
sta dev_blk_num
lda #0
rol a
sta dev_blk_num+2
lda #1024
;sta dev_blk_size
sta dev_req_cnt
stz dev_req_cnt+2
bra device_read
endp
end