Close

VPOKE & VPEEK

A project log for LM80C Color Computer

A Z80 homebrew computer with 64KB SRAM & 32KB ROM (with BASIC), TMS9918A VDP (video) and AY-3-8910 PSG (audio)

leonardo-milianiLeonardo Miliani 06/15/2019 at 14:320 Comments

In the last days I've worked to expand the commands and functions of NASCOM BASIC by adding VPOKE & VPEEK.

VPOKE is a command that, as you can understand by the name, lets you write a value into a specific VRAM cell. VPEEK is a function that, obviously, reads a byte from a VRAM cell. These two are necessary because the LM80C firmware manages the cursor through an interrupt raised by a timer of the Z80 CTC: due to this way of working, at regular intervals the main code flow is interrupted and the cursor management code is executed. Since the VDP has a data buffer for reading and writing from/to the VRAM and since it also has an auto increment counter that, after the first read/write, automatically increments the address pointer, if you use OUTs and INs to write/read to the VRAM, you will experience glitches and graphical artifacts because the read/write operation you are making could be interrupted in the middle of its course by the cursor manager: this will lead to collisions between the two codes that make a VRAM access through the VDP and unpredictable side effects, like random chars that could appear on the screen or wrong data written into memory. 

VPOKE & VPEEK avoid this, since they disable interrupts before accessing the VRAM and re-enable them after they did their work.

The new firmware is marked R1.8 and is available for download from my Github repo.

Discussions