-
Notifications
You must be signed in to change notification settings - Fork 0
/
device.aii
79 lines (59 loc) · 856 Bytes
/
device.aii
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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