'{$STAMP BS2pe} '{$PBASIC 2.5} ' (c) 2003 Tracy Allen, http://www.emesystems.com ' explores the PBASIC 2.5 commands ' word READ - WRITE - GET - PUT ' ' to use this program as a study guide, ' Enter alternative program cases after #DEFINE below ' then look at tokens using CTRL-M memory map window ' Scroll to the bottom of the window to the red area. #DEFINE example=10 ' 10 READ word using PBASIC 2.5 ' 11 same tokens as 10, but using old PBASIC ' 20 WRITE word constant using PBASIC 2.5 ' 21 same tokens as 20, but using old PBASIC ' 22 WRITE word variable with expressions using PBASIC 2.5 ' 23 same tokens as 22, but using old PBASIC ' 30 GET word using PBASIC 2.5 ' 31 same tokens as 30, but using old PBASIC ' 40 PUT word constant using PBASIC 2.5 ' 41 same tokens as 40, but using old PBASIC ' 42 PUT word variable with expressions using PBASIC 2.5 ' 43 same tokens as 42, but using old PBASIC mydata DATA word 12345, word 0 ' eeprom data myscram CON 0 ' scratchpad data x VAR Word #SELECT example #CASE 10 ' READ word using PBASIC 2.5 READ mydata, word x ' read a word #CASE 11 ' same tokens as 10, using old PBASIC READ mydata, x ' note: least byte first READ mydata+1, x.byte1 ' note: +1 at run time #CASE 20 ' WRITE constant using PBASIC 2.5 WRITE mydata, word $1234 ' save it at the next word address #CASE 21 ' same tokens as 20, using old PBASIC WRITE mydata, $1234 ' low byte $34 is written WRITE mydata+1, $1234>>8 ' high byte $12 is written to address+1 #CASE 22 ' WRITE variable, expression using PBASIC 2.5 WRITE mydata+2, word x*2 ' note expression here in both address and data #CASE 23 ' same tokens as 22, using old PBASIC WRITE mydata+2, x*2 ' writes low byte WRITE mydata+2+1, x*2>>8 ' writes high byte, note: no optimization #CASE 30 ' GET word using PBASIC 2.5 GET myscram, word x #CASE 31 ' same tokens as 30, using old PBASIC GET myscram, x GET myscram+1, x.byte1 #CASE 40 ' PUT word constant using PBASIC 2.5 PUT myscram, word $1234 #CASE 41 ' same tokens as 40, using old PBASIC PUT mydata, $1234 ' low byte $34 is written PUT mydata+1, $1234>>8 ' high byte $12 is written #CASE 42 ' PUT variable, expression using PBASIC 2.5 PUT mydata+2, word x*2 ' note expression in both address and data #CASE 43 ' same tokens as 42, using old PBASIC PUT mydata+2, x*2 ' writes low byte PUT mydata+2+1, x*2>>8 ' writes high byte, note: no optimization #ENDSELECT