Friday, August 21, 2015

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:
.area _CODE
;.org 0

; configure GPIO 0 to high
 ld a, #1
 out (0x80), a

; configure GPIO 0 to output
 ld a, #1
 out (0x81), a

; configure GPIO 0 to low
 ld a, #0
 out (0x80), a

; write c0 to MAX3110E (configure)
 ld a, #0xc0
 out (0x83), a

 ld a, #0x28
 out (0x84), a

 nop
 nop
 nop
 nop
 nop
 nop
 nop
 nop


; write 0a to MAX3110E (9600 baud)
 ld a, #0x0a
 out (0x83), a

 ld a, #0x28
 out (0x84), a

 nop
 nop
 nop
 nop
 nop
 nop
 nop
 nop

; configure GPIO 0 to high
 ld a, #1
 out (0x80), a

loop:

; configure GPIO 0 to low
 ld a, #0
 out (0x80), a

; write 40 to MAX3110E (write)
 ld a, #0x40
 out (0x83), a

 ld a, #0x28
 out (0x84), a

 nop
 nop
 nop
 nop
 nop
 nop
 nop
 nop


; write 0a to MAX3110E ('A')
 ld a, #0x41
 out (0x83), a

 ld a, #0x28
 out (0x84), a

 nop
 nop
 nop
 nop
 nop
 nop
 nop
 nop

; configure GPIO 0 to high
 ld a, #1
 out (0x80), a

 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


No comments:

Post a Comment