There are around 100 tutorials/tests/examples under the gbas folder, they document every gtBASIC function and statement.
Use % in your variable name and it will be a byte array instead of a word array, *NOTE* you only use the % during declaration, i.e. only during the DIM statement.
The DEF command is quite complicated and extremely powerful, it lets you create powerful LUT's using high level C math functions and loops, there are many examples in the gbas folder.
Code: Select all
_runtimePath_ "../gbas/runtime"
_codeRomType_ ROMvX0
dim msg%(237) = 2,168,0,40,40,8,136,137,100,170,170,72,0,0,0,0,12,0,0,52,0,0,52,0,0,84,0,0,124,0,0,0,0,195,140,48,128,3,32,209,140,52,251,239,190,0,0,0,16,0,4,0,0,0,8,0,2,248,0,62,0,0,0,195,14,48,128,128,32,208,199,52,251,239,190,0,0,0,16,48,4,0,48,0,8,48,2,248,48,62,0,48,0,32,16,8,16,48,16,12,48,32,3,16,192,0,51,0,3,16,192,12,48,32,16,32,16,32,48,8,64,48,8,64,16,16,32,32,32,16,0,192,12,3,0,35,172,0,32,32,0,32,248,0,33,116,182,2,114,126,184,112,110,0,80,118,32,80,126,32,80,96,32,216,0,0,0,0,56,32,0,58,138,170,56,2,168,0,2,128,0,248,0,3,254,0,14,3,128,24,0,192,52,1,96,102,3,48,69,5,16,68,137,16,4,81,0,4,33,0,4,1,0,1,40,0,121,244,240,0,0,0
cls
loop:
x = 0 : y = x : xx = y
repeat
c = rnd(0) AND 63 : cc = NOT c
for i=0 &to 236
digit = msg(i)
for j=0 &to 7
xxx = xx+x+j
if (digit AND 128)
pset xxx, y, cc
else
pset xxx, y, c
endif
digit = digit LSL 1
next j
x = x + 8
if x.lo &&> 23
x = 0
y = y + 1
endif
next i
y = 0
xx = xx + 25
until xx.lo &&>= 150
goto &loop
ROMv4: compiles to a 597 byte gt1 file.
ROMv5a: compiles to a 582 byte gt1 file.
ROMvX1: compiles to a 488 byte gt1 file and is about 2.5x times faster.