int e l 1.4 DEFINITION OF TERMS STACK STRUCTURE: MCS BASIC-52 reserves the first 512 bytes of EXTERNAL DATA MEMORY to implement two "soft- ware" stacks. These are the control stack and the arithmetic stack or ARGUMENT STACK. Understanding how the stacks work in MCS BASIC-52 is NOT NECESSARY if the user wishes only to program in BASIC. However, understanding the stack structure is necessary if the user wishes to link MCS BASIC-52 to ASSEMBLY language routines. The details of how to link to assembly language are covered in the ASSEMBLY LANGUAGE LINKAGE section of this manual. CONTROL STACK -- The control stack occupies locations 96 (60H) through 254 (0FEH) in external ram memory.
This memory is used to store all information associated with loop control (i.e. DO- WHILE, DO-UNTIL, and FOR-NEXT) and basic subroutines (GOSUB). The stack is initialized to 254 (OFEH) and "grows down." ARGUMENT STACK -- The ARGUMENT STACK occupies locations 301 (12DH) through 510 (1FEH) in external ram memory. This stack stores all constants that MCS BASIC-52 is currently using. Operations such as ADD, SUBTRACT, MULTIPLY, and DIVIDE always operate on the first two numbers on the ARGUMENT STACK and return the result to the ARGUMENT STACK. The argument stack is initialized to 510 (1FEH) and "grows down" as more values are placed on the ARGUMENT STACK.
Each floating point number placed on the ARGUMENT STACK requires 6 BYTES of storage. INTERNAL STACK -- The stack pointer on the 8052AH (SPECIAL FUNCTION REGISTER, SP) is initialized to 77 (4DH). The 8052AH's stack pointer "grows up" as values are placed on the stack. In MCS BASIC-52 the user has the option of placing the 8052AH's STACK POINTER anywhere (above location 77) in internal memory. The details of how to do this are covered in the ASSEMBLY LANGUAGE LINKAGE section of this manual. LINE EDITOR: MCS BASIC-52 contains a minimum level line editor. Once a line is entered the user may not change the line without re-typing the line.
However, it is possible to delete characters while a line is in the process of being entered. This is done by entering a RUBOUT or DELETE character (7FH). The RUBOUT character will cause the last character entered to be erased from the text input buffer. Additionally, a control-D will cause the entire line to be erased. In Version 1.1 of MCS BASIC-52, Control-Q (X-ON) and Control S (X-OFF) recognition have been added to the serial port. The user is cautioned not to accidentally type a Control-S when entering information because the MCS BASIC-52 will no longer respond to the console device. Control-Q is used to bring the console device back to life after Control-S is typed.
NOTE -- In this document a carriage return is indicated by the symbol (cr). The carriage return is the RETURN key on most keyboards. - 8 -