MrProper Posted April 21, 2020 Share Posted April 21, 2020 Hi everyone! I have been trying my hand at writing a little bit of code after reading through most of the "2600 programming for Newbies" but I ran in to a problem with the positioning for my sprites. In trying to test my knowledge I wanted to simply draw box (P0) on a predefined position on the screen. But my timing seemed off. I wrote some code to experiment with timing and RESP0 but it seems to contradict what I read. Can some one help me? After the vertical sync I wrote this to set the player position sta WSYNC REPEAT 15 nop REPEND sta RESP0 Now from what I read this should take 15*2*3 = 90 colour cycles. Which should position the player at 90-68 = 22.But what gets drawn is this: (The white lines are the most left and right pixel of the player. The rest is just playfield for help counting pixels) So I'm off by what seems like 5 cpu cycles. Can anyone explain what goes wrong in my calculations? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted April 22, 2020 Share Posted April 22, 2020 You left out the 3 cycles for sta RESP0 - (15*2 + 3) * 3 = 99. As for the rest of the difference I believe it's caused by a propagation delay within TIA, but don't know specifics. I do know the results are slightly different for the ball and missiles, I cover that in Step 11 - add the ball object of my tutorial: Quote I then modified RandomLocation to set all objects to the same location for comparision: RandomLocation: ... ; for alignment test, set to (100, 100) lda #100 sta ObjectX,x sta ObjectY,x rts This revealed a minor quirk with TIA - namely that when objects are set to the same X position, missiles and the ball end up 1 pixel to the left of where a player ends up (player1 is the green square and it's directly on top of the red ball). This is a known issue and the solution is to increase the X value by 1 to compensate. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.