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

int e l 4.36 DESCRIPTION OF STATEMENTS STATEMENTS: LD@ [expr] and ST@ [expr] (VERSION 1.1 ONLY) MODE: COMMAND AND/OR RUN TYPE: INPUT/OUTPUT ST@ The ST@ [expr] statement lets the user specify where MCS BASIC-52 floating point numbers are to be stored. The expression [expr] following the ST@ statement specifies the address of where the number is to be stored and the number is assumed to be on the argument stack. The ST@ [expr] statement is designed to be used in conjunction with the LD@ [expr] statement.

The purpose of these two statements is to allow the user to save floating point numbers anywhere in memory with the assumption that the user will employ some type of battery back-up or non-volatile scheme with this memory. LD@ The LD@ [expr] statement lets the user retrieve floating point numbers that were saved with the ST@ [expr] statement. The expression [expr] following the LD@ statement specifies where the number is stored and after executing the LD@ [expr] statement, the number is placed on the argument stack. EXAMPLE: Saving and retrieving a ten element array at location array at location 0F000H 10 REM *** ARRAY SAVE *** 20 FOR I = 0 TO 9 30 PUSH A(I) :

REM PUT ARRAY VALUE ON STACK 40 ST@ 0F005H+6*I : REM STORE IT, SIX BYTES PER NUMBER 50 NEXT I 60 REM *** GET ARRAY *** 70 FOR I = 0 TO 9 80 LD@ 0F005H+6*I 90 POP B(I) 100 NEXT I Remember that each floating point number requires 6 bytes of storage. Also note that expression in the ST@ [expr] and LD@ [expr] statements point to the most significant byte of the stored number. Hence. ST@ (0F005H) would save the number in locations 0F005H, 0F004H, 0F003H, 0F002H, 0F01H, and 0F000H. - 71 -