Working with Pixels

Minicube64 uses a simple 64x64, 8 bits per pixel frame buffer. This can be any 4K page in memory, and may be changed at any time.
This makes drawing pixels to the screen very simple and easy.

Setting the Frame Buffer

Setting the VIDEO register instructs to set the visible screen at a specific 4K page in memory.
The immediate value we load refers to the high-byte of the desired memory address. This can be any value from $0 to $f. For example memory address $f000, we use #$f
lda #$f
sta VIDEO
We can also use the macro _setb #$f, VIDEO

Drawing a Pixel

The VIDEO buffer page is now set at 0xf000
With our frame-buffer defined we can start to draw pixels. To do this we simply write a value directly to a memory address within the 4K page we defined.
lda #63 ;white
sta $f820
We load the immediate value #63 into the Accumulator, and write (store) that value to 0xf820 which in this case is the middle of the screen.
You can also use in-line math functions to achieve the same result. In this case we start at the VIDEO page, add 32 multiplied by 64 for the Y position, and adding another 32 for the X position.
sta $f000+32*64+32
For example, this table shows what addresses correspond to each position of the screen, assuming the buffer is set to 0xf000
Address
Position
0xf000
Top Left
0xf03f
Top Right
0xf820
Middle
0xffc0
Bottom Left
0xffff
Bottom Right

Example

This example simply draws a white pixel in the middle of the screen.
org $200
sei
lda #63 ;white
sta $0820
Loop:
jmp Loop