Progress
My flash programmer/bus controller PC app and Arduino app now talk to the GPIO/SPI CPLD. Here is how I set the baud rate on the MAX3110E UART now:
fp gpioout 1 1
fp gpiodir 1 1
fp gpioout 1 0
fp clock 8
fp spireg 40
fp spictrl 28
fp clock 50
fp spireg 0a
fp spictrl 28
fp clock 50
fp clock 1
fp gpioout 1 1
fp spireg ff
I also finished the Intel Hex flash programmer. It’s not fast, but it works. It will do until I can have flash programming built into the Z-80 code.
So, I decided that I should come up with a way to ensure the CPU is working with something simple. So I decided to try this: which will just spam ‘A’ out the serial port (I think–need to make sure I have enough NOPs and make sure it really does what I think it does).
This is spam.s:
1 .area _CODE
2 ;.org 0
3
4 ; configure GPIO 0 to high
5 ld a, #1
6 out (0x80), a
7
8 ; configure GPIO 0 to output
9 ld a, #1
10 out (0x81), a
11
12 ; configure GPIO 0 to low
13 ld a, #0
14 out (0x80), a
15
16 ; write c0 to MAX3110E (configure)
17 ld a, #0xc0
18 out (0x83), a
19
20 ld a, #0x28
21 out (0x84), a
22
23 nop
24 nop
25 nop
26 nop
27 nop
28 nop
29 nop
30 nop
31
32
33 ; write 0a to MAX3110E (9600 baud)
34 ld a, #0x0a
35 out (0x83), a
36
37 ld a, #0x28
38 out (0x84), a
39
40 nop
41 nop
42 nop
43 nop
44 nop
45 nop
46 nop
47 nop
48
49 ; configure GPIO 0 to high
50 ld a, #1
51 out (0x80), a
52
53 loop:
54
55 ; configure GPIO 0 to low
56 ld a, #0
57 out (0x80), a
58
59 ; write 40 to MAX3110E (write)
60 ld a, #0x40
61 out (0x83), a
62
63 ld a, #0x28
64 out (0x84), a
65
66 nop
67 nop
68 nop
69 nop
70 nop
71 nop
72 nop
73 nop
74
75
76 ; write 0a to MAX3110E ('A')
77 ld a, #0x41
78 out (0x83), a
79
80 ld a, #0x28
81 out (0x84), a
82
83 nop
84 nop
85 nop
86 nop
87 nop
88 nop
89 nop
90 nop
91
92 ; configure GPIO 0 to high
93 ld a, #1
94 out (0x80), a
95
96 jr loop
It’s assembled with this:
cygwin-bash$ sdasz80 -o spam.s
cygwin-bash$ sdld -i spam.rel
where -o causes the .rel to be generated and -i causes the linker to produce a .ihx file.
which produces spam.ihx:
:200000003E01D3803E01D3813E00D3803EC0D3833E28D38400000000000000003E0AD3837B
:200020003E28D38400000000000000003E01D3803E00D3803E40D3833E28D384000000004F
:1A004000000000003E41D3833E28D38400000000000000003E01D38018D694
:00000001FF
Those strings of zeroes are the ‘nop’ opcodes, so it looks reasonable. I have already used the new Intel Hex feature of the flash programmer to program it to the flash. So once the Z-80 is plugged in, it should immediately start spamming ‘A’ to the serial port.
So, now I’m getting ready to make the connections I need to insert the 2MHz oscillator, RAM, and Z80. I need to:
- rewire RESET to the button
- BUSACK to the flash programming system
- BUSREQ to the flash programming system and pulled high
- INT pulled high (for now)
- WAIT pulled permanently high
- CLK to oscillator
- oscillator OE pulled permanently high
- bank switch CPLD CS0 to flash CE
- bank switch CPLD CS1 to SRAM CE
- bank switch Aout14-17 to flash and SRAM