Warning

You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
variables [2019/06/27 07:45] neilsvariables [2019/08/01 12:20] – [Scope] neils
Line 16: Line 16:
   let b = 2   let b = 2
  
 +===== Fast variables =====
 +
 +Since version 2.1, some variables can be placed on the zeropage for faster load/store operations. You can use the ''DIM'' directive to define a variable as fast variable, for example:
 +
 +  dim myFastVar fast
 +  
 +This is limited however (max 15 bytes currently). The compiler will emit a warning if no more variables can be placed on the zeropage.
 ===== Types ===== ===== Types =====
  
Line 99: Line 106:
 Variables, constants and labels can be global or local. Variables, constants and labels can be global or local.
  
-Any variable or constant declared using a ''CONST'', ''LET'', ''DIM'' or ''DATA'' statement outside a ''PROC ... ENDPROC'' pair is considered to be a global variable and can only be accessed from the global scope. Global variables are accessible from within a procedure by using the global modifier (''\'').+Any variable or constant declared using a ''CONST'', ''LET'', ''DIM'' or ''DATA'' statement outside a ''PROC ... ENDPROC'' pair is considered to be a global variable and are only accessible within a procedure by using the global modifier (''\'').
  
 Any variable or constant declared using a ''CONST'', ''LET'', ''DIM'' or ''DATA'' statement inside a ''PROC ... ENDPROC'' pair, including the procedure's parameters, is considered to be a local variable and can only be accessed within that procedure. Any variable or constant declared using a ''CONST'', ''LET'', ''DIM'' or ''DATA'' statement inside a ''PROC ... ENDPROC'' pair, including the procedure's parameters, is considered to be a local variable and can only be accessed within that procedure.