Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is posible put a ubyte variable just after DIM
#2
(09-04-2021, 02:17 PM)maeloterkim Wrote: Hi

Is posible put a ubyte variable just after DIM   WITHOUT ASSEMBLER  maybe with AT @  or something

Example:

Code:
DIM udg(1, 7) AS uByte => {{0,1,3,7,15,31,63,127}, _
                           {1,2,4,7,15,31,63,127}}

DIM myVariable as ubyte 

I WANT THIS VARIABLE VALUE JUST THE NEXT BYTE AT THE END OF LAST UDG DIM BYTE LIKE THIS

ADDRESS       1  2  3  4   5   6   7   8     9  10   11  12   13   14   15   16        17
VALUE         0  1  3  7  15  31  63  127    1   2   4    7   15   31   63   127    myVariable
              --------------------      DIM UDG  -------------------------------

ZX Basic does not usually allow to change variables locations: this is the linker task, and currently ZX Basic linker is very... BASIC (pun intended). Unfortunately, single variables (like myVariable) are placed first. I will try to make ZX Basic to allocate global variables in the same order they are declared.

Also, this will be soon available:
Code:
DIM myVariable as UByte AT @udg(1, 7) + 1
Which will, effectively, declare myVariable at the first byte after the array, but it won't allocate the required byte (DIM ... AT, is just an alias for memory access).

I will investigate this.
A simpler way is to use PEEK and POKE I guess.
Reply


Messages In This Thread
RE: Is posible put a ubyte variable just after DIM - by boriel - 09-05-2021, 09:41 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)