POKE

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

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

Use with caution as Poking into the wrong location can cause problems.

POKE BYTE addr%, byte POKE BYTE will set the byte (ie, 8 bits) at the memory location 'addr%' to 'byte'. 'addr%' should be an integer.
POKE SHORT addr%, short% POKE SHORT will set the short integer (ie, 16 bits) at the memory location 'addr%' to 'word%'. 'addr%' and short%' should be integers.
POKE WORD addr%, word% POKE WORD will set the word (ie, 32 bits) at the memory location 'addr%' to 'word%'. 'addr%' and 'word%' should be integers.
POKE INTEGER addr%, int% POKE INTEGER will set the MMBasic integer (ie, 64 bits) at the memory location 'addr%' to int%'. 'addr%' and int%' should be integers.
POKE FLOAT addr%, float! POKE FLOAT will set the word (ie, 64 bits) at the memory location 'addr%' to 'float!'. 'addr%' should be an integer and 'float!' a floating point number.
POKE VAR var, offset, byte POKE VAR will set a byte in the memory address of 'var'. 'offset' is the ±offset from the address of the variable. An array is specified as var().
POKE VARTBL, offset, byte POKE VARTBL will set a byte in MMBasic's variable table. 'offset' is the ±offset from the start of the variable table. Note that a comma is required after the keyword VARTBL.

Example on the CMM2:

 sample$ = "The Colour Maximite 2 is the latest in a long series of microcomputers."
 
 startB = PEEK(VARADDR sample$)
 PRINT "          00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F"
 PRINT
 dump startB
 FOR k = 0 TO 255
   POKE BYTE startB+k,k
 NEXT k
 PRINT
 dump startB
 
 SUB dump(startblock)
 LOCAL INTEGER k,b,n
 LOCAL a$
 FOR k = 0 TO &h0f
   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 SUB
 
END

 

Last edited: 29 September, 2020