My First Project!

Building your first 6502-based project? We'll help you get started here.
wDavies
Posts: 5
Joined: 05 Sep 2020

My First Project!

Post by wDavies »

I've Begun Working on A Project with the 6502 and hope to create a working computer,
here are my current specs:
(hopefully) 8Mhz Clock
44kB of Ram
4kB of I/O Space
16kB of ROM

I'm posting here to wonder if there is anything that i'm doing wrong with my Schematic design which is necessary to fix.

Any Help welcome, Thanks!
Attachments
Reformat.PNG
Last edited by wDavies on Mon Sep 07, 2020 9:59 pm, edited 2 times in total.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: My First Project!

Post by GARTHWILSON »

It's much harder to follow a netlist written around boxes than it is a real schematic. The main thing I see however, if I'm looking at it straight, is that there's nothing keeping RAM from being written to during the Φ2-low time. The address is not guaranteed to be valid before the R/W line goes down; so without Φ2, you could write to invalid addresses. The bug could be awfully hard to track down just from a software standpoint. You can either qualify the RAM's WR\ with Φ2, or, if the RAM is fast enough, you can simply not even select the RAM until Φ2 rises.

The other thing you'll want to change is to de-bounce the reset circuit.

These things and a lot more are discussed in the 6502 primer at http://wilsonminesco.com/6502primer/ which was written to answer a ton of questions and problems that kept coming up on the forum. It has 22 logically organized pages covering the various aspects of making your own 6502 computer and being successful. (Several of the pages could also be applied to other processors as well.)
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?
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: My First Project!

Post by BigEd »

(Welcome, wDavies! It might be good to know where you got your inspiration from and what references you're using. Are you going for a PCB, or using breadboard, or something in between?)
wDavies
Posts: 5
Joined: 05 Sep 2020

Re: My First Project!

Post by wDavies »

BigEd wrote:
(Welcome, wDavies! It might be good to know where you got your inspiration from and what references you're using. Are you going for a PCB, or using breadboard, or something in between?)
I got my inspiration from channels like Ben Eater and 8-Bit Guy on YouTube, I'm also just very intrigued in electronics and programming and would like to make something to link the two!
I'm looking to end up with some form of PCB, although will probably test the design on a Breadboard.
wDavies
Posts: 5
Joined: 05 Sep 2020

Re: My First Project!

Post by wDavies »

GARTHWILSON wrote:
It's much harder to follow a netlist written around boxes than it is a real schematic. The main thing I see however, if I'm looking at it straight, is that there's nothing keeping RAM from being written to during the Φ2-low time. The address is not guaranteed to be valid before the R/W line goes down; so without Φ2, you could write to invalid addresses. The bug could be awfully hard to track down just from a software standpoint. You can either qualify the RAM's WR\ with Φ2, or, if the RAM is fast enough, you can simply not even select the RAM until Φ2 rises.

The other thing you'll want to change is to de-bounce the reset circuit.

These things and a lot more are discussed in the 6502 primer at http://wilsonminesco.com/6502primer/ which was written to answer a ton of questions and problems that kept coming up on the forum. It has 22 logically organized pages covering the various aspects of making your own 6502 computer and being successful. (Several of the pages could also be applied to other processors as well.)
The RAM has a 17ns read time, so i'll probably just qualify WR with Phi2. Thanks for the information!

edit: i have fixed the problem and have therefore updated the schematic's photo
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: My First Project!

Post by BigEd »

Sounds good!
User avatar
8BIT
Posts: 1787
Joined: 30 Aug 2002
Location: Sacramento, CA
Contact:

Re: My First Project!

Post by 8BIT »

I notice your SRAM chips is 32k x 8. Anything addressed from 0x8000 to 0xAFFF will be a duplicate of addresses 0x0000 to 0x2FFF. It would be simpler to just use A15 as the CS for the SRAM to limit access to 0x000 to 0x7FFF. You could eliminate the NOR chip in that case. Use a spare NAND gate to invert A15 and feed that into 2b of the NAND to qualify the CS with PHI2.

If wiring to a breadboard, you might start with a 1 MHz clock to prove your design. Be sure to use bypass capacitors for all of your IC's, especially if you are clocking above 1 MHz.

Best wishes!

Daryl
Please visit my website -> https://sbc.rictor.org/
User avatar
BigDumbDinosaur
Posts: 9426
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: My First Project!

Post by BigDumbDinosaur »

wDavies wrote:
I've Begun Working on A Project with the 6502 and hope to create a working computer...

Could you please post the schematic in monochrome.

As for a read/write circuit, here is what I use. It works for any asynchronous hardware that has separate /RD and /WD inputs. Note that this circuit is not to be used with any 65xx peripheral hardware.

Read/Write Qualified with Ø2
Read/Write Qualified with Ø2
x86?  We ain't got no x86.  We don't NEED no stinking x86!
wDavies
Posts: 5
Joined: 05 Sep 2020

Re: My First Project!

Post by wDavies »

Thank you for all the replies, i will be sure to implement all of them into the Schematic, however i've been wondering, Would it be possible to use the Arduino Nano, or the atmega 328P as a Graphics Processor? In theory, it would be able to take characters from the CPU (after being addressed in the IO space), and an XY position and it would interface with some form of VGA driver?
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: My First Project!

Post by drogon »

wDavies wrote:
Thank you for all the replies, i will be sure to implement all of them into the Schematic, however i've been wondering, Would it be possible to use the Arduino Nano, or the atmega 328P as a Graphics Processor? In theory, it would be able to take characters from the CPU (after being addressed in the IO space), and an XY position and it would interface with some form of VGA driver?
In theory, yes. In practice yes, but its not easy.

There are many ATmega/Arduino video devices out there - including some here. Google for "Arduino TVout" for many examples.

The issue is making the ATmega and the 6502 talk. If you have serial then it's fine, but if not, then it starts to become more challenging. An ATmega running at 16Mhz might just be able to act as a register device directly to a 6502 bus running at 1Mhz. Maybe. You need to be able to reliably sample the edge of a 1Mhz clock (the 'chip select' signal that your decoding generates), then read the data directly off the data bus, but the timing is tight and you have less than 0.5µS to do it. (8 cycles on a 16Mhz ATmega)

You can decouple the timing issues using the VIA in handshake mode. You write the byte to the VIA, it generates the "strobe" signal which the ATmega is listening for, then the ATmega reads the byte, sends the 'ack' signal back to the VIA which then signals to the 6502 side that it can send another byte. You can then invent your own protocol for sending bytes over, however the speed that the ATmega will be governed by the spare CPU cycles it has left over from 'racing the beam' to generate the video signal.

Making the ATmega generate characters is not hard, making it generate graphics is harder. I put together a system (Atmega12804p) to generate a 320x240x1 display for my early 6502 systems but later abandoned that idea - mostly because generating that video signal (and this was PAL composite video, not VGA) required between 60 and 70% of all cycles that the ATmega had and I had other uses for it. (Like serial and SD card access)

This: https://www.youtube.com/watch?v=09zhGUbVxdU is a quick demo of that ATmega system. (There was no 6502 at that point)

If you want VGA, then Quinn Dunki's Veronica project is a good read: http://quinndunki.com/blondihacks/?page_id=1761 She uses n ATmega with external RAM to implement a low resolution VGA system. It's very tight AVR assembler though.

Cheers,

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: My First Project!

Post by BigEd »

I would strongly caution against feature creep, especially on a first project. You (probably) don't yet know what you don't know, about building and debugging, so keep the first machine as simple as possible, and get it working. You can follow on with more sophisticated designs - there's lots of headroom - but if you get bogged down in an over-ambitious first build that might be the end of your interest, or turn an interesting journey into a slog.
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: My First Project!

Post by drogon »

BigEd wrote:
I would strongly caution against feature creep, especially on a first project. You (probably) don't yet know what you don't know, about building and debugging, so keep the first machine as simple as possible, and get it working. You can follow on with more sophisticated designs - there's lots of headroom - but if you get bogged down in an over-ambitious first build that might be the end of your interest, or turn an interesting journey into a slog.
Wise words!

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
wDavies
Posts: 5
Joined: 05 Sep 2020

Re: My First Project!

Post by wDavies »

I have decided that i will leave out VGA for my first project, and will instead use something like Serial to interface to a program like PuTTY on a computer and then use that as a pseudo-display, does anyone have any recommendations on how to achieve this goal
SamCoVT
Posts: 344
Joined: 13 May 2018

Re: My First Project!

Post by SamCoVT »

wDavies wrote:
Serial to interface to a program like PuTTY on a computer and then use that as a pseudo-display, does anyone have any recommendations on how to achieve this goal
I'd highly recommend taking Garth up on his suggestion to read his excellent primer at http://wilsonminesco.com/6502primer/. It has everything you will need to know and then some. You will find information on serial interfacing in section 14 (labeled "I/O ICs").

I suspect you will also be interested in sections 2 (Address Decoding), 7 (Reset Circuits), and I recommend checking out 17 (General Steps for A Successful Project) for a nice listing of the decisions you will need to make and the general order to approach the tasks you will want to complete so that you don't get overwhelmed.

You may also want to look at other people's projects. This will show you how others have solved various issues from reset circuits to address decoding to memory maps. You're welcome to look at my 65C02 based computer at https://github.com/SamCoVT/SBC and you'll find many others on 6502.org and here in the forums.

If you get stuck or would like some advice on a decision you are trying to make, feel free to come back and ask (beware that you may get several different answers, but usually all of them are helpful). When posting schematics, make sure to convert them to black and white first.

To directly answer your question, I used a 65C51 ACIA (Asynchronous Communications Interface Adapter) for serial and designed my board to accept a FTDI USB to 5V TTL-level serial cable. There is a bug in the WDC version of this chip (with several possible software fixes discussed in Garth's primer, of course). I avoided this on my 65C02 design by purchasing an older Rockwell brand 65C51 instead.
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: My First Project!

Post by drogon »

wDavies wrote:
I have decided that i will leave out VGA for my first project, and will instead use something like Serial to interface to a program like PuTTY on a computer and then use that as a pseudo-display, does anyone have any recommendations on how to achieve this goal
This is how my Ruby 6502 and '816 systems work. I have code in the 6502 side to send out text and data using a well defined set of codes, so I can move the cursor, clear screen and so on. Then there is a 'shim' bit of code inside an ATmega which translates these codes into ANSI terminal codes and from there into minicom or putty. (or a real serial terminal - the ATmega is a "host" processor in my system providing serial port, filing system and a few other minor things.

OR rather than use minicom/putty, I also wrote my own terminal program that's capable of graphics - in this case, the ATmega just passes the codes through unchanged. (I've recently switched from minicom to putty as I think it's ANSI emulation is better)

The "well defined set of codes" on the 6502 side are identical to the codes used in the BBC Micro VDU system rather than just starting with ANSI codes - that way I can run BBC Basic on my systems as well as other applications that might run on a Beeb and have all the graphics and cursor control available without changes.

Demo to my graphics terminal (which is written in C and uses SDL): https://www.youtube.com/watch?v=rPGCT0lah4Q

and to a real serial terminal: https://www.youtube.com/watch?v=Bg-DcjrJ8g0

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Post Reply