Labels and `$` inside `asm` blocks
This is not an issue I expect to be resolved at the moment, but certainly a reminder that it is a valid use-case. It seems customasm is not designed to support single instruction architectures by lack of a true macro mnemonic. The two main issues:
- You can't define a relative label inside a asm{}
- $ will always reference the first asm{} IP even when referencing other asm{}
As we've discussed on Discord, there's the problem of asm blocks being available in any kind of expression context, even if the address isn't aligned. For example:
#ruledef {
jmp {addr: u8} => 0xaa @ addr
}
#d4 0xf
#d4 asm { jmp $ }
So labels wouldn't work either. But if the address is indeed aligned, then I think the idea is workable. We'll just have to continue erroring out on misaligned addresses.
When it comes to $ I understand the problem. But your example should be equivalent to the one below in a way. Both fail with that error. So yes, it should keep failing like that by design.
#ruledef {
jmp {addr: u8} => 0xaa @ addr
}
#d4 0xf
jmp $
I'm sorry, I'm an idiot. Tried to find out how to syntax highlight assembly and clicked the wrong button closing the issue. :) Yeah, I might not be the sharpest tool in the shed. lol