Hello!
Background/info:
I designed a little 65c02 single board computer as a summer project. I finally got it built over the past weekend, and it doesn't seem to be working at all.
SchematicsCode
Code:
; Register definitions
VIA_PORTB = $FE10
VIA_PORTA = $FE11
VIA_DDRB = $FE12
VIA_DDRA = $FE13
VIA_T1C_L = $FE14
VIA_T1C_H = $FE15
VIA_T1L_L = $FE16
VIA_T1L_H = $FE17
VIA_T2C_L = $FE18
VIA_T2C_H = $FE19
VIA_SR = $FE1A
VIA_ACR = $FE1B
VIA_PCR = $FE1C
VIA_IFR = $FE1D
VIA_IER = $FE1E
VIA_PORTA_NH = $FE1F
READIN = $06
; Start of loader - ROM begins at $FF00
* = $FF00
; Setup VIA outputs
begin lda #$FE
sta VIA_DDRA
loop lda VIA_PORTA
and #$01
sta READIN
cmp #$01
beq pin_on
pin_off lda #$AA
sta VIA_PORTA
jmp loop
pin_on lda #$55
sta VIA_PORTA
jmp loop
*=$FFFC
!raw $00,$FF
The test program is fairly straightforward (I think, at least): it reads the state of PA0 and sets ORA to either $AA or $55 is PA0 is a logic level 0 or 1, respectively. The computer, however, isn't doing this, and seems to be acting completely randomly. On most resets, it's not even executing from ROM; the ROM's chip select line goes high seconds after reset, although this too varies from anywhere to seconds to minutes. I don't have an oscilloscope or a logic analyzer, so the only checks I can make are from a multimeter probing individual pins.
What I've tried:
The voltage input is 5.1v 1A, and I've run it so far from two different power supplies, so I doubt it's a power supply issue.
The reset IC is behaving as expected; pressing SW1 causes a momentary 0v pulse on the reset line.
My ROM burner verified that the ROM's contents match my assembler's output, so I don't think the ROM is the issue.
I've tried running the computer off a *much* slower clock source generated by a microcontroller for debugging purposes, but when I do nothing seems to happen. No read to $FFFC/FFFD, no write to the stack, nothing.
What I've noticed:
I did notice something that struck me as odd with PHI0. When the 1mHz crystal oscillator is removed, I get a voltage reading of ~1.2v on pin 37 of the 65c02. When it is inserted, I get a voltage reading of ~2.5v on the same pin. I thought this was my multimeter attempting to average the high and low voltages of the square wave (since 5v / 2 = 2.5v), but I get the same thing with slower clock sources, going as slow as .25Hz (generated from a microcontroller) which should easily allow my multimeter to catch up. Is this normal?
Am I missing anything obvious? I'm at my wit's end trying to debug this and I have no clue where to go from here.
Thanks in advance,
John