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

int e l 4.4 DESCRIPTION OF STATEMENTS STATEMENTS: CLEARI (clear interrupts) CLEARS (clear stacks) MODE: COMMAND AND/OR RUN TYPE: CONTROL CLEARI The CLEARI STATEMENT clears all of the BASIC evoked interrupts. Specifically, the ONTIME and ONEX1 interrupts are DISABLED after the CLEARI STATEMENT is executed. This is accomplished by clearing bits 2 and 3 of the 8052AH's special function register, IE and by clearing the status bits that determine whether MCS BASIC-52 or the user is controlling these interrupts. The real time clock which is enabled by the CLOCK1 STATEMENT is not affected by CLEARI.

This statement can be used to selectively DISABLE interrupts during specific sections of the users BASIC program. The ONTIME and/ or ONEX1 STATEMENTS MUST BE EXECUTED AGAIN before the specific interrupts will be enabled. CLEARS The CLEARS statement RESETS all of MCS BASlC-52's STACKS. The CONTROL and ARGUMENT STACKS are reset to their initialization value, 254 (0FEH) and 510 (1FEH) respectively. The INTERNAL STACK (the 8052AH's STACK POINTER, SPECIAL FUNCTION REGISTER-SP) is loaded with the value that is in INTERNAL RAM location 62 (3EH). This statement can be used to "purge" the stack should an error occur in a subroutine.

In addition, this statement can be used to provide a "special" exit from a FOR-NEXT, DO-WHILE, or DO-UNTIL loop. EXAMPLE OF CLEARS: >10 PRINT "MULTIPLICATION TEST. YOU HAVE 5 SECONDS" >20 FOR I = 2 TO 9 >30 N = INT(RND*10) : A - N*I >40 PRINT "WHAT IS ",N,"*",I,"?": CLOCK1 >50 TIME = O : ONTIME 5,200 : INPUT R : IF R A THEN 100 >60 PRINT "THAT'S RIGHT" TIME=0 : NEXT I >70 PRINT "YOU DID IT. GOOD JOB" : END >100 PRINT "WRONG - TRY AGAIN" : GOTO 50 >200 REM WASTE CONTROL STACK, TOO MUCH TIME >210 CLEARS : PRINT "YOU TOOK TOO LONG" : GOTO 10 NOTE: When the CLEARS and CLEARI STATEMENTS are LISTED they will appear as CLEAR S and CLEAR I respectively.

Don't be alarmed, that is the way it's supposed to work. - 31 -