hlorenzi / customasm

💻 An assembler for custom, user-defined instruction sets! https://hlorenzi.github.io/customasm/web/
Apache License 2.0
704 stars 55 forks source link

Calculate `.len` of labels automatically #167

Open hlorenzi opened 1 year ago

hlorenzi commented 1 year ago

I recently added #define sizeof(Begin) (pc - Begin)*2 so that I can get the size in bytes of a data region as a constant and it has become an extremely useful feature:

args:
#d16    1, 2, 3, 4, 5
.size = sizeof(args)

mov t0, args.size

Are there any ways to do something like that?

Originally posted by @p-rivero in https://github.com/hlorenzi/customasm/issues/68#issuecomment-779207557