Coding Guide - OfficialPixelBrush/Pix80 GitHub Wiki
Necessary Knowledge
You'll need to know the basics of reading & writing Z80 Assembly, and while there are lots of resources for Programming it online, I think the best way to learn it is by just playing around with it to see what everything does! Here's the pages I reference the most.
Another useful skill would be ability to read Hexadecimal and Binary Values, but this isn't a necessity.
Code Samples
Note: These Code samples can become outdated very quickly as the Pix80 evolves
REDPANDA
A simple Program that displays a spinning, monochrome Red Panda on the left side of the display, explaiming "Hello, world!"
It utilizes the 20x4 Character LCD.
Memory
Memory Map
The Default Memory Map of the Pix80 is extremely simplistic, simply splitting the RAM and ROM space in half, giving access to 32kB of ROM and 32kB of RAM.
For accessing Extended Memory, the lower half of RAM can be banked, allowing access to, for example, more I/O Devices, Graphics, or General Memory. More on Extended Memory is under Extended Memory
Default Memory Map
0x0000- 0x8000-
0x7FFF 0xFFFF
_______________________________
| | | | |
| ROM | ROM | RAM | RAM |
|_______|_______|_______|_______|
Extended Memory
Extended Memory allows the Pix80 to access more memory than is usually available to a Z80. This is made possible by using Memory Banks, where one Bank is 16kB big.
Important to Note about Coding Software, or designing Hardware, that takes advantage of the Extended Memory System is the following:
- the ROM remains unchanged, no matter what Bank is selected
- the last 16kB of RAM remain unchanged, no matter what Bank is selected
- Bank 0 is always the on-board RAM of the Pix80
- to enable Extended Memory, the Expansion Jumper (labelled as EXPJMP on the Schematic) must be shorted to 5V (this may be subject to change)
Truth Table for Expanded Memory
- represents either logic low or high
0 represents logic low
1 represents logic high
MREQ, BANK0, CSROM and CSRAM are active low,
while EXPJMP, A15 and A14 are active high.
| MREQ | EXPJMP | BANK0 | A15 | A14 | CSROM | CSRAM |
|---|---|---|---|---|---|---|
| 0 | - | - | 0 | - | 0 | 1 |
| 0 | - | 0 | 1 | - | 1 | 0 |
| 0 | 0 | 1 | 1 | - | 1 | 0 |
| 0 | 1 | 1 | 1 | 0 | 1 | 1 |
| 0 | 1 | 1 | 1 | 1 | 1 | 0 |
| 1 | - | - | - | - | 1 | 1 |
Example Extended Memory Map
0x0000- 0x8000- 0xC000-
0x7FFF 0xBFFF 0xFFFF
_______________________________
| | | | |
| ROM | ROM | RAM | RAM |
|_______|_______|_______|_______|
| |
Bank #1 | RAM |
|_______|
| |
Bank #n : :
I/O
I/O is implemented using a simple, but efficient system, utilizing Address Pins A5-A7 to address I/O Devices, theoretically allowing 16 or more Devices.
A4-A0 can be used for whatever the relevant Software/Hardware desires, be it different Memory Banks or Sub-Devices.
A5-A7 switch between different Main Devices.
_______
A7 ---| |=== =
A6 ---| Demux |=== =
A5 ---| |=== =
|_______|=== =
A4 --------------- -
A3 --------------- -
A2 --------------- -
A1 --------------- -
A0 --------------- -