PDA

View Full Version : Reading the 9th bit of VPOSR


Photon
06 January 2005, 15:37
Hm. I need to wait for raster line $129 on my A500. Currently I do this:

wait: move.w $dff004,d0
btst #0,d0
beq.s wait
wait2: move.b $dff006,d0
cmp.b #$29,d0
bne.s wait2
;timed code follows

My copper has a $ffdffffe command, so the raster goes beyond $100.

But it doesn't work, the routine is called when the raster reaches $029. How should I do it? Any tips appreciated. :)

Toni Wilen
06 January 2005, 15:59
move.l $dff004,d0
lsr.l #8,d0
and.w #511,d0

or something similar.

EDIT: of course the 9th bit can change just between read accesses to 4 and 6 so there may be need for another test first :)

EDIT2: maybe you have too much blitter/copper/bitplane activaty that stops the CPU at line $129? Your code should work..

Photon
06 January 2005, 17:15
I have 1 bpl on, and no blitter activity and a copper list of about 100 bytes :)

Photon
06 January 2005, 17:26
With your code it worked, thanks!. Maybe the raster register changed between reading the hi bit and comparing the low part.

Photon
06 January 2005, 18:12
Here's the macro that I use now ($dff000 in a6, as usual)


WAITRASa6: MACRO
.wl\@: move.l 4(a6),d0
and.l #$1ff00,d0
cmp.l #\1<<8,d0
bne.s .wl\@
ENDM

I now have 640 rotated and zoomed stars in one frame! :) :)

Photon
06 January 2005, 19:53
Correction, 692 now. :D