I'm going to tentatively say that I have a working board!
There are still some things I'd like to improve, though.
I reverted to the rev-3 glue logic, which uses an HC32 for both the RAM/ROM banking and the clock stretching. Unfortunately, in order to use the HC32 for the clock stretcher, I have to invert both inputs and the output, which means the clock stretch logic is slower than before. As I was afraid of, that made it too slow for 10MHz:
Attachment:
20230828_171324.jpg [ 3.27 MiB | Viewed 4537 times ]
You can see here the ROM select goes low, but the stretcher logic doesn't get finished in time, so there's an extra clock tick before the `163 hits the brakes. A lot of the time, this doesn't seem to matter (!) but every so often there are some memory glitches. Here's with a much slower (1MHz) oscillator, showing the clock stretcher behaving properly:
Attachment:
20230828_171559.jpg [ 3.09 MiB | Viewed 4537 times ]
I'm not sure what I want to do about this yet. I could just run it at 8MHz/4MHz, but that is a lot slower than I'd hoped. Either way, one of the nice things about wire-wrapping like this is that it's pretty easy to change things if I feel like it. As long as I don't need more ICs than I have sockets for, making changes just means undoing some wraps.
Meanwhile, to test the bank register I wrote a little "run from RAM" program:
Code:
; Blue August RAM test
; CPU WDC65c02S
; I/O Decoding (controlled by front panel switches)
; ON for I/O in ROM, OFF for I/O in RAM
; | Controlled by switch block
; | | | Decoded by 74AHC138 to give 8 IO Selects
; | | | | | Not decoded
; | | | | | | |
; A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
; 0 0 0 0 0 0 0 0 0 x x x x x x x
BANKREG = $7F
DEST = $80 ; 2 bytes
SRC = $82 ; 2 bytes
; Start of ROM
.org $8000
reset:
; Copy "OS" to page 2
ldy #0 ; .Y will count bytes
lda #$02
sta DEST+1
stz DEST
lda #$82
sta SRC+1
stz SRC ; prepare source / destination addreses
copy:
lda (SRC),y
sta (DEST),y
iny
bne copy ; copies the whole page, to make it easy
jmp $0200 ; here we go!
.org $8200
lda #1
sta BANKREG ; Bank out the ROM
forever:
lda #$AA
sta $9000
lda $9000
lda #$55
sta $F000
lda $F000 ; can we read and write in the ROM area?
bra forever
nmi:
irq:
rti
.org $fffa
.word nmi
.word reset
.word irq
And here's a capture of it running: I actually find it's helpful to have the capture and the assembler listing side by side, so here is the listing, in case anyone is interested in actually looking closely:
Attachment:
listing.txt [3.62 KiB]
Downloaded 36 times
The reset line is *still* not as smooth as I would like. Here it is thumping along with the clock (this is the fast 20MHz oscillator):
Attachment:
20230828_164224.jpg [ 3.45 MiB | Viewed 4537 times ]
This offends my sense of aesthetics, and bothers me because I don't know why it's happening (Peanutbutter-1's reset line does not look like this), but the fluctuations never drop low enough to cause spurious resets. I guess I will be like Drogon - it works, but it looks scary, so that's why I don't probe my board.
The other thing is that the data bus still looks really bad.
Attachment:
20230828_171947.jpg [ 3.35 MiB | Viewed 4537 times ]
With the slow oscillator, you can *really* see clearly how the high levels are fluctuating. Again, they don't ever seem to drop low enough to cause logic errors, but it bothers me. It's ugly, and I don't understand why it's there.
That is to say, I think it's there because the oscillator / prescaler switch hard and put a lot of noise on VCC. But I've got bypass caps out the wazoo and a couple of big bulk decoupling capacitors (10uf and 100uf) right by where the power comes on board, which is what I normally do. Maybe these capacitors just aren't very good?
Anyway, overall, positive developments, and some more stuff to ponder.