Micro programmed 6502-like CPU

Building your first 6502-based project? We'll help you get started here.
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: Micro programmed 6502-like CPU

Post by drogon »

JuanGg wrote:
Some updates:

I've added a new heatsink for the voltage regulator as it was getting too hot. Now I can keep my finger on it for as long as I want, so it should be fine.
Juan
There are some nice SMPS 7805 drop-in units that are far more efficient and don't get hot! I've used the Traco Power TSR 1-2450 in some projects with good results.

Cheers,

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
User avatar
JuanGg
Posts: 103
Joined: 04 Nov 2019
Location: Spain
Contact:

Re: Micro programmed 6502-like CPU

Post by JuanGg »

drogon wrote:
There are some nice SMPS 7805 drop-in units that are far more efficient and don't get hot! I've used the Traco Power TSR 1-2450 in some projects with good results.

Cheers,

-Gordon
Thanks. I wasn't aware of those. I did have a SMPS but it was putting out 4 V and the computer wasn't very happy. Power consumption is not an issue right now. The whole thing take about 5W, of which about half is dissipated as heat.

-------------

In other news: Final schematics for the CPU and some peripherals, the assembly "kernel", the BASIC program I mentioned before and some misc documentation are up on gitHub (https://github.com/Juan-Gg/microcoded6502). No computer-drawn schematic for the video card, sorry. Some hand drawn stuff has just been scanned and posted, figured that that should be better than nothing.

I'll write a summary of the build on my website, and try writing a simple game for the thing, like pong or something.
Juan
User avatar
JuanGg
Posts: 103
Joined: 04 Nov 2019
Location: Spain
Contact:

Re: Micro programmed 6502-like CPU

Post by JuanGg »

Some updates:
____________________________

Since the last post I have written some programs:

-Simple PONG game in BASIC.
-An Apple II-like assembler and disassembler. It's pretty limited, it can only handle hexadecimal values and it's quite unforgiving with syntax and such (an absolute address has to be 4 characters long, for example). I have used lookup tables for opcodes and addressing modes, so it takes up a lot more space than the Apple one (which used patterns in opcodes to its advantage), but it does work.
-A simple version of Asteroids. No particular reason to do it apart from it being an interesting challenge. First time I have played anything similar was after I was done programming.

I have also done a summary/demo video with some photos and video fragments I had collected: https://www.youtube.com/watch?v=bMZuDuWTcAI&t=1s

All schematics and code have been uploaded to the gitHub repository I've mentioned above.

So I think that I can call this project finished. I have done much more than I originally planned, and I must thank each and everyone of you who have helped along the way.

But...

I don't really like the way the control logic and microcode is implemented. There is 64 K worth of microcode in this CPU. Just by using some logic to reset the micro instruction counter conditionally based on flags (for branches), I could have easily cut microcode by half. And having shared micro-instructions for things like addressing modes would have reduced it even further. I have quite a lot to learn in this respect.

The way the internal buses are structured result in a slow and inefficient implementation, as most operations have to wait because of the shared bus. Some instruction take up to 14 clock cycles.

The fact that control signals come directly from control ROMs, and those being unstable after their addresses change causes contention in the internal buses as some registers may output at the same time. Which results in ugly signals, though they stabilize long before they take effect.

However some of these things have resulted in a compact CPU, with minimal interconnects between cards, and easily modifiable in terms of functionality.
Anyway, some thing to keep in mind for a future project. I think I have not done enough research for this one, but definitely learned a lot.

Next project will probably be a 65C816 based SBC... We'll see.

Juan
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: Micro programmed 6502-like CPU

Post by drogon »

JuanGg wrote:
I have also done a summary/demo video with some photos and video fragments I had collected: https://www.youtube.com/watch?v=bMZuDuWTcAI&t=1s
Impressive!

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
User avatar
ttlworks
Posts: 1464
Joined: 09 Nov 2012
Contact:

Re: Micro programmed 6502-like CPU

Post by ttlworks »

Juan: Nice video, and congratulations on finishing this project.

Looking forward to see, if you might be out to build a faster/better TTL CPU in a few years from now.

Cheers,
Dieter.
User avatar
JuanGg
Posts: 103
Joined: 04 Nov 2019
Location: Spain
Contact:

Re: Micro programmed 6502-like CPU

Post by JuanGg »

drogon wrote:
Impressive!

-Gordon
Thanks! I'm looking at your Ruby pages, planning my next project.
ttlworks wrote:
Juan: Nice video, and congratulations on finishing this project.

Looking forward to see, if you might be out to build a faster/better TTL CPU in a few years from now.

Cheers,
Dieter.
Thanks! I may very well be. In the meantime, I'll keep reading on computer architecture, and hopefully I'll learn something related at University (not worth waiting though).

Juan
User avatar
Proxy
Posts: 746
Joined: 03 Aug 2018
Location: Germany

Re: Micro programmed 6502-like CPU

Post by Proxy »

congrats on finishing the project!

if i may suggest, you could start with CPLDs if you want to stick with "hardware design" projects. because there is only so much you can do with TTL chips...
you could for example try to rebuild the CPU or the video card with them.

the ATF150x series is pretty good, but the issue with those is the programmer from Atmel, which is quite expensive at ~55 EUR. Mouser
but if you have an old PC with an LPT port you can make your own adapter and use that instead. Source
though i cannot confirm that it works because i don't have a PC with an LPT port...
User avatar
JuanGg
Posts: 103
Joined: 04 Nov 2019
Location: Spain
Contact:

Re: Micro programmed 6502-like CPU

Post by JuanGg »

Proxy wrote:
congrats on finishing the project!

if i may suggest, you could start with CPLDs if you want to stick with "hardware design" projects. because there is only so much you can do with TTL chips...
you could for example try to rebuild the CPU or the video card with them.

the ATF150x series is pretty good, but the issue with those is the programmer from Atmel, which is quite expensive at ~55 EUR. Mouser
but if you have an old PC with an LPT port you can make your own adapter and use that instead. Source
though i cannot confirm that it works because i don't have a PC with an LPT port...
Thanks!

Proxy, you seem to read my mind from time to time :). I'm thinking of using those same CPLDs in a video card for a 65C816 SBC I'm "working" on (more like "thinking about"). I'll start a new thread in the Hardware section in a minute. I don't mind acquiring that programmer if I put the CPLDs to good use. I do have an IBM PC clone, with a DB-25 on the back that could be an LPT port...

Juan
User avatar
Proxy
Posts: 746
Joined: 03 Aug 2018
Location: Germany

Re: Micro programmed 6502-like CPU

Post by Proxy »

JuanGg wrote:
Thanks!

Proxy, you seem to read my mind from time to time :). I'm thinking of using those same CPLDs in a video card for a 65C816 SBC I'm "working" on (more like "thinking about").
it's scary sometimes isn't it? because i'm also still thinking about designing a custom 8 bit video card/chip meant to be used with any 6502 based system, but my idea was to use an FPGA, the LCMXO2-640HC to be exact, which is only slightly more expensive than a single CPLD but can hold much larger circuits... only downside it's 3.3V so level shifters are required to interface it.

I've planned making my own FPGA board to test/develop that card for a few months now but i never really started.
oh well i'll fiquire it out one day i don't want to pollute the tread.
JuanGg wrote:
I'll start a new thread in the Hardware section in a minute. I don't mind acquiring that programmer if I put the CPLDs to good use. I do have an IBM PC clone, with a DB-25 on the back that could be an LPT port...

Juan
yea that was my thought as well about the programmer, plus i don't really have an alternative.
also an IBM PC era machine would be too old, the software you use to load the JED file onto the CPLD needs WinXP or similar to run.
User avatar
ttlworks
Posts: 1464
Joined: 09 Nov 2012
Contact:

Re: Micro programmed 6502-like CPU

Post by ttlworks »

Hmm... if you are just out for testing concepts, the Terasic DE10 board might be interesting for you.
Altera 10M50 FPGA (probably two 32 Bit CPUs would fit in), 64MB SDRAM (16 Bit), analog VGA, programmer already included (USB).

More documentation here.

Currently the DE10 does cost 86.81€ at Mouser, but it might be possible to get a rebate when ordering it as a student through your university.
Terasic_DE10.png
User avatar
Proxy
Posts: 746
Joined: 03 Aug 2018
Location: Germany

Re: Micro programmed 6502-like CPU

Post by Proxy »

ttlworks wrote:
Hmm... if you are just out for testing concepts, the Terasic DE10 board might be interesting for you.
Altera 10M50 FPGA (probably two 32 Bit CPUs would fit in), 64MB SDRAM (16 Bit), analog VGA, programmer already included (USB).

More documentation here.

Currently the DE10 does cost 86.81€ at Mouser, but it might be possible to get a rebate when ordering it as a student through your university.
thank you but the thing is i already have a powerful FPGA board. it's an Altera DE2 board with a Cyclone II FPGA.
i got it from Ebay for like ~88EUR (>100 EUR with shipping).
of course i could just use that to develop the whole card, but...
i want to get into using and designing things around standalone FPGAs without a premade board. (because this is far from the last thing i want to use FPGAs for)
so i thought a VGA Card project would be simple enough that i could start designing a custom board to finally get started with learning about standalone FPGAs.

I'll likely make a reddit thread for it and not post on here about it until i have something or get stuck at 65(C)02 timings :p

I'm sorry, i hate it when i'm the last to post for a long time, makes me think i somehow killed the conversation.
Post Reply