6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 3:01 pm

All times are UTC




Post new topic Reply to topic  [ 82 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
Author Message
PostPosted: Tue Mar 24, 2020 6:02 pm 
Offline
User avatar

Joined: Mon Mar 23, 2020 4:02 pm
Posts: 52
Location: Parker, CO
New member here. I've read a lot of the posts here and visited all of the websites I could find and have learned a ton. I thought I'd join and share my progress and ask for comments and suggestions.
First, thanks to everyone who has been willing to share their knowledge and experience. There is so much good information available. I have been particularly impressed with how civil the discussions here typically are. There are plenty of differences of opinion, but everybody seems to be able to get along with each other without being rude or insulting. Kudos!
I am building a 6502 computer mostly for fun and the learning experience. It has been very rewarding so far.

My roadmap:
  1. Basic 6502 Computer
    [Completed] - I have wire wrapped a WD65C02, AT28C256 32K ROM, 62256 32K RAM, WD65C22 VIA, Rockwell R6551P ACIA and an ATF22V10C for address decoding running at 1MHz. I have blinked some LEDs and written to a 16x2 LCD connected to the 6522, and written "Hello World" to the 6551 following the example at grappendorf.net
  2. Interrupts
    [Completed] - Interrupt lines from the 6544 and 6551 connected to the CPU.
  3. 10 MHz
    I would really like to run my computer at 10 MHz. I have a 15ns RAM chip, but I understand I will probably need to introduce a wait-state or two for the ROM, and am planning to use a GAL for that. For the UART I will probably go with a WDC 65C51 since it is rated to run at up to 14 MHz, even though it has the Xmit bug, unless the R6551P will run at 10 MHz. After that I am open to trying alternate UARTs.
  4. Monitor ROM
    I'd like to write a useful monitor. I think there are plenty of examples I can follow.
    [Update] - Currently running floobydust's SBC1 C02Monitor V1.04
  5. PCB
    Eventually I'd like to have a PCB made.
  6. Forth
    I have a coworker who loves Forth and runs it on all of his AVRs. I think he'd get a huge kick out of a 6502 computer running Forth.
  7. SPI?
    I know next to nothing about SPI except that I should be able to bit-bang it or implement it using a CPLD.
  8. Keyboard and video
    Ultimately, I would like to be able to plug a keyboard and monitor directly into my computer. From what I have read it sounds like an FPGA is one option to output a VGA signal. I know nothing about FPGAs yet, but I think it might be fun to learn. It would be fun if I could come up with something with enough graphics power for games, but I'm not holding my breath.

My questions:
  1. Does anyone know the specs for the Rockwell R6551P R6551-27? The datasheeets I can find don't list the P variant.
  2. Is an FPGA a good solution to add a keyboard and VGA? Are there other options I should be considering?
  3. What is a good way to interface to an FPGA? Is memory mapped I/O appropriate, or should I use SPI or something else?
  4. Any advice on making a PCB would be appreciated.

Thanks in advance for any comments or suggestions!
Shawn


Last edited by Shawn Odekirk on Fri Apr 03, 2020 4:16 am, edited 2 times in total.

Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 24, 2020 6:57 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
Shawn Odekirk wrote:

Thanks in advance for any comments or suggestions!
Shawn


Hi Shawn,

Welcome and all that!

Sounds like you're well under way - PCB? KiCAD would be the suggested open source package these days - and myself and others use JLCPCB (from China) to make the PCBs, but do work out what works for you in your country (I'm in the UK). I use Fritzing, but - it's basically a dead-end project and one day I'll learn KiCAD.

Th 6551 Tx bug - once you have interrupts coming from the 6522 VIA, you can use T2 in one-shot mode, so load char into 6551, poke timer on the VIA, then when you get the T2 interrupt from the VIA, poke the next character - it's a few more lines of code and you'll need to work out the right values for the timer based on the clock and baud rates, then off you go.

Otherr here may suggest other UARTs though.

Video - I started using an ATmega1284p for a 32x240x1 display, but it ended up being to slow, so moved to a plan B. Plan C is to use a $5 SBC with HDMI output. Look at the Parallax propeller though - there are a few VGA designs using that. Many other solutions involving and SRAM chip with built-in video generator and others before you dive into FPGA land.

14Mhz is achievable with a GAL based system - my 6502 and 65816 boards us GAL(s) and run at 16Mhz and I didn't do anything clever with them (although I don't have a slow EEPROM to get in the way - they're RAM only) I started on breadboard, then stripboard, then PBC - long story & pictures at https://projects.drogon.net/6502-ruby/

Cheers,

-Gordon

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 24, 2020 7:07 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Welcome! For the R6551P question, I'd be pretty confident in saying the P is for the plastic package (ceramic packages were a lot more expensive and quickly became less common.)

Yes, you can use an FPGA for VGA and for many other purposes, but it's a whole new learning curve and might be regarded as a different kind of project. (Search for anything you might want to put into FPGA by searching for "HDL" as well as the thing you want.) In most cases, you need the FPGA, and an EEPROM, and a programming dongle, and a mega download of the (free) tools.

I suspect we have many older threads here about different approaches to VGA. For the simplest approach you can just use logic. It's not uncommon to get carried away with adding features - I'd recommend you build something simple first.

PCB is a good next step. Other than the current pandemic, the tools are (or can be) free, the delivery is quick, the quality is good, the price is low.

You can certainly bit-bang SPI which means the hardware can be very simple. Again, it's worth searching this forum.

Keyboards is just a little bit tricky. You can
- cook up your own keyboard matrix and scan it
- interface with PS/2 which is quite fiddly
- use an interface chip to connect to USB.

Different people have different ideas of what kinds of technology they find applicable. Many are happy with using cheap (but internally complex) parts to do things, many would use CPLD (which is a bit easier than FPGA), some will use GALs, others stick to standard logic families. There is no right answer, although people often hold their preferences strongly.


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 24, 2020 7:30 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
Welcome, Shawn.

Many of your questions are answered in the 6502 primer, indexed at http://wilsonminesco.com/6502primer/ . It was written to answer questions and problems that kept coming up on the forum, and updates are made frequently.

_________________
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?


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 24, 2020 7:35 pm 
Offline

Joined: Mon May 21, 2018 8:09 pm
Posts: 1462
Definitely a good thing to have a basic, unambitious machine running first.

The part number you should look for, for a bug-free ACIA, is R65C51P4. This is specified to run at 4MHz and should be capable of a bit more than that, with care. A disadvantage of the dedicated 65xx-bus parts is that it's relatively difficult to interface an older, slower device to a fast 6502, because they use the Phi2 clock directly for CPU bus timing, so you can't simply generate a RDY signal to stretch the specific access. Instead you have to stretch the whole clock cycle, which may distort timers in a 6522.

The go-to UART for us is the 28L92. This has an asynchronous CPU bus interface which is easy to interface a 6502 to, and is believed to be bug-free as well as much more capable than the 6551. Someone put together some documents on wiring it up and programming it, which you should be able to find in the 6502.org library.

I have an untested design for a 96-key matrix and scanner in my own library, using discrete logic, and probably achieving a 0.5-millisecond latency from key down to having the scancode in the CPU - an order of magnitude faster than some modern USB keyboards. Debouncing means the key-up latency is significantly greater, but that will be much less noticeable in use. 96 keys is enough, for example, to replicate the BBC Master's keyboard layout.

It should be practical to build a basic VGA output using discrete logic as well, provided you do it on a reasonable substrate - the signals required are fast enough to cause real trouble on a breadboard. A first attempt might aim for a text display with attribute colour and a fixed font ROM. Adjusting such a design to support a planar bitmap display should be reasonably straightforward, but involves a larger number of parts in the high-speed path, so the text-mode design would be easier to debug in the first instance.

There are a number of places that can make good PCBs at hobbyist-friendly volumes and prices. I firmly recommend sticking to the ones that accept standard Gerber files, which KiCad can produce. This gives you flexibility to shop around without having to re-construct your design in a different set of tools. A well-regarded example is JLCPCB, which is based in Hong Kong; there are alternatives in the Western hemisphere as well.


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 24, 2020 7:43 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
Welcome and congrats on getting a system running.

For some input on the UART side. I have a fair amount of old NMOS parts and lots of newer CMOS parts, including Rockwell and Synertek NMOS parts and CMD, Rockwell and WDC CMOS parts. In short, I've not found the Rockwell parts to run much, if any, about their rated speeds. I have a few NMOS R6551P (plastic encapsulation), all are 1MHz chips and none run above 1MHz. The Synertek NMOS part runs perfect at 6MHz... note that in ALL cases I'm running full-duplex interrupt-driven receive and transmit. For the CMOS parts, The Rockwell R65C51P-4 chips (rated at 4MHz) all seem to run okay at 5MHz but no more. My particular CMD (which is NOS) is rated at 4MHz but has some intermittent issues.

For the WDC parts, I have the new ones in both DIP and PLCC, all have the Xmit bug. Note that to use these, you either drive their clock with a can oscillator or make sure you add a 1Megohm resistor in parallel with the crystal, otherwise the baud clock will not work. I've used these at 10MHz in an older 2-board design with interrupt-driven receive and a timing loop for transmit. As already noted, you can use one of the W65C22 timers to create an interrupt source at the baud rate used to drive the W65C51.

Feel free to look at my Github page... my older SBC1 is out there.. schematics and source code. There's also my newer C02 Pocket SBC which uses a Philips/NXP UART, albeit an older one with schematics, GAL coding and source ccode. Going forward I would suggest you just use one of the newer NXP DUART chips, as they will keep up with a 16MHz CPU without issue and also incorporate a 16-bit time and some additional port lines.

Have fun!

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 24, 2020 8:02 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
If you're going to have SPI anyway, the 14-pin MAX3100 is another nice UART (but you interface to it through SPI). There's also the MAX3110 with a few more pins which is the same thing with the line drivers and receivers built in, so it's an extra-compact solution. The 6502 primer shows how to interface to SPI, and there's working sample code for an efficient bit-banged method.

_________________
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?


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 24, 2020 8:35 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8505
Location: Midwestern USA
Shawn Odekirk wrote:
New member here. I've read a lot of the posts here and visited all of the websites I could find and have learned a ton. I thought I'd join and share my progress and ask for comments and suggestions.

Welcome to 6502-land.

Chromatix wrote:
The go-to UART for us is the 28L92. This has an asynchronous CPU bus interface which is easy to interface a 6502 to, and is believed to be bug-free as well as much more capable than the 6551. Someone put together some documents on wiring it up and programming it, which you should be able to find in the 6502.org library.

The NXP 28L92 documentation to which Chromatix is referring may be found here. I have two of these in my POC V1.2 unit, giving me four high-speed serial ports, all interrupt-driven in both directions. To date, I have yet to find a bug in any NXP UART, although I do have some beefs with their documentation. :D

The 65C51 is lame 1970s technology. The transmit bug in the W65C51 has resulted in a UART that is, in my opinion, not worth the silicon used to fabricate it. Much better UARTs are available.

For general-purpose I/O, the 65C22 offers a set of convenient resources for both parallel and serial (non-RS232) interfaces.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 27, 2020 2:51 am 
Offline
User avatar

Joined: Mon Mar 23, 2020 4:02 pm
Posts: 52
Location: Parker, CO
I got the interrupt lines from the 6522 and 6551 connected to the CPU. I must have done something right because this works. Thanks floobydust!
If anyone is wondering, I used an AND gate like shown in figure 3 on Garth's 6502 Interrupts page.


Attachments:
File comment: Screenshot of Micromon running
Micromon.jpg
Micromon.jpg [ 557 KiB | Viewed 2487 times ]
Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 27, 2020 3:26 am 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
Shawn Odekirk wrote:
I got the interrupt lines from the 6522 and 6551 connected to the CPU. I must have done something right because this works. Thanks floobydust!
If anyone is wondering, I used an AND gate like shown in figure 3 on Garth's 6502 Interrupts page.

That's great... basically why I did the Micromon code, which was cobbled down from the larger BIOS/Monitor. Quick and easy to get a 6551 running as a console.

If you grab the code for the SBC-01 (V104), it has full interrupt code that enables the timers on the 6522 as well for accurate delays and a RTC implemented via a 4ms timer interrupt. It does a lot more than Micromon and will allow you to check out all of the hardware (6551/6522). Have fun... and post some pics of the build!

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 27, 2020 4:21 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8505
Location: Midwestern USA
floobydust wrote:
That's great... basically why I did the Micromon code, which was cobbled down from the larger BIOS/Monitor. Quick and easy to get a 6551 running as a console.

Not a criticism or anything, but I notice that Micromon doesn't show the state of the unused status register bit (bit 5). That bit is permanently set in the 65C02 (and 65C816 in emulation mode). I've been staring at 6502 register dumps for so many years (43, to be exact) the unset bit immediately jumped out at me. :D

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 27, 2020 5:06 am 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
BigDumbDinosaur wrote:
floobydust wrote:
That's great... basically why I did the Micromon code, which was cobbled down from the larger BIOS/Monitor. Quick and easy to get a 6551 running as a console.

Not a criticism or anything, but I notice that Micromon doesn't show the state of the unused status register bit (bit 5). That bit is permanently set in the 65C02 (and 65C816 in emulation mode). I've been staring at 6502 register dumps for so many years (43, to be exact) the unset bit immediately jumped out at me. :D


Well, actually it will :mrgreen: A closer look shows that Micromon was just booted followed by the Register command. As the variables are in page zero (which is cleared on a cold start) everything shows zeros. A send-break from Putty, executing to a BRK instruction or executing code via the Go command will populate all of the variables from the CPU and show them correctly. As it's name implies... it doesn't take much space, just 1.75KB, yet it provides a decent amount of function, is extendable, has a JMP table and runs the 6551 in interrupt mode for transmit and receive with a pair of 128-byte circular buffers.

[CNTRL-R] Reset
( Init Macro
) Run Macro
A Display/Edit A register
C Compare memory block
D Display Memory contents in HEX/TEXT
F Fill memory block
G Go execute at <addr>
H Hex byte string search
M Move memory block
P Display/Edit CPU status reg
R Display Registers
S Display/Edit stack pointer
T Text character string search
X Display/Edit X register
Y Display/Edit Y register

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 27, 2020 4:45 pm 
Offline
User avatar

Joined: Mon Mar 23, 2020 4:02 pm
Posts: 52
Location: Parker, CO
Photos as requested.
The socket in the upper left hand corner is where I connect +5V and ground.
The header running along the top is the address and data buses, clock and RW signals. This was very helpful for troubleshooting early on, but I haven't used them for a while.
The headers on the left side are Port A and Port B of the 6522 and Tx and Rx from the 6551.
The empty space in the top row of ICs is for the wait-state GAL for when I try to go to 10 MHz.
Initially I had all of the sockets "shoulder to shoulder", but I couldn't see what I was doing, so I spread them out. I may have spread them out more than I needed to. I would have liked to keep the wires much shorter. Also, I don't know if I should have tried to route the wires more directly, but I think routing them the way I did made it easier for me to see what was connected.
No filter capacitors right now. I tried wire wrapping them directly but didn't like the result, and I am running low on sockets.
When I went to connect the interrupts from the 6522 and 6551 to the CPU I found that the way I had initially tied /IRQ, /NMI, BE, RDY and /SOB high made it difficult to disconnect /IRQ. I seem to remember thinking at the time that I was going to want to be able to easily change it later and should probably not daisy chain it with the other pins. I'll probably run into the same problem when I go to connect RDY to my wait-state generator. Oh well, live and learn.
I don't have a lot of experience wire wrapping, so I don't know if this looks awful or not and would love to hear how I could have done better.


Attachments:
File comment: Photo of the top of the board
top.jpg
top.jpg [ 808.8 KiB | Viewed 2443 times ]
File comment: Photo of the bottom of the board
bottom.jpg
bottom.jpg [ 803.95 KiB | Viewed 2443 times ]
Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 28, 2020 3:18 am 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
Shawn Odekirk wrote:
.I don't have a lot of experience wire wrapping, so I don't know if this looks awful or not and would love to hear how I could have done better.

The 6502 primer has a section answering WW questions and doubts, at http://wilsonminesco.com/6502primer/WireWrap.html .

_________________
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?


Top
 Profile  
Reply with quote  
PostPosted: Fri Apr 03, 2020 4:23 am 
Offline
User avatar

Joined: Mon Mar 23, 2020 4:02 pm
Posts: 52
Location: Parker, CO
I got floobydust's SBC1 C02Monitor V1.04 monitor running. Thanks floobydust! There's a ton I can learn from your code.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 82 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: