@FieldDoc
Global variables can be modified and their values retrieved anywhere in the code
You have to define them first:
global variablename
Optionally you can set the type
global variablename as type
Memblocks are a sequence of bytes (one byte 0..255) cannot be passed in or out of functions, but you can store data in them.
For example, if I wanted to put 4 numbers out of a function (here I am only using one byte per number, but you can use more if you want larger numbers, WRITE MEMBLOCK DWORD will give you up to 4 billion!)
MakeDWORD(50,100,150,255,1)
do
`The modified data is now stored in the memblock
`We now use the memblock commands to read the values back
print GetNumber(1,1)
print GetNumber(1,2)
print GetNumber(1,3)
print GetNumber(1,4)
sync
loop
function MakeDWORD(First,Second,Third,Fourth,Mem)
Make Memblock Mem,4
`Here we do alter the inputed numbers somehow just to demonstrate, in this case I just take 10 off each one
Write Memblock Byte Mem,0,First-10
Write Memblock Byte Mem,1,Second-10
Write Memblock Byte Mem,2,Third-10
Write Memblock Byte Mem,3,Fourth-10
endfunction
function GetNumber(memblocknum,position)
Result = Memblock Byte(memblocknum,position-1)
endfunction Result
OK... I think that's enough DBP work for now...