Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - Doing tables in 65816 | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
Sukasa Boomboom Error 349857348734534: The system experienced an error. Level: 57 Posts: 959/1981 EXP: 1446921 For next: 39007 Since: 02-06-05 From: *Shrug* Since last post: 6 days Last activity: 1 day |
| ||
I'm doing a bit of SNES coding, and I need to know how to do a lookup table, sort of like this: 03 26 95 48 Where I would have the SNES read those sequentially when I want to. Now, If I wanted some sort of ASM that would let me put those into a table and read from it, how would I do that? I'm trying to reduce ASM size and simplify the coding, because the values are for a sprite's X and Y values, updated once each frame, and there are at least 50 different locations I'll need to hardcode. |
|||
beneficii Lakitu Level: 36 Posts: 196/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours |
| ||
I don't have as much experience with 65816 as I do with 6502, but typically you'd use either y or x. This is assuming you're trying to read one byte at a time. Something like: ldy #$00 lookup: lda startingaddress, y (do your stuff with it here) iny tya cmp #$04 bne lookup I think there should be asm very similar to this in 65816. Load 0 to y, then read the starting address + current value of y, then do your stuff with it, then increase y by one, transfer y to accumulator to check to see if y has reached 4 yet, and if not, then it should go back to lookup to do it again. Essentially, this is just like a for loop in C: for(int y = 0; y < 4; y++) { accumulator = variable[startingaddress + y (do your stuff here) } (edited by beneficii on 06-24-05 06:41 PM) (edited by beneficii on 06-24-05 06:42 PM) (edited by beneficii on 06-24-05 06:43 PM) |
|||
Sukasa Boomboom Error 349857348734534: The system experienced an error. Level: 57 Posts: 965/1981 EXP: 1446921 For next: 39007 Since: 02-06-05 From: *Shrug* Since last post: 6 days Last activity: 1 day |
| ||
OK, thanks, because what happens is that once every frame, the table is read and the values resulting from it are multiplied by 16 in a custom loop and fed to the sprite X/Y location tables. | |||
Euclid Cheep-cheep Level: 23 Posts: 174/193 EXP: 65528 For next: 2195 Since: 03-15-04 From: Australia Since last post: 24 days Last activity: 7 days |
| ||
Originally posted by beneficii you can replace the tya and cmp with a single cpy instruction. or if you're really tight on bytes, you can do it in reverse... ldy #whatever maximum value loop: lda addr,y (stuff) dey bne loop |
|||
beneficii Lakitu Level: 36 Posts: 200/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours |
| ||
Originally posted by EuclidOriginally posted by beneficii Duh... |
|||
Sukasa Boomboom Error 349857348734534: The system experienced an error. Level: 57 Posts: 990/1981 EXP: 1446921 For next: 39007 Since: 02-06-05 From: *Shrug* Since last post: 6 days Last activity: 1 day |
| ||
OK, thanks. Now I only need to get a way to fit that into SMW, since that was a table I'm placing into it. |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - Doing tables in 65816 | | | |