-
Notifications
You must be signed in to change notification settings - Fork 1
/
hisiocode-vbi.src
79 lines (64 loc) · 2.03 KB
/
hisiocode-vbi.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
; highsiocode-vbi.src - highspeed SIO routine, optional fast VBI code
;
; Copyright (c) 2003-2023 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.
.if .def FASTVBI
VBICODE
.if .not .def FASTVBI_NOCLOCK
INC RTCLOK+2
BNE ?NOC1
INC RTCLOK+1
; note: RTCLOK is handeled in hisiocode-main by checking RTCLOK+1 wrap-around
; this saves 7 cycles in worst case
; BNE ?NOC1
; INC 18
?NOC1
.endif
; fast implementation of system timer 1:
; - jumps to ?ERRTO if it reaches 0
; - no check if timer has already expired (just set MYTIM1+1 to $FF
; and it will run long enough before starting the timeout code)
; - MYTIM1+1 has to be set to HIVAL+1, since timer starts at $0000 (not $FFFF).
DEC MYTIM1
BNE ?NOTOUT
DEC MYTIM1+1
BEQ ?RUNTIM ; timer reached 0, start timeout code
?NOTOUT
; ensure the critical VBICODE doesn't cross a page boundary
.if [ * & $FF00 ] <> [ VBICODE & $FF00 ]
.if .def ALLOW_PAGE_CROSSING
.warn "VBICODE crosses a page boundary!"
.else
.error "VBICODE crosses a page boundary! Set ALLOW_PAGE_CROSSING to make this a warning"
.endif
.endif
; note: to save 6 additional cycles we don't use "JMP XITVBV" here
; but implement the OS code directly. This code is identical in all
; OS versions I know of.
PLA
TAY
PLA
TAX
PLA
RTI
; jump to timeout code
?RUNTIM
?ABSF07 JMP ?ERRTO
.if .def RELOCTABLE
?VBIADR
?ABSF08 .WORD VBICODE
.endif
.endif