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

int e l CHAPTER 9 Assembly Language Linkage 9.1 OVERVIEW NOTE: This section assumes that the designer has an understanding of the architecture and assembly language of the MCS-51 Microcontroller family!!! MCS BASIC-52 contains a complete library of routines that can easily be accessed with assembly language CALL instructions. The advantage of using assembly language is that it offers a significant improvement in execution speed relative to interpreted BASIC. In order to successfully interface MCS BASIC-52 with an assembly language program, the software designer must be aware of a few simple facts. READ THIS CAREFULLY!!! 1. MCS BASIC-52 uses REGISTER BANKS 0, 1, and 2 (RB0, RB1, and RB2).

REGISTER BANK 3 (RB3) is never used except during a PGM statement. RB3 is designated the USER REGISTER BANK and the users can do whatever they want to with REGISTER BANK 3 (RB3) and MCS BASIC-52 will never alter the contents of this REGISTER BANK except during the execution of a PGM statement. The contents of REGISTER BANK 3 (RB3) can be changed by executing a DBY ([expr]) = [0 to 255] statement. Where the [expr] evaluates to a number between 24 (18H) and 31 (1FH) inclusive. In addition, INTERNAL MEMORY LOCATIONS 32 (20H) and 33 (21 H) are also NEVER used by MCS BASIC-52. These two BIT and/or BYTE addressable locations are specifically reserved for assembly language programs. 2.

MCS BASIC-52 uses REGISTER BANK 0 (RB0) as the WORKING REGISTER FILE. Whenever assembly language is used to access MCS BASlC-52's routines, the WORKING REGISTER FILE, REGISTER BANK 0 (RB0) MUST BE SELECTED!!! This means that the USER MUST MAKE SURE THAT REGISTER BANK 0 (RB0) IS SELECTED BEFORE CALLING ANY OF MCS BASlC-52's ROUTINES. This is done simply by setting BITS 3 and 4 in the PSW equal to ZERO. If this is not done, MCS BASIC-52 will "KICK OUT" the USER and NO operation will be performed. When an ASSEMBLY LANGUAGE program is accessed by using the MCS BASlC-52's CALL instruction, REGISTER BANK 0 (RB0) will always be selected.

So unless the user selects REGISTER BANK 3 (RB3) in assembly language, it is NOT NECESSARY to change the designated REGISTER BANK. 3. ALWAYS ASSUME THAT MCS BASIC-52 DESTROYS THE CONTENTS OF THE WORKING REGISTER FILE AND THE DPTR, UNLESS OTHERWISE STATED IN FOLLOWING DOCU- MENTATION. 4. Certain routines in MCS BASIC-52 require that REGISTERS be initialized BEFORE the user CALLS that specific ROUTINE. These registers are ALWAYS in the WORKING REGISTER FILE, REGISTER BANK 0 (RB0). 5. Certain routines in MCS BASIC-52 return the result of an operation in a register or registers. The result registers are ALWAYS in the WORKING REGISTER FILE, REGISTER BANK 0, (RB0). - 104 -