![]() |
Labels as byte values in inline assembly - Printable Version +- Forum (https://www.boriel.com/forum) +-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11) +---- Forum: Help & Support (https://www.boriel.com/forum/forumdisplay.php?fid=16) +---- Thread: Labels as byte values in inline assembly (/showthread.php?tid=331) |
Labels as byte values in inline assembly - britlion - 03-13-2011 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? Re: Labels as byte values in inline assembly - britlion - 03-23-2011 Nobody? Re: Labels as byte values in inline assembly - boriel - 03-23-2011 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. Re: Labels as byte values in inline assembly - britlion - 03-23-2011 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!" |