-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmega65_macros.asm
143 lines (111 loc) · 4.46 KB
/
mega65_macros.asm
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
!zone VIC3
;write $A5 and $96 there to enable VIC 3
;write 'G' and 'S' there to enable VIC 4
.KEY = $d02f
;xxxx xxx1 CRAM2K $1F800 - $1FFFF, $D800 - $DFFF, writeable
; $FF80000 - $FF807FF
; map 2nd KB of colour RAM to $DC00-$DFFF
;xxxx xx1x EXTSYNC
;xxxx x1xx PAL Use PALETTE ROM or RAM entries for colours 0 - 15
;xxxx 1xxx ROM8 $38000 - $39FFF, $8000 - $9FFF, not writeable
; map C65 ROM to $8000
;xxx1 xxxx ROMA $3A000 - $3BFFF, $A000 - $BFFF, not writeable
; map C65 ROM to $A000
;xx1x xxxx ROMC $2C000 - $2CFFF, $C000 - $CFFF, not writeable
; map C65 ROM to $C000
;x1xx xxxx CROM9 $29000 - $29FFF, $D000 - $DFFF, not writeable
; select between C64 and C65 charset
;1xxx xxxx ROME $3E000 - $3FFFF, $E000 - $FFFF, not writeable
; map C65 ROM to $E000
.ROMBANK = $d030
;1xxx xxxx H640 0 = use 40 character screen width
;x1xx xxxx FAST enable C65 FAST mode (∼3.5MHz)
;xx1x xxxx ATTR enable extended attributes and 8 bit colour entries
;xxx1 xxxx BPM bit plane mode
;xxxx 1xxx V400 enable 400 vertical pixels
;xxxx x1xx H1280 enable 1280 horizontal pixels (not implemented)
;xxxx xx1x MONO enable VIC-III MONO video output (not implemented)
;xxxx xxx1 INT enable VIC-III interlaced mode
.VICDIS = $d031
!zone VIC4
;VIC4 display settings
;1xxx xxxx = ALPHEN alpha compositor enable
;x1xx xxxx = VFAST C65GS FAST mode (48MHz)
;xx1x xxxx = PALEMU video output pal simulation
;xxx1 xxxx = SPR640 1 = sprite 640 resolution enabled
;xxxx 1xxx = SMTH enable video output horizontal smoothing
;xxxx x1xx = FCLRHI 1 = enable full color for chars > $ff
;xxxx xx1x = FCLRLO 1 = enable full color for chars <= $ff
;xxxx xxx1 = CHR16 1 = enable 16 bit character numbers
.VIC4DIS = $d054
;enable sprite wide mode (bit = sprite index)
.SPRX64EN = $d057
;number of bytes per line lo
.CHARSTEP_LO = $d058
;number of bytes per line hi
.CHARSTEP_HI = $d059
;disable hot registers
;1xxx xxxx = HOTREG 1 = disable writing VIC2 registers affecting VIC4 registers
;x1xx xxxx = RSTDELEN 1 = enable raster delay by one line to match output pipeline
;xx11 xxxx = SIDBDRWD = width of single side border
.HOTREG = $d05d
;3 byte address of screen ram
;$d060 = lo byte
;$d061 = medium byte
;$d062 = hi byte
.SCRNPTR = $d060
;enable sprite 16 color mode (bit = sprite index)
.SPR16EN = $d06b
;sprite pointer list address lo
.SPRPTRADR_LO = $d06c
;sprite pointer list address hi
.SPRPTRADR_HI = $d06d
;1xxx xxxx = SPRPTR16 - enable 16 bit sprite addresses
;x111 1111 = SPRPTRBNK - sprite pointer bank
.SPRPTR16 = $d06e
;11xx xxxx = MAPEDPAL - palette bank mapped at $d100 to $d3ff
;xx11 xxxx = BTPALSEL - bitmap/text palette bank
;xxxx 11xx = SPRPALSEL - sprite palette bank
;xxxx xx11 = ABTPALSEL - VIC4 alternative bitmap/text palette bank
.PALSEL = $d070
;palette red entries (up to $d1ff) - nibbles are switched in 8bit color mode
.PALRED = $d100
;palette green entries (up to $d2ff) - nibbles are switched in 8bit color mode
.PALGREEN = $d200
;palette blue entries (up to $d3ff) - nibbles are switched in 8bit color mode
.PALBLUE = $d300
!zone Mega65
;read the last key pressed (until written to)
.PRESSED_KEY = $d610
!macro enable40Mhz
; Enable 40Mhz
lda #$41
sta $00
!end
!macro enableVIC3Registers {
lda #$00
tax
tay
taz
map
eom
;Enable VIC III
lda #$A5
sta VIC3.KEY
lda #$96
sta VIC3.KEY
}
!macro enableVIC4Registers {
; Enable VIC4 registers
lda #$00
tax
tay
taz
map
eom
;Enable VIC IV
lda #$47 ;'G'
sta VIC3.KEY
lda #$53 ;'S'
sta VIC3.KEY
}