comparison genesis.s68 @ 9:997690aa0507

Improve method for choosing line palette entries. Read number of global and dynamic colors from image binary. Go back to doing a word, longword, word pattern of writes for turning off display, doing DMA and turning it back on again to make things work correctly on the real hardware.
author Mike Pavone <pavone@retrodev.com>
date Wed, 04 Sep 2013 00:41:52 -0700
parents 4ffd621f1d0c
children
comparison
equal deleted inserted replaced
8:a049de420cc1 9:997690aa0507
85 ButtonState equ $FFFFEFF0 85 ButtonState equ $FFFFEFF0
86 ButtonStateNew equ ButtonState+2 86 ButtonStateNew equ ButtonState+2
87 PalAddress equ ButtonStateNew+2 87 PalAddress equ ButtonStateNew+2
88 88
89 CRAMXferSizeCmd equ $9308 89 CRAMXferSizeCmd equ $9308
90 CRAMDMACmd equ $C0100080 90 CRAMDMACmd equ $C0000080
91 StaticColors equ 8 91 StaticColors equ 8
92 92
93 USE_HINT equ 0 93 USE_HINT equ 0
94 move.b #$40, $A10009 94 move.b #$40, $A10009
95 move.l #$C00000, a4 95 move.l #$C00000, a4
139 139
140 add.l d5, d4 140 add.l d5, d4
141 dbra d2, WriteNamesY 141 dbra d2, WriteNamesY
142 142
143 move.l #$C0000000, (a5) ;setup writes to CRAM 143 move.l #$C0000000, (a5) ;setup writes to CRAM
144 moveq #(StaticColors-1), d0 ;copy first 12 colors (static pallete) 144 move.b (a0)+, d0 ;Number of static colors
145 move.b (a0)+, d1 ;Number of dynamic colors
146 ext.w d0
147 move.w d0, -(a7)
148 beq NoStatic
149 subq.w #1, d0
145 CopyColors: 150 CopyColors:
146 move.w (a0)+, (a4) 151 move.w (a0)+, (a4)
147 dbra d0, CopyColors 152 dbra d0, CopyColors
153 move.w (a7)+, d0
154 NoStatic:
148 155
149 move.l a0, (PalAddress).w 156 move.l a0, (PalAddress).w
150 157
151 158
152 move.l #$60000010, (a5) ;setup writes to VSRAM 159 move.l #$60000010, (a5) ;setup writes to VSRAM
170 ;bsr LoadSpritePal 177 ;bsr LoadSpritePal
171 ;bsr InitFrameBigSprite 178 ;bsr InitFrameBigSprite
172 moveq #0, d3 179 moveq #0, d3
173 ;bsr ChangeFrameBigSprite 180 ;bsr ChangeFrameBigSprite
174 181
175 182 move.w d0, d5
176 183 ext.l d5
177 move.l #CRAMDMACmd, d5 ;setup DMA command word 184 moveq #17, d2
178 185 lsl.l d2, d5
179 move.w #CRAMXferSizeCmd, (a5) ;set Transfer length 186 or.l #CRAMDMACmd, d5 ;setup DMA command word
187
188 ext.w d1
189 beq NoDynamic
190 or.w #$9300, d1
191 move.w d1, (a5) ;set Transfer length
180 move.w #$9400, (a5) 192 move.w #$9400, (a5)
181 193
182 move.w #$8114, d6 194 move.w #$8114, d6
183 move.w #$8174, d7 195 move.w #$8174, d7
184 196
207 beq WaitNextLine 219 beq WaitNextLine
208 220
209 221
210 222
211 HINT: 223 HINT:
212 ;move.w d6, (a5) 224 move.w d6, (a5)
213 ;move.l d5, (a5) ;start DMA 225 move.l d5, (a5) ;start DMA
214 ;move.w d7, (a5) 226 move.w d7, (a5)
215 move.l d6, (a5) 227 ;move.l d6, (a5)
216 move.l d7, (a5) 228 ;move.l d7, (a5)
217 move.w #CRAMXferSizeCmd, (a5) ;set Transfer length 229 move.w d1, (a5) ;set Transfer length
218 move.w #$9400, (a5) 230 move.w #$9400, (a5)
219 231
220 if USE_HINT 232 if USE_HINT
221 rte 233 rte
222 endif 234 endif
223 235
224 cmp.b #223, 4(a5) 236 cmp.b #223, 4(a5)
225 beq WaitTop 237 beq WaitTop
226 238
227 bra LineDone 239 bra LineDone
228 240 NoDynamic:
241 move.w #$8174, (a5)
242 move #$2300, SR
243 .loop
244 bra .loop
229 VINT: 245 VINT:
246 move.w d1, -(a7)
230 if USE_HINT 247 if USE_HINT
231 move.w #$8144, (a5) 248 move.w #$8144, (a5)
232 endif 249 endif
233 ;bsr SpriteCopyVRAM 250 ;bsr SpriteCopyVRAM
234 251
251 and.b #$7F, d6 268 and.b #$7F, d6
252 move.w d6,(a5) 269 move.w d6,(a5)
253 270
254 ;move.l d5, (a5) ;do DMA for first line 271 ;move.l d5, (a5) ;do DMA for first line
255 272
256 move.w #CRAMXferSizeCmd, (a5) ;set Transfer length 273 move.w (a7)+, d1
274 move.w d1, (a5) ;set Transfer length
257 move.w #$9400, (a5) 275 move.w #$9400, (a5)
258 276
259 move.w #$8114, d6 ;VDP commands to turn screen on and off during HBlank 277 move.w #$8114, d6 ;VDP commands to turn screen on and off during HBlank
260 swap d6 278 ;swap d6
261 swap d5 279 ;swap d5
262 move.w d5, d6 280 ;move.w d5, d6
263 swap d5 281 ;swap d5
264 move.w d5, d7 282 ;move.w d5, d7
265 swap d7 283 ;swap d7
266 move.w #$8174, d7 284 move.w #$8174, d7
267 if USE_HINT 285 if USE_HINT
268 move.w d7, (a5) 286 move.w d7, (a5)
269 endif 287 endif
270 rte 288 rte