I'm editing a sprite where it's range of speeds vary depending on the Extra Property Byte, making several different sprites that more or less use the same code but behave differently because of the differently referenced tables. I may not be doing it right though, and I'm most certainly overworking it; I'm getting a 'positive branch too long' error with my 'expert handiwork' that you can see here:
I haven't really gotten around to editing the other tables yet since I was gonna do that after testing it but these are all the tables nonetheless:
As you can see, it's a complete mess. Knowing how I can check the Extra Property Byte without being so messy (and whether or not I'm even doing it right) would be a godsend to me at this point. I'm a complete and utter noob when it comes to ASM so you might have to explain it in layman's terms. Thanks in advance though.
Code
LDA $157C,x BEQ Right LDA $7FAB28,x CMP #$00 BEQ ATbl1 LDA $7FAB28,x CMP #$01 BEQ BTbl1 LDA $7FAB28,x CMP #$02 BEQ CTbl1 LDA $7FAB28,x CMP #$03 BEQ DTbl1 LDA $7FAB28,x CMP #$04 BEQ ETbl1 LDA $7FAB28,x CMP #$05 BEQ FTbl1 LDA $7FAB28,x CMP #$06 BEQ GTbl1 AfterCmp1: EOR #$FF INC A STA $1626;,y LDA $1626;,y BRA SetSpeed Right: LDA $7FAB28,x CMP #$00 BEQ ATbl2 LDA $7FAB28,x CMP #$01 BEQ BTbl2 LDA $7FAB28,x CMP #$02 BEQ CTbl2 LDA $7FAB28,x CMP #$03 BEQ DTbl2 LDA $7FAB28,x CMP #$04 BEQ ETbl2 LDA $7FAB28,x CMP #$05 BEQ FTbl2 LDA $7FAB28,x CMP #$06 BEQ GTbl2 SetSpeed: STA $B6,x LDA $7F998F BNE UpdatePos BRA Moving ATbl1: LDA Tbl1R,y JMP AfterCmp1 BTbl1: LDA Tbl2R,y JMP AfterCmp1 CTbl1: LDA Tbl3R,y JMP AfterCmp1 DTbl1: LDA Tbl4R,y JMP AfterCmp1 ETbl1: LDA Tbl5R,y JMP AfterCmp1 FTbl1: LDA Tbl6R,y JMP AfterCmp1 GTbl1: LDA Tbl7R,y JMP AfterCmp1 ATbl2: LDA Tbl1R,y JMP SetSpeed BTbl2: LDA Tbl2R,y JMP SetSpeed CTbl2: LDA Tbl3R,y JMP SetSpeed DTbl2: LDA Tbl4R,y JMP SetSpeed ETbl2: LDA Tbl5R,y JMP SetSpeed FTbl2: LDA Tbl6R,y JMP SetSpeed GTbl2: LDA Tbl7R,y JMP SetSpeed
I haven't really gotten around to editing the other tables yet since I was gonna do that after testing it but these are all the tables nonetheless:
Code
Tbl1R: db $00,$11,$13,$15,$15,$13,$11,$11,$11 Tbl2R: db $00,$11,$13,$15,$15,$13,$11,$11,$11 Tbl3R: db $00,$11,$13,$15,$15,$13,$11,$11,$11 Tbl4R: db $00,$11,$13,$15,$15,$13,$11,$11,$11 Tbl5R: db $00,$11,$13,$15,$15,$13,$11,$11,$11 Tbl6R: db $00,$11,$13,$15,$15,$13,$11,$11,$11 Tbl7R: db $00,$11,$13,$15,$15,$13,$11,$11,$11
As you can see, it's a complete mess. Knowing how I can check the Extra Property Byte without being so messy (and whether or not I'm even doing it right) would be a godsend to me at this point. I'm a complete and utter noob when it comes to ASM so you might have to explain it in layman's terms. Thanks in advance though.