6502 PC - where to start?

Building your first 6502-based project? We'll help you get started here.
User avatar
cbscpe
Posts: 491
Joined: 13 Oct 2013
Location: Switzerland
Contact:

Re: 6502 PC - where to start?

Post by cbscpe »

Considering the size of todays storage, you could actually implement a very simplistic file system where efficiency regarding space is not important. A small directory at the beginning and then just reserve a junk of let's say 32kbyte for every file. Even with thousand files you will have difficulties to find a storage that is not capable of holding such amount. As an interface you can either build an SPI using a CPLD or bit-banging the SPI protocol.
dagenius
Posts: 16
Joined: 09 Apr 2020
Location: Australia

Re: 6502 PC - where to start?

Post by dagenius »

floobydust wrote:
I'd also recommend getting a breadboard machine running first... then once you're happy with it, consider making a PCB for it.
I will probably be breadboarding it first, but I have a friend with a CNC machine that can do PCBs.
BigDumbDinosaur wrote:
6502 PC - where to start? :)

That's easily answered. Start simple. My advice to anyone starting out in the 6502 homebrew hobby is to learn how to fly a Piper Cub before stepping into the cockpit of a 747.

As others have advised, you should scale back your aspirations and build a basic machine with a TIA-232 link to a PC acting as a terminal. Such a design will be much easier to debug, as serial I/O is relatively straightforward. Video generation, on the other hand, is fraught with timing "gotchas" and other things that can trip up the beginner. If hardware flaws in your machine prevent it from displaying a picture and/or accepting keyboard input, you are going to have an extremely rough time debugging.

There are a number of good reference designs you should examine and perhaps implement. The first stop I'd recommend is at Garth's 6502 primer, in which he elucidates on the nuts-and-bolts of a functioning 6502 system. Working from his presentation, you will gain some understanding of the 6502's bus cycle, how to clock the thing, how to attach peripherals, etc. This would be the equivalent of learning to fly a Piper Cub.

After you've built a functional basic unit you can start to explore a more complex design and eventually take off in that 747. Meanwhile, enjoy yourself and welcome to 6502-land.
I have been reading Garth's primer and it has some excellent advice on the hardware side, and I'll probably base mine partially on the schematic he has for a very simple 6502 computer.
cbscpe wrote:
I don't know your background, but in case this is your first PC you are building I would recommend that you use an existing design. Grant Searle has a very nice collection of basic 8-bit PCs with various processors http://www.searle.wales. When I say basic, it just refers to the minimal required hardware. But there is also software available, in case of the 6502 project there is BASIC and for the Z80 there is even CP/M available.

As for the serial interface, Proxy started to build a 6502 system as well and he is using a FT240X. This is a very nice alternative to a serial interface and avoids the bug of the WD65C51.

However if you are really in FPGAs you could as well build your 6502 system using just the FPGA, then again Grant has it as well.

Peter
Yes, this is my first 6502 project. I've done projects with Raspberry Pi and Arduino before but 6502 is new to me. I probably will base mine heavily on existing designs, but I do want mine to be unique as well. As for making the entire thing on an FPGA, I did consider this but with FPGAs I have to program it in Verilog, and I'd much rather actually build a physical computer.

Again, thanks for all the support you've all given me. It's great to have an online community dedicated to keeping the 65xx series alive
User avatar
BigDumbDinosaur
Posts: 9426
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: 6502 PC - where to start?

Post by BigDumbDinosaur »

dagenius wrote:
Yes, this is my first 6502 project. I've done projects with Raspberry Pi and Arduino before but 6502 is new to me. I probably will base mine heavily on existing designs, but I do want mine to be unique as well. As for making the entire thing on an FPGA, I did consider this but with FPGAs I have to program it in Verilog, and I'd much rather actually build a physical computer.
For more information about building and debugging a design, I chronicled the ongoing development of my POC series right here. Although POC units are powered by the 65C816, the principles and much of the circuitry is very similar to that of the 65C02. My POC V1 series is entirely discrete logic, using readily-available parts, and has multichannel TIA-232 I/O for communicating with other devices (my Linux development server being one of them).

Which brings up something to consider. If you're game to try it, may I suggest your first build be powered by a 65C816? You can start out with the '816 running in "emulation" mode, which makes it mostly look like a 65C02, but one on steroids. That is, you can initially treat a 65C816 unit as though it were a 65C02, with the future prospect of being able to access more memory, enjoy a more expansive instruction set and use 16-bit operations as your skill with 6502 assembly language develops.

Others have said it but I will reiterate it. Be extremely cautious if purchasing your parts from anyone other than a well-known electronics distributor. We've had a number of members get burned with eBay purchases that proved to be counterfeit parts. In particular, note that there are no Chinese versions of Western Design Center (WDC) products and only two authorized distributors in China (Drexell and Mouser). WDC is the only producer of new 65C02 and 65C816 MPUs worldwide, and has been so since the start of the current century. If you purchase an MPU from anyone who WDC does not list on their website as a distributor you are likely to end up with a fake part that could, in some circumstances, cause damage to other parts of your unit.

Unless you have a particular reason to do so, I do not recommend purchasing Rockwell parts. In the 1980s and 1990s, Rockwell was a major second-source producer of the 65C02 and at one time, JAMECO stocked the R65C02, which were excess NOS or pulls from modems with a Rockwell chipset. Rockwell divested their semiconductor business some 20 years ago and no new production of genuine Rockwell 65C02s is known to have taken place since then. Also, the NOS and pulls inventory has pretty much been depleted.

The reason I mention this is we are increasingly seeing Rockwell parts that have been remarked, either being a NMOS part relabeled as a 65C02, or a 1980s or 1990s part remarked with a newer date code. The odds are more than even you will end up with a bogus part if you go that route.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 6502 PC - where to start?

Post by GARTHWILSON »

BigDumbDinosaur wrote:
Which brings up something to consider. If you're game to try it, may I suggest your first build be powered by a 65C816? You can start out with the '816 running in "emulation" mode, which makes it mostly look like a 65C02, but one on steroids. That is, you can initially treat a 65C816 unit as though it were a 65C02, with the future prospect of being able to access more memory, enjoy a more expansive instruction set and use 16-bit operations as your skill with 6502 assembly language develops.

And, I might add (or clarify), that the '816 offers more instructions even in '02-emulation mode; ie, you don't even have to go into native mode to get a lot of benefits.
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: 6502 PC - where to start?

Post by BigEd »

Feels like we just got carried away... this thread is about starting off, with a strong bias towards keeping things simple and avoiding feature creep.

The '816 has a place, arguably, but surely not here.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 6502 PC - where to start?

Post by GARTHWILSON »

BigEd wrote:
Feels like we just got carried away... this thread is about starting off, with a strong bias towards keeping things simple and avoiding feature creep.

Feature creep is always a problem, and keeps things from ever getting finished. But in this case, the initial post included video and an FPGA, before getting toned down. I think the '816 is much simpler than video and the FPGA.
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
BigDumbDinosaur
Posts: 9426
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: 6502 PC - where to start?

Post by BigDumbDinosaur »

BigEd wrote:
Feels like we just got carried away... this thread is about starting off, with a strong bias towards keeping things simple and avoiding feature creep.
I agree with Garth regarding FPGA vs. 65C816. What we are discussing at this point is several orders less complicated than originally proposed. In any case, the suggestion to look at the 65C816 was just that: a suggestion. The bus setup with the '816 is no more complicated than with a 65C02 if one ignores VDA and VPA, as you like to advise.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
dagenius
Posts: 16
Joined: 09 Apr 2020
Location: Australia

Re: 6502 PC - where to start?

Post by dagenius »

cbscpe wrote:
Considering the size of todays storage, you could actually implement a very simplistic file system where efficiency regarding space is not important. A small directory at the beginning and then just reserve a junk of let's say 32kbyte for every file. Even with thousand files you will have difficulties to find a storage that is not capable of holding such amount. As an interface you can either build an SPI using a CPLD or bit-banging the SPI protocol.
That was one of my ideas - I was thinking of having 128 byte sectors and having a section at the start with file names and sizes, but then I decided that if I needed a file system then I could just implement FAT16.
GARTHWILSON wrote:
BigEd wrote:
Feels like we just got carried away... this thread is about starting off, with a strong bias towards keeping things simple and avoiding feature creep.

Feature creep is always a problem, and keeps things from ever getting finished. But in this case, the initial post included video and an FPGA, before getting toned down. I think the '816 is much simpler than video and the FPGA.
I agree that the '816 is quite simple, and I was thinking that I could just use it in 65c02 emulation mode and possibly upgrade later, as BigDumbDinosaur suggested. Also, I'm not too concerned about feature creep - I have plenty of time to work on this. Also, remember that in the original post I eventually wanted to make it portable.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 6502 PC - where to start?

Post by GARTHWILSON »

I started a topic a few years aog about super-simple file systems for flash memory on the Brad's Projects forum, at http://bradsprojects.com/forum/viewtopi ... =17&t=1233 .

dagenius wrote:
Also, remember that in the original post I eventually wanted to make it portable.

That right there, in my experience, is a major job. Making a nice, small, portable computer that you can throw in the attache case may be more of a challenge than the circuitry is.
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: 6502 PC - where to start?

Post by BigEd »

It's all possible - everything can be done! But usually there are a few people advising that it's really best to start by building simple. Every little enhancement that gets rolled into that first build is actually slowing down progress, not speeding it up. Your second build will proceed much faster, as you will have learnt a lot, and you will have learnt it faster because you had a simpler problem.
dagenius
Posts: 16
Joined: 09 Apr 2020
Location: Australia

Re: 6502 PC - where to start?

Post by dagenius »

BigEd wrote:
It's all possible - everything can be done! But usually there are a few people advising that it's really best to start by building simple. Every little enhancement that gets rolled into that first build is actually slowing down progress, not speeding it up. Your second build will proceed much faster, as you will have learnt a lot, and you will have learnt it faster because you had a simpler problem.
I've done some more research and it seems that FPGAs are more expensive and harder to implement than I thought (living in Australia while prices are in USD always makes things look so affordable :D ), so I'll have to start a lot simpler. On Garth's primer I was interested in the 4D Systems VGA controller but it's also expensive and has more features than I need. Does anyone know any other good parallel or serial VGA controllers?
Thanks
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Re: 6502 PC - where to start?

Post by BillO »

dagenius wrote:
Does anyone know any other good parallel or serial VGA controllers?
http://geoffg.net/terminal.html

I got one of these working the other day. The chip cost me $7 CAD and I already had a PICKit 3 programmer, but you can get viable clones for under $20 or the microchip SNAP for maybe $25.

It works as advertised. It can be used as a fully VT100 compatible terminal or as a single chip standalone serially driven VGA or composite video interface. If I'm not mistaken, Silicon Chip Magazine's online store in Australia sell pre-programmed chips for $15 AUD.

All that said, I stick by what I posted earlier. If you're just starting out, using a PC as a terminal has huge advantages.
Bill
User avatar
cjs
Posts: 759
Joined: 01 Dec 2018
Location: Tokyo, Japan
Contact:

Re: 6502 PC - where to start?

Post by cjs »

BillO wrote:
dagenius wrote:
... which means I could have an independent setup for the computer and not rely on a PC for interfacing.
Then there will be the issue of having to provide some sort of storage for programs, or be forced to type them in each time. Using a PC as the terminal allows you to store programs on the PC. Just a thought.
I second this. It's not just about program storage; it's about program development. If you've built your own system, an inevitable part of that is at least modifying software to work on it, and it's long been found to be easier to write (and perhaps do some testing) of that on a larger, more capable machine. (This is known as "cross-development.") This is not new: even the original 8080 Microsoft BASIC, in 1976, was written and tested on a PDP-10 mainframe, before being transferred to an Altair for further testing.

A serial works very well for this sort of thing because you can very easily use it both for typing at and getting output from your computer and for transferring programs.

If you want to have a look at what a modern cross-development system looks like, you might examine my personal 8-bit development repo, 8bitdev on GitHub. Currently, from assembly language source I assemble programs, run unit tests in a 6502 emulator, send code (via serial port) to my Apple 1 clone, build binaries and disk images for an Apple II, and run them in an Apple II emulator. (The documentation unfortunately is a bit out of date at the moment.) While I still do plenty of hacking by typing directly into real machines, having framework like this makes 8-bit software development significantly faster and easier.
Curt J. Sampson - github.com/0cjs
dagenius
Posts: 16
Joined: 09 Apr 2020
Location: Australia

Re: 6502 PC - where to start?

Post by dagenius »

cjs wrote:
BillO wrote:
dagenius wrote:
... which means I could have an independent setup for the computer and not rely on a PC for interfacing.
Then there will be the issue of having to provide some sort of storage for programs, or be forced to type them in each time. Using a PC as the terminal allows you to store programs on the PC. Just a thought.
I second this. It's not just about program storage; it's about program development. If you've built your own system, an inevitable part of that is at least modifying software to work on it, and it's long been found to be easier to write (and perhaps do some testing) of that on a larger, more capable machine. (This is known as "cross-development.") This is not new: even the original 8080 Microsoft BASIC, in 1976, was written and tested on a PDP-10 mainframe, before being transferred to an Altair for further testing.
What would be the best assembler to use for the code? I had a look at the ASxxxx and from looking at the docs it's hard to tell what features it has. I'm looking for something that supports macros and works on Windows 10 or Ubuntu 18.04. Does anyone have any suggestions?

Thanks
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 6502 PC - where to start?

Post by GARTHWILSON »

dagenius wrote:
What would be the best assembler to use for the code? I had a look at the ASxxxx and from looking at the docs it's hard to tell what features it has. I'm looking for something that supports macros and works on Windows 10 or Ubuntu 18.04. Does anyone have any suggestions?

There are so many that I don't think anyone could be familiar with all the best ones to be able to tell you which one is actually best. I list a lot of 65xx assemblers at http://wilsonminesco.com/links.html#assem, including the C32 macro assembler I use and really like. If you really need a free one, I suspect our own Andrew Jacobs' As65 is one of the best, and he's a regular here on the forum, meaning that if you have questions or problems, you can get immediate attention to them. [Edit: Andrew died Jan 8, 2021, and Bill Chatfield ("gungwald") took over development, producing DEV65 (but it assembles for other µPs also). It additionally supports relocatable code and multiple output formats. It's available for download in a pre-built binary that is easy to install and run on any system with Java 1.6 or 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?
Post Reply