Z80 Assembly programming for
the ZX81!
The ZX81 was one of the earliest
affordable home computers, and was actually the first computer my
family owned!
While my only memories of it was it crashing while loading hangman,
we can have some fun learning about this early Z80 computer! |
 |
 |
 |
|
ZX81 |
| Cpu |
Z80 3.25mhz |
| Ram |
1k (!) 32k upgradable |
| Vram |
ha! (768 bytes) |
| Resolution |
32x24 characters |
| Charset |
64 characters + Inverse |
| Colors |
Black and white |
| Sound |
None |
|

|
The Keyboard Layout
Reading the keyboard
We can read in a row of the keyboard by setting BC to the correct value
and using IN A,(C)... the resulting byte will contain a 0 if the key is
pressed, 1 if it is not.
|
C=
&FE |
| B=... |
4
|
3
|
2
|
1
|
0
|
| %11111110 |
V |
C |
X |
Z |
SHIFT |
| %11111101 |
G |
F |
D |
S |
A |
| %11111011 |
T |
R |
E |
W |
Q |
| %11110111 |
5 |
4 |
3 |
2 |
1 |
| %11101111 |
6 |
7 |
8 |
9 |
0 |
| %11011111 |
Y |
U |
I |
O |
P |
| %10111111 |
H |
J |
K |
L |
ENTER |
| %01111111 |
B |
N |
M |
DEL |
SPC |
The Character Map
Below are the visible characters... Note that basic commands and other
functions are also 'characters', the most important is &76 (118) which
is NewLine - we need this for the 'Display File' (Screen Ram)

Ports
| Port |
|
Purpose |
| FB |
W |
Printer Write |
| FB |
R |
Printer Read |
| FD |
W |
Disable NMI (used for FAST mode) |
| rrFE |
R |
Init Vertical Retrace / Casette out LOW / Read
Keyboard row rr |
| FE |
W |
Enable NMI (used for SLOW mode) |
| FF |
W |
Terminate Vertical Retrace and Restart LineCTR /
Cassette out HIGH |
Memory Map
| From |
To |
Purpose |
| 0000 |
3FFF |
ROM |
| 4000 |
4008 |
System Vars |
| 4009 |
407C |
P-File save area |
| 407D |
43FF |
1K RAM |
| 4400 |
FFFF |
16K+ Ram upgrade |
VRAM is at the end of your basic program, it's address is stored at
&400C
|
Buy my Assembly programming book on Amazon in Print or Kindle!



Available worldwide! Search 'ChibiAkumas' on your local Amazon website!
Click here for more info!
Buy my Assembly programming book on Amazon in Print or Kindle!



Available worldwide! Search 'ChibiAkumas' on your local Amazon website!
Click here for more info!
Buy my Assembly programming book on Amazon in Print or Kindle!



Available worldwide! Search 'ChibiAkumas' on your local Amazon website!
Click here for more info!
|