-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSTEPPER.S
299 lines (273 loc) · 3.03 KB
/
STEPPER.S
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
LST OFF
ZL = $00
ZH = $01
STARTFLG EQU $C9
LOW EQU $F2
HI EQU $F3
AUTOFLG EQU $F8
DIGIT EQU $F9
JUSTIFY EQU $FA ;0 FOR LEFT, $A0 FOR RIGHT
IN EQU $200
COUT EQU $FDED
*
GETLN = $FD6A
RL = $50
RH = $51
COUNT = $52
DEL = $53
DRV = $54
YVAL = $55
STEP = $56
JSR $FC58
JSR PRINT
ASC "DISK DRIVE STEPPER"
HEX 8D00
LDA #5
JSR GETDRV
LDA #10
JSR GETDEL
JSR PRINT
ASC " USE THE ARROWS TO CHANGE TO STEP"
HEX 8D
ASC "DIRECTION"
HEX 8D
HEX 8D
ASC " HIT 'W' FOR NEW WAIT PERIOD OR 'D' FOR NEW DRIVE"
HEX 8D00
LDA $C0E9
LDA DRV
ORA #$60
TAX
LDA $C08A,X
LDA #$50
JSR $FCA8
USTEP LDA #">"
STA $427
LDA #$00
STA STEP
STLP LDA STEP
AND #$03
ASL
ORA #$60
TAX
LDA $C081,X
LDA DEL
JSR WAIT
LDA $C080,X
LDA DEL
JSR WAIT
INC STEP
JMP STLP
RTS
DSTEP LDA #"<"
STA $427
LDA #$03
STA STEP
STLP1 LDA STEP
AND #$03
ASL
ORA #$60
TAX
LDA $C081,X
LDA DEL
JSR WAIT
LDA $C080,X
LDA DEL
JSR WAIT
DEC STEP
JMP STLP1
RTS
GETDEL STA $25
STA YVAL
NOGDEL LDA #$01
STA $24
LDA YVAL
JSR $FC24
JSR PRINT
ASC "ENTER WAIT PERIOD BETWEEN STEPS (0-255)"
HEX 8D
HEX 00
JSR IDEC
BCS NOGDEL
LDA RH
BNE NOGDEL
LDX RL
STX DEL
JSR PRDEC
JSR PRINT
ASC " STEP DELAY"
HEX 8D00
RTS
GETDRV STA YVAL
STA $25
NOGDRV LDA #$01
STA $24
LDA YVAL
JSR $FC24
JSR PRINT
ASC "ENTER DRIVE NUMBER (0 OR 1)"
HEX 00
JSR IDEC
BCS NOGDRV
LDA RH
BNE NOGDRV
LDX RL
CPX #02
BCS NOGDRV
STX DRV
JSR PRINT
ASC "DRIVE NUMBER "
HEX 00
LDA #$00
LDX DRV
JSR PRDEC
JSR $FD8E
NOKEY RTS
WAIT JSR $FCA8
LDA $C000
BPL NOKEY
BIT $C010
CMP #$9B
BEQ DARG
CMP #"W"
BEQ DOW
CMP #"D"
BEQ DOD
CMP #$88
BEQ DOL
CMP #$95
BEQ DOR
RTS
DARG PLA
PLA
LDA $C0E8
RTS
DOW JSR $FC58
LDA #5
JMP GETDEL
DOD JSR $FC58
LDA #5
JSR GETDRV
LDA DRV
ORA #$60
TAX
LDA $C08A,X
RTS
DOL PLA
PLA
JMP DSTEP
DOR PLA
PLA
JMP USTEP
IDEC LDA #$DC
STA $33
LDA #$00
STA RH
STA RL
JSR GETLN
DEX
LDY #$00
MLOOP LDA $200,X
CMP #$A0
BEQ SPACE
CMP #$AD
BEQ NEG
EOR #$B0
CMP #$0A
BCS BADCHAR
STA COUNT
CLC
GRRR DEC COUNT
BMI FN
LDA RL
ADC DTABL,Y
STA RL
LDA RH
ADC DTABH,Y
STA RH
BCC GRRR
RTS
FN INY
SPACE DEX
BPL MLOOP
CLC
BADCHAR RTS
NEG LDA RL
CLC
EOR #$FF
ADC #$01
STA RL
LDA RH
EOR #$FF
ADC #$00
STA RH
CLC
RTS
DTABL DFB 1,10,100,1000,10000
DTABH DFB /1,/10,/100,/1000,/10000
PRDEC STA HI
STX LOW
LDX #$04
STX STARTFLG
NXDIGIT LDA #"0"
STA DIGIT
SUBTRCT LDA LOW
CMP NUMLOW,X
LDA HI
SBC NUMHI,X
BCC GETDIG
STA HI
LDA LOW
SBC NUMLOW,X
STA LOW
INC DIGIT
BNE SUBTRCT
GETDIG LDA DIGIT
INX
DEX
BEQ PRDDD
CMP #"0"
BEQ CHKFLGS
STA STARTFLG
CHKFLGS BIT STARTFLG
BMI PRDDD
LDA JUSTIFY
BEQ NXTX
PRDDD JSR COUT
BIT AUTOFLG ;THESE 4 LINES
BPL NXTX ;ARE FOR AUTO-LINE
STA IN,Y ;NUMBERING AND CAN
INY ;BE DELETED.
NXTX DEX
BPL NXDIGIT
RTS
NUMLOW DFB 1
DFB 10
DFB 100
DFB 1000
DFB 10000
NUMHI DFB >1
DFB >10
DFB >100
DFB >1000
DFB >10000
CHOUT EQU $FDF0
PRINT LDA #$00
STA ZL
PLA
TAY
PLA
STA ZH
JMP PRINT2
LOOP LDA (ZL),Y
BEQ DONE
JSR CHOUT
PRINT2 INY
BNE LOOP
INC ZH
BNE LOOP
DONE LDA ZH
PHA
TYA
PHA
RTS