Maker Pro
Maker Pro

VPOKE VPEEK

stuart sutherland

Jul 6, 2015
12
Joined
Jul 6, 2015
Messages
12
Hi,

I have a general questions about VPOKE and VPEEK of a register.
After POKE-ing a register with a value, do you have to subsequently PEEK the register for the POKE to work and effectively write the address to the register?

i.e) VPOKE 0001 FFFF -- This should write FFFF to address 0001.
Do you need to then VPOKE 0001 for FFFF to close out this command?
Or is the VPOKE command on its own enough?

I don’t know the way the computer terminology works so just looking for some more information.

Thanks,
Scott
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
Afaik Peek and Poke are independent.

In the case of I/O registers it may even happen that a PEEk following a POKE delivers a different value as I/O-addresses may be used for different purposes depending on I/O-read or I/O-write direction.
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Generically, PEEK and POKE are constructs of the BASIC computer programming language that allow reading (PEEK) and writing (POKE) of specific memory and/or register locations. Their implementation on specific hardware depends on the hardware and the BASIC interpreter or compiler used with that hardware. For example, some processors separate the program and data memory space from the input/output space, so a different pair of instructions, typically INP (addr) or OUT (addr), is required to access the I/O ports and registers.

The size of the data argument in the PEEK and POKE commands is usually an 8-bit byte (range from 0 to 0xFF), but it can be larger depending on the hardware and BASIC language compiler or interpreter. You need to tell us the specific hardware on which you are going to execute your VPEEK and VPOKE commands.

VPEEK and VPOKE may refer to read and write operations performed on video memory on a pixel-by-pixel basis. In general the command format is VPOKE addr, byte or VPEEK addr, byte where addr is a memory address and byte is the 8-bit value to be read or written to addr. VPOKE 0,FFFF would not be a legal construct for an 8-bit memory address, but again this depends on your specific hardware. You also need to know what the default radix is for your BASIC interpreter or compiler. The most common default radix is base 10, meaning hexadecimal representations that include the letters a, b, c, d, e, and f will not be recognized unless qualified by a radix prefix or suffix. Worse that that, hexadecimal numbers that do not include letters will be interpreted as decimal values if the default radix is base 10.

If VPEEK and VPOKE do indeed refer to video memory, you may not be able to see their effect on your monitor unless a entire group of nearby pixels is written with a contrasting value different from the background pixel values.
 
Top