Subject: Re: [stella] Re: Help with efficient code From: jimn8@xxxxxxxxxx (Jim Nitchals) Date: Mon, 29 Sep 1997 17:42:34 -0700 (PDT) |
> beq pointers,x This isn't a valid instruction. Conditional branches can only go to one fixed location +/- 127 bytes away from the branch instruction itself. If you have a single state in "VARIABLE", as your example did, try: lda variable cmp #num_entries bcs not_in_table asl tax lda jump_table,x sta temp ; temp should be 2 bytes somewhere in RAM lda jump_table+1,x sta temp+1 jmp (temp) ; jump indirect through temp @not_in_table: ; continue with rest of program jump_table: dc.w framistat ; your assembler may prefer .word dc.w dohickey dc.w whachamacallit dc.w thingy dc.w dodad num_entries equ (*-jump_table)/2 ; some assemblers use $, not * ; to refer to current address (or if all else fails:) num_entries equ 5 ; but it isn't as nice It's possible to rearrange the jump table into two halves (low and high byte of the addresses in separate tables) but doing so only saves 1 instruction and makes the code harder to change. Give this method a try. -- Archives updated once/day at http://www.biglist.com/lists/stella/archives/ Unsubscribing and other info at http://www.biglist.com/lists/stella/stella.html
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] Re: Help with efficien, crackers | Thread | [stella] Re: Help with efficient co, Jim Nitchals |
Re: [stella] Re: Help with efficien, crackers | Date | RE: [stella] Re: Help with efficien, arb |
Month |