comparison menu.s68 @ 814:109ac52ffecd

Menu cleanup with macros
author Michael Pavone <pavone@retrodev.com>
date Mon, 27 Jul 2015 09:27:15 -0700
parents 60686f8d5e48
children 35f5658d141f
comparison
equal deleted inserted replaced
813:c9ed929ee984 814:109ac52ffecd
90 dc.b " " 90 dc.b " "
91 dc.b " " 91 dc.b " "
92 dc.b " " 92 dc.b " "
93 dc.b " " 93 dc.b " "
94 dc.b "JUE " 94 dc.b "JUE "
95
96 ;register addresses
97 VDP_DATA equ $C00000
98 VDP_CTRL equ $C00004
99 VDP_HV equ $C00008
100 Z80_RAM equ $A00000
101 IO_AREA equ $A10000
102
103 MODE_0 equ 0
104 MODE_1 equ 1
105 SCROLL_A equ 2
106 WINDOW equ 3
107 SCROLL_B equ 4
108 SAT equ 5
109 BG_COLOR equ 7
110 HINT equ $A
111 MODE_3 equ $B
112 MODE_4 equ $C
113 HSCROLL equ $D
114 AUTOINC equ $F
115 SCROLL EQU $10
116 WINDOW_H equ $11
117 WINDOW_V equ $12
118 DMALEN_L equ $13
119 DMALEN_H equ $14
120 DMASRC_L equ $15
121 DMASRC_M equ $16
122 DMASRC_H equ $17
123
124 VDP_VRAM_WRITE equ $40000000
125 VDP_CRAM_WRITE equ $C0000000
126 VDP_VSRAM_WRITE equ $40000010
127 VDP_DMA_FLAG equ $80
128
129 vdpregset macro
130 move.w #(((\1) << 8) | $8000 | (\2)), (a1)
131 endm
132
133 vdpreg macro
134 dc.w (((\1) << 8) | $8000 | (\2))
135 endm
136
137 ;Writes a normal VDP command to the control port
138 ;\1 - VDP address
139 ;\2 - Access type
140 vdpaccess macro
141 move.l #((\2) | (\1) << 16 & $3FFF0000 | (\1) >> 14 & 3), (a1)
142 endm
95 143
96 empty_handler: 144 empty_handler:
97 int_6: 145 int_6:
98 rte 146 rte
99 int_4: 147 int_4:
101 149
102 rsset $FFFF8000 150 rsset $FFFF8000
103 x_pos rs.w 1 151 x_pos rs.w 1
104 base_cmd rs.l 1 152 base_cmd rs.l 1
105 153
154 initial_regs:
155 vdpreg MODE_1, $4 ;Mode 5, everything turned off
156 vdpreg MODE_0, $4
157 vdpreg SCROLL_A, $20 ;Scroll a table $8000
158 vdpreg SCROLL_B, $05 ;Scroll b table $A000
159 vdpreg SAT, $60 ;SAT table $C000
160 vdpreg BG_COLOR, 0
161 vdpreg HINT, $FF
162 vdpreg MODE_3, 0 ;full screen scroll
163 vdpreg MODE_4, $87 ;40 cell mode, double-res interlace
164 vdpreg HSCROLL, 0
165 vdpreg AUTOINC, 2
166 vdpreg SCROLL, 1 ;64x32 scroll size
167 end_initial_regs
168
106 start: 169 start:
107 lea $C00000, a0 170 lea $C00000, a0
108 lea $C00004, a1 171 lea $C00004, a1
109 move.w #$8104, (a1) ;Mode 5, everything turned off 172
110 move.w #$8004, (a1) 173 moveq #(end_initial_regs-initial_regs-1), d0
111 move.w #$8220, (a1) ;Scroll a table $8000 174 lea initial_regs.w, a2
112 move.w #$8405, (a1) ;Scroll b table $A000 175 .regloop
113 move.w #$8560, (a1) ;SAT table $C000 176 move.w (a2)+, (a1)
114 move.w #$8700, (a1) ;backdrop color 0 177 dbra d0, .regloop
115 move.w #$8B00, (a1) ;full screen scroll 178
116 move.w #$8C87, (a1) ;40 cell mode, double-res interlace 179 vdpaccess $0, VDP_CRAM_WRITE
117 move.w #$8D00, (a1) ;hscroll table at 0
118 move.w #$8F02, (a1) ;autoinc 2
119 move.w #$9001, (a1) ;64x32 scroll size
120 move.l #$C0000000, (a1)
121 move.w #$000, (a0) 180 move.w #$000, (a0)
122 move.w #$EEE, (a0) 181 move.w #$EEE, (a0)
123 182
124 ;init scroll table 183 ;init scroll table
125 move.l #$40000000, (a1) 184 vdpaccess $0, VDP_VRAM_WRITE
126 move.w #0, (a0) 185 move.w #0, (a0)
127 move.w #4, (a0) 186 move.w #4, (a0)
128 187
129 ;load tiles 188 ;load tiles
130 move.l #$48000000, (a1) 189 vdpaccess $800, VDP_VRAM_WRITE
131 lea font(pc), a2 190 lea font(pc), a2
132 move.w #((fontend-font)/4 - 1), d0 191 move.w #((fontend-font)/4 - 1), d0
133 tloop: 192 tloop:
134 move.l (a2)+, (a0) 193 move.l (a2)+, (a0)
135 dbra d0, tloop 194 dbra d0, tloop
136 195
137 196
138 197
139 ;clear name table 198 ;clear name tables
140 move.l #$40000002, (a1) 199 vdpaccess $8000, VDP_VRAM_WRITE
141 moveq #32, d0 200 moveq #32, d0
142 move.w #(64*64-1), d1 201 move.w #(64*64-1), d1
143 ploop: 202 ploop:
144 move.w d0, (a0) 203 move.l d0, (a0)
145 dbra d1, ploop 204 dbra d1, ploop
146 205
147 move.l #$40000002, d3, 206 move.l #$40000002, d3
148 move.l d3, (a1) 207 move.l d3, (a1)
149 move.l d3, base_cmd.w 208 move.l d3, base_cmd.w
150 209
151 lea Message(pc), a6 210 lea Message(pc), a6
152 moveq #0, d0 211 moveq #0, d0
157 move.w #$8144, (a1) ;enable display 216 move.w #$8144, (a1) ;enable display
158 move #$2300, sr 217 move #$2300, sr
159 218
160 219
161 wait_forever 220 wait_forever
221 stop #2500
162 bra wait_forever 222 bra wait_forever
163 223
164 Message: 224 Message:
165 dc.b "Journey From Darkness - Strider Returns (U) [c][!].bin", $A 225 dc.b "Journey From Darkness - Strider Returns (U) [c][!].bin", $A
166 dc.b "Toejam & Earl in Panic on Funkotron (U) [!].bin", $A 226 dc.b "Toejam & Earl in Panic on Funkotron (U) [!].bin", $A