-
Notifications
You must be signed in to change notification settings - Fork 84
/
lcc.end
218 lines (218 loc) · 2.89 KB
/
lcc.end
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
.PAGE 'LCC.END'
;
;
;
; MOTOR AND STEPPER CONTROL
;
;
; IRQ INTO CONTROLLER EVERY 10 MS
END
LDA T1HL2
STA T1HC2
;
LDA DSKCNT
;
END001
AND #$10 ; TEST WRITE PROCTECT
CMP LWPT
STA LWPT ; CHANGE ?
BEQ END002 ; NO
;
LDA #1 ; YES, SET FLAG
STA WPSW
;
END002 LDA PHASE ; TEST FOR PHASE OFFSET
BEQ END40
;
CMP #2
BNE END003
;
LDA #0
STA PHASE
BEQ END40
;
END003 STA STEPS
LDA #2
STA PHASE
JMP DOSTEP
;
END40 LDX CDRIVE ; WORK ON ACTIVE DRIVE ONLY
BMI END33X ; NO ACTIVE DRIVE
;
LDA DRVST ; TEST IF MOTOR ON
TAY
CMP #$20 ; TEST IF ANYTHING TO DO
BNE END10 ; SOMETHING HERE
;
END33X JMP END33 ; MOTOR JUST RUNNING
;
END10 DEC ACLTIM ; DEC TIMER
BNE END30
;
TYA ; TEST IF ACEL
BPL END20
;
;
AND #$7F ; OVER, CLEAR ACEL BIT
STA DRVST
;
END20 AND #$10 ; TEST IF TIME OUT STATE
BEQ END30
;
LDA DSKCNT
AND #$FF-$04 ; TURNOFF MOTOR
STA DSKCNT
;
;
LDA #$FF ; NO ACTIVE DRIVE NOW
STA CDRIVE
;
LDA #0 ; DRIVE INACTIVE
STA DRVST ; CLEAR ON BIT AND TIMOUT
BEQ END33X
;
END30 TYA ; TEST IF STEP NEEDED
AND #$40
BNE END30X ; STEPPING
;
JMP END33
;
;
END30X JMP (NXTST) ;GOTO PROPER STEPPER STATE
;
INACT LDA STEPS ; GET ABS(STEPS)
BPL INAC10
;
EOR #$FF
CLC
ADC #1
;
INAC10 CMP MINSTP ; TEST IF WE CAN ACCEL
BCS INAC20 ; TOO SMALL
;
LDA #<SHORT ;SHORT STEP MODE
STA NXTST
LDA #>SHORT
STA NXTST+1
BNE DOSTEP
;
INAC20 ; CALC THE # OF RUN STEPS
SBC AS
SBC AS
STA RSTEPS
;
LDA AS
STA ACLSTP ; SET # OF ACCEL STEPS
LDA #<SSACL
STA NXTST
LDA #>SSACL
STA NXTST+1
;
DOSTEP LDA STEPS
BPL STPIN
;
;---------ROM05-BC 09/12/84--------
;STPOUT INC STEPS
; LDX DSKCNT
; DEX
; JMP STP
;
STPOUT JMP PATCH9 ; CHECK TRACK 0 (PHOTO SENSOR)
NOP ;
NOP ;
NOP ;
PPPPPP JMP STP ; GOTO STEP
;----------------------------------
;
SHORT LDA STEPS
BNE DOSTEP
;
LDA #<SETLE
STA NXTST
LDA #>SETLE
STA NXTST+1
LDA #5 ; SETTLE TIME
STA ACLSTP
JMP END33
;
SETLE DEC ACLSTP
BNE END33
;
LDA DRVST
AND #$FF-$40
STA DRVST
;
LDA #<INACT
STA NXTST
LDA #>INACT
STA NXTST+1
JMP END33
;
STPIN DEC STEPS
LDX DSKCNT
INX
;
STP TXA
AND #3
STA TMP
LDA DSKCNT
AND #$FF-$03 ; MASK OUT OLD
ORA TMP
STA DSKCNT
JMP END33
;
SSACL ; SUB ACEL FACTOR
SEC
LDA T1HL2
SBC AF
STA T1HC2
;
DEC ACLSTP
BNE SSA10
;
LDA AS
STA ACLSTP
;
LDA #<SSRUN
STA NXTST
LDA #>SSRUN
STA NXTST+1
;
SSA10 JMP DOSTEP
;
SSRUN DEC RSTEPS
BNE SSA10
;
LDA #<SSDEC
STA NXTST
LDA #>SSDEC
STA NXTST+1
BNE SSA10
;
SSDEC ; DECEL
LDA T1HL2
CLC
ADC AF
STA T1HC2
;
DEC ACLSTP
BNE SSA10
;
LDA #<SETLE ; GOTO SETTLE MODE
STA NXTST
LDA #>SETLE
STA NXTST+1
;
LDA #5
STA ACLSTP ; SETTLE TIMER
;
;
END33 LDA PCR2 ; DISABLE S.O. TO 6502
AND #$FF-$02
STA PCR2
;
RTS
;
;
;
.END