-
Notifications
You must be signed in to change notification settings - Fork 84
/
ssutil
191 lines (191 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
.PAGE 'SSUTIL'
;*********************************
;* B0TOB0: TRANSFER BYTES FROM *
;* ONE BUF 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
;*
;*****************************
;*
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)
; JMP ADDT12
;
ADDT12
CLC ;ADD .A TO T1,T2
ADC T1
STA T1
BCC ADDRTS
INC T2
ADDRTS
RTS
;
.END