6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 10, 2024 7:20 pm

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: DANI-I 6502 SBC
PostPosted: Thu Jul 21, 2022 7:21 pm 
Offline

Joined: Tue Feb 21, 2017 8:32 pm
Posts: 38
Hey All,
Been on this forum for quite some time (since the beginning of my venture into 6502). I have finally completed my project in it's entirety and wanted to share it with you all, especially due to all the tips and tricks I've learned from the community along the way. My project will be completely open sourced (for the most part, I just have to upload my KiCad schematics and gerber files to github). Here was my design guidelines and the things I was able to tackle.

For the Main System
  • 6502 CPU
  • 32k SRAM
  • Real Time Clock
  • 6522 VIA
  • PS2 Keyboard Support
  • 16k ROM
  • Custom Monitor
  • EhBasic Ported
  • SD Card support (Load/Save)

For the Graphics
  • Custom VGA GPU via FPGA
  • Character based graphics
  • 6-bit color
  • Dual Port RAM (4k) for VRAM
  • 32k SRAM for character RAM with programmable characters up to 256

For development
  • Custom ROM Flasher
  • Device for stepping through the 65c02 and viewing ADDR bus & Data Bus
  • cc65 target for compiling C code against it

Keep in mind when I started this project, I had zero knowledge of VHDL & zero knowledge of 6502 assembly. By trade I'm a network engineer with background in Computer Science and I have always loved tinkering with electronics as a hobby. I cannot believe as I look back at this list that I put out for myself that I was able to complete all the things listed in any way shape or form. I knew my sights were ambitious but with enough stick-to-itiveness I guess anything is possible. If you do get a chance to look over my VHDL code for my VGA GPU and my 6502 assembly for my Monitor please keep in mind I am a newbie so you very may well come across areas that could cause you to scratch your head. For many parts of this it was my first time ever developing/engineering for these things. I can express how much I have learned doing this. If you are on the brink of starting a project and you say to your self, "Hmmm, I'm not sure I can do that." just try. You will learn more failing at what you don't know than continuing to tinker with what you do know.

Here are some of my milestones in pictures -

First time getting HSYNC and VSYNC working on the FPGA to get a 640x480 signal recognized by a monitor
Attachment:
File comment: FPGA Start
IMG_6739.JPG
IMG_6739.JPG [ 1.66 MiB | Viewed 4960 times ]


I got 6-bit color working! Displaying the full palette
Attachment:
2.png
2.png [ 8.15 MiB | Viewed 4960 times ]


I have my pseudo registers working, and able to tell the VGA GPU to save my Characters to Character SRAM
Attachment:
3.png
3.png [ 9.15 MiB | Viewed 4960 times ]


The Dual Port RAM is now interfacing with a VGA debugging device I created, It is accurately showing text on screen
Attachment:
4-ed.png
4-ed.png [ 9.33 MiB | Viewed 4949 times ]


The day I placed the 65C02 on the breadboard, exciting moment
Attachment:
5.png
5.png [ 10.85 MiB | Viewed 4960 times ]


Adding the SRAM, ROM, and the Glue Logic to select everything
I never really realized how important placement is on a bread board until months later
Attachment:
6.png
6.png [ 11.68 MiB | Viewed 4960 times ]


Wiring the busses up
Months later I would realize using this type of wiring was horrible, I wish I cut hookup wire and did it all properly. All part of learning though
Attachment:
7.png
7.png [ 12.06 MiB | Viewed 4960 times ]


Custom Debugging board
I created this custom debugging board to allow me to step the 65C02 and look at what is on the data bus as well as the address line through the 7 Segment LEDs
Attachment:
8.png
8.png [ 13.04 MiB | Viewed 4960 times ]


Hello World
Another huge moment for me, getting some 6502 code assembled and have it print Hello World on screen
Attachment:
9.png
9.png [ 9.98 MiB | Viewed 4960 times ]


The beginning of DANI-I Monitor
It had ROM functions for printing strings, clearing the screen and showing simple tile based graphics
Attachment:
10.png
10.png [ 9.61 MiB | Viewed 4960 times ]


Keyboard Support!
At this point I had placed the VIA, used a Port on it, Set up a PIC16F1509 to translate keyboard scan codes into bytes that could pull the interrupt on the VIA and send it to an input buffer. I implemented simple commands like Peek & Poke and the monitor was really taking shape.
Attachment:
File comment: Keyboard Support
11.jpeg
11.jpeg [ 976.05 KiB | Viewed 4960 times ]


Drive & RTC Implemented
At this point the sky was the limit, I had implemented a PIC18F that would communicate over i2c to a RTC & over SPI to a SDCard. Then a simple protocol that could talk to it over the VIA port. Suddenly the world opened up as I was able to Read / Write to SD Cards & have a working clock. Shortly after I ported over EhBasic and implemented LOAD & SAVE commands
Attachment:
12.png
12.png [ 4.56 MiB | Viewed 4949 times ]


Version 2.0 Of The DANI-I Monitor
Introduced EhBasic, DUMP Command, WRITE commands, JMPR, LOAD, SAVE, DIR - basically everything i needed to load programs off of SDCARD as a binary, or from basic and execute them
Attachment:
File comment: DUMP
dump.JPG
dump.JPG [ 4 MiB | Viewed 4960 times ]

Attachment:
File comment: Directory
13.JPG
13.JPG [ 3.97 MiB | Viewed 4960 times ]


KiCAD & Schematics
Probably the most fulfilling point of this project was when these guys came in, I designed, routed and sent off for PCB's to be printed. I checked the mail every day for them to come in.
Attachment:
14.png
14.png [ 4.19 MiB | Viewed 4950 times ]



Solderfest 2022
Attachment:
15.png
15.png [ 6.01 MiB | Viewed 4950 times ]

Attachment:
16.png
16.png [ 4.06 MiB | Viewed 4950 times ]


The payoff
Hooking it up and booting up for the first time was insanely nerve wracking for some reason. It felt great to finally see this through tho.
Attachment:
17.png
17.png [ 14.13 MiB | Viewed 4950 times ]


In action... via gif (Click on me to see it work!)
At this point I forked CC65 and created a target for my system. I started to build all sorts of small projects and games in C. Seeing it working and interfacing with my ROM functions felt out of this world
Attachment:
DANI-I.gif
DANI-I.gif [ 15.71 MiB | Viewed 4960 times ]


What an incredible feeling guys. Like I said I am such a complete newbie at this but it was such a great learning experience. I will add my github repo's below, and as I said earlier, try not to laugh too much at my code, I am no way shape or form an experienced 6502 developer. And please leave me some questions or comments I'd love to discuss some things i've learned along the way.

Github: DANI-I-SYSTEM-ROM
Github: DANI-I-Keyboard Controller Firmware
Github: DANI-I-Drive Controller Firmware
Github: DANI-I-VGA VHDL FPGA Source
Github: CC65 Fork with DANI-I Support as a Target
Attachment:
File comment: PDF of the DANI-I SBC Schematics
DANI-I SBC.pdf [476.41 KiB]
Downloaded 85 times


Last edited by ChaseHQ85 on Fri Jul 22, 2022 11:16 am, edited 6 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: DANI-I 6502 SBC
PostPosted: Fri Jul 22, 2022 7:07 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8480
Location: Midwestern USA
Man, you've been busy! Looks great.

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


Top
 Profile  
Reply with quote  
 Post subject: Re: DANI-I 6502 SBC
PostPosted: Fri Jul 22, 2022 7:29 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10976
Location: England
Wonderful! Congratulations for learning all the things you needed and for finishing the project - and thanks indeed for sharing the story with pictures - and the code!


Top
 Profile  
Reply with quote  
 Post subject: Re: DANI-I 6502 SBC
PostPosted: Fri Jul 22, 2022 7:52 am 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 746
Location: Germany
very impressive to go from 0 to your own SBC!

though, personally i find it better to have 1 github repository for a project instead of multiple repositories for each part of a project.
keeps everything tidy and in one place for convenience, and makes it easier to find any specific thing as you don't need to go searching through the user's profile.

also i can't seem to be able to find any schematic files. in Kicad you can export a Schematic as a Monochrome PDF under File -> Plot -> PDF, which you can then directly upload to here, so people can look at it without going to an external site. (and the Monochrome part is because some people on here are color blind)

but besides those, that is a pretty good looking project, many things to play around/experiment with! for example, did you implement an existing file system to access your SD Card, or something custom? if it's custom then one idea is to try and implement the FAT16 file system so you can move files between your PC and SBC.
also if you ever feel the need to go for a version 2 or even a completely new SBC desing, one idea i can give you is trying to figure out how you could replace the Dual Port RAM with regular SRAM (as it's usually much cheaper and comes in greater capacities, and more VRAM = more potential for Graphics like a Bitmap Mode). you do have an FPGA so there are a billion ways to do it, and there already are some projects on here that do use regular SRAM for VRAM and share it between the CPU and Video Circuit.
So i'm sure you can think of something.


Top
 Profile  
Reply with quote  
 Post subject: Re: DANI-I 6502 SBC
PostPosted: Fri Jul 22, 2022 11:19 am 
Offline

Joined: Tue Feb 21, 2017 8:32 pm
Posts: 38
Proxy wrote:
also i can't seem to be able to find any schematic files.


Sorry! I have now added the Schematics as a PDF, it's the last link on my original post

Proxy wrote:
if it's custom then one idea is to try and implement the FAT16 file system so you can move files between your PC and SBC.


Yes! The filesystem is Fat32! It's how In my gif I compile a program i've made with CC65, xfer it over to my SBC and run it. Once I had that up and running, it was such a breeze to continue to write and test code on my SBC. I even have it read the disk label when you do a Dir listing and show it on screen. The only thing i currently do not support are directories other than the root.


Top
 Profile  
Reply with quote  
 Post subject: Re: DANI-I 6502 SBC
PostPosted: Fri Jul 22, 2022 11:22 am 
Offline

Joined: Tue Feb 21, 2017 8:32 pm
Posts: 38
BigDumbDinosaur wrote:
Man, you've been busy! Looks great.


BigEd wrote:
Wonderful! Congratulations for learning all the things you needed and for finishing the project - and thanks indeed for sharing the story with pictures - and the code!


Thanks, and a thank you to you guys! I know there are a couple of times in forum posts you both played a part in overcoming a bug that I encountered!


Top
 Profile  
Reply with quote  
 Post subject: Re: DANI-I 6502 SBC
PostPosted: Fri Jul 22, 2022 2:01 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1114
Location: Albuquerque NM USA
ChaseHQ85 wrote:

Yes! The filesystem is Fat32! It's how In my gif I compile a program i've made with CC65, xfer it over to my SBC and run it. Once I had that up and running, it was such a breeze to continue to write and test code on my SBC. I even have it read the disk label when you do a Dir listing and show it on screen. The only thing i currently do not support are directories other than the root.


Developing usable FAT filing system and use it to transfer updated programs between workstation and 6502SBC is a great idea. My background in CPM caused me to think serial transfer as the way to develop new computer, but serial port is extra hardware and I always need to arbitrate inputs from serial port or keyboard as well as output to serial port and video port. Well done!
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: DANI-I 6502 SBC
PostPosted: Fri Jul 22, 2022 2:23 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1485
Location: Scotland
plasmo wrote:
Developing usable FAT filing system and use it to transfer updated programs between workstation and 6502SBC is a great idea. My background in CPM caused me to think serial transfer as the way to develop new computer, but serial port is extra hardware and I always need to arbitrate inputs from serial port or keyboard as well as output to serial port and video port. Well done!
Bill


A non 65xx system I'm working on where I have serial terminal attached, I'm working on a "thingy" that allows block transfers to/from a file on the host system. (Note a file and not files).

So from the SBC side, it has the FAT filesystem code which at it's lowest level calls "read block X" or "write block X" and maybe "select block device Y" so that can be sent to an SD card, CF, etc. or multiple devices or partitions... or to a bit of software that sends a code down the serial line - and at the other end of the serial line is my "smart" terminal which is doing stuff like graphics, text and so on, so the magic code is just another thing to interpret where it then reads the block from a large fixed-size file (say 32MB) and sends the block down the wire (or reads the block up the wire and writes it).

Under Linux this file can be loopback-mounted so it's then easy to read/write files into it as a mounted filesystem. At the SBC end, it's no different and writing he serial block device driver is probably less work than an SPI block device driver for e.g. SD card.

I know this technique has been used elsewhere, but it's not hard if you already have a Linux terminal program to work with.

-Gordon

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


Top
 Profile  
Reply with quote  
 Post subject: Re: DANI-I 6502 SBC
PostPosted: Fri Jul 22, 2022 3:22 pm 
Offline

Joined: Tue Feb 21, 2017 8:32 pm
Posts: 38
plasmo wrote:
ChaseHQ85 wrote:

Yes! The filesystem is Fat32! It's how In my gif I compile a program i've made with CC65, xfer it over to my SBC and run it. Once I had that up and running, it was such a breeze to continue to write and test code on my SBC. I even have it read the disk label when you do a Dir listing and show it on screen. The only thing i currently do not support are directories other than the root.


Developing usable FAT filing system and use it to transfer updated programs between workstation and 6502SBC is a great idea. My background in CPM caused me to think serial transfer as the way to develop new computer, but serial port is extra hardware and I always need to arbitrate inputs from serial port or keyboard as well as output to serial port and video port. Well done!
Bill


The moment Fat32 was implemented the speed of development skyrocketed. The ability to assemble some code and run it instantly via an SD-Card was amazing.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 1 guest


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: