Close

Variables, Files and Instant ON

A project log for Terminal-BASIC programmable calculator

A poket-to-laptop size microcomputer/programmable calculator, based on Terminal-BASIC

ptravptrav 05/24/2020 at 12:320 Comments

After some major brain surgery, the RPN calculator understands BASIC variables

Variables' implementation

In the calculator, variable names may start with a letter or an underscore (_) and can further contain letters and numbers, such as: My_variable, _my_other_variable, _my_other_variable2, Catch_22.

As in the standard BASIC, the variable type is defined by name ending.

BASIC supports 4 variable arrangements:

Standard variables and Instant On

The following variables are always available (in the final version will be more):

If the SD card is inserted, during a power-down all standard and user-defined variables are stored on the card in the file named /_RPN_SaveStatus.bin Upon the power-up, the calculator is automatically restored to the state just before the power-down. If the card is not present during power-down, all user-defined variables and other settings are lost. Upon the power-up, only the standard variables will be present and will be initialized with defaults.

This allows keeping separate working environments on different SD cards. Or, in some cases, it is important to have no stored environments on the calculator - for example, for math exams.


Implementation details

The current variable space is defined in Variables.hpp as VARIABLE_SPACE = 32000 bytes.

Variables are placed in the variable space as following:

Then:

Or:

Or:

Discussions