-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathtapsup.src
187 lines (150 loc) · 3.7 KB
/
tapsup.src
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
.page
.subttl 'tape support'
; if cas plat sw is not pressed give message & wait until pressed
; entry to test sw for record:
;
tstrec ;i just have to keep thinking about the 68000...
sec
.byte $24
tstply
clc
lda xport
and #4
beq pok
php
jsr primm
.byte cr,'PRESS PLAY ',0
plp
bcc qq2
jsr primm
.byte '& RECORD ',0
qq2
jsr primm
.byte 'ON TAPE',0
waitpl
jsr tstsky ; does user want to play some more?
bcs pabort ; nope, boo...
lda xport
and #4
bne waitpl ; play still not down
jsr primm ; finally!
.byte cr,'OK',0
pok
clc ; everything's fine
pabort ; ooops
rts ; exit
; prep system for cassette useage...
; stop dma's by blanking screen & disable interrupts
;
; call motor/on after this routine to allow ds clk to setup
;
faster
sei ; pass on the irq's
; select screen blanking: 1.7mhz clock & no dma's
;
lda tedvcr ; have mutex from above <sei>
and #$ef
sta tedvcr
lda tedicr
and #$fd ; raster int off
ora #$08 ; t1 int on
sta tedicr
rts
; restore system to normal(?) mode of operation...
; restore timer t1, re-enable dma's & irq's
slower ; !carry preserved
sei
lda tedvcr ; de-select blanking
ora #$10
sta tedvcr
lda tedicr
and #$f7 ; t1 int off
ora #$02 ; raster int on
sta tedicr
cli ; yes, you too
rts ; !carry preserved
; turn motor on & delay
; modifies a,x,y
;
moton
php ; !preserve carry
sec
ror lsem
lda port
and #$f5 ; motor on & init write line to high
sta port ; ...have to write inverted
ldx #30 ; wait 480ms for motor to come up to speed
md1 ; to do skewed servo
jsr w16ms ; ...wait 16ms
dex
bne md1
plp ; !restore carry
rts
.byte 'C1984COMMODORE'
; turn motor off
motoff ; !carry preserved
lda port
ora #$08
sta port ; !carry preserved
rts
; write blanks to tape buffer
; modifies a,x
blkbuf
ldy #0
lda #$20
blklop
sta (tapebs),y
iny
cpy #bufmax+1
bne blklop
rts
; setup tape pointer to reserved buffer
bufini
pha ; !save ac
lda #<tapbuf
sta tapebs
lda #>tapbuf
sta tapebs+1
pla ; !restore ac
rts
balout ; error recovery for stop-key pressed
jsr tstsky
bcc cont
jsr motoff ; restore system
jsr slower
ldx srecov
txs
lda #0
sta srecov
sec
cont
rts ; blind faith
d2 = 13200 ; dead man-2
dtimeo
lda tedirq ; was this a t1 int
and tedicr
and #$08
bne nott1 ; no return
rts
nott1
sta tedirq ; yep, clear it
sei
lda #<d2 ; set up d2
sta timr1l ; timeout sets up d2
lda #>d2
sta timr1h
ldx drecov ; get stack mark
txs
sec ; indicate error
rts ; return to upper lexical level
; word marker sets this time up
d1 = 18600 ; dead man-1
setd1 ; setup delta #1 for byte read
lda #<d1
sta timr1l
lda #>d1
sta timr1h
lda #$08 ; clear any pending t1 int's
sta tedirq
rts
;end