Aligning to more than 15bytes

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello! It's me again...

I've just started working on a 6502 CPU emulator on an AVR. I want to to make a 256 entry jump-table, covering all the possible OP-codes on the 6502.

The OP look-up code I've come up with this far looks like the following...
...
ldi ZH, hi8(jumptable)
loop:
ld ZL, PC_6502+ ; The 6502 code is stored in external memory
icall ; execute OP-code
rjmp loop ; next OP-code

.align 256
jumptable:
rjmp execute_OP0
rjmp execute_OP1
...

For the above code to work the jumptable _must_ be aligned to 256. The compiler complains about: "Alignment too large: 15 assumed"

Is there anyway around this?

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok... never mind. I've figured the GCC .align switch out
For those of you who don't know this; .align aligns to 2^(the parameter you type in) number of bytes. In my case I wanted the lover byte of `jumptable´ to start at 0x00, 2*256 bytes = 2^9. Thus .align 9 puts the code on a 256 word boundary :)

admin's test signature