11.07.2015 Views

PICBASIC PLUS LITE Manual - Profe Saul

PICBASIC PLUS LITE Manual - Profe Saul

PICBASIC PLUS LITE Manual - Profe Saul

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>PICBASIC</strong> <strong>PLUS</strong> Compiler5.59. RESTORESyntax :Overview :Operators :Example :RESTORE ValueMoves the pointer in a DATA table to the position specified by valueValue can be a constant, variable, or expression.DIM IDATA 5 , 8 , ”fred” , 12RESTOREREAD I‘ I will now contain the value 5READ I‘ I will now contain the value 8RESTORE 3‘ Pointer now placed at location 4 in our data table i.e. “r”READ I‘ I will now contain the value 114 i.e. the ‘r’ character in decimalThe data table is defined with the values 5,8,102,114,101,100,12 as“fred” equates to f:102,r:114,e:101,d:100 in decimal. The table pointeris immediately restored to the beginning of the table. This is not alwaysrequired but as a general rule, it is a good idea to prevent tablereading from overflowing.The first READ, I takes the first item of data from the table and incrementsthe table pointer. The next READ, I therefore takes the seconditem of data.RESTORE 3 moves the table pointer to the fourth location (first locationis pointer position 0) in the table - in this case where the letter ‘r’is. READ I now retrieves the decimal equivalent of ‘r’ which is 114.See also :CDATA, CREAD, CWRITE, DATA, LOOKUP, READ111Copyright Crownhill 2001

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!