geas icon indicating copy to clipboard operation
geas copied to clipboard

Including arbitrary data in bytecode

Open fjl opened this issue 2 years ago • 1 comments

This is a pretty standard assembler feature. Sometimes you just need to put some raw bytes into the bytecode. This should be implemented as a new directive, for example:

#bytecode "file.bin"

Including binary files should obviously work, but sometimes it can also be interesting to include the output of expressions. I think the syntax for this could use the same directive but with braces instead of the filename. The size of each expression would also need to be declared:

#bytecode {
   1: 0x01
   4: macro & mask
   2: @label
}

Allowing labels in there is interesting for jumptable constructions.

fjl avatar Sep 13 '23 17:09 fjl

I have added a #bytes directive for literal bytes. The full syntax (with { ... }) is not implemented yet.

fjl avatar Feb 28 '25 12:02 fjl

#bytes and several other related features have been added in release v0.3.0, completing this feature idea. I didn't end up implementing the fancy { ... } syntax, but it'll be easy enough to add if needed.

fjl avatar Oct 24 '25 13:10 fjl