-
Notifications
You must be signed in to change notification settings - Fork 84
/
lcc.seek
220 lines (220 loc) · 2.87 KB
/
lcc.seek
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
.PAGE 'LCC.SEEK'
;
;
;
SEAK LDX #90 ; SEARCH 90 HEADERS
STX TMP
;
LDX #0 ;READ IN 8 GCR BYTES
;
LDA #$52 ; HEADER BLOCK ID
STA STAB
;
SEEK10 JSR SYNC ; FIND SYNC CHAR
;
BVC * ; WAIT FOR BLOCK ID
CLV
;
LDA DATA2
CMP STAB ; TEST IF HEADER BLOCK
BNE SEEK20 ; NOT HEADER
;
SEEK15 BVC *
CLV ; READ IN GCR HEADER
;
LDA DATA2
STA STAB+1,X
;
INX
CPX #7
BNE SEEK15
;
JSR CNVBIN ; CONVERT HEADER IN STAB TO BINARY IN HEADER
;
LDY #4 ; COMPUTE CHECKSUM
LDA #0
;
SEEK30 EOR HEADER,Y
DEY
BPL SEEK30
;
CMP #0 ; TEST IF OK
BNE CSERR ; NOPE, CHECKSUM ERROR IN HEADER
;
LDX CDRIVE ; UPDATE DRIVE TRACK#
LDA HEADER+2
STA DRVTRK,X
;
LDA JOB ; TEST IF A SEEK JOB
CMP #$30
BEQ ESEEK
;
LDA CDRIVE
ASL A ; TEST IF CORRECT ID
TAY
LDA DSKID,Y
CMP HEADER
BNE BADID
LDA DSKID+1,Y
CMP HEADER+1
BNE BADID
;
JMP WSECT ; FIND BEST SECTOR TO SERVICE
;
;
SEEK20 DEC TMP ; SEARCH MORE?
BNE SEEK10 ;YES
;
LDA #2 ; CANT FIND A SECTOR
JSR ERRR
;
;
ESEEK LDA HEADER ;HARRIS FIX....
STA DSKID ;....
LDA HEADER+1 ;....
STA DSKID+1 ;....
;
DONE LDA #1 ; RETURN OK CODE
.BYTE SKIP2
;
BADID LDA #11 ; DISK ID MISMATCH
.BYTE SKIP2
;
CSERR LDA #9 ; CHECKSUM ERROR IN HEADER
JMP ERRR
;
;
;
WSECT LDA #$7F ; FIND BEST JOB
STA CSECT
;
LDA HEADER+3 ; GET UPCOMING SECTOR #
CLC
ADC #2
CMP SECTR
BCC L460
;
SBC SECTR ;WRAP AROUND
;
L460 STA NEXTS ; NEXT SECTOR
;
LDX #NUMJOB-1
STX JOBN
;
LDX #$FF
;
L480 JSR SETJB
BPL L470
;
STA WORK
AND #1
CMP CDRIVE ; TEST IF SAME DRIVE
BNE L470 ; NOPE
;
LDY #0 ; TEST IF SAME TRACK
LDA (HDRPNT),Y
CMP TRACC
BNE L470
;
LDA JOB ; TEST IF EXECUTE JOB
CMP #EXECD
BEQ L465
;
LDY #1
SEC
LDA (HDRPNT),Y
SBC NEXTS
BPL L465
;
CLC
ADC SECTR
;
L465 CMP CSECT
BCS L470
;
PHA ; SAVE IT
LDA JOB
BEQ TSTRDJ ; MUST BE A READ
;
PLA
CMP #WRTMIN ; [IF(CSECT<9)RETURN;
BCC L470 ; [IF(CSECT>12)RETURN;
;
CMP #WRTMAX
BCS L470
;
DOITT STA CSECT ;ITS BETTER
LDA JOBN
TAX
ADC #>BUFS
STA BUFPNT+1
;
BNE L470
;
TSTRDJ PLA
CMP #RDMAX ; IF(CSECT>6)RETURN;
BCC DOITT
;
;
L470 DEC JOBN
BPL L480
;
TXA ; TEST IF A JOB TO DO
BPL L490
;
JMP END ; NO JOB FOUND
;
L490 STX JOBN
JSR SETJB
LDA JOB
JMP REED
;
;
;
;
CNVBIN LDA BUFPNT
PHA
LDA BUFPNT+1
PHA ; SAVE BUFFER PNTR
;
LDA #<STAB
STA BUFPNT ; POINT AT GCR CODE
LDA #>STAB
STA BUFPNT+1
;
LDA #0
STA GCRPNT
;
JSR GET4GB ; CONVERT 4 BYTES
;
LDA BTAB+3
STA HEADER+2
;
LDA BTAB+2
STA HEADER+3
;
LDA BTAB+1
STA HEADER+4
;
;
JSR GET4GB ; GET 2 MORE
;
LDA BTAB ; GET ID
STA HEADER+1
LDA BTAB+1
STA HEADER
;
PLA
STA BUFPNT+1 ;RESTORE POINTER
PLA
STA BUFPNT
;
RTS
;
;
;
;
;
;
;
.END