Debugging my first SBC

Building your first 6502-based project? We'll help you get started here.
User avatar
Dr Jefyll
Posts: 3525
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: Debugging my first SBC

Post by Dr Jefyll »

Which of these accesses are reads and which are writes? It helps to include such details.

Really we're trying to determine if the program is executing as intended. Have you studied the program, and do you feel you understand what ought to happen as it begins?

I haven't studied the program (has it been posted?) but for sure the ACIA needs to be initialized before it can produce output. So, let's verify that that's happening. When troubleshooting it's important to be methodical. Conduct your investigation and make your conclusions step by step.
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
sepseel
Posts: 36
Joined: 05 Mar 2017

Re: Debugging my first SBC

Post by sepseel »

These three accesses are writes, and according to the code they are the correct adress and value, so everything is as expected.

Btw, I included the monitor, and the port of ehBASIC im using.
Attachments
basic.asm
This is the port of ehBASIC
(244.47 KiB) Downloaded 75 times
min_mon.asm
This is the monitor
(4.42 KiB) Downloaded 85 times
User avatar
Dr Jefyll
Posts: 3525
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: Debugging my first SBC

Post by Dr Jefyll »

Right -- the three accesses you described result from this code

Code: Select all

ACIA_init
	LDA	#$00
	STA	ACIAstatus		; Soft reset
	LDA	#$0B
	STA	ACIAcommand		; Parity disabled, IRQ disabled
	LDA	#$1E
	STA	ACIAcontrol		; Set output for 8-N-1 9600
Next question, I'd say, is this. Is the ACIA actually outputting any serial data? (Maybe it is, but something is amiss with the terminal/whatever which you're using to receive and display that data.) So, when the program starts is there any activity on the TXD pin?

There are various options, but here's what I recommend. If you have a logic probe, put it on the TXD pin and see if there's activity when you boot. (Watch carefully, as the min_mon greeting message takes just fraction of a second to transmit.)

If you don't have a logic probe then it's better to arrange for the greeting message to get transmitted again and again endlessly (see altered code below). After booting into the altered code you should, using a voltmeter, be able to observe a change on the TXD pin.

Code: Select all

; now do the signon message, Y = $00 here

LAB_signon
	LDA	LAB_mess,Y		; get byte from sign on message
	BEQ	LAB_nokey		; exit loop if done

	JSR	V_OUTP		; output character
	INY				; increment index
	BNE	LAB_signon		; loop, branch always

LAB_nokey
    LDY #0           ;<----- new/altered
    JMP LAB_signon   ;<----- new/altered
Hopefully after this you'll know what direction to take for further investigation. I have a hunch the problem lies with the receiving device. (Are the handshake lines set to the appropriate levels?) But if I'm wrong it won't be the first time. :)
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Debugging my first SBC

Post by GARTHWILSON »

I haven't taken time to re-read the entire six preceding pages to verify, but make sure you're heeding this paragraph in the address-decoding page of the 6502 primer:

  • The VIAs and ACIAs have their own Φ2 input, and the address decoding must provide the appropriate valid chip-select before the Φ2 rising edge. I know from experience that the VIA will not work if the CS waits for the Φ2 rising edge. (I found out in about 1986, then years later had to use the trick shown near the bottom of this page when I used a pair of 6522's in a Commodore 64 I/O expansion board, the C64 not giving an early select signal.) Do not bring Φ2 into these ICs' CS logic like the circuit above does for RAM.


If you can read back from the command and control registers the values you stored there, that's a good indication that it's probably working. The values you say you stored should work though. Oh, one more thing: the ACIA's CTS\ input must be true (low) for the transmitter to operate, and the DCD\ must be true for the receiver to operate.

With the exception of the hardware problem I had before I put the capacitor on the crystal input when using just a crystal (no external oscillator), I have never had any trouble getting the '51 to work as intended on first try. If you just follow the data sheet, it works. There's a tendency however to think that much of the data sheet is for someone else.

Oh, yet one more thing comes to mind: Solderless breadboards are the worst of all worlds for computer construction. We won't forbid it (as if we could anyway), but please know that the Φ2 clock input is the most critical to have a clean signal on, particularly to the processor. Make sure the signal and ground connections from the clock oscillator (and divider flip-flop, if used) to the processor are as short and direct as you can reasonably get them. One of our other members made a computer on a breadboard several years ago and found that he could not get it going until he did it this way, since ringing in, and coupling from, other lines was corrupting the clock signal. All those arches without accompanying grounds make for great antennas for transmitting and receiving digital noise. Next most important would be to make the Φ2 connections (and accompanying ground connections) to the VIA and ACIA also as short and direct as practical.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Post Reply