-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathtapecontrol
186 lines (186 loc) · 4.15 KB
/
tapecontrol
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
.PAG 'TAPE CONTROL'
JTP20 JSR ZZZ
INC BUFPT
LDY BUFPT
CPY #BUFSZ
RTS
.SKI 5
;STAYS IN ROUTINE D2T1LL PLAY SWITCH
;
CSTE1 JSR CS10
BEQ CS25
LDY #MS7-MS1 ;"PRESS PLAY..."
CS30 JSR MSG
CS40 JSR TSTOP ;WATCH FOR STOP KEY
JSR CS10 ;WATCH CASSETTE SWITCHES
BNE CS40
LDY #MS18-MS1 ;"OK"
JMP MSG
.SKI 5
;SUBR RETURNS <> FOR CASSETTE SWITCH
;
CS10 LDA #$10 ;CHECK PORT
BIT R6510 ;CLOSED?...
BNE CS25 ;NO. . .
BIT R6510 ;CHECK AGAIN TO DEBOUNCE
CS25 CLC ;GOOD RETURN
RTS
.SKI 5
;CHECKS FOR PLAY & RECORD
;
CSTE2 JSR CS10
BEQ CS25
LDY #MS8-MS1 ;"RECORD"
BNE CS30
.SKI 5
;READ HEADER BLOCK ENTRY
;
RBLK LDA #0
STA STATUS
STA VERCK
JSR LDAD1
.SKI 3
;READ LOAD BLOCK ENTRY
;
TRD JSR CSTE1 ;SAY 'PRESS PLAY'
BCS TWRT3 ;STOP KEY PRESSED
SEI
LDA #0 ;CLEAR FLAGS...
STA RDFLG
STA SNSW1
STA CMP0
STA PTR1
STA PTR2
STA DPSW
LDA #$90 ;ENABLE FOR CA1 IRQ...READ LINE
LDX #14 ;POINT IRQ VECTOR TO READ
BNE TAPE ;JMP
.SKI 5
;WRITE HEADER BLOCK ENTRY
;
WBLK JSR LDAD1
;
;WRITE LOAD BLOCK ENTRY
;
TWRT LDA #20 ;BETWEEN BLOCK SHORTS
STA SHCNH
TWRT2 JSR CSTE2 ;SAY 'PRESS PLAY & RECORD'
TWRT3 BCS STOP3 ;STOP KEY PRESSED
SEI
LDA #$82 ;ENABLE T2 IRQS...WRITE TIME
LDX #8 ;VECTOR IRQ TO WRTZ
.SKI 5
;START TAPE OPERATION ENTRY POINT
;
TAPE LDY #$7F ;KILL UNWANTED IRQ'S
STY D1ICR
STA D1ICR ;TURN ON WANTED
LDA D1CRA ;CALC TIMER ENABLES
ORA #$19
STA D1CRB ;TURN ON T2 IRQ'S FOR CASS WRITE(ONE SHOT)
AND #$91 ;SAVE TOD 50/60 INDICATION
STA CASTON ;PLACE IN AUTO MODE FOR T1
; WAIT FOR RS-232 TO FINISH
JSR RSP232
; DISABLE SCREEN DISPLAY
LDA VICREG+17
AND #$FF-$10 ;DISABLE SCREEN
STA VICREG+17
; MOVE IRQ TO IRQTEMP FOR CASS OPS
LDA CINV
STA IRQTMP
LDA CINV+1
STA IRQTMP+1
JSR BSIV ;GO CHANGE IRQ VECTOR
LDA #2 ;FSBLK STARTS AT 2
STA FSBLK
JSR NEWCH ;PREP LOCAL COUNTERS AND FLAGS
LDA R6510 ;TURN MOTOR ON
AND #%011111 ;LOW TURNS ON
STA R6510
STA CAS1 ;FLAG INTERNAL CONTROL OF CASS MOTOR
LDX #$FF ;DELAY BETWEEN BLOCKS
TP32 LDY #$FF
TP35 DEY
BNE TP35
DEX
BNE TP32
CLI
TP40 LDA IRQTMP+1 ;CHECK FOR INTERRUPT VECTOR...
CMP CINV+1 ;...POINTING AT KEY ROUTINE
CLC
BEQ STOP3 ;...YES RETURN
JSR TSTOP ;...NO CHECK FOR STOP KEY
;
; 60 HZ KEYSCAN IGNORED
;
JSR UD60 ; STOP KEY CHECK
JMP TP40 ;STAY IN LOOP UNTILL TAPES ARE DONE
.SKI 5
TSTOP JSR STOP ;STOP KEY DOWN?
CLC ;ASSUME NO STOP
BNE STOP4 ;WE WERE RIGHT
;
;STOP KEY DOWN...
;
JSR TNIF ;TURN OFF CASSETTES
SEC ;FAILURE FLAG
PLA ;BACK ONE SQUARE...
PLA
;
; LDA #0 ;STOP KEY FLAG
;
STOP3 LDA #0 ;DEALLOCATE IRQTMP
STA IRQTMP+1 ;IF C-SET THEN STOP KEY
STOP4 RTS
.SKI 5
;
; STT1 - SET UP TIMEOUT WATCH FOR NEXT DIPOLE
;
STT1 STX TEMP ;.X HAS CONSTANT FOR TIMEOUT
LDA CMP0 ;CMP0*5
ASL A
ASL A
CLC
ADC CMP0
CLC
ADC TEMP ;ADJUST LONG BYTE COUNT
STA TEMP
LDA #0
BIT CMP0 ;CHECK CMP0 ...
BMI STT2 ;...MINUS, NO ADJUST
ROL A ;...PLUS SO ADJUST POS
STT2 ASL TEMP ;MULTIPLY CORRECTED VALUE BY 4
ROL A
ASL TEMP
ROL A
TAX
STT3 LDA D1T2L ;WATCH OUT FOR D1T2H ROLLOVER...
CMP #22 ;...TIME FOR ROUTINE...!!!...
BCC STT3 ;...TOO CLOSE SO WAIT UNTILL PAST
ADC TEMP ;CALCULATE AND...
STA D1T1L ;...STORE ADUSTED TIME COUNT
TXA
ADC D1T2H ;ADJUST FOR HIGH TIME COUNT
STA D1T1H
LDA CASTON ;ENABLE TIMERS
STA D1CRA
STA STUPID ;NON-ZERO MEANS AN T1 IRQ HAS NOT OCCURED YET
LDA D1ICR ;CLEAR OLD T1 INTERRUPT
AND #$10 ;CHECK FOR OLD-FLAG IRQ
BEQ STT4 ;NO...NORMAL EXIT
LDA #>STT4 ;PUSH SIMULATED RETURN ADDRESS ON STACK
PHA
LDA #<STT4
PHA
JMP SIMIRQ
STT4 CLI ;ALLOW FOR RE-ENTRY CODE
RTS
.END
; RSR 8/25/80 MODIFY I/O FOR MOD2 HARDWARE
; RSR 12/11/81 MODIFY I/O FOR VIC-40
; RSR 2/9/82 ADD SCREEN DISABLE FOR TAPE
; RSR 3/28/82 ADD T2IRQ TO START CASSETTE WRITE
; RSR 3/28/82 ADD CASSETTE READ TIMER1 FLAG
; RSR 5/11/82 CHANGE SO WE DON'T MISS ANY IRQ'S
; RSR 5/14/82 SIMULATE AN IRQ