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

int e l 4.32 DESCRIPTION OF STATEMENTS STATEMENTS: UI1 and UI0 (USER INPUT) MODE: COMMAND and/or RUN TYPE: CONTROL UI1 The UI1 statement permits the user to write specific console input drivers for MCS BASIC-52. After UI1 is executed BASIC will call external program memory location 4033H when a console input is requested. The user must provide a JUMP instruction to an ASSEMBLY LANGUAGE INPUT ROUTINE at this location. The appropriate ASCII input from this routine is placed in the 8052AH's accumulator and the user input routine returns back to BASIC by executing an ASSEMBLY LANGUAGE RET instruction.

The user must NOT modify any of the 8052AH's registers in the assembly language program with the exception of the MEMORY and REGISTER BANK allocated to the USER. THE ASSEMBLY LAN- GUAGE LINKAGE section of this manual explains what memory MCS BASIC-52 allocates to the user and how the user may allocate additional memory if needed. In addition to providing the INPUT driver routine for the UI1 statement, the user must also provide a CONSOLE STATUS CHECK routine. This routine checks to see if the CONSOLE DEVICE has a character ready for MCS BASIC-52 to read. BASIC CALLS external memory location 4036H to check the CONSOLE STATUS.

The CONSOLE STATUS ROUTINE sets the CARRY BIT to 1 (C = 1) if a character is ready for BASIC to read and CLEARS the CARRY BIT (C = 0) if no character is ready. Again, the contents of the REGISTERS must not be changed. MCS BASIC-52 uses the CONSOLE STATUS CHECK routine to examine the keyboard for a control-C character during program execution and during a program LISTING. This routine is also used to perform the GET operation. UI0 The UI0 statement assigns the console input console routine back to the software drivers resident on the MCS BASIC-52 device. UI0 and UI1 may be placed anywhere within a program.

This allows the BASIC program to accept inputs from different devices at different times. NOTE: The UI0 and UI1 function is controlled by BIT 30 (IEH) in the 8052AH's internal memory. BIT 30 is in internal memory location 35.6 (23.6H) i.e. the sixth bit in internal memory location 35 (23H). When BIT 30 is SET (BIT 30 = 1), the user routine will be called. When BIT 30 is CLEARED (BIT 30 = 0), the MCS BASIC-52 input driver routine will be used. The assembly language programmer can use this information to change the input device selection in assembly language. - 67 -