SeaGtGruff Posted April 8, 2010 Share Posted April 8, 2010 Wow, this got a bit off-topic, lol. EDIT: Very informative post, though, I must say. ^^ LOOK OUT, EVERYBODY... D E R A I L E D !!! Michael Quote Link to comment Share on other sites More sharing options...
johnon Posted April 8, 2010 Author Share Posted April 8, 2010 Okay... Really, though. Can no one tell me what I'm doing wrong? I understand it can be re-written at will to work by most of you. Rewriting it without explaining doesn't teach me anything. I still will make the same mistakes because I didn't realize that they were mistakes. I need to know what I'm doing wrong, specifically, so I can learn from it. Quote Link to comment Share on other sites More sharing options...
Omegamatrix Posted April 8, 2010 Share Posted April 8, 2010 One thing I noticed was your pointers weren't being loaded correctly. Specifically, you had it right that the address need 2 bytes of ram. However the high byte was not being loaded correctly into ram. Look at yours and Chris's on top of each other: Okay I did a list file on Chris's to show you the address that should be loaded. I'm not going to show the whole thing as it's too long! 278 f122 WhalemanDeadWater 279 f122 280 f122 60 66 .byte.b #<WhalemanDeadWater1,#<WhalemanDeadWater2 281 f124 282 f200 00 00 00 00* ALIGN 256 283 f200 284 f200 Sprites 285 f200 286 f200 WhalemanLeftWater1 287 f200 288 f200 70 .byte.b %01110000 289 f201 f8 .byte.b %11111000 290 f202 7c .byte.b %01111100 291 f203 3e .byte.b 111110 292 f204 55 .byte.b %01010101 293 f205 aa .byte.b %10101010 .... 304 f20c WhalemanRightWater1 305 f20c 306 f20c 0e .byte.b 001110 307 f20d 1f .byte.b 011111 308 f20e 3e .byte.b 111110 309 f20f 7c .byte.b %01111100 310 f210 aa .byte.b %10101010 311 f211 55 .byte.b %01010101 So Chris used "ALIGN 256" to start the graphics on a new page. Now you can see that "WhalemanLeftWater1" starts at $F200 and "WhalemanRightWater1" starts at $F20C. The thing you got to know is how these addresses are stored in ram. It's low byte, high byte. So $F20C would look like $0C $F2 instead of $F2 $0C. If you want to use a "LDA (someGfxPtr),Y" it expects the pointer to be low byte then high byte. That link I gave you on addressing modes should talk about this more. To tell the compiler which byte is which do this: LDA #<WhalemanLeftWater1 ; low byte, #$00 in this case STA someGfxPtr LDA #>WhalemanLeftWater1 ; high byte, #$F2 in this case STA someGfxPtr+1 Now Chris just loaded the high byte once and stored them into ram for all the pointers. That's the beauty of having all the gfx on the same page. The high pointer is the same for all of them. Your gfx was all in the same page too, but without an ALIGN or ORG statement they will shift around as you write new code. You don't want that as you could potentially cross a page boundary, for one thing. Anyhow I would start with Chris's code and really try to understand it. Also try adding a little bit of code at a time and test it as you go instead of trying the whole thing at once. Quote Link to comment Share on other sites More sharing options...
cd-w Posted April 8, 2010 Share Posted April 8, 2010 Okay... Really, though. Can no one tell me what I'm doing wrong? I understand it can be re-written at will to work by most of you. Rewriting it without explaining doesn't teach me anything. I still will make the same mistakes because I didn't realize that they were mistakes. I need to know what I'm doing wrong, specifically, so I can learn from it. Problems that I found: The code segment was not set (SEG CODE) so the binary size was zero The frame timings were incorrect (for the vertical blank and overscan areas) - I added macros to take care of these The high byte of the graphics pointers was not set - pointers are 2 bytes long The animation counter was a constant and not a variable The sprite data needs to be updated on every line of the screen where you want to display it (search the forums for "skipdraw" for more details) You can't update the playfield after the sprites - everything must be updated on the correct scanline and you have 76 cycles per scanline to do everything The sprite repositioning code must not cross a page boundary (I added an ALIGN 256) I think it would be a good idea to start with a single sprite and update the code a little bit at a time until it does what you want. Chris 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.