QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The _MEMPUT statement writes data to a portion of a designated memory block at an OFFSET position.

Syntax

_MEMPUT memoryBlock, bytePosition, sourceVariable [AS type]

Parameter(s)

Description

Example(s)

_MEMPUT can be used just like POKE without DEF SEG.


DIM o AS _MEM
o = _MEM(d&)
_MEMPUT o, o.OFFSET + 1, 3 AS _UNSIGNED _BYTE  'POKE
v = _MEMGET(o, o.OFFSET + 1, _UNSIGNED _BYTE) 'PEEK
PRINT v 'prints 3
PRINT d& 'print 768 because the 2nd byte of d& has been set to 3 or 3 * 256 

See Also