PEEK(  )

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 CMM2

Description:
Will return a byte or a word within the CPU’s virtual memory space.

Each device has a different set of available memory locations to PEEK
Note that 'addr%' should be an integer.

PEEK(BYTE addr%) BYTE will return the byte (8-bits) located at 'addr%'
PEEK(SHORT addr%) SHORT will return the short integer (16-bits) located at 'addr%'
PEEK(WORD addr%) WORD will return the word (32-bits) located at 'addr%'
PEEK(INTEGER addr%) INTEGER will return the integer (64-bits) located at 'addr%'
PEEK(FLOAT addr%) FLOAT will return the floating point number (64-bits) located at 'addr%'
PEEK(VARADDR var) VARADDR will return the address (32-bits) of the variable 'var' in memory. An array is specified as var().
PEEK(VARHEADER var) VARHEADER will return the address (32-bits) of the variable descriptor of the variable var in memory. An array is specified as var()
PEEK(VAR var, ±offset) VAR, will return a byte in the memory allocated to 'var'. An array is specified as var().
PEEK( VARTBL, ±offset) VARTBL, will return a byte in the memory allocated to the variable table maintained by MMBasic. Note that there is a comma after VARTBL.
PEEK( PROGMEM, ±offset) PROGMEM, will return a byte in the memory allocated to the program. Note that there is a comma after the keyword PROGMEM.

On the CMM2:

sample1$ = "Sample1 string was declared first! Variables are allocated memory starting at the top."
sample2$ = "The Colour Maximite 2 is the latest in a long series of microcomputers."

startBlock = peek(varaddr sample2$)
 print
 print "          00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F"
 for k = 0 to &h1f
   a$ = "   "
   print hex$(startblock+k*16,8);"  ";
   for n = 0 to 15
     b = peek(byte startBlock+n+k*16)
     print hex$(b,2);" ";
     if b > 31 and b < 128 then
       a$ = a$ + chr$(b)
     else
       a$ = a$ + "."
     endif
   next n
   print a$
 next k
 end

 

Last edited: 15 December, 2020