POKE (write to memory address)

Top  Previous  Next




Writes data to a memory address.


A numeric constant, variable, or expression (evaluated to a LONG) which specifies a memory address. This parameter should always use the ADDRESS procedure, to ensure the correct protected mode address is used.


The label of a variable.

The POKE statement writes the contents of the source variable to the memory address at address. POKE writes as many bytes as are in the source variable.

It is easily possible to create a General Protection Fault (GPF) if you POKE to an incorrect address, so great care should be taken when using POKE. There are usually Windows API functions that will do whatever you require of POKE and these should be used in preference to POKE.


MAddress         LONG

Source1          BYTE

Source2          SHORT

Source3          REAL

KeyboardFlag     BYTE



  POKE(ADDRESS(MAddress),Source1)  !Write 1 byte to the memory location

  POKE(ADDRESS(MAddress),Source2)  !Write 2 bytes to the memory location

  POKE(ADDRESS(MAddress),Source3)  !Write 8 bytes to the memory location


  KeyboardFlag = BOR(KeyboardFlag,40h)   !turn on caps lock

  POKE(ADDRESS(00400017h),KeyboardFlag)  !and put it back


See Also: