codernator Posted May 29, 2013 Share Posted May 29, 2013 I am attempting to use indirect addressing to render a sprite, by referencing a table of addresses to various sprite frames. I did read http://atariage.com/forums/topic/198867-address-table-question-urgent/page__hl__+indirect%20+address?do=findComment&comment=2536600, but I seem unable to correctly apply this to my code. What is rendered is not the sprite I intended, but whatever happens to be in whatever address I happen to be incorrectly referencing. Please help me uncover the error. Here is a snippet: FRAME_POINTER will point to the current frame by address. (In this snippet there is only one frame). SEG.U VARS ORG $80 FRAME_POINTER ds 2 SEG CODE LDA TankImageTable STA FRAME_POINTER LDA TankImageTable + 1 STA FRAME_POINTER + 1 Gfx Kernel reducted to only the relevant part. LDY #2 LDX #7 TankArea LDA (FRAME_POINTER),X STA GRP0 STY WSYNC DEX BPL TankArea Sprite Definition: TankImageFrame0 .byte #%01111110 .byte #%11010101 .byte #%10101011 .byte #%11111110 .byte #%10111000 .byte #%10011000 .byte #%00011000 .byte #%00011000 TankImageTable .word TankImageFrame0 Quote Link to comment Share on other sites More sharing options...
Omegamatrix Posted May 30, 2013 Share Posted May 30, 2013 LDA (FRAME_POINTER),X is not a valid addressing mode. Use LDA (FRAME_POINTER),Y instead. Your compiler shouldn't let it compile. Are you using DASM or something else? Quote Link to comment Share on other sites More sharing options...
codernator Posted May 30, 2013 Author Share Posted May 30, 2013 Wow, I feel like such a code monkey. I read the addressing modes over and over, but still didn't pick up what was being laid down. Anyway, it works now. I was using DASM 1.09. I've upgraded to DASM 2.20.11. Either way, no error was reported concerning the invalid addressing mode at any verbosity. :/ Quote Link to comment Share on other sites More sharing options...
roland p Posted May 30, 2013 Share Posted May 30, 2013 I also made this mistake several times with dasm. I wonder Is there any use for indexed indirect addressing mode on the 2600? Quote Link to comment Share on other sites More sharing options...
codernator Posted May 31, 2013 Author Share Posted May 31, 2013 Thanks to this post, I now have an animated tank that you can move back and forth on a multi-colored background. Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted May 31, 2013 Share Posted May 31, 2013 I wonder Is there any use for indexed indirect addressing mode on the 2600? Probably there is, but I have never ever used it in more than 10 years of coding. 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.