Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Declaring arrays with constants (*solved*)
#7
nitrofurano Wrote:
LTee Wrote:...
Code:
'constants
const DGMAXX as ubyte = 10
const DGMAXY as ubyte = 10

'dungeon data
dim dgConnected(DGMAXY, DGMAXX) as ubyte
...

well, i think what i’m really missing is this:
Code:
dim dgConnected(DGMAXY, DGMAXX) as ubyte at $E000
(just like as we do for allocating variables to different memory addresses)

so that would take around 121 bytes (11*11 (i guess it’s 11, because it is an array from 0 to 10?) ) starting from $E000 - i’m needing this a lot, because when we patch ZX-Basic resulting binaries to rom files (such as on cartridge roms for Sega 8-bit consoles, ColecoVision, MSX, etc.), we really need to use peeks and pokes instead of arrays, since we can’t allocate arrays outside the rom area

i really have no idea how difficult would be implementing it

I'm working on this. Basically, using Dynamic arrays. The problem is arrays also use a dimension table to calculate offset. And it always precedes the data.
For dynamic arrays I think the best way is to put the dimension table at the end. Dynamic arrays are created on runtime (just like in basic) and can change the dimension during the execution.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)