Skip to main content

__MAP__

Syntax


__MAP__   [CODE const_expression]  [CONST const_expression]  [DATA  const_expression]  [STRING  const_expression]

Description


__MAP__ tells the compiler to reserve space, by advancing the 4 pointers.   In all cases it must be a constant expression.  There is no error checking, so the user is responsible for the validity of the values. 

All of these values are byte values. For CODE sets the compiler program counter. CONST sets the pointer for constant strings and CONST arrays, it counts down from the end of Flash memory. Both of these addresses are byte addresses and are absolute.

DATA sets the pointer for INTEGER and SINGLE variables. STRING sets the pointer for arrays of BYTE, INTEGER or FLOAT and counts down from the end of the variable space.   These are byte addresses, but are relative to the space that BASIC allocates for variables.

When used with no parameters, the compiler will report where the various pointers are left following the compile.

This allows you to reserve space for Flash Write , or for implimenting program overlays.

Example


The values for the above map represent are based on the SuperPRO with 8.25 firmware.

The first program writes code to the first Flash sector then calls code in the second Flash sector

share_x = 22

share_y = 33

print "start the program and call overlay"

gosub start1

print "we are back"

print share_x

end ' if you don't have an END here or a loop the program will drop through into unprogrammed memory

__MAP__ CODE &H11000 CONST &H27000

start1:

print "in the overlay"

return

This program when run shows

start the program and call overlay

in the overlay

we are back

22

Now overlay the second Flash sector with this program

DIM
share_x ' to access global
variables in the original program, they must be declared in the
same order

DIM share_y

' if you declare anything that
would produce code before the __MAP__ you will overlay the 1st sector -- which
you don't want to do

__MAP__ CODE &H11000 CONST &H27000

start1:

'print "THIS IS A NEW OVERLAY"

share_x = share_y

return

Now when run it shows, and it shows the access to share_x was changed

start the program and call overlay

we are back

33

Differences from other BASICs

\

  • no equivalent in Visual BASIC
  • no equivalent in PBASIC

See also

\