| 1 |
44 |
rrred |
Z80 Computer on DE1 Development board
|
| 2 |
|
|
|
| 3 |
|
|
Arquitecture
|
| 4 |
|
|
------------
|
| 5 |
|
|
|
| 6 |
|
|
SW9 - Reserved - Reset
|
| 7 |
|
|
SW8 - Reserved
|
| 8 |
|
|
LEDR9 - Reserved
|
| 9 |
|
|
LEDR8 - Reserved
|
| 10 |
|
|
|
| 11 |
|
|
Memory
|
| 12 |
|
|
------
|
| 13 |
|
|
0000H - 3FFFH - ROM
|
| 14 |
|
|
4000H - 52BFH - VIDEO RAM
|
| 15 |
|
|
52C0H - 57FFH - System Variables
|
| 16 |
|
|
5800H - 5FFFH - Characters RAM
|
| 17 |
|
|
6000H - FFFFH - RAM memory
|
| 18 |
|
|
|
| 19 |
|
|
Registers
|
| 20 |
|
|
---------
|
| 21 |
|
|
52C0H - Z80SOC VERSION (0 = DE1, 1 = S3E)
|
| 22 |
|
|
|
| 23 |
|
|
IO (Ports)
|
| 24 |
|
|
----------
|
| 25 |
|
|
|
| 26 |
|
|
01H - Out - Green Leds (7-0)
|
| 27 |
|
|
02H - Out - Red Leds (7-0)
|
| 28 |
|
|
10H - Out - HEX3 - HEX2
|
| 29 |
|
|
11H - Out - HEX1 - HEX0
|
| 30 |
|
|
20H - In - SW(7-0)
|
| 31 |
|
|
30H - In - KEY(3-0)
|
| 32 |
|
|
80H - In - PS/2 keyboard
|
| 33 |
|
|
|
| 34 |
|
|
GPIO Expansion pins
|
| 35 |
|
|
-------------------
|
| 36 |
|
|
All write operations to GPIO are buffered.
|
| 37 |
|
|
To write the buffered signals to the pins, the Z80 must
|
| 38 |
|
|
write any value to port C0 (GPIO0) or C1 (GPIO1)
|
| 39 |
|
|
|
| 40 |
|
|
A0 - GPIO0 (7-0)
|
| 41 |
|
|
A1 - GPIO0 (15-8)
|
| 42 |
|
|
A2 - GPIO0 (23-16)
|
| 43 |
|
|
A3 - GPIO0 (31-24)
|
| 44 |
|
|
A4 - GPIO0 (35-32)
|
| 45 |
|
|
|
| 46 |
|
|
B0 - GPIO1 (7-0)
|
| 47 |
|
|
B1 - GPIO1 (15-8)
|
| 48 |
|
|
B2 - GPIO1 (23-16)
|
| 49 |
|
|
B3 - GPIO1 (31-24)
|
| 50 |
|
|
B4 - GPIO1 (35-32)
|
| 51 |
|
|
|
| 52 |
|
|
C0 - GPIO0 Write
|
| 53 |
|
|
C1 - GPIO1 Write
|
| 54 |
|
|
|
| 55 |
|
|
|
| 56 |
|
|
--
|
| 57 |
|
|
|
| 58 |
|
|
Reference sample ROM (for version 0.7.1a and 0.7.2)
|
| 59 |
|
|
It is provided a sample rom which demonstrate how to access the hardware using C language.
|
| 60 |
|
|
All needed low-level functions are also provide:
|
| 61 |
|
|
- crt0.s
|
| 62 |
|
|
- putchar
|
| 63 |
|
|
- getchar
|
| 64 |
|
|
- 7 segment displays
|
| 65 |
|
|
- leds
|
| 66 |
|
|
- push buttons
|
| 67 |
|
|
- dip switches
|
| 68 |
|
|
- sram
|
| 69 |
|
|
- vram
|
| 70 |
|
|
- character ram (can be redefined, providing up to 640x480 resolution monochromatic)
|
| 71 |
|
|
|
| 72 |
|
|
The rom is a simple game framework.
|
| 73 |
|
|
The only gun for the hero spaceship is dip switch 7. Switch it on to fire the most powerfull weapon in the universe!
|
| 74 |
|
|
Use the push buttons to move the spaceship left and right.
|
| 75 |
|
|
-
|
| 76 |
|
|
|
| 77 |
|
|
Reference Sample ROM (for version 0.7)
|
| 78 |
|
|
|
| 79 |
|
|
|
| 80 |
|
|
It is provided a ROM with a reference application, and the correspnding
|
| 81 |
|
|
Z80 source codes.
|
| 82 |
|
|
|
| 83 |
|
|
To use the application you will need to connect the DE1 board to a
|
| 84 |
|
|
VGA monitor and PS/2 keyboard.
|
| 85 |
|
|
|
| 86 |
|
|
The program will show how to use:
|
| 87 |
|
|
Input push buttons
|
| 88 |
|
|
Input Switches
|
| 89 |
|
|
PS/2 keyboard
|
| 90 |
|
|
Video text out (memory mapped and port mapped io)
|
| 91 |
|
|
Leds
|
| 92 |
|
|
7seg display
|
| 93 |
|
|
Redefinition of characters
|
| 94 |
|
|
|
| 95 |
|
|
The program starts waiting for keys to be typed in the keyboard.
|
| 96 |
|
|
The characters are shown on the 40x30 video (VGA).
|
| 97 |
|
|
If "A" is pressed, then the program starts another routine,
|
| 98 |
|
|
that will write bytes into SRAM. After 255 bytes are written,
|
| 99 |
|
|
the bytes are read sequencially.
|
| 100 |
|
|
The address read are displayed in the seven seg display, and
|
| 101 |
|
|
the byte read displayed in the leds (binary format).
|
| 102 |
|
|
When finished, waits for KEY0 (DE1 board) and then restart again.
|
| 103 |
|
|
|
| 104 |
|
|
The switches (7-0) are used as input to calculate delays. Try
|
| 105 |
|
|
changing these switches to speed up ou slow down the leds. It only
|
| 106 |
|
|
takes effect after a Z80 reset.
|
| 107 |
|
|
To reset the Z80, use SW9.
|
| 108 |
|
|
|
| 109 |
|
|
The looping text inside the box demonstrates how to access the video ram.
|
| 110 |
|
|
To change speed of scrolling, use the switches (SW).
|
| 111 |
|
|
|
| 112 |
|
|
To modify the screen layout (rows x columns), edit the file z80soc_pack.vhd and find the constants:
|
| 113 |
|
|
- vid_cols = number of columns (maximum is 80)
|
| 114 |
|
|
- vid_lines = number of lines (maximum is 40)
|
| 115 |
|
|
- pixelsxchar = 1 every character will be plotted using 8x8 pixels
|
| 116 |
|
|
- pixelsxchar = 2 every character will be plotter using 16x16 pixels
|
| 117 |
|
|
|
| 118 |
|
|
The column x lines total must not be over 3200, because this is the capacity defined for the video ram.
|
| 119 |
|
|
The characters can be redefined. Every character must have 8 bytes (8 x 8 bits).
|
| 120 |
|
|
|
| 121 |
|
|
Hope you enjoy.
|
| 122 |
|
|
|
| 123 |
|
|
TO-DO:
|
| 124 |
|
|
----
|
| 125 |
|
|
|
| 126 |
|
|
- (done)80x60 Video display
|
| 127 |
|
|
- Serial communication
|
| 128 |
|
|
- Monitor program to allow download of programs by serial communication
|
| 129 |
|
|
- Mass storage device (SD/MMC)
|
| 130 |
|
|
- Video colors
|