Skip to main content


A question that keeps coming back is how to apply a struct to a database in #uxntal.

Here's the little example I will be using in the upcoming docs 😀
in reply to Philip Nelson

@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 😀
in reply to Devine Lu Linvega

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.
in reply to tebicat

@tebicat .person/name will give you a byte literal of the enum field, do you really need the raw byte for this?
in reply to Devine Lu Linvega

@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
in reply to Devine Lu Linvega

@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.
in reply to tebicat

@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.
in reply to tebicat

@tebicat Aight, so this kept me up last night proper..

What would you say about this:

=label/sub for raw shorts
-label/sub for raw byte
in reply to Devine Lu Linvega

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.
in reply to tebicat

@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, `_`?
in reply to Devine Lu Linvega

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.
in reply to Devine Lu Linvega

@tebicat So I've updated uxnasm to support the -rune, and =rune, without replacing the :rune, they'll both work for now.

But you can try it out at least, the -rune is pretty neat, it'll let you create zp byte references!

Enjoy.

Lo, thar be cookies on this site to keep track of your login. By clicking 'okay', you are CONSENTING to this.