-
Notifications
You must be signed in to change notification settings - Fork 85
/
ssutil
196 lines (196 loc) · 2.86 KB
/
ssutil
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
.PAGE 'SSUTIL'
;
;*********************************
;* B0TOB0: TRANSFER BYTES FROM *
;* ONE BUFFER TO OTHER. *
;* REG: IN: .A = # BYTES *
;* .Y = SOURCE BUF # *
;* .X = DESTIN BUF # *
;*********************************
;
B0TOB0
PHA
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: CLEAR BUFFER GIVEN *
;* REG: IN: .A = BUFFER # *
;* OUT: .Y, .A = 0 *
;*********************************
;
CLRBUF
TAY
LDA BUFIND,Y
STA TEMP+1
LDA #0
STA TEMP
TAY
CB10
STA (TEMP),Y
INY
BNE CB10
RTS
;
;*********************************
;* SSSET: SET SS PNTR TO 0 *
;* REG: OUT: .A = SS NUMBER *
;*********************************
;
SSSET
LDA #0
JSR SSDIR
LDY #2
LDA (DIRBUF),Y
RTS
;
;*********************************
;* SSDIR: SET DIRBUF WITH CURRENT*
;* SS POINTER. *
;* REGS: IN: .A = LOW BYTE *
;*********************************
;
SSDIR
STA DIRBUF
LDX LINDX
LDA SS,X
TAX
LDA BUFIND,X
STA DIRBUF+1
RTS
;
;*********************************
;* SETSSP: SET DIRBUF & BUFTAB *
;* WITH CURRENT SS PTR. *
;* REGS: IN: .A = LOW BYTE *
;*********************************
;
SETSSP
PHA
JSR SSDIR
PHA
TXA
ASL A
TAX
PLA
STA BUFTAB+1,X
PLA
STA BUFTAB,X
RTS
;
;*********************************
;* SSPOS: POSITION SS & BUFTAB *
;* TO SSNUM SSIND. *
;* FLAG: .V = 0, OK *
;* .V = 1, OUT OF RANGE *
;*********************************
;
SSPOS
JSR SSTEST
BMI SSP10 ; OUT OF RANGE
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
SSP20
LDA SSIND ; OK, SET PTR W/INDEX
JSR SETSSP
BIT ER0
RTS
;
;*********************************
;* IBRD: INDIRECT BLOCK READ & *
;* IBWT: WRITE. *
;* REGS: IN: .A = BUF # FOR R/W*
;* .X = LINDX *
;* (DIRBUF),Y POINTS TO *
;* T&S TO BE R/W. *
;*********************************
;
IBRD
STA JOBNUM
LDA #READ
BNE IBOP
IBWT
STA JOBNUM
LDA #WRITE
IBOP
PHA
LDA FILTYP,X
AND #1
STA DRVNUM
PLA
ORA DRVNUM
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
;
; CALCULATE # 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
.END