I am trying to write a routine to print large sprites using small tile pieces.
Anyway, I am having some problems with GLOBAL and SHARED variables.
I've reduced the code to a very basic example.
Code: Select all
OPTION EXPLICIT ON
DIM a AS BYTE
PROCEDURE testProc
SHARED a
PRINT a
END PROCEDURE
a=8
CALL testProc
However, this code:
Code: Select all
OPTION EXPLICIT ON
GLOBAL a AS BYTE
PROCEDURE testProc
PRINT a
END PROCEDURE
a=8
CALL testProc
undefined variable (OPTION EXPLICIT ON) (a)
If I set OPTION EXPLICIT OFF, the program compiles, and works as expected.
But that removes the desired benefits of using OPTION EXPLICIT.
Does GLOBAL only work when OPTION EXPLICIT is OFF?