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

int e l 9.2 GENERAL PURPOSE ROUTINES COMMENTS ON THE NEXT TWO INSTRUCTIONS: The next two instructions permit the user to transfer floating point numbers between an assembly language program and MCS BASIC-52. The user provides the address where a floating point number is stored or will be stored in a 16-bit REGISTER PAIR. Depending on the operation requested, the floating point numbers are either PUSHED ON or POPPED OFF MCS BASlC-52's ARGUMENT STACK. This instruction permits the user to keep track of variables in assembly language and bypass the relatively slow procedure BASIC must follow.

As mentioned earlier, when a floating point number is PUSHED onto the ARGUMENT STACK, the ARGUMENT STACK POINTER is decremented by a count of 6. This is because a floating point number requires 6 bytes of RAM storage. Although it may seem confusing to the novice, the LAST value placed on the ARGUMENT STACK is referred to as the value on the TOP of the ARGUMENT STACK, even though it is on the BOTTOM of the STACK relative to the sequential numbering of memory addresses. No one knows why this is so. The ARGUMENT STACK resides in EXTERNAL RAM MEMORY LOCATIONS 301 (12DH) through 510 (1FEH). The lower BYTE of the ARGUMENT STACK POINTER resides in INTERNAL MEMORY LOCATION 9 (09H).

MCS BASIC-52 always assumes that the upper BYTE (higher order address) of the ARGUMENT STACK POINTER is 1 (01H). The software designer can use this information, along with the next two instructions to perform operations like copying the stack. OPBYTE = 2 (02H) PUSH THE FLOATING POINT NUMBER ADDRESSED BY REGISTER PAIR R2:R0 ONTO THE ARGUMENT STACK. R2 and R0 (in REGISTER BANK 0, RB0) contain the ADDRESS (R2 = high byte, R0 = low byte) of the location where the floating point number is stored. After this instruction is executed the floating point number that the REGISTER PAIR R2:R0 points to is PUSHED onto the TOP of the ARGUMENT STACK.

The ARGUMENT STACK POINTER automatically gets DECREMENTED, by a count of 6, when the value is placed on the stack. A floating point number in MCS BASIC-52 requires 6 BYTES of RAM storage. The register Pair R2:R0 points to the MOST SIGNIFICANT BYTE of the floating point number and is DECREMENTED BY 6 after the CALL instruction is executed. So, if R2:R0 = 7F18H before this instruction was executed, it would equal 7F12H after this instruction was executed. - 107 -