6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 4:39 am

All times are UTC




Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Wed Jan 10, 2024 7:19 pm 
Offline

Joined: Tue Jan 02, 2024 6:24 pm
Posts: 13
Location: Hanover, Germany
Hello everyone!

Since I've had a discussion on the Forth board about adding Forth to my SBC, I was asked to introduce the machine a bit more in detail here. As I've got a lightning talk where I explain the idea of the machine in five minutes, let's start with this: https://xayax.net/sorbus/lightning1.php.

The website is https://xayax.net/sorbus/, the software and KiCad design files, etc is at https://github.com/SvOlli/sorbus.

The basic idea is to combine a 6502/65C02/65816 with a clone of a Raspberry Pi Pico and just call it a computer. :D And don't forget to expose the bus to allow for extensions. Since all 30 GPIO pins are required to communicate with the CPU, the USB UART is the only generic I/O left. It also provides power.

As the RP2040 of the Pico clone acts as the chipset including RAM and clock, a lot is possible. I've got three different "cores" available.

A clone of an Apple 1: well, not that much to see here. It's behaves like an Apple 1, except that the I/O is done via the USB UART. It was the first thing I implemented, since it's the most simple system I know.

Monitor Command Prompt: this one drives the CPU at a clock speed of 1 to 100.000 Hz. It is intended as a system to explain how the CPU works and to figure out how it behaves in corner cases. For me, I finally understood why the JSR of the 6502 has to store the return address minus one on the stack. Seeing the CPU run cycle by cycle, it was rather obvious.

Sorbus Native: this is where things get interesting. This is my own design with a memory map looking like this:
  • $0000-$0003: special I/O intended e.g. for an upcoming VGA card
  • $0004-$CFFF: RAM
  • $D000-$DEFF: I/O provided by external boards
  • $DF00-$DFFF: I/O provided by main RP2040 board
  • $E000-$FFFF: bank 0 (RAM, used to load CP/M 65)
  • $E000-$FFFF: bank 1 (ROM, custom firmware / kernel)
  • $E000-$FFFF: bank 2 (ROM, OSI BASIC)
  • $FF00-$FFFF: bankswitching code, BRK handler, I/O routines, can be copied to RAM using code at $0100 after loading a bootblock.

The flash of the RP2040 is also used as a "hard disk" or "internal drive" as I call it. The interface is DMA driven (the C implementation just does a memcpy). Other neat features include a trap register one can write to to stop the CPU and come up with a "meta-menu" that allows to show the last 512 bus accesses, a poor man's logic analyser. All of this runs at ~1MHz without overclocking the RP2040.

The software side is also looking quite well right now: it's got a port of WozMon, as well as a port of the Terminal Interface Monitor of the MOS 6530-004. Furthermore there is are ports of the OSI BASIC and Tali Forth 2 included. And it also got an operating system: it's using David Given's implementation of CP/M on a 6502. Just feels like a nice fit. The kernel uses software interrupts to prove the more complex functions, like loading and saving of files, or running a few VT100 escape sequences. It's also possible to expand the software interrupt handler with own functions in RAM.

And the best part of it: in does not only invite for tinkering by the architecture, but also by the price. When ordering parts for 10 systems (gerber files are also available), the price per system is about $13. I also got a slightly cost reduced model called "Junior" which can be done for <$10 per system when building 10 systems.

If anyone is thinking about building one yourself, I'd be happy to assist. I also have enough parts here in Germany, so I can also send out PCBs or I've even got enough parts for a few kits.

Have fun,
SvOlli


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 10, 2024 9:55 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Looks great - and an excellent price!


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 10, 2024 10:02 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
SvOlli wrote:
The basic idea is to combine a 6502/65C02/65816 with a clone of a Raspberry Pi Pico and just call it a computer.


Are you aware of these other projects? They also pair up a Pi Pico with a real CPU doing more or less the same thing:

https://github.com/picocomputer

https://www.olimex.com/Products/Retro-C ... e-hardware

-Gordon

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


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 10, 2024 10:50 pm 
Offline

Joined: Tue Jan 02, 2024 6:24 pm
Posts: 13
Location: Hanover, Germany
Yes, I learned about both. The Picocomputer a few weeks before I started my design. I just bought a board without components on tindie for $85.02, which still requires the chips and Picos. So at a very conservative estimate, that'll be $100, against my $10 machine. If you take into account that mine still needs to be soldered, I'm sure it could be sold on tindie for $20 with still enough margin in it.

However the inspiration was something completely different: the discussion about a comment by Eben Upton on hackaday that you can use the Pico GPIOs with 5V directly without level shifters. Knowing this people started to build cartridges that are just PCBs and a Pico, like the A8PicoCart. So my design was 5V at first and was switched to 3.3V later, because there was no need for 5V. However, the board still has a jumper to choose between the two voltages.

The Neo6502 only got announced after my was done (I had the idea in June and got everthing working in August). I'm also a bit puzzled by the complexity of that design for what they were trying to achieve, knowing my design works with just a 65c02, an RP2040 eval board for $2,50 a few pull ups and connectors.

If you take a look at the schematics of my "Junior" (which is the true SBC), you'll notice that you can't do it much simpler: https://github.com/SvOlli/sorbus/blob/master/doc/Sorbus-Junior.pdf.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 10, 2024 11:44 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1117
Location: Albuquerque NM USA
How fast can you run 6502? Pico+6502 may be a simple test setup to find the upper clock limit of 6502. I know w65c02 can go at least 36 Mhz, perhaps your setup can go even higher?
Bill


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 11, 2024 6:46 am 
Offline

Joined: Tue Jan 02, 2024 6:24 pm
Posts: 13
Location: Hanover, Germany
Nope! The Pico runs with 133MHz right now. (Highest clock not considered overclocking.) Running a tight loop in C results in a clock for the 6502 of ~1MHz with my native core, ~1.25MHz with the Apple 1 core. With overclocking the RP2040 you might be able to double that.

For a high-speed 6502 design, I'd rather go with a FPGA approach. However this would break the idea of being simple, because programming an FPGA is doable for less people than a microcontroller in C. Also there is no FPGA eval board that could drive a 6502 and be available for $2.50.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 11, 2024 7:34 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Fair point about simple and accessible. But there's an interesting possibility or two beyond where you are: to rewrite the core of your C code in ARM assembly (which isn't too bad at all for someone already familiar with 6502 assembly); and to redo some core part of your code as PIO code, which is very specific to the Pico, is a different technical challenge, but - for some people - extremely interesting to learn about. There are examples of these already around, for example check out work by Dave (hoglet67) and Dominic (dp111) on github.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 11, 2024 8:15 am 
Offline

Joined: Tue Jan 02, 2024 6:24 pm
Posts: 13
Location: Hanover, Germany
That's a nice idea, but a 1MHz machine still feels very fast. If even felt fast enough running CP/M 65 with just ~500MHz due to some (now reverted) design changes, that caused heavy load.

About the PIOs, that's something I want to go for for the upcoming VGA card. But more for the feature that PIO offers a FIFO with four entries for each direction. This way the scheduling of the tasks can be done much more relaxed. (I need to run a VGA interrupt, a USB host, the 6502 bus handling, and the "drawing routines", so this will get a little bit crowded there.)

Maybe a hybrid (just doing the tight loop with RAM/ROM access in assembly and calling C functions from there for I/O) would work, but since I'm still quite satisfied with the performance, that would be something for "way later".

Or for someone else to contribute, maybe in another experimental core based upon the Apple 1, as this is just 64k of memory with two I/O ports? That's the fun part about using the microcontroller. You can change the "flavour" with just one upload.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 11, 2024 10:58 am 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 589
Location: Michigan, USA
Nice project. May I ask if you're using the 'purple' RP2040 board because it has more flash memory? If so, is there any reason why someone couldn't use the RasPi Pico board?

TIA... Cheerful regards...


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 11, 2024 12:54 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1117
Location: Albuquerque NM USA
SvOlli wrote:
For a high-speed 6502 design, I'd rather go with a FPGA approach. However this would break the idea of being simple, because programming an FPGA is doable for less people than a microcontroller in C. Also there is no FPGA eval board that could drive a 6502 and be available for $2.50.

The 36MHz 6502 is done with 5V CPLD and external RAM. Most of my 6502 designs are in the 14.7-25.175MHz range and based on CPLD. They are definitely NOT $2.50. Good job driving down the cost of 6502 computer, making it simple so accessible to many.
Bill


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 11, 2024 1:44 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
SvOlli wrote:
Nope! The Pico runs with 133MHz right now. (Highest clock not considered overclocking.) Running a tight loop in C results in a clock for the 6502 of ~1MHz with my native core, ~1.25MHz with the Apple 1 core. With overclocking the RP2040 you might be able to double that.

For a high-speed 6502 design, I'd rather go with a FPGA approach. However this would break the idea of being simple, because programming an FPGA is doable for less people than a microcontroller in C. Also there is no FPGA eval board that could drive a 6502 and be available for $2.50.


I'm somewhat surprised about the max. speed you can crank the 6502 at. Also, I've just had a look at the other 2 projects and oddly I could not find anything on them that suggests their max. speed either - just references to emulators for e.g. the Apple II at 1Mhz ...

Not even get to 2Mhz to emulate a BBC Micro?

Quite surprised. However I've never used an RP2040 so don't really know it's low-level details.

My own Ruby 6502 and 65816 boards run at 16Mhz and the Tiny 6507 system at 2Mhz, so I'm remaining somewhat unconvinced and sceptical about fronting a 65C02 with a hugely complex microcontroller - for now.

But if it's making it easier for some to get into the 6502 (again), then I'm all for it .. But I'm always wary of this race to the bottom (price, etc.) something has to give somewhere along the line...

Cheers,

-Gordon

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


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 11, 2024 1:53 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
For me, reaching 1MHz is a good level to reach, and by meeting other goals like simplicity or affordability, it's a good result. (But yes of course one might always ask for a little bit more, especially to get to 2MHz which is a nice round number and a meaningful number in the land of Acorn.)


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 11, 2024 2:19 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1117
Location: Albuquerque NM USA
Another cheap, simple solution may be W65C134. It is a 6502 microcontroller with good collection of I/O needing only a RAM to complete as a computer. It even has ROM monitor built in and can run at 14MHz.
Bill


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 11, 2024 2:47 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
plasmo wrote:
Another cheap, simple solution may be W65C134. It is a 6502 microcontroller with good collection of I/O needing only a RAM to complete as a computer. It even has ROM monitor built in and can run at 14MHz.
Bill


Well, yes, but ..

I think one of the advantages of these systems is that you can plug them into a USB port then drag & drop code to their virtual drive, hit their reset button and off they'll go. No fiddling with 2 crystals, no battling with the monitor using ZP locations you want, or the hardware using ZP locations you want - you just plug them in and go.

That puts them more or less into the same category as BBC Micro:Bit, Arduino, ESP32 and a whole slew of other systems - SBCs and many other microcontrollers, so the entry-level to getting your code running is minimal, even from the C level rather than assembler, and when you have 63KB of RAM then you don't really care if your 1000 line C program uses all of it or not.

And you can buy them ready assembled.

So we, the 6502 community (here and on Facebook, etc.) need to encourage these then when/if some folks want more they have something different to look at and maybe appreciate in a different way.

Getting something cheaper than a $1 RP2040 is hard to beat - even my ATmega 12804p front-end costs more than that... e.g. I'm currently looking at a kit for my 6507 TinyBasic system and right now I don't think I could get it cheaper than $50 as it stands...

-Gordon

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


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 11, 2024 3:02 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
I do like the idea of just dragging and dropping a new machine definition onto the microcontroller.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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: