So I really hope I'm not repeating a question here but I took a look around the web (and found some posts on the forum but not exactly what I was looking for) and couldn't find much for exactly what I want to do.
I've wanted to build a 6502 SBC for a really long time, probably almost a decade, but I've never actually gotten around to doing it. I'm fairly familiar with electronics (although more with analog than with digital) and I've built some projects before (cmoy, which I hacked on some other features to, O2 Amp/Dac combo, lots of arduino stuff, tons of 3D printer board work (swapped a MEGA2560 from an arduino to a board recently that had a dead mcu) and a couple others). I read the primer and I'm still a bit confused on my starting point. The section that discussed how to start gave me some good info on what to do, so I got a notebook and started planning out features for it, and was looking to start memory mapping and trying to figure out the address decoding.
I should mention, this project is sort of a gift to my fiancee, who really loves retro electronics, specifically video game stuff. Because of this, I'd like to build it with a color display and run PAC-MAN on it. I want to use the machine for a lot of other small projects as well, and as a way to learn digital electronics.
I have about a decade of programming experience in high level languages, and I've worked with stack based programming before, so I'm
fairly confident that I can get this done
eventually but I think the biggest hurdle here is I've not put together a lot of digital circuits.
So with the precursor, let me explain a little bit about what I've come up with so far
I'd like to use a 65c02 or similar, but I've not ruled out the '816
I'm not aiming for super high speed, but was hoping for 2-4Mhz if I can swing it
I'd like to have 32-64k RAM, I realize I probably won't need this much, but I'd like to have it just in case (if I use a '816 I'd like to try for over 1MB)
For ROM, I'd like to have 32-64k as well, but I'd also like to investigate the possibility of using EEPROM that I can program from the 6502
I have a small CNC router that I've made double sided boards with before, will I be able to make a double sided board with it for this (it does through hole pretty well, but struggles on super small traces, I'd say resolution goes down to about 0.2mm) ? I'd like to do it this way instead of going to a fab just for the fun of it (I'm using KiCad and FlatCAM for my CAD/CAM stack)
I've looked at a few video chips that have been paired with the 6502 before, but most are either not sourceable or don't do exactly what I want
Because of the item above, I've been thinking about the possibility of running a RGB display with a parallel connection (specifically I found this one but it's not exactly what I want, and it's barely 3.3v tolerant)
I want to attach a full keyboard, possibly PS/2 but I may run a USB keyboard over a PS/2 adapter, as the only PS/2 keyboard I have laying around is really broken
I'd like to have mass storage of some kind, probably an SD card over SPI, although I'm open to suggestions
I want to have audio out, the resolution isn't super important, but I'd like to try and use something that can take samples from mass storage and play them, so I'm not spending a lot of time emulating "wakka-wakka" in waveforms, although one that can do both would be awesome
And finally, I'd like to retain some GPIO for future use, and keep it as modular as possible
So, with all that in mind, I have a few ramblings on how I think things will work:
LCD:
I originally wanted a 256x256 LCD with 8 bit color, although it seems impossible to find, so all my calculations are according to this spec
depending on frame rate, updating all pixels on this display would require 2-8M operations, which is obviously way out of range of the '02 unless I clock it super fast, which I don't want to do to start with. the '816 may possibly do a little better, especially if I use all 16 bits of the data bus to do 2 pixels at once but it's still pushing it
It also requires 64k memory just for the LCD, so poof goes my ram
The solution I came up with was to have dedicated SRAM for the display and some sort of "frame ready" line that I pull high/low when the CPU is done writing to the SRAM. This fixes losing all my ram, but it doesn't fix the ridiculous amount of operations I need to do to update all the pixels. To solve that issue, I decided to treat the display video somewhat like a GIF, that is, only update the pixels that are changing in the next frame. This lets us have a very slow first frame, but the following frames can be relatively fast (if PAC-MAN is 32x32 and so are all the ghosts, that's 1,280 pixels total that need to be updated, and if they're only allowed to move one pixel each frame, that gives us only an additional (32x5) for a total of 1,440 pixels to update each frame)
I'm not sure how many cycles it will take to update a single byte of the SRAM I'm using for video, I seem to remember it was fairly fast for normal memory, but at only 1,440 pixels updated per frame there's a bit of headroom to play with and still achieve a decent FPS (my goal is about 30) even at 1Mhz system clock.
I realize I've left out a few pixels for the score display, but I'm also hoping I can get some text generation going on so I can do one ascii value write for each character, rather than having to bit bang letters onto the screen (bit banging pacman will be hard enough)
With all this in mind, I'm aiming to keep the draw subroutine at about 10% of the cycles of the CPU, leaving 90% for game logic
Now, the above rambling about the LCD may be waaaaaaaaaay off base, because I've not dealt with drawing to LCDs much even with my arduino projects, so there may be way better ways of achieving this result (I read something about scanline rendering, but I'm not sure how to use it or how it would play in here). If there's a video chip that can do all this on its own, that would be great, although I would like to keep the project sort of "pure" and not put something arm based running at a couple hundred Mhz on it. I also don't want to do VGA (right now) because I'd like to put this all in a 3D printed enclosure, and my printer doesn't print large enough to mount any VGA panels out there.
Game Logic:
I know this is a little off topic but it's related to the project in general, so I'd like to see if I'm on the right track when thinking about this in a memory sensitive and stack based context. I think the hardest part is managing the map, and the different entities (pacman and ghosts) moving around it. If I simplify the map to a 256x256 pixel area, and use single bits as walls/ghosts/pacman/dots I think I can get away with doing it with only about 9,600 bytes for the map itself, and then some bytes to store locations of pacman and the ghosts and walls (walls I'm going to try and use some bitmasking to save more memory, and if none of these items are in a location that has a 1 in the map, I'm assuming its a dot, I'll need to also save locations of the powerup dots). Doing it this way also allows me to move pacman smoothly, since I have a 1:1 backing of pixels to the map in memory
Board Design:
So, I'm still a bit green with board design, but I've put together a few working boards (with some 27016 I2C I/O expanders and a few other misc chips) that I made in Eagle (and now KiCad) and then milled on my CNC. I don't know a whole lot about protecting lines other than to use a ground plane and power plane (which, with only 2 sides is impossible) but the primer had a lot of good info on this, as far as keeping chips very close together, making connections as short as possible, using bypass capacitors, and making fat power lines in a star configuration (which I'm not familiar with but I'm sure it's not incredibly complex). Past this, I'm pretty clueless (chip placement, port placement, etc)
Component selection:
I've looked at the 74xx logic chips before, I added one in a project I never actually built (it was really just a joke making it) that was a 3 in 8 out mux iirc. (I used it to mux CS on some 23s17s so I could have 64 chips on the same board and same SPI lines, turning 7 IO pins into 1,024 IO pins) but I honestly only know how they work in theory, and even then I don't know a lot about certain types of chips. Basically, I can work with boolean logic very well but once it's in hardware I'm a bit lost. I also saw the 6522 (I believe the VIA) and 6521 (I believe the ACIA) mentioned a lot in the primer, and I know that the ACIA gives serial communication, and the VIA gives parallel, but I'm still a bit confused on exactly how I need to use them. For SRAM, although I've not dealt with it before, I'm more knowledgeable, because I've read a lot about it in the past and it's fairly simple to grasp, but I've not looked into specific chips yet. The same goes for (E)EPROM. As far as the SD card goes, once I have some form of SPI I know there's about a billion interfaces out there that will let me access it. For display, see the above notes on the LCD
General Consensus:
I don't think I'm going to finish this in time for valentines day, but I've got a backup gift, so it's ok
TL;DR: OP has no idea what he is doing and needs some guidance on taking on this project
I believe I've touched on everything I have in my notes, except memory mapping (which I've barely started) but if I have more info I'll drop it here, thanks in advance for the help, it is much appreciated.