Call 77: protected variable storage – Rockwell Automation 1771-DB BASIC MODULE User Manual
Page 264
Chapter
Call Routines 69–127
13
13 -6
Use CALL 77 to reserve the top of RAM memory for protected variable
storage. Values are saved if you enabled CALL 74 (page13 -5).
You store values with the ST@ (page11 -35) statement and retrieve them
with the LD@ (page11 -18) statement. Each variable you store requires 6
bytes of storage space.
You must subtract 6 times the number of protected variables you are
storing from MTOP. This reduces the available RAM memory. PUSH this
value onto the stack as the new MTOP address. All appropriate variable
pointers are reconfigured. Do this only in Command mode to ensure
proper operation.
Important:
Use CALL 77 from Command mode only.
Do not let the ST@ address write over the MTOP address. This could
alter the value of a variable or string.
CALL 77 de-allocates all the string memory along with all the string
contents. Therefore, make sure you perform this call before execution
of the string statement.
Input and Output Arguments
This routine has one input argument and no output arguments. The input
argument is the new MTOP address.
Syntax
PUSH
new MTOP address
CALL 77
Example
>PRINT MTOP
14335
>PRINT MTOP-12 (2 VARIABLES TIMES 6 BYTES EACH)
14323
>PUSH 14323 (NEW MTOP ADDRESS)
>CALL 77
>10 K = 678 * PI
>20 L = 520
>25 PUSH K
>30 ST@ 14335:REM STORE K IN PROTECTED AREA
>40 PUSH L
>50 ST@ 14329
>55 REM TO RETRIEVE PROTECTED VARIABLES
CALL 77: Protected Variable
Storage