Variable length

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Variable length

Jowan
Can @variable be bigger than a word?
Reply | Threaded
Open this post in threaded view
|

Re: Variable length

WBahn
Administrator
Not per the authors' language specification -- in fact it can't even be a full word, but only a 15-bit unsigned integer (so 0..32767).

If you want to extend the language specification you are free to do so, but then you need to define what it means to have a value that is more than a word in size and how it is to be implemented and interpreted. It's a very reasonable and doable thing, but it is likely quite a bit larger task than you might be thinking.
Reply | Threaded
Open this post in threaded view
|

Re: Variable length

Jowan
I want 16 words for a table. I have a one word @pointer to the table. I called the table @100 because I don't know how to take 16 words and give it a name. Must I remember what table goes in what part of data memory?
Reply | Threaded
Open this post in threaded view
|

Re: Variable length

WBahn
Administrator
I'm not following what you are trying to accomplish.

The command @100 does nothing more (or less) than loads the value 100 into the A register.

When writing assembly, you control how memory gets used with the caveat that variables are assigned to memory addresses sequentially starting at address 16. Other than that, this assembler doesn't have the ability to work with symbolic names for memory addresses (in RAM -- it also associated addresses in ROM with symbolic labels).

You can certainly extend the assembler to support declared labels, perhaps something like

EQU MyTable 100

Then you could use

@MyTable

But you would still be responsible for making sure that the addresses within the table were never used for anything else. You could device other extensions to help with that task.
Reply | Threaded
Open this post in threaded view
|

Re: Variable length

Jowan
That helped me think thank you.

I have put my table just below @SCREEN. That gives me a label to come down from into unused memory instead of breaking what's left in two parts. And my long division works.
Reply | Threaded
Open this post in threaded view
|

Re: Variable length

Lozminda
In reply to this post by Jowan
I was looking for the max length of @some_variable_name

I've done a little test and the CPUEmulator recognises the difference between

@abcdefghijklmnopqrstuvwxyz1234567890000000000abcdefghijklmnopqrstuvwxyz
and
@abcdefghijklmnopqrstuvwxyz1234567890000000000abcdefghijklmnopqrstuvwxyy

so that's 72 characters so far. Haven't found the limit yet as I've run out of time this eve

Handy for statics if you've got a long filename (which was my problem I'm currently sorting)

All the best...