From 8bit breadboard to 6502

Building your first 6502-based project? We'll help you get started here.
Post Reply
nei02
Posts: 59
Joined: 21 Jul 2017

Re: From 8bit breadboard to 6502

Post by nei02 »

If for future Project useful! Maybe I Should Buy one.

Its 100nF I have no smaller ones. I have tried without condenser .
User avatar
Dr Jefyll
Posts: 3525
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: From 8bit breadboard to 6502

Post by Dr Jefyll »

Quote:
Its 100nF
Thank you.
nei02 wrote:
I have tried without condenser .
And are the results the same? Really, it's important to provide plenty of information! Otherwise it becomes harder for anyone trying to help.
nei02 wrote:
I get only dots ........... :oops:
Do you mean the UART is connected to a terminal, and the terminal is receiving the period character ($2E)?
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
nei02
Posts: 59
Joined: 21 Jul 2017

Re: From 8bit breadboard to 6502

Post by nei02 »

I am using CoolTerm.
Adapter: PL2303HX USB zu TTL RS232. https://www.amazon.de/gp/product/B00WE0 ... UTF8&psc=1

Dots mean Hex00. So basically nothing.

When I run it without the condenser it is the same.
I have checked address decoding. When the programm reaches the step to store to address $4080
The write pin gets low. CS0 High, CS1B Low, RS0 & RS1 Low.

1-VSS-ground
2-CS0-A7
3-CS1B - output NAND address decoding
4-RESB - 5V
5-RXC - NC
6-XTLI - Crystal
7-XLT0 - Crystal
8 - RTSB - NC
9 - CTSB - ground
10 - TXD - Adapter pin green TXD
11 - DTRB - NC
12 - RxD - Adapter pin white RXD
13 - RS0 - A0
14 - RS1 - A1

15 - VDD - 5V
16 - DCDB - ground
17 - DSRB - ground
18-25 Data
26 - IRQ - NC
27 - PHI2 - Clock CPU 1 MHz
28 - RWB - Read/Write CPU
nei02
Posts: 59
Joined: 21 Jul 2017

Re: From 8bit breadboard to 6502

Post by nei02 »

Since the loopback test with CoolTerm and am RS232-USB adapter doesn't work,
(First time that I those things) I will stop testing and order a new adapter.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: From 8bit breadboard to 6502

Post by GARTHWILSON »

You can put [code] and [/code] around your code so the forum software will keep the white space you intended instead of throwing out all the spaces it thinks are extra.

Next, some things to simplify the code a bit (although this still leaves a problem I'll address further down):
  • You can leave out the LDA #$00 because you don't do anything with it before the LDA ACIA_DATA further down.
  • You can leave out the LDX #$00 because it doesn't matter what the data is when storing to the status register. You can store anything to the status register and it will reset the '51. Even if it did need to be 0, you could save a byte by doing INX (a single byte, since you had $FF in there from before the TXS). Assuming you have a CMOS 6502 (65c02), you could store 0 without it being in a register, using STZ ACIA_STAT.
  • You can leave out the LDY #$00 because you have it below anyway.
  • Since you null-terminate the string, you can use the LDA Hello,Y's automatic, implied compare-to-0 and leave out the CPY.
So the result is:

Code: Select all

RESET:  LDX  #$FF
        TXS
        STZ  ACIA_STAT      ; You can store anything to ACIA_STAT.  It doesn't matter.
        LDA  ACIA_DATA
        LDA  #%00011110
        STA  ACIA_CTRL
        LDA  #%00001011
        STA  ACIA_COMM	
		
START:  LDY  #$0

OUTPUT: LDA  Hello,y
        BEQ  START          ; If we just picked up the null terminator, start over.
        STA  ACIA_DATA
        INY
        BRA  OUTPUT

hello:  .byte  "HELLO", 0
========================
Now: The next thing is that you have a severe overrun problem! You don't have any delay between bytes fed to the '51 to give it time to send each one. If you don't have a WDC '51 with the bug, you would use bit 4 of the status register to make sure it's ready for the next byte. But with WDC's bug, you can either use a delay loop (not my favorite, because then the computer can't do anything else while waiting), or use one of the timers in a 65(c)22 VIA, and then either poll the timer or set it up to produce an interrupt.
nei02 wrote:
Currently I have a 100nF connected.
If you have a 100nF (ie, 0.1µF) in the crystal circuit, it absolutely will not work. You should have something like what's in the second diagram at http://wilsonminesco.com/6502primer/IO_ICs.html, in about the middle of the page. 100nF is about 4,000 times too much. (1nF is a thousand pF.)
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?
nei02
Posts: 59
Joined: 21 Jul 2017

Re: From 8bit breadboard to 6502

Post by nei02 »

Thank you for revising my code. This helps a lot to learn! :!:

Capacitor:
Will order a couple of capacitors to have various values at hand.

Delay:
Yes I have a WDS 65C02. The manual says that there is a bug and one should use a delay.
But even without delay I would have assumed that I get a least some characters transmitted.
For the first step I will go with a delay since I don't have an AVIA. And I want to reduce the complexity.
I saw anywhere in this forum (or it was the primer turorial) how to implement a delay. Will study this.

Adapter:
But still believe that the adapter doesn't work since the loopback test doesn't work.
I ordered a new one with an CP2102.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: From 8bit breadboard to 6502

Post by GARTHWILSON »

nei02 wrote:
Delay:
Yes I have a WDS 65C02. The manual says that there is a bug and one should use a delay.
But even without delay I would have assumed that I get a least some characters transmitted.
Yes, if you try transmitting "HELLO" over and over, you should see those letters coming through, but not in order, since many letters would get skipped between the ones that do get sent. The problem is that the onboard oscillator will not work with the .1µF capacitor from input to ground. If you use an outboard oscillator can, you don't need the capacitor at the input at all. Make sure you put the 1M resistor across the crystal like the WDC data sheet shows. Not all brands use this. Also, check the lot on your '51. I see now that the WDC data sheet says the internal oscillator didn't work right in a couple of lots SA1105A and SA0519A. Darn. It looks like they hurried this thing too much! I never had any trouble with the other (slower) brands of '51 I used, as long as I had the 22pF capacitor at he input.
Quote:
For the first step I will go with a delay since I don't have an AVIA. And I want to reduce the complexity.
You wouldn't need the VIA for just RS-232 I/O; but soon you'll probably want the other benefits of a VIA anyway, especially some parallel I/O and timers. BTW, it's "VIA" (for "Versatile Interface Adapter," not "AVIA." The "A" in "ACIA" (the 65c51) is for "Asynchronous," in "Asynchronous Communications Interface Adapter.")

At 1MHz processor clock speed, one frame of RS-232 at 9600,8,N,1 will take a little over 1042 processor clock cycles. Your software delay could be something like:

Code: Select all

        LDX  #$D0
loop:   DEX
        BNE  loop
which with the other instructions in your loop, will give just a few more cycles than you need. I'm in a hurry to leave now so I can't take time to merge it with your code, but I'll take a look later.
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?
nei02
Posts: 59
Joined: 21 Jul 2017

Re: From 8bit breadboard to 6502

Post by nei02 »

Thank you very much! I was thinking to buy an oscillator can 1.8432 MHz. So I will do now.
I ordered a collection of ceramic capacitors anyway. So I can test both variants.

I can't read the lot on the chip.
The 1Mg resistor is in parallel to the crystal.

I bought the eBook of Programming the 6502, 65C02,.... as suggested.

Vielen Dank
Ralf
nei02
Posts: 59
Joined: 21 Jul 2017

Re: From 8bit breadboard to 6502

Post by nei02 »

So -> Ordered

a second ACIA 65C51 (just in case)
Oscillator can 1.8432 MHz
22 pF, 37pF
CP CP2102N-MINIEK http://www.mouser.com/ds/2/368/SiLabs_0 ... 080002.pdf


It would mean so much to me if my 65C02 could talk to me! :-)
nei02
Posts: 59
Joined: 21 Jul 2017

Re: From 8bit breadboard to 6502

Post by nei02 »

Found this interesting cause I was wondering why the 6502 steps to different addresses when powered on

http://www.pagetable.com/?p=410
nei02
Posts: 59
Joined: 21 Jul 2017

Re: From 8bit breadboard to 6502

Post by nei02 »

The Ophis Assembler seems to have a problem with the OPCODEs
STZ and BRA

Perhaps because Ophis is only for 6502 and not for 65C02

:oops: :twisted:
nei02
Posts: 59
Joined: 21 Jul 2017

Re: From 8bit breadboard to 6502

Post by nei02 »

And I have a question:

If I assemble my the (unrevised) code and disassembled this. I don't understand where the last three opcodes come from and where the .byte "Hello World" is stored.
The jump at the end to $004F concerns me since my code start at $8600 (ROM)

But which opcode tells the 6502 to store the .byte "Hello World"

Assembler: Ophis
Attachments
code2.jpeg
code1.jpeg
code1.jpeg (19.49 KiB) Viewed 1397 times
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: From 8bit breadboard to 6502

Post by GARTHWILSON »

I'm back.
nei02 wrote:
The Ophis Assembler seems to have a problem with the OPCODEs
STZ and BRA

Perhaps because Ophis is only for 6502 and not for 65C02

:oops: :twisted:
The 65c02 has only been out about 35 years. Maybe they just need a little more time to catch on! :lol: :roll:
Quote:
And I have a question:

If I assemble my the (unrevised) code and dissemble this I don't understand where the last three opcodes come from and where the .byte "Hello World" is stored.
The jump at the end to $004F concerns me since my code start at $8600 (ROM)

But which opcode tells the 6502 to store the .byte "Hello World"
That's a problem with disassemblers. They don't understand when something is data rather than code. Your "HELLO",0 is there. ASCII for "H" is the $48 which is also PHA; ASCII for "E" is $45 which is also EOR ZP; and so on.
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?
rwiker
Posts: 294
Joined: 03 Mar 2011

Re: From 8bit breadboard to 6502

Post by rwiker »

Hint: what are the hexadecimal values for the ascii codes of "H", "E", "L" and "O"?
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: From 8bit breadboard to 6502

Post by GARTHWILSON »

nei02 wrote:
Found this interesting cause I was wondering why the 6502 steps to different addresses when powered on

http://www.pagetable.com/?p=410
The reset circuit should always do its thing upon power-up, not just when someone presses a button. So on power-up, the reset routine will always be the first thing run, and automatically. It's the one whose address is found at $FFFC and $FFFD. The other two vectors are for interrupts, and their sources should be disabled by the reset, and should not be enabled until the software enables them. My 6502 interrupts primer is here.
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