-
Notifications
You must be signed in to change notification settings - Fork 85
/
tapecontrol
162 lines (162 loc) · 3.44 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
.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 #$40 ;CHECK PORT
BIT D1ORA ;CLOSED?...
BNE CS25 ;NO. . .
BIT D1ORA ;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 #$82 ;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 #$A0 ;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 D2IER
STA D2IER ;TURN ON WANTED
; WAIT FOR RS-232 TO FINISH
JSR RSP232
; 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 D1PCR ;TURN MOTOR ON
AND #$FD ;LOW TURNS ON
ORA #$0C ;MAKE SURE
STA D1PCR
STA CAS1 ;FLAG INTERNAL CONTROL OF CASS MOTOR
LDX #$FF ;DELAY BETWEEN BLOCKS
TP32 LDY #$FF
TP35 DEY
BNE TP35
DEX
BNE TP32
STA D2T2H
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
LDA D2IFR
AND #$40 ; CHECK FOR T1 IRQ
BEQ TP40 ;...NO
LDA D1T1L ; KILL T1 IRQ REQUEST
JSR UDTIM ; 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 D2T2L ;WATCH OUT FOR D2T2H ROLLOVER...
CMP #21 ;...TIME FOR ROUTINE...!!!...
BCC STT3 ;...TOO CLOSE SO WAIT UND2T1LL PAST
ADC TEMP ;CALCULATE AND...
STA D2T1L ;...STORE ADUSTED TIME COUNT
TXA
ADC D2T2H ;ADJUST FOR HIGH TIME COUNT
STA D2T1H
CLI ;ALLOW FOR RE-ENTRY CODE
RTS
.END
; RSR 8/25/80 MODIFY I/O FOR MOD2 HARDWARE