intel MCS BASIC-52 — Intel MCS BASIC-52 Versions 1 & 1.1 Operating and Reference Manual PDF

int e l 9.1 OVERVIEW READ THIS CAREFULLY!!! 6. MCS BASIC-52 loads the INTERNAL STACK POINTER (SPECIAL FUNCTION REGISTER- SP) with the value that is in INTERNAL MEMORY LOCATION 62 (3EH). MCS BASIC-52 initializes INTERNAL MEMORY LOCATION 62 (3EH) by writing a 77 (4DH) to this location after a hardware RESET. MCS BASIC-52 does NOT use any memory beyond 77 (4DH) for anything EXCEPT STACK SPACE. If the user wants to ALLOCATE some additional internal memory for their application, this is done by changing the contents of INTERNAL MEMORY LOCATION 62 (3EH) to a value that is GREATER than 77 (4DH).

This will allocate the INTERNAL MEMORY LOCATIONS from 77 (4DH) to the value that is placed in INTERNAL MEMORY LOCATION 62 (3EH) to the user. As a guideline, it is a good idea to allow at least 48 (30H) bytes of stack space for MCS BASIC-52. The bad news about reducing the stack space is that it will reduce the amount of nested parentheses that MCS BASIC-52 can evaluate in an expression [expr]. This will either cause a I-STACK ERROR or will cause a fatal CPU "crash." Use caution and DON'T allocate more memory than you need. EXAMPLE OF THE EFFECTS OF ALTERING THE STACK ALLOCATION:

COMMENTS >PRINT DBY(62) AFTER RESET INTERNAL MEMORY LOCATION 6 77 CONTAINS A 77 >PRINT (1*(2*(3))) BASIC HAS NO PROBLEM EVALUATING 3 LEVELS 6 OF NESTED PARENRHESIS >DBY(62)=230 NOW ALLOCATE 255-230 = 25 BYTES OF STACK SPACE TO BASIC, REMEMBER, THE STACK ON >PRINT (1*(2*(3))) THE 8052AH GROWS "UP" ERROR: I-STACK BASIC CANNOT EVALUATE THIS EXPRESSION READY BECAUSE IT DOES NOT HAVE ENOUGH STACK >DBY(62)=210 NOW ALLOCATE 255-210 = 45 BYTES OF STACK SPACE TO BASIC >PRINT (1*(2*(3))) THE I-STACK ERROR GOES AWAY 6 7. Throughout this section a 16-BIT REGISTER PAIR is designated-Rx:Ry, where Rx is the most sig- nificant byte and Ry is the least significant byte. EXAMPLE:

R3:R1 - R3=MOST SIGNIFICANT BYTE. R1=LEAST SIGNIFICANT BYTE - 105 -