-
Notifications
You must be signed in to change notification settings - Fork 84
/
ssutil.src
156 lines (138 loc) · 3.19 KB
/
ssutil.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
.messg "ssutil"
.subttl "ssutil"
.page
b0tob0 pha ; buff to buff transfr
lda #0
sta temp
sta temp+2
lda bufind,y
sta temp+1
lda bufind,x
sta temp+3
pla
tay
dey
b02 lda (temp),y
sta (temp+2),y
dey
bpl b02
rts
clrbuf tay ; clr given buffer
lda bufind,y ; accm =buff
sta temp+1
lda #0
sta temp
tay
cb10 sta (temp),y
iny
bne cb10
rts
ssset lda #0 ; set ss pntr=0
jsr ssdir
ldy #2
lda (dirbuf),y ; accm=ss number
rts
ssdir sta dirbuf ; set dirbuf w/current
ldx lindx ; ss pointer. accm=low byte
lda ss,x
tax
lda bufind,x
sta dirbuf+1
rts
setssp pha ; set dirbuf and buftbl with
jsr ssdir ; current ss pntr. acm=low byte
pha
txa
asl a
tax
pla
sta buftab+1,x
pla
sta buftab,x
rts
.pag
sspos jsr sstest ; set ss/buftbl to
bmi ssp10 ; to ssnum ssind
bvc ssp20 ; er0:ok, in range
ldx lindx ; er1: possibly in range
lda ss,x
jsr ibrd ; read ss in
jsr sstest ; test again
bpl ssp20
ssp10 jsr ssend ; not in range,set end
bit er1
rts ; v=1
ssp20 lda ssind ; ok, set ptr w/ index
jsr setssp
bit er0
rts ; v=0
ibrd sta jobnum ; indir block rd/wr.
lda #read_dv ; accm= buf#, x=lindx
bne ibop ; dirbuf)y pnts to t&s for r/w
sta jobnum
lda #wrtsd_dv
ibop sta cmd
lda (dirbuf),y
sta track
iny
lda (dirbuf),y
sta sector
lda jobnum
jsr seth
ldx jobnum
jmp doit2
gsspnt ldx lindx
lda ss,x
jmp gp1
scal1 lda #nssp
jsr addt12 ; add (#ss needed)*120
sscalc dex
bpl scal1
lda t3 ; add (# ss indices needed)
lsr a
jsr addt12
lda t4 ; add (# ss blocks needed)
addt12 clc ; add .a to t1,t2
adc t1
sta t1
bcc addrts
inc t2
addrts rts
;
; calc # of side sectors needed
;
ssscal
jsr zerres
jsr zeracc
ldy r3
sssca1
dey
bmi sssca2
ldx #>726
lda #<726
jsr addlit
jmp sssca1
sssca2
ldy t4
sssca3
dey
bmi sssca4
ldx #0
lda #nssp+1
jsr addlit
jmp sssca3
sssca4
lda t3
lsr a
ldx #0
jmp addlit
zeracc
ldx #0
stx accum+1
stx accum+2
stx accum+3
rts
addlit
stx accum+2
sta accum+1
jmp addres