-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhisiocode-cleanup.src
78 lines (67 loc) · 1.7 KB
/
hisiocode-cleanup.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
; highsiocode-cleanup.src - highspeed SIO routine, cleanup at end of code
;
; Copyright (c) 2003-2010 by Matthias Reichl <[email protected]>
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; cleanup, in case of error or end of transmission
?CLEANUP LDA #$A0 ; reset pokey
STA AUDC4
LDA #$3C ; clear command line
STA PBCTL
.if .def FASTVBI
?CLRTIM1 LDA #$FF
STA MYTIM1+1
RTS
; set timeout: X=HI, Y=LO
?SMYTOUT
?ABSF06 JSR ?WTVBI
STY MYTIM1
STX MYTIM1+1
RTS
; similar to SETVBV: waste 22 cpu cycles after STA WSYNC
; so that the VBI code can be executed
?WTVBI STA WSYNC
BIT STACKP ; 4 cycles
BIT STACKP ; 4 cycles
BIT STACKP ; 4 cycles
BIT STACKP ; 4 cycles
RTS ; 6 cycles
.else
; clear timer1
?CLRTIM1 LDY #$00
; set timer1 with Y cycles
?STIMOUT LDX #$00
; set timer1 X*256 + Y cycles
?STIMOU2 LDA #1
JSR SETVBV
.if .def RELOCTABLE
?ABS65 LDA ?ERRTOA
STA CDTMA1
?ABS66 LDA ?ERRTOA+1
STA CDTMA1+1
.else
LDA #<?ERRTO
STA CDTMA1
LDA #>?ERRTO
STA CDTMA1+1
.endif
RTS
.endif
.if .not .def FASTVBI
.if .def RELOCTABLE
?ERRTOA
?ABS67 .WORD ?ERRTO
.endif
.endif