Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Labels as byte values in inline assembly
#1
If I had code that wanted to make a jump table, and still be able to compile it such that it can move around, how can I do this?

That is, I want something like

jump_table:
defb routine1
defb routine2
defb routine3


routine1:
<code>
ret

routine2:
<code>


routine3:
<code>


The design calls for a jp (hl). I could probably code around it, but I'm wondering how I could get label locations into the actual bytes compiled?
Reply
#2
Nobody?
Reply
#3
I was really busy fixing up things in version 1.2.8 (I think it's done, phew!). At this moment the ASM does not support this (but it should). Labels and values are supposed to be interchangeable, so DW (or DEFW) LABEL or DW 3 * Label -1 should also be admitted. I will check the assembler this evening.
I was going to use this technique for READ/DATA/RESTORE and GOTO <arithmetical expression> instructions.
Reply
#4
Wow!

Awesome, Boriel.

You are exceptional. At best, I was hoping for a "this will happen in a newer version when I get to it!"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)