View Full Version: Propeddle Project by Jac Goudsmit

ZappBots > Propeddle Project by Jac Goudsmit > Propeddle Project by Jac Goudsmit


Title: Propeddle Project by Jac Goudsmit
Description: An Open Source hardware/software project


zappman - November 29, 2011 11:21 PM (GMT)
This discussion forum is for the Propeddle project by Jac Goudsmit, a Software Defined Computer based on the 6502 and the Parallax Propeller microcontroller.

The name Propeddle is a contraction of "Propeller" and "Peddle", after Chuck Peddle, the principal engineer behind the 6502 and the PET-2001.

Propeddle is an Open Source hardware/software project, which will be available as a kit once it's done. Jac is using only through-hole parts, so the board can be assembled by electronics hobbyists with moderate soldering experience.

Jac's personal goal is to replicate a PET/CBM computer, but it should be possible to replicate many other 6502 based computers too.

A picture of the Propeddle prototype is shown below:

The Propeller chip is not on this circuit board because the project is implemented as a GadgetGangster Propeller Platform Shield: it's intended to be plugged into a GGPP motherboard, like this one: Gadget Ganster Shield.

zappman - November 30, 2011 03:23 PM (GMT)
Propeddle: Software-Defined 6502 Computer
Original Post on June 5th, 2011, 04:12 AM at Savage Circuits by Jac Goudsmit

user posted image

Download the ZIP file with schematics and board layout here:
PropeddleRev5A.zip



Introduction
This is the official thread for the Propeddle project. I've been working on the project since January 2011 but I've been putting off the documentation until I had something solid to show. On Saturday the 4th of June 2011 I ordered the circuit board from Laen so this is probably a good time to present this project to the world.

The name Propeddle is a contraction of "Propeller" (as in: Parallax Propeller) and "Peddle", after Chuck Peddle, the principal engineer behind the 6502 and the PET-2001. If you have some time, there are lots of interesting webpages on those subjects. Don't miss the video of the epic 2009 get-together between Jeri Ellsworth, Bil Herd and Chuck Peddle (I hope one day they'll do a follow-up).

What is it?
Propeddle was initially intended as a replica for the early Commodore computers (PET-2001, CBM-4032 and CBM-8032) because those happen to be the first computers I ever worked on. But because of the way it's designed, it's really a universal platform to (re-)create many types of 6502-based computers, or design a new one. In many cases you won't even need additional hardware (besides a GadgetGangster Propeller Platform board): the software on the Propeller determines how the computer behaves, and it can emulate other hardware such as storage, by using the EEPROM or the serial port to a PC or other device.

What is it not?
It's not an exact duplicate of any computer. Pretty much the only hardware that is on there is the 6502 processor and all the memory that it can possibly address. By using a real 6502, we don't have to worry too much about many timing issues, and by using real memory we don't have to worry about the fact that the Propeller has limited RAM on board. Using a Propeller makes it possible to do away with many complicated, expensive and/or unobtainable components such as ROMs, video logic and keyboard.

No I/O hardware is part of the project. It should be possible to emulate most simple hardware (like VIA's PIA's and ACIA's) by some clever programming on the Propeller in some way, but even if it turns out that that's impossible, the expansion bus will help to add real hardware in the future.

The Propeddle circuit board is not a complete system by itself: You will need to purchase a GadgetGangster Propeller Platform motherboard to make it do anything useful. Of course, when you're not using your Propeller Platform board for Propeddle, you can unplug it and use it for something else.(*)

In addition to the Propeller Platform board, Some hardware is needed to program the Propeller, for example, a PropStick or an FTDI USB-to-serial cable. No FPGA programmer is needed, no JTAG interface, no EPROM burner: all configuration and ROM data is stored on the EEPROM of the Propeller Platform module. A 64K EEPROM may be required because 32K may not be enough to store the Propeller software as well as any ROM image for the 6502; The secondary EEPROM of the Propeller Platform board will probably be optional (I'm thinking we should reserve it for disk/tape storage).

Hasn't this been done before?
Jeri Ellsworth's C64DTV (Commodore 64 Direct-To-TV) emulates a Commodore 64 in an FPGA. The entire system is small enough to fit in a joystick. Jeri also worked on the C-One computer, a "reconfigurable computer" that can emulate many 8-bit and 16-bit computers, and then some. I don't imagine that I have nearly enough knowledge to do anything similar.

André Fachat built a 6502-based and 65816-based computer that's capable of working like an early Commodore. It's completely open-source but it looks like it would be difficult and expensive to duplicate.

So yes, it has been done before. Kinda.

I'm also not the first person to think of letting the Propeller control the 6502 by bitbanging the control lines: In 2008, Dennis Ferron won an honorable mention in a Parallax contest, by gutting a toy laptop and replacing the motherboard with a Propeller Protoboard with a 6502, a 64KB RAM chip and two 74LS244 chips. It's no secret that Propeddle was largely based on Dennis' schematic, but I had to make some changes that I will detail in a later post. Thanks for sharing, Dennis!

So, what's different (hopefully better) about Propeddle:
*Uses a real 6502, not an emulation, so no need to worry about timing issues or emulation bugs
*Uses static RAM with no need for glue logic or periodic refreshing.
*Up to 128KB memory, mainly because 128K chips are easier to find than 64K chips, but also because bank switching may be required for some systems.
*Additional hardware can be added on the expansion port, in situations where this is needed.
*Capable of replicating many 6502 systems simply by changing the software that's running on the Propeller.
*Easy to build even for those who have limited experience with soldering.
*Uses low count of widely available components to keep the price low.
*Doesn't require any high-tech gear that many electronics hobbyists may not have. No JTAG adapter, no EPROM burner; All that's needed is a serial cable to download software to the Propeller.
*Open-source hardware and software, so you can make your own circuit boards, software, expansion boards etc.
*Simple design: no need to "reinvent" any of the Propeller-related hardware.
*Small circuit board thanks to Propeller Platform, keeps cost down and makes it possible to design (additional) hardware in cheap and free versions of Cadsoft Eagle.
*Expansion port uses standard headers. It should be possible to re-use standard 40-pin IDE cables that many people may have in their junk drawer, to wire expansion boards. For complicated systems that require bus buffers, a back plane with standard female headers can be created.

How does it work?
The trick is to let the Propeller do the hard work. It pretty much "bitbangs" all the control signals that are normally needed in a 6502 based computer: Turn the clock input of the 6502 on and off, allow read and write access to the RAM, and trick the 6502 into "thinking" that there's more hardware attached than there really is. Meanwhile, the 6502 thinks it has the computer all to itself.

More details will follow in later posts in this thread.

How can you get one?
At the time of this writing, the software for Propeddle is not finished yet so you can't get the hardware yet, either. If you want to make your own Propeddle, go ahead and use the schematics and PCB design that I will attach to this post. Plans to sell a kit are not finalized at this time; any chances that that will happen can be increased by people showing their support.

Propeddle is a GadgetGangster Propeller Platform shield. That means you need a Propeller Platform motherboard to use it. You also need other shields to connect a monitor and a keyboard. I'm developing with a VGA monitor because I don't have anything else, so I recommend Wulfden's VGA module. I intend to make it possible to use a TV instead of a VGA monitor too. More details will follow later.

An interesting advantage of having the Propeller circuitry separated from Propeddle is the possibility of not using a Propeller at all: since all 6502 control signals are exposed on the expansion header, it should be possible to make an expansion board that has a crystal and glue logic to control the 6502 and the memory chip, and replace the Propeller.

What's the point?
Judging from the increasing number of projects that are showing up on the Internet, I'm not the only person who is interested in building an 8-bit computer. Many people are interested in retro hardware, and there are several kits available that let you build your own, for example the Micro-KIM and the Replica 1 (Apple 1 replica) by Briel Computers. I hope that my project will add to the list of similar projects that inspire enthusiasts to build their own computers from scratch, without competing with other kit producers.

8-bit computers may not be very useful for the things that most people do with computers today, but their simplicity makes them easier to understand than contemporary computers. If you like building modern computers from motherboards, CPUs, hard disks etc., building a working classic computer from separate parts is guaranteed to give you even more of a sense of accomplishment.

===Jac

(*) The Propeddle project is not guaranteed to be compatible with any Propeller Platform motherboards that have a MicroSD card reader hard-wired on pins 0..3 of the Propeller. Propeddle depends on the lowest 16 pins to access the data bus and address bus of the 6502. The pull-up resistors and SD-card reader probably interfere with this, and the SD card reader can't be enabled or disabled from software. It's critical to the Propeddle design that the address bus and data bus are on the lowest numbered pins, so their values can be used in calculations, without the need to shift bits back and forth.

(Edit 09-Jun-2011: Added links and highlights; Many small other changes)
(Edit 10-Jun-2011: Added pictures, schematics, PCB layout)
(Edit 13-Jul-2011: Replaced inaccurate schematic and board pictures with photo of prototype) Last edited by jac_goudsmit; September 28th, 2011 at 01:25 PM.

[COLOR=blue][/COLOR]

zappman - November 30, 2011 03:27 PM (GMT)
Re: Propeddle: A Commodore PET/CBM Replica using a 6502 and a Propeller
Original Post on June 9th, 2011, 12:35 AM at Savage Circuits by SSteve

I had a Commodore Pet when I was in high school. My friend's big brother had the CBM-8032--we were very envious. And around the corner was an engineer who had an original IBM PC. Every now and then he'd let us come over and play Flight Simulator! I still remember the buzzing speaker making the sound effects.

I was pretty stoked to be able to program a computer in my own bedroom. Unfortunately, something on the Pet's motherboard was flakey. I brought it across the Bay to a repair guy in Berkeley who replaced some RAM chips. But the problem didn't go away. The cool thing is the repair guy gave me my money back and so did the guy I bought the Pet from.

It took a few years before I could buy another computer. That was a brand new Macintosh Plus. My RAM jumped from 4kb to 1Mb! That was my main computer for about six years.

zappman - November 30, 2011 03:30 PM (GMT)
Re: Propeddle: A Commodore PET/CBM Replica using a 6502 and a Propeller
Original Post on June 9th, 2011, 12:46 AM at Savage Circuits by Chris Savage

My business for many years was based around Commodore starting with the VIC-20. Heck, it was what got me started! It will be interesting to see how this goes. I follow with keen interest.

zappman - November 30, 2011 03:36 PM (GMT)
Re: Propeddle: A Commodore PET/CBM Replica using a 6502 and a Propeller
Original Post on June 11th, 2011, 12:00 AM at Savage Circuits by Oldbitcollector (Jeff)


You guys KNOW how I feel about this project.....

"/me" is really wanting one! Go 6502!

OBC

zappman - November 30, 2011 03:39 PM (GMT)
Re: Propeddle: A Commodore PET/CBM Replica using a 6502 and a Propeller
Original Post on June 12th, 2011, 02:50 AM at Savage Circuits by Jac Goudsmit

Hi Guys! Thanks for the comments!

I love reading about other people's first computer experiences. I started adding mine to the article too but it was already getting pretty long so I edited it out. Here it is:

My first experience with computers dates back to around 1978 or so, when I was 10 or 11 years old: a classmate had a PET-2001 with a chiclet keyboard at home. I wasn't allowed to touch it but he showed me a version of "Hunt the Wumpus".

The high school that I went to had a PET-2001, a CBM-8032 and a CBM-4032. My math teacher was in charge of the computer lab, and somehow he give me permission to spend some time in the computer lab after school. In the beginning I spent a lot of time playing games like Space Intruders. Then I learned Basic and assembler and for a while I was the youngest student who was able to use the computers in the lab.

When the VIC-20 and C-64 were released (around the same time as far as I can remember), the math teacher put up a C-64 poster in one of the classrooms. I drooled over it many times and I was a big fan of the C64 but I never owned one. I was never even really familiar with the C64: by the time one showed up in the school computer lab, there were always other kids that would hog the C64, but that meant they left the older systems alone which was just fine by me.

Meanwhile, my dad was working for a municipal IT department, and around 1984 when I was 17 he was able to get an IBM PC on loan to use at home, and later an IBM PC/XT, followed by many other systems. By now, the world was moving towards IBM compatibility and the school had moved on to PC's as well. I abandoned the world of Commodore until I got an Amiga 500 and an Amiga 3000 much later on, but that's another story...

===Jac

zappman - November 30, 2011 03:44 PM (GMT)
PETSCII video driver for the Propeller
Original Post on June 12th, 2011, 02:50 AM at Savage Circuits by Jac Goudsmit

I don't remember when I first got the idea of creating a PET/CBM replica, maybe it happened when I got my MicroKim about a year ago. Then again, it may have been a lot earlier. Either way, in my mind, the video part of the PET/CBM was always the main obstacle that kept me from starting with the project. Video is always a little complicated and on 6502 computers with video it always takes up a considerable part of the cost, not just in parts and board space but also in effort to get it to work: usually the video hardware in a 6502 system is designed so that the bits of the video are accessed and latched during the first half of the 6502 clock cycle when the processor isn't using the data bus. On pretty much all 6502 systems I've seen that use video, the clock frequency of the processor is tied to the dot clock of the video. It's not difficult to design such a system but it takes a lot of hardware to generate all the clocks, arbitrate the video memory between processor and video generator, and generate the video signal itself.

It got a little easier when I found out that all the monochrome 8-bit Commodores except for the PET used the 6545 CRT controller, the "older brother" of the 6845 which happens to be a chip that I'm very familiar with. But even though the 6845 was used in millions of video adapters for the IBM PC and other computers, it's no longer in production and I couldn't find an easy replacement.

Then I found out about the Parallax Propeller.

Besides the MicroKim, the (Apple 1) Replica 1 and a number of other projects, Vince Briel also sells the Pocketerm terminal emulator which uses a Propeller. I already had the acrylic case but I got the Pocketerm kit for Christmas 2010.
user posted image

The Pocketerm works great with the MicroKim and I actually used them together for a few days.
user posted image


I have a very modest parts drawer, so I had to buy a breadboard and two 74LS244 chips at Fry's, but after I borrowed the 6502 and 32K SRAM chip from the MicroKim and the Propeller from the Pocketerm, I had enough hardware to make my own version of Dennis Ferron's Prop-6502. I started by performing some "brain surgery" on the Pocketerm: I breadboarded the Propeller but used the Pocketerm board for the VGA output, the PS/2 keyboard input and the PC serial port.

At first I borrowed an FTDI FT232 demo board from work to connect the Pocketerm to my PC to program the Propeller. But the Pocketerm has an unpopulated header for the PropPlug that I bought at Parallax, so later on you will see me use that instead.
user posted image

After I verified that my lobotomized Pocketerm was still working, I breadboarded a slightly modified version of Dennis' schematic: I had to move some pins around in the software because Dennis used NTSC and I'm using VGA, but other than that, it's pretty much the same.
user posted image

Obviously I couldn't use the same video driver as Dennis had used, because I was using VGA instead of TV. But I had to find a driver with some very specific properties:
*It has to be able to do 40x25 as well as 80x25 text
*Text buffer should be stored in hub memory so we have 8-bit access without the need for shifting bits around
*It has to be easy to adapt the video frequencies to both CRT's (70Hz frame rate or higher) and LCD's (60Hz frame rate)
*It has to be able to use a soft font instead of the Propeller built-in font: PETSCII is very different from Propeller ASCII.
*It should be possible to change some of these parameters on the fly: eventually I want to emulate the 6545/6845 as accurately as possible.
*It should generate reverse video by setting bit 7 of a character.
*Monochrome video is "good enough" for now, but 7 or more colors are probably desirable for later versions
Chip Gracey's VGA_Hires_Text driver was an almost perfect module to start with. It didn't do exactly what I wanted at first, but it was pretty easy to adapt, even though I had never programmed a Propeller before. I think it did reverse video "out of the box" and thanks to the use of two cogs it can generate high resolution display frequencies.

First of all, I changed the code to display PETSCII instead of ASCII. I used a short C program on my PC to convert a PET/CBM character generator ROM dump to a format that the driver could use. This is a picture of the Lower Case version of the font.
user posted image

As you may know, there are two versions of the PETSCII font on board each PET/CBM computer. They can be switched with a POKE that changes an address line to the character generator ROM. At this time, I whenever I want to change between the two fonts, I have to recompile the code. Eventually it will be possible to change the font on the fly just like you would do on a real PET/CBM. Here's a picture of the screen with the upper case/graphics font.
user posted image

By the way, I think the PETSCII font looks really good on a High Resolution display, and it gave me the idea of perhaps creating the possibility of running the PET screen in a "Window" while the rest of the screen is showing a different user interface. I might switch between windowed 160x64 (or whatever) and full screen 40x25 or 80x25 with a hot key, e.g. to change parameters of the Propeller software, to change disks in a future virtual floppy drive, to show debug messages ("someone just did a killer POKE!"), to switch to a different emulator, etc. I will reconsider this possibility in the future.

By tweaking the pixel clock and other parameters, I changed the display to 40x25. I also freed up some pins by masking the all the bits of the VGA port except Green (major), HSync and VSync. This was a good time to make a silly mock-up screen of an imaginary CBM 4008 . The cursor didn't blink, it was just an inverse-video space character.
user posted image

I modified Dennis' mini-debugger code to use PETSCII instead of ASCII and got it to run. I put in a small test program that lets the 6502 perpetually increase a byte that's stored in virtual "video" memory.

It worked!

I had created a working 6502 computer with a Propeller based screen in about a month (the video was recorded 2011-02-06). Not bad for my first Propeller project, even if I do say so myself.

Hello 6502! Video Link

I posted my video online and started thinking about a name for the project. "FrankenPeller"? "Franken502"? I decided the name would honor the creator of the 6502 and the PET-2001, so the video comment was the official announcement of the name "Propeddle". A week later I opened a Twitter account because I noticed that my friends and family on Facebook were showing little interest in the project. The rest is history

Here is my version of the VGA_HiRes_Text driver. It will need some more work, but I decided this was enough proof that it's doable. I didn't put my name in the spin file yet but this is definitely mine. It's licensed under the MIT license because Chip Gracey licensed the original code under MIT too. I will eventually upload this to OBEX once I polish it a little, but this is the current version.

VGA_HiRes_Text.spin

I will implement runtime switching between the two fonts later on, and I'm also thinking of making this into a reasonably accurate emulation of (at least some of) a 6545/6845 based video adapter, so it will be possible to tweak video parameters at runtime. That should also make it more useful in other projects by other users.

Unfortunately, while I was experimenting with the video, I found out that Dennis' setup had some limitations that I'll get into in the next posting.

===Jac Last edited by jac_goudsmit; June 13th, 2011 at 04:43 PM.

zappman - November 30, 2011 03:48 PM (GMT)
Re: Propeddle: A Commodore PET/CBM Replica using a 6502 and a Propeller
Original Post on June 21st, 2011, 06:53 PM at Savage Circuits by Jac Goudsmit

Propeddle Theory of Operation
This article explains how the Propeddle electronics work in detail. Some generic knowledge of digital electronics, the Propeller and the 6502 are assumed, but even if you're not familiar with the intricate details, you should still be able to follow this. If not, feel free to post any questions in the thread!

In the Propeddle, the 6502 processor is controlled by the Propeller:

*The Propeller generates a clock signal that the 6502 uses to run its software.
*The Propeller can tell the RAM chip to read data from, or write data to the data bus. *The RAM chip uses the 6502 address (plus one address bit controlled by the Propeller) to determine the address.
*The Propeller can read and write data to the data bus of the 6502; this makes it possible to simulate hardware that's not really there. My video recorded in February demonstrated this feature: the 6502 executed a program from "virtual" memory to continuously update a byte in the "virtual" display memory. No "real" RAM was involved.
*The Propeller doesn't have direct control over the address bus, but using interrupts and the data bus it's possible to get indirect control: The 6502 gets a non-maskable interrupt and starts executing NOPs that are fed to it by the Propeller, but while it's doing this, it's iterating the address bus and the Propeller can access the RAM "when the 6502 isn't looking".
This is a block diagram of the Propeddle in its current incarnation. I didn't draw the debug LED or the expansion bus in the drawing; they're not needed to understand how it works anyway.

user posted image

Note, I noticed too late that I was inconsistent with my naming conventions between the schematic and the block diagram. In this article I will use the names from the block diagram.

Pin Usage Reference
This list shows how the pins of the Propeller are used in Propeddle.
*P0-P7: Read/write data bus during CLK2=HI; Read address bus (when EN=active) during CLK2=LO. The 6502 puts the data bus in high-Z mode during CLK2=LO so we can multiplex the address bus and data bus this way without the need for a 3-state buffer on the data bus.
*P8-P15: Read address bus (when EN=active), write control signals to the latch (when EN=inactive).
*P16/P17/P19/P21/P23 Used for VGA monitor. These are the standard pins as used on the demo board; the minor bits of the D/A converters (P18/P20/P22) are used for different purposes so they need to be disconnected from the VGA connector or they'll probably cause noise on the screen.
*P16/P17/P18/P19 Used for TV out.These are not the standard TV pins because they are used for other purposes. It shouldn't be too hard to adapt a TV driver to use these pins, though. I myself can only test with a VGA monitor (the only TV I have with a CVBS input is my main TV).
*P18 (VGA mode) or P21 (TV mode): "EN" output that enables the buffers that put the address bus on P0-P15. This should only be activated during CLK2=LO, and while LE=inactive.
*P20 SYNC input from the 6502: indicates that the 6502 is reading an instruction
*P22 LE output to latch the signals to the 6502 and the RAM chip (OE, WE, A16, NMI, IRQ, RDY, RES, SO) from P8-P15 (respectively).
*P24 R/W input from 6502
*P25 CLK2 input from 6502
*P26-P27 used for PS/2 keyboard
*P28-P29 used for EEPROM; P28 also used for output to CLK0 on the 6502
*P30-P31 used for serial port to/from PC

6502 Timing

user posted image

The above diagram came from the 6502 data sheet. Let's go over the timing requirements from the viewpoint of the Propeller in the Propeddle project

CLK0/CLK2
During normal operation, the 6502 is clocked at 1MHz via the CLK0 line (also known as Phi 0). To make sure that the Propeller is always in sync with the 6502, the clock is generated by the Propeller instead of from a crystal oscillator. This also makes it very easy to change the clock frequency or stop the clock altogether. CLK0 is connected to Propeller pin P28 which is the same pin as the SCL clock pin for the EEPROM. This shouldn't be a problem.

CLK1 (otherwise known as Phi 1) is an output from the 6502 that carries a delayed version of the inverted clock signal. This is rarely used in 6502 systems and it's not wired in the Propeddle project.

CLK2 (otherwise known as Phi 2) is an output from the 6502 carrying a delayed version of CLK0. It's connected to the Propeller at pin P25. There's no other hardware in the Propeddle so it could be argued that CLK2 is not strictly necessary because the Propeller clocks the 6502, so if Tphi2 is known, we can generate all other timings based on our generated CLK0. The connection from CLK2 to the Propeller may be eliminated in a later version of Propeddle, but for starters, it makes life slightly easier because I can use WAITPEQ and WAITPNE to calculate timings.

The clock can be generated by setting up a timer on one of the cogs, that generates a square wave of (up to) 1MHz on pin 28. As far as I understand, most 6502s can be slowed down considerably (I had my Rockwell running at 1Hz and it worked fine), or even stopped (though the 65C02 datasheet says to stop it only while CLK0 is HIGH). Instead of using a timer to generate the clock, it can also be done with a WAITCNT instruction.

Address, R/W, SYNC
A short time (TADS) after the clock goes through the high-to-low transition, the 6502 produces a valid address on the address bus. One of the first things the Propeller needs to do during the main loop (which spans exactly one clock cycle), is to read the address from the address bus. To do this, it enables the 74LS244 tri-state buffers that connect the 6502 address bus to pins P0-P15. This is possible because the data bus is in High-Z state during the first half of the clock cycle. The latch is disabled so that the bits from the address bus won't influence the signal pins on the 6502.

The R/W signal which determines whether the 6502 wants to read from memory (LO) or write to memory (HI) is connected to pin P24 on the Propeller. It's read at the same time as the address.

The SYNC signal from the 6502 indicates that the 6502 is reading a byte that will be executed as an instruction. It's connected to pin P20 and it's read at the same time as the address. SYNC is not strictly needed for Propeddle's operation so it may be eliminated in the future, but for now it's an easy way to detect whether the 6502 is executing code or doing something else (like retrieving an interrupt vector or pushing data onto the stack), especially during special operations to read and write memory from the Propeller. I'll get to that in a minute.

RAM Control, Data Bus
The RAM chip provides 128KB of memory, but the 6502 can only address 64KB. The reason why the RAM chip is so big is that (oddly enough) I couldn't find a 64KB chip that would be compatible with the 6502. The nice part about having a 128KB design is that it makes it possible to replicate systems that use bank switching to connect more than 64K to the 6502.

As you may know, many chips in the 61XXX series 8-bit Static RAM are pin-compatible. It's possible to put a 61512 in the socket if you have one. I'm actually testing with a 61256 (32K) that I borrowed from my MicroKim expansion board.

The CE pins of the RAM are hard-wired in the Enabled state. The OE and WE pins of the RAM aren't controlled by the 6502 but by the Propeller, via the 74LS373 latch. The A16 address line is also on the latch. More about the latch later on.

The data bus of the 6502 is directly connected to the Propeller on pins P0-P7. During the second half of the clock cycle, the 6502 reads or writes data from the data bus. The Propeller does one of the following:

If the Propeller determines that the address should be mapped to a RAM location, it will set the OE or WR lines on the RAM chip appropriately and finish the clock cycle. It's very easy to simulate ROM by allowing a Read (from the 6502's point of view) but not a Write operation at certain locations.
If the Propeller determines that the address bus is associated with some virtual hardware (like the video buffer), it may read or write the data bus itself without letting the 6502 access the RAM chip
The Propeller is much faster than the 6502, so it can actually access the memory before first half of the clock cycle is over, and feed the 6502 with dummy data or instructions. This will be explained below.

Signals (RES, NMI, IRQ, RDY, SO), Latch
The 6502 has 5 inputs that influence the processor's behavior: Reset, NMI (Non-Maskable Interrupt), IRQ (Interrupt Request), RDY (to hold the processor when it accesses slow hardware) and SO (to set the Overflow flag). RDY and SO are rarely used but since I needed a latch to keep the signals separated from the Propeller when it reads the Address bus, I figured I might as well use an octal latch and put all the signals on there.

As long as the latch is inactive, the outputs won't change regardless of what's on the inputs. But when the LE input of the latch (on P22 of the Propeller) is active, the logic levels on pins P8-P15 are transferred as follows:
*P8 goes to OE on the RAM
*P9 goes to WE on the RAM
*P10 goes to A16 on the RAM
*P11 goes to NMI
*P12 goes to IRQ
*P13 goes to RDY
*P14 goes to RES
*P15 goes to SO
The signals on the 6502 are connected to VCC through a pull-up resistor and the latch is connected through a diode. This makes it possible to generate interrupts and reset signals from other hardware in the future. There's no need for the Propeller to know when any of the signals are activated by other hardware.

Special Operations
Every computer needs ROM memory. The 6502 doesn't have a ROM and it has no access to the EEPROM of the Propeller. Instead of ROM, the Propeddle has a RAM and the Propeller can easily deny write-access to simulate ROM. But to initialize the data in the RAM, it's necessary to use a trick during the boot stage (*).

*When the Propeller starts the 6502, it activates the RESET line (and deactivates the other lines NMI, IRQ, RDY and SO).
*Then the Propeller starts generating a clock signal on CLK0.
*Then it deactivates the RESET signal.
*The 6502 wakes up and starts by reading the reset vector at $FFFC and $FFFD.
*The Propeller feeds the 6502 the bytes that represent the address of the first address of the memory area that will contain the ROM image.
*The 6502 starts executing at (what it thinks is) the first ROM location: it sets the Program Counter to that address and attempts reads the byte that is there.
*The Propeller sees the address on the address bus, and puts the byte value for that address on the data bus. Then it activates and deactivates the WE line to write the byte to memory.
*Writing the byte to memory takes a few nanoseconds but the 6502 is much slower than the Propeller so it hasn't even started probing the data bus yet. By the time it reads the data bus, the Propeller has put a NOP instruction on it, which lets the 6502 increase the Program Counter by one without any side effects.
*This repeats itself until all the memory is written. After that, the Propeller generates a Reset again, but this time it lets the 6502 have (read-only) access to the ROM area.
Using a similar mechanism, it's possible to read or write any RAM address from the Propeller during normal execution too:

*The Propeller generates a Non Maskable Interrupt.
*The 6502 saves its current state on the stack. Then it retrieves the new value for the Program Counter from $FFFA and $FFFB.
*The Propeller feeds the address of the first memory it wants to read or write to the data bus.
*The 6502 starts executing at the first address that the Propeller wants to read or write.
*The Propeller accesses the RAM in the way it wants to (read or write), while it feeds NOPs to the 6502
*When the 6502 executes up to the last address of the RAM that the Propeller is interested in, it feeds an RTI instruction to the 6502 which will then continue what it was doing.
Of course this only works while the 6502 isn't doing anything time-critical. But I expect that any kind of RAM access is initiated by the user, for example from a debugger.

Remaining Pins
Like every Propeller based project, there is an EEPROM on pins P28 and P29 (as mentioned, P28 also functions as CLK0).

The serial port on pins P30-P31 is also normal for Propeller based projects.

A PS/2 keyboard can be connected to port P26-P27.

I do my testing with a VGA monitor, because I don't have a TV with a CVBS input available. The VGA D/A converter takes up 8 pins but the PET/CBM (and many other computers that the Propeddle is intended to replicate) is monochrome, so I only really need pins P16, P17 and P21 (VSYNC, HSYNC and Green-MSB). If I would make all 8 standard pins (P16-P23) available for VGA, there wouldn't be enough pins for controlling the 6502 in the current configuration. As a compromise, I made pins P19 (Blue-MSB) and P23 (Red-MSB) available for use by a VGA monitor too, so it's possible to display up to 8 colors. It will be necessary to disconnect the LSB pins from the VGA connector to prevent interference on the screen from pins that are used for 6502 control. The unused bits will need to be masked in the VGA driver.

It's also possible to connect a TV to the system, but the usual TV pins (P12-P15) are needed for the address bus and the latch. Instead, you can use pins P16-P19 with a modified driver. When connected to a TV, it will be possible to display all the colors that TV drivers can usually produce.

This leaves just one problem: the pins for VGA and TV are the same pins on Propeddle, and there is no single pin that's available for the Address Enable pins of the 74LS244s in both VGA and TV mode. For that reason, there's a jumper that connects this line to either P18 (which is unused in VGA mode) or P21 (which is unused in TV mode). The software will have to be modified accordingly.

I found it useful to have an LED for debugging, but there were no unused pins anymore. So I decided to connect the LED to pin P19 (which is also used for Blue-MSB when using VGA, but as mentioned, the PET/CBM is monochrome and I'm using Green-MSB only. The LED will probably be eiliminated in later models, but to prevent it from causing trouble with color systems that I may want to emulate, I put a jumper in the system to disconnect the LED.

===Jac

(*) This made me realize that it may be necessary to change the expansion port circuit a little: It will probably be necessary to generate a lockout signal to other hardware that is activated while the Propeller is initializing the RAM with a ROM image, or while it's accessing the RAM at runtime.

Last edited by jac_goudsmit; July 25th, 2011 at 01:03 AM.

zappman - November 30, 2011 03:51 PM (GMT)
Re: Propeddle: Software-Defined 6502 Computer
Original Post on July 25th, 2011, 02:06 AM at Savage Circuits by Jac Goudsmit

6502 Driver

The core of the Propeddle project's software is the Propeller module that controls the 6502, and here it is. See the previous article for more information.

It took me a long time to get this to work, and it would have been totally impossible to get the timings right if it weren't for the PPLA Propeller Platform Logic Analyzer that I got from The Shoppe at Wulfden. Thanks guys!

Also, once again, I reused existing hardware in a way that it wasn't intended for: The PPLA requires its own Prop plug and I only have one of those. After an evening of switching the Prop plug back and forth between Propeller Platform motherboard and PPLA, I got pretty tired of it. The Pocketerm has a serial port on the normal connections, as well as a hookup for a Prop plug. So I removed the Propeller chip from the Pocketerm and connected the prop plug connections of the Pocketerm to the PPLA. The serial port on board the Pocketerm now acts as Prop plug for the PPLA.

user posted image


Note, there are a couple of places where the code is different from what I said in the previous article. Also, this is just a proof of concept, it doesn't actually do anything useful yet and there's no I/O. Furthermore, this still needs a LOT of optimization: currently the 6502 runs at about half of normals speed (about 560kHz).

Next Time
This is the to-do list:
*Downloading the 6502 firmware to the RAM should be possible on Reset as well as on NMI, so it's possible to generate an NMI to download more than one block of RAM or ROM data.
*The main loop needs to be optimized so that the 6502 runs at the full 1MHz.
*During the main loop, it should be possible to divide the work over more than one cog: that way one cog can control the RAM, others can emulate I/O devices

Later on, it should be possible to store the 6502 firmware in the second half of the 64KB EEPROM or in the secondary EEPROM on a Propeller Platform board if it has one.

The Spin module is configured for a 6.25MHz crystal (100MHz operating frequency) because the Propalyzer works at 100MHz too, but it should work fine at the standard 80MHz (5MHz crystal) too. In fact, the waitcnt instructions are only to make it easier to read the logic analyzer but aren't strictly necessary. I will try to make the final product run the 6502 at full speed with a 5MHz crystal but it's not impossible that a 6.25MHz crystal will be necessary to do that.

The Spin file linked below works with revision 5 of the PCB which isn't for sale but the first post in this thread has the files to create your own. I'm working on an update for the schematics and the PCB design with a couple of improvements that I want to put into the production model; the software will need to be adapted for the new schematic and PCB layout, but I'll get to that later.

Enjoy!
6502rev5.spin

===Jac

Last edited by jac_goudsmit; August 29th, 2011 at 01:50 AM.

zappman - November 30, 2011 03:54 PM (GMT)
Re: Propeddle: Software-Defined 6502 Computer
Original Post on August 29th, 2011, 01:48 AM at Savage Circuits by Jac Goudsmit

Improvements to Schematic


(See the attached schematic below)


Download a ZIP file with the Eagle design here: PropeddleRev7.zip

Hello everyone!

This is to announce that I made some improvements to the schematic:

*There was an error in the library symbol for the expansion connector (basically it expected you to mount the connector on the bottom side of the circuit board). This has been fixed.

*The expansion connector is now 40 pins instead of 36 pins, and it carries VCC and GND. It will probably not be enough to use as supply for expansion boards, but I needed to accomodate for two new signals (see below) so I had to go from 36 to 38 pins and I figured I might as well go all the way to 40 pins. This means the holes on the corners near the expansion port had to be deleted.

*CLK2 and SYNC are no longer connected to the Propeller. They weren't strictly needed anyway (see previous postings)

*The !RAMOE and !RAMWE signals are now controlled directly instead of through the latch. This should save a few cycles in the main loop. Unfortunately this also means that there were not enough pins for full or partial VGA support. Monochrome VGA is still possible but for color output it will be necessary to use a TV.

*Controlling the RAM directly freed up two lines on the latch, which I named "SEL0" and "SEL1". This should come in handly later on when it's time to develop expansion boards.

*The LED and jumpers have been deleted, this should make the kit a little cheaper, and assembly a little easier. The LED was never really needed anyway except for debugging, and I can do that with the Propalyzer; Also the audio/video board from Wulfden should make it easy to add an LED.

*The 74LS373 has been replaced with a 74LS374. On the '373, the outputs are copied from the inputs as long as the Enable line is HIGH, on the '374 the outputs are copied when the Clock input goes from LOW to HIGH. This should save at least one instruction in the main loop (because it will be possible to remove the signal outputs and the clock pin at the same time) and makes the timing of updating the signals less critical.

I just placed an order with @Laen for the updated board, and I'll probably order the parts later this week (it's time to return the borrowed parts to the MicroKim ).

The next update in this thread will have updated software to run on this board. If I can make it work, I will order a production run in September!

Thanks for your patience everyone!

===Jac

UPDATE: Sorry about the lack of updates lately. Real Life outside SavageCircuits.com, Twitter, Propeddle and other interesting things is going crazy. I'm extremely busy in a new job and I'm renovating my house which doesn't leave much time or space for the project. I promise, I will get back to it as soon as I can, but it may be a little quiet around here for a while. Again, thanks everyone for your patience!

Last edited by jac_goudsmit; October 17th, 2011 at 02:20 AM.

zappman - November 30, 2011 03:56 PM (GMT)
Re: Propeddle: Software-Defined 6502 Computer
Original Post on October 21st, 2011, 06:23 PM at Savage Circuits by Jac Goudsmit

I'm proud to announce that the project has won 2nd prize in the Gadget Gangster design contest!

Link to Fall 2011 Gadget Ganster Contest

I'm extremely honored and I would like to thank everyone who has shown interest in the project, both here and elsewhere.

===Jac


zappman - December 6, 2011 01:41 PM (GMT)
Here is a picture of the Propeddle Board Version 7

user posted image

zappman - December 6, 2011 01:48 PM (GMT)
Here is a link to Jac Goudsmit's Propeddle Blog




Hosted for free by zIFBoards