Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Out of memory when using uinteger array (*solved*)
#3
Darkstar Wrote:
Code:
' tn = TriangleNumber, mt = MaximumTriangles (# of), rn = RandomNumber, GraphicWidth, GraphicHeight, zn = ZeroNumber (Modifier) 'DIM udg(7) AS UBYTE => {0,1,3,7,15,31,63,127}
[...]
FirstPoint:
x(tn,4)=x(tn,2): y(tn,4)=y(tn,2): RETURN

This crashes after a few pixels drawn with an out of memory error while if you use float it works fine under
the latest version of the compiler. In version 1.2.6 uinteger works without a hitch. The compilation options are:
zxb Triangles.bas --optimize=2 --output=TRIANGLES.ASM --asm --org=24576 --array-base=1 --string-base=1 --heap-size=1024
zxbasm TRIANGLES.ASM --output=TRIANGLES --tap --BASIC --autorun
Sorry for this mega-delay (I'm alive), but I've been *REALLY* busy (okay, I went to NY for two weeks, but had lot of stuff piled up upon return). I will check this ASAP.

Quote:On to another subject, what is the correct syntax for "DIM udg(7) AS UBYTE => {0,1,3,7,15,31,63,127}"
as a multidimensional array? I tried "DIM ma(2,2) AS UBYTE => {1,4,6,2,0,55}" but it did not work.
Use "vector inside vectors":
Code:
DIM ma(1 TO 2, 2) AS UBYTE => {{1, 4, 6}, {2, 0, 55}}
Remember that arrays start from 0, so DIM(2, 2) is equivalent to DIM(0 TO 2, 0 TO 2) => 9 cells array.
You can read more about it here: <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:DIM">http://www.boriel.com/wiki/en/index.php/ZX_BASIC:DIM</a><!-- m -->
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)