6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Jun 01, 2024 12:24 pm

All times are UTC




Post new topic Reply to topic  [ 15 posts ] 
Author Message
PostPosted: Thu Mar 04, 2021 10:55 am 
Offline

Joined: Thu Mar 04, 2021 10:08 am
Posts: 13
Hey everyone!

I'm currently designing/testing my own 65C02 computer (inspired by Ben Eater) and thought I might post it here.
I wanted something versatile and fun to play with while learning assembly language and the 6502 seemed a good choice becuase of its already big community.

I put a lot of chips in it because I had some of them lying around. Also I always add a bit too much to my projects, just in case ;)

Here are some specs of my computer:

Clock:
- Single Step
- NE555 timer (~5Hz .. 50kHz)
- Oscillator (currently 1MHz)

Memory Map:
0000 - 3FFF = Banked RAM
4000 - 7EFF = Common RAM
7F00 - 7F0F = PIA
7F10 - 7F1F = VIA1
7F20 - 7F2F = VIA2
7F30 - 7F3F = VIA3
7F40 - 7F4F = ACIA1
7F50 - 7F5F = ACIA2
7F60 - 7F6F = VGA GPU (will be an FPGA)
7F70 - 7F8F = SID
7F90 - 7F9F = IO9
7FA0 - 7FAF = IOA
7FB0 - 7FBF = IOB
7FC0 - 7FDF = IOC
7FE0 - 7FFF = IOD
8000 - FFFF = ROM

Banked RAM is 32 pages, I decided to bank the ZP and Stack as well, so every "task" later can have its own. Maybe a dumb idea, maybe good, I have to see how this will turn out....
I also added a BluePill-Board with STM32 microcontroller as embedded USB logic analyzer, so I can trace the program while the clock is slower.

PIA is for 2 Ports LEDs out (also on pin headers for general IO)
VIA1 is controlling the RAM banks as well as interfacing with the LCD (up to 4x40 char LCD)
VIA2 is 8 buttons as inputs (diode-ORed to CB1) as well as 8 interrupt lines (diode ORed to CA1), connected to IRQB on the 6502
VIA3 is currently only connected to pin headers (also connected to NMI on 6502), might add a PS2 keyboard to this one
ACIAs have Pin headers for the 5V serial signals as well as 2 MAX232 each for RS232 (each one connected to an interrupt)
GPU - IOD are expansion ports on the main pcb.
VGA GPU i will be another project. I plan to realize a VGA GPU on an FPGA for 640x480 display. This is postponed due to me still have to learn VHDL better....
SID is reserved for a 8580 SID I have lying here, will be the sound card.
the rest of IO-spaces can be used for whatever (one idea is hooking it up to an ESP32 for internet connection)
ROM is.... well.... ROM... EEPROM 28C256

I also added LEDs to the address and data bus, as well as RWB and Clock

I started this project out of fascination and boredom, also because I was inspired by Ben Eaters Breadboard computer (actually I tested the schematic on breadboards too), but since I'm currently studying to become a state certified technician (in electronics), I will use this project as my finals work.

If you have any questions, feel free to ask.
Currently I'm programming the libraries for the ICs and LCDs, writing or porting a small OS to it would be awesome, but as I'm still learning assembly, it can take some time...

and here is a picture of my computer ^^


Attachments:
File comment: my 65C02 computer
computer.jpg
computer.jpg [ 155.21 KiB | Viewed 1566 times ]
Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 04, 2021 2:52 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10811
Location: England
Welcome! That's really impressive - what kinds of things have you managed to run on it so far?

Banking the bottom 16k is an unusual choice, so it will be interesting to hear how you get on with making use of that. I'm sure it can be made to work.


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 04, 2021 3:36 pm 
Offline

Joined: Thu Mar 04, 2021 10:08 am
Posts: 13
So far I'm just writing libraries and test-codes. PIA library and VIA library (mostly just initializations, timers will come soon) are working as well as a library for the 2x16 character lcd in 4bit mode. I have a connector for a 4x40 char LCD as well, but this is essentially 2 seperate displays in one, so I have to see how I'll manage to do that. but both displays are responding and displaying text, so I can build on that.

Next will be the interrupt routines, then I'll implement timers, after that I think are only the ACIAs left.

when I confirmed everythin working, I'll try to write some small OS with a simple round-robin task queue and will make use of the cc65 assembler, currently only using the ca65....

since I try to do everything from scratch there is quite a learning curve to it, so progress will be slow, but it's honest work ;)


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 04, 2021 5:17 pm 
Offline
User avatar

Joined: Sun Dec 27, 2020 11:12 pm
Posts: 94
Location: France
Wow very impressive indeed! What are you planning to do with it? I’m also wondering: why you have 3 VIAs and two serial chips ? You can control a whole lot of stuff with that. 6502 robotics maybe ? :lol:

_________________
Jonathan Foucher

Take a look at the Planck 6502 computer.


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 04, 2021 6:13 pm 
Offline

Joined: Thu Mar 04, 2021 10:08 am
Posts: 13
@jfoucher
as I said, I had these chips lying around and finally wanted to do something with them. I did a lot of dumpster diving once and found these in nearly pristine condition...
I know I already have more IOs than I ever need, but I like to think a bit easier here... PIA ist just output for me (since the PIA registers are somewhat minimalistic and require a lot of cycles of setup compared to a VIA), one VIA is RAM bank and LCD only, one VIA is button input, IRQ input and timers (since it is the only chip connected directly to the 6502s IRQB pin, every other interrupt signal has to go through this VIA), one VIA is for expansion/GPIO (as already said, likely going to be PS2 keyboard input) and I have two ACIAs just becuase I already had them.. and if I only ever need one of these, I won't have another one lying on the shelf for the next couple decades...

so basically I use very inefficient function placement for the chips in order to have an excuse for cramping every 6502 related chip I have into one project so I finally have them sorted (if you understand what I mean ^^)


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 11, 2021 1:53 pm 
Offline

Joined: Thu Apr 14, 2016 2:13 pm
Posts: 9
This looks really cool! Hoping I can get mine to this point one day. Where do you get that eeprom holder and does it allow you to program it without removing it from the board?


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 12, 2021 1:40 pm 
Offline

Joined: Fri Apr 06, 2018 4:20 pm
Posts: 94
BigEd wrote:
Welcome! That's really impressive - what kinds of things have you managed to run on it so far?

Banking the bottom 16k is an unusual choice, so it will be interesting to hear how you get on with making use of that. I'm sure it can be made to work.


I think the possibilities are pretty interesting. Banking then becomes like a context switch each bank with its own direct page and stack and perhaps a simple way to implement multitasking. My instinct would be to go smaller or larger on the bank size (either 32k so you can swap between very large programs and applications) or much smaller to conserve memory.


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 12, 2021 5:34 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3362
Location: Ontario, Canada
BigEd wrote:
Banking the bottom 16k is an unusual choice
rpiguy2 wrote:
I think the possibilities are pretty interesting.

The somewhat obscure MOS 6509 processor (not to be confused with Motorola 6809), banks out not just the bottom 16K but the entire 64K. The 6509 was featured in some of the Commodore CBM machines, so you might gain some insights by seeing how Commodore managed the situation.

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 14, 2021 5:19 pm 
Offline

Joined: Fri Apr 06, 2018 4:20 pm
Posts: 94
Dr Jefyll wrote:
BigEd wrote:
Banking the bottom 16k is an unusual choice
rpiguy2 wrote:
I think the possibilities are pretty interesting.

The somewhat obscure MOS 6509 processor (not to be confused with Motorola 6809), banks out not just the bottom 16K but the entire 64K. The 6509 was featured in some of the Commodore CBM machines, so you might gain some insights by seeing how Commodore managed the situation.

-- Jeff


It would be a little easier than the MOS 6509 because if you are only swapping out the bottom 16K then at least you could implement a small kernel somewhere in the upper 48K without having to worry about banking out to ROM, or copying the ROM into every bank, as you would have had to have done on the 6509.

But probably still no walk in the park to fully exploit.


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 25, 2021 8:09 am 
Offline

Joined: Thu Mar 04, 2021 10:08 am
Posts: 13
instantaphex wrote:
This looks really cool! Hoping I can get mine to this point one day. Where do you get that eeprom holder and does it allow you to program it without removing it from the board?


sorry for the late response...

these sockets are called ZIF (Zero Insertion Force) and are there to easily be able to swap out cips. Because during development I will have to reprogram the ROM very ofthen, I figured this would be justified. You can get them off ebay, mouser, amazon or whatnot ;)


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 26, 2021 2:28 pm 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
Synthron: congratulations, you've made a beautiful machine!

I am every curious about your memory layout and banking, as I am exploring similar issues. I've considered (very briefly) the consequences of swapping bottom RAM including the stack, and decided it's best to avoid doing so, if at all possible.

In my case, I wanted to make calls to the OS routines located in a separate 64K page. Not sharing the stack between mappings makes cross-page calls cumbersome, and in certain configurations nearly impossible.

How do you handle cross-page calls and returns when the stack is swapped out as well?

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 28, 2021 8:45 pm 
Offline

Joined: Thu Mar 04, 2021 10:08 am
Posts: 13
enso wrote:
I am every curious about your memory layout and banking, as I am exploring similar issues. I've considered (very briefly) the consequences of swapping bottom RAM including the stack, and decided it's best to avoid doing so, if at all possible.

well, I decided to just try it... in worst-case, I'll have only just shy of 32k RAM, which is for my usage (just as a plaything and first Proof of Concept) more than enough. It certainly will be interesting ;)

Quote:
In my case, I wanted to make calls to the OS routines located in a separate 64K page. Not sharing the stack between mappings makes cross-page calls cumbersome, and in certain configurations nearly impossible.

How do you handle cross-page calls and returns when the stack is swapped out as well?


my thought was that every task will have its own 16k page, thus can have a seperate stack and ZP. Task-handling will likely be timer based, so on each timer interrupt, I'll push A, X,Y and State-Register as well as current address (if possible) to the stack, switch the bank and pull the last state out of it. not the most efficient design, maby a very DUMB design, but I wanted to give it a try... If that doesn't work, I can just swap out the Chip-Selects for the banked ram and the shared ram and have 16k shared lower ram (ZP and Stack included) and bank the upper 16k-ish ram. So best case I have a somewhat unusual working design, mid-case (swapping the chip selects) I have a sorta normal design, worst case I just have 32k-ish ram....


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 29, 2021 9:12 pm 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 998
Location: near Heidelberg, Germany
My GeckOS implements preemptive multitasking by re-mapping the memory in 4k blocks, with each task having at least its own 4k block for dedicated zeropage and stack.
Just if you want to have a look

_________________
Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content: http://6502.org/users/andre/


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 30, 2021 4:24 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8196
Location: Midwestern USA
fachat wrote:
My GeckOS implements preemptive multitasking by re-mapping the memory in 4k blocks, with each task having at least its own 4k block for dedicated zeropage and stack.
Just if you want to have a look

A bit off-topic...

André, have you given any thought to porting GeckOS to the 65C816? I've done a fair amount of reading of your GeckOS pages and have come away thinking it would be a good environment to run on 816 hardware with extended RAM.

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 30, 2021 9:08 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10811
Location: England
(That would be good for a new thread...)


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

All times are UTC


Who is online

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