@blu3r4d0n You know how |00 rolls back the program address to $0000, this works the same for an enum.
You basically define labels with offsets, for example `person/age` is equal to $0002, naming that offset allows to access specific members of a data structure 😀
this is also really useful for enums or other constants, i ran into the 256 macro limit recently because i was using them for constants.
i will say, some way to use an immediate byte constant (equivalent to ":") would be nice. so you can have byte enum fields in your staticly initialized structs.
@tebicat Oh wow really, well, I could add a rune for this, the way I'm thinking about this is that you could always fork the drifblim assembler, and include it in your project to build the project, you don't need to target uxnasm.
If one of my project is esoteric enough, it'll have it's own compiler to suit the project's microlanguage.
hmm. the symmetry certainly is nice, but: 1. then you lose :/; symmetry 2. you have to rewrite code to replace : 3. those are decently common to use in macro names
i've thought about it a fair bit too, and the best i could think of was using ^ as it already has associations with bytes.
on the subject of adding directives, here's the ones ive wanted at one time or another: * including the raw bytes of a file in a rom * raw relative reference (saves a few bytes for certain loop constructs because you can use JCNr) * compile-time symbol arithmetic
obviously some of these are more complex than others, and they're all kinda niche, but i think it's worth thinking about if a symbol would fit some future feature better.
@tebicat I like the idea of adding raw rel ref, (although, I never managed to write a return stack loop that worked properly)
Those are all good ideas, I've tried the compile-time arithmetic before but it complexified everything too much for the simple uxntal assembler, I don't think I could implement that one myself.
Adding the two new raw byte runes would be a good first step tho, I wonder what would be a good raw rel rune, `_`?
here's an idea for comptime arithmetic: expand on how things work currently, using the byte offset as an accumulator. something like |@label and $@label to pad by the value of a label, then maybe something for subtracting... might try and make a concept by forking driftblim...
as for raw rel byte, it's tricky, not too many runes are left. `_` is decent, tho the fact that it's almost always grouped in with alphanumerics in language syntax makes it feel a bit weird. don't exactly have a better idea tho.
Philip Nelson
in reply to Devine Lu Linvega • • •Devine Lu Linvega
in reply to Philip Nelson • • •You basically define labels with offsets, for example `person/age` is equal to $0002, naming that offset allows to access specific members of a data structure 😀
tebicat
in reply to Devine Lu Linvega • •i will say, some way to use an immediate byte constant (equivalent to ":") would be nice. so you can have byte enum fields in your staticly initialized structs.
Luna Saphira Dragofelis 🐱 likes this.
Devine Lu Linvega
in reply to tebicat • • •tebicat
in reply to Devine Lu Linvega • •if i want to minimize memory usage, yeah...
it would also let you do things like write simple bytecode if you wanted
Devine Lu Linvega
in reply to tebicat • • •tebicat
in reply to Devine Lu Linvega • •well, it's somewhere in nrg i have a table of the unlocks for each level which is twice as big as it needs to be because of this.
Devine Lu Linvega
in reply to tebicat • • •If one of my project is esoteric enough, it'll have it's own compiler to suit the project's microlanguage.
Devine Lu Linvega
in reply to tebicat • • •What would you say about this:
=label/sub for raw shorts
-label/sub for raw byte
tebicat
in reply to Devine Lu Linvega • •1. then you lose :/; symmetry
2. you have to rewrite code to replace :
3. those are decently common to use in macro names
i've thought about it a fair bit too, and the best i could think of was using ^ as it already has associations with bytes.
on the subject of adding directives, here's the ones ive wanted at one time or another:
* including the raw bytes of a file in a rom
* raw relative reference (saves a few bytes for certain loop constructs because you can use JCNr)
* compile-time symbol arithmetic
obviously some of these are more complex than others, and they're all kinda niche, but i think it's worth thinking about if a symbol would fit some future feature better.
Devine Lu Linvega
in reply to tebicat • • •Those are all good ideas, I've tried the compile-time arithmetic before but it complexified everything too much for the simple uxntal assembler, I don't think I could implement that one myself.
Adding the two new raw byte runes would be a good first step tho, I wonder what would be a good raw rel rune, `_`?
tebicat
in reply to Devine Lu Linvega • •as for raw rel byte, it's tricky, not too many runes are left. `_` is decent, tho the fact that it's almost always grouped in with alphanumerics in language syntax makes it feel a bit weird. don't exactly have a better idea tho.
Devine Lu Linvega
in reply to Devine Lu Linvega • • •But you can try it out at least, the -rune is pretty neat, it'll let you create zp byte references!
Enjoy.
like this
🐡 la ninpre 🍄, seven and tebicat like this.
john
in reply to Devine Lu Linvega • • •