Subject: Re: [stella] Qb/Demo background animation (very rudimentary) From: "Eckhard Stolberg" <Eckhard_Stolberg@xxxxxx> Date: Mon, 5 Feb 2001 14:25:13 +0100 |
Hello Andrew, > Well, the response hasn't exactly been overwhelming... but, plunging on... > Please find attached the latest work-in-progress. This is semi-playable, in > that you can actually move the blocks to the correct positions. I've also > got a couple of rudimentary sprites up. This demo works in PCAE, but the > sprites are mispositioned in Z26. Could somebody please let me know how it > goes on actual hardware? > I have about 10 bytes of free RAM, and about 1200 bytes of ROM. If this demo works in PCAE, you must be using a pretty old version of this emulator. I tried PUSH.BIN on my 7800 and the sprite positioning is totally off too. After looking at the z26 trace log, I think the problem is a little misunderstanding on your part about how object postioning works on the VCS. If you want to position an object on the VCS, you have to wait for the start of a scanline. Then you have to do a delay loop until the electron beam reaches the horizontal postion, where you want to display your object. Then you have to access the RESxx register for the object, that you want to position. Due to the fact that each cycle represents three pixels, you can't position an object on any pixel with RESxx alone. Therefore you now have to shift your object a couple of pixels to the left or right, if nessessary. To do that you have to write the apropriate shifting value into the HMxx of the desired object. Then you have to wait for the start of a scanline again. Then you have to access HMOVE which will apply the fine movement to all objects at the same time. Now you have to wait at least 24 cycles before you can write to any of the fine movement registers again, including HMCLR. If you don't access HMOVE directly at the start of a scanline, or if you access any of the movement registers too soon after the access to HMOVE you will get strange positions for your objects. So a routine to position two players could look like this. sta WSYNC ldx player_0_X_position lda position_value_table,x sta HMP0 and #$0f tax L1: dex bpl L1 sta RESP0 sta WSYNC ldx player_1_X_position lda position_value_table,x sta HMP1 and #$0f tax L1: dex bpl L1 sta RESP1 sta WSYNC sta HMOVE sta WSYNC sta HMCLR position_value_table contains for each desired horizontal position the appropriate delay loop counter in the low nibbles and the appropriate horizontal shift value in the hich nibbles. One other thing that I noticed on your demo is, that it only does about 249 scanlines per frame, and every couple of scanlines there is a frame where you do a different number of scanlines, so that the screen jumps. Z26 displays the number of scanlines in the last completed frame, when you start it with the -n command line switch. This could help you to generate a proper display. Also you should do a STA WSYNC before you turn on VSYNC. Otherwise you might turn on VSYNC at the end of a scanline and therefore do only 2 scanlines of VSYNC effectively. Ciao, Eckhard Stolberg - Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] Qb/Demo background ani, Andrew Davie | Thread | Re: [stella] Qb/Demo background ani, Andrew Davie |
Re: [stella] Qb/Demo background ani, Andrew Davie | Date | Re: [stella] Qb/Demo background ani, Andrew Davie |
Month |