-
Notifications
You must be signed in to change notification settings - Fork 82
/
setdrv.src
114 lines (95 loc) · 2.74 KB
/
setdrv.src
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
.messg "setdrv"
.subttl "setdrv"
.page
onedrv lda f2cnt
sta f1cnt
lda #1
sta f2cnt
sta f2ptr
;set up all drives from f2cnt
alldrs ldx #0 ; ...into file entry table...
ad10 stx f1ptr ; ...on sector ptr byte
lda filtbl,x
jsr setdrv
ldx f1ptr
sta filtbl,x ; incr ptr past ":"
tya ; bits rep drives
sta fildrv,x ; bit7: default
inx ; bit0: drive #
cpx f2cnt
bcc ad10
rts
;---------------------------------------
; set drive number
; determines drive # from text or
; uses default (-d)
; a: in,out: index, cmdbuf
; y: in: default drive
; out: drive number, - if default
;---------------------------------------
setdrv tax ; x= cmdbuf index
ldy #0 ; set default drive to zero
lda #':
cmp cmdbuf+1,x ; for xxx:file
beq sd40 ; ^
cmp cmdbuf,x ; for xxx:file
bne sd50 ; ^
inx ; found ":", so...
sd20 tya ; drive= default
sd22 and #1 ; convert to numeric
sd24 tay ; restore drive
txa ; a=index & xxxxfile
rts ; ^
sd40 lda cmdbuf,x
inx ; xxx:file
inx ; --^
cmp #'0 ; for xx0:file
beq sd22 ; ^
cmp #'1 ; drive one?
bne sd20
jmp bcerr ; bad cmd error
sd50 tya ; for xxx,file or xx=file
ora #$80 ; ^ ^
and #$81 ; drive= -default
bne sd24 ; finish testing
.pag
setany lda #0 ; set drv frm any config
sta image
ldy filtbl
sa05 lda (cb),y
jsr tst0v1
bpl sa20
iny
cpy cmdsiz
bcs sa10
ldy cmdsiz
dey
bne sa05
sa10 dec image
sa20 jmp setlds
;set ptrs to one file stream & chk type
fs1set ldy #0
lda f1cnt
cmp f2cnt
beq fs15
dec f2cnt
ldy f2cnt
lda filtbl,y
tay
lda (cb),y
ldy #ntypes-1
fs10 cmp typlst,y
beq fs15
dey
bne fs10
fs15 tya
sta typflg
rts
;test char in accum for "0" or "1"
tst0v1 cmp #'0
beq t0v1
cmp #'1
beq t0v1
ora #$80
t0v1 and #$81
rts