A call for programming ideas for DIY 6502 computer and others

Hi,

I need the help of your collective imagination.

I’ve built a 6502 computer (based on Ben Eater, and others). It has a 4X20 lcd and a PS/2 keyboard. I don’t have a video card yet (it will be a VGA Arduino based one (instead of hardware) with its own memory to not slow down the 6502… or I hope so…). I also have a I2C communication between it and a PC (windows, linux , Arduino, or TRS-80 (model I). I would be willing to add any hardware required to implement a fun idea.

I am looking to use it for something useful, but I need a lot of ideas (any ideas : weird, out of the box, mundane, Impossible, boring, or anything) to get a brainstorming going to find something that I want to do.

Here are some idea to get the train started and those that were suggested by the community!

  • Proprietary Game console (port existing games?)
  • write a vertically scrolling shooter - with VGA card
  • Control window blinds
  • Auto adjust shower temps
  • litter box cleaning
  • Security camera controller
  • Super-Macro recorder/playback (Keylogger/Playback with context)
  • Calendar/Activity display
  • Goal monitor (check when done something, like going to the gym)
  • Fridge inventory (with barcode?)
  • Robot (doing what? idk - help?)
  • advanced washing machine programming
  • advanced AC control
  • automatic interactive cat toy/feeder
  • R&D for blitting operation for graphics
  • Music Instrument/synth/stand alone music tracker (need extra hardware for sound)
  • Proximity warning for the car. LEDs that light up if a car or other obstacle are too close. Bio if signaling to change lane and there is someone in the dead angle…

Keep them coming! The more we have, the stormier the brain gets!

1 Like

So most home automation that I happen to run into these days gets implemented by using one of esp8266 or esp32 (with esphome/freertos) or an raspberry pi zero w, to interface with low level hardware on one end, and provide a wifi interface on the other end.
Usually on the other end of that wifi interface there’s something like Home Assistant.

Which brings me to my question - why would you program a 6502 instead of something slightly more comfortable?

1 Like

Id suggest looking around you for things that would profit from 6502 automation - maybe an advanced controller for your AC? Or a washing program for your washing machine?

1 Like

That is a good question. Why use the 6502 junky homemade computer instead of an arduino or a rPi?

Well, I built the 6502 for fun and nostalgia. It is now collecting dust on the workbench. I like to program in assembler (nostalgia, again), and I’d like to put it to some uses. But you are right, I should not limit myself to the 6502 DIY computer. I have many arduino or rPi laying around doing nothing. I could use those too.

So my initial question stay : what can I program (using any computer/controller) using low level language (Assembler, C) that would be useful around the house?

Is it easy to use such a platform to switch things like relais or read out stuff like spi sensors or i2c?

The 6502 or more precisely, the W65C02 (which I am using) is still used in a lot of modern things (cars, IoT, Home automation, Industrial Embeded systems, etc) because of its low cost and ease of programming. One could say that it was built to do that kind of stuff.

And since I’ve built the computer, I can do anything I want with it. It has I2C connectivity right now (1 for the LCD and 1 free port currently used to “talk” to a PC) . I haven’t tried SPI, but it should be possible, and It has 8 free gpio digital pin that could by used to activate relay and trigger an interrupt if wired for it. I have the chips to add Analog IO if needed and could add more gpio if required.

The limitation of mine will be the speed. I run it at 3 mhz (approx.) In theory, it could go all the way up to 14, but realistically, I might already be at the max speed. (timing and stability are hard, even after moving everything on soldered PCB).

I’ll add both to the brainstorm list, thanks!

Lol

A 6502 with vga is like having a 286 with 3dfx voodoo

Kudos for making it work but seems like a weird Frankenstein collection of parts

I get wanting to scratch the assembly programming itch though. I keep wanting to go back and learn 6502 or dabble in x86 again. Or try again to write stuff for amiga in 68k. I coded a few shitty little games in pascal plus my own vga library in assembly way back. :metal:

Keen to see what you do with it.

Old processors are much easier to learn assembly for.

My vote: write a vertically scrolling shooter with it. Should be an interesting challenge given literally nobody else has this hardware combo.

Vga mode x and page flips etc should get you some nice smooth scrolling without too much cpu overhead. Maybe. You might be throughout limited on the CPU to do decent resolution though. But hey. I didn’t get into advanced vga programming and just brute forced everything via software using a 486 processor - I think the vga hardware may have support for hardware blitting operations?

Edit: then again “river raid” managed to run on a 2600. Look up how… lacking that hardware was.

1 Like

Well, The VGA output is easy to program (kind of… still complex to get the good timing for any kind of passable resolution) as RGB have their own connectors, the voltage of each determine the intensity and the timing determine the Xposition. Hsync determine the line.

I still have issue with my “vga card” (it’s an arduino) but there is kind of multiple pages.

There aren’t blitting operation native to the 6502, but it would be fun to research and implement that…

Audio would also be fun to have for a game. Which just gave me a new idea! (we are storming the brains!!)

Thank you for the ideas. I’ll add them to the list!

Yeah my thoughts with throughput of 6502 vs VGA is that 256 colour VGA requires at least 16 kb worth of memory write operations to update a video page (of 320x200) using the CPU (assuming you’re able to do 4 bytes at a time via modeX - modeX can update 4 bytes at a time with the same value via a register bit mask).

On a 1mhz 6502 that’s a lot of data :smiley:

I’m not sure if regular VGA hardware has the ability to copy/blit blocks of video memory from one location to another independent of CPU. If it can, you could use CPU to upload all your sprites to display memory and then tell the VGA to move it around…

You can definitely do viewport scrolling in hardware (mostly), but individual sprites, not so sure without some level of SVGA…

Otherwise, in terms of CPU throughput to update display memory you might need to knock it down to a lower colour video mode (maybe CGA or something). Or update less of the screen… black background mostly… which might work OK for a shooter.

tl;dr summary :

  • modeX is cool.
  • I still have a long way to go before having a working graphic output.
  • I like this 6502 computer
  • I like to talk about it.

This was the tl;dr summary

I didn’t know about modeX. Cool!

It might not have been clear. I use an arduino as a video card that output a signal compatible with VGA, the protocol and pins. It (almost) works by having 2 memory space on the arduino. one that is currently being draw on the monitor and another that is reading “video memory” from the 6502 using the same address and data bus. That need to be done when the 6502 is not using the address bus (there is a signal from the 6502 when the bus is free). When I have to vSync, I just switch the two address and restart reading from the start of 6502 video memory. I often don’t get to read all the data before I have to switch page. I might change the behavior to continue from where I was and roll over to the start. There would be flicker and tears, but I would get the whole image.

The 6502 does not output data itself. by the way, it is a modern W65C02 that I run at 3mhz, but as you have calculated, it is still not fast enough to output video. The arduino, running at 16Mhz, can barely keep up to output a 200X150. (VGA resolution of 800X600 divided by 4 because the Arduino clock isn’t fast enough to display more). Since I output pixel at a slower rate than expected (by a factor of 4) each (Mega)pixel is 4 times longer. To keep the same display ratio, I output the same line 4 times in a row. Right now, I only send a signal on the blue wire and it is ON/OFF (blue/Black). I can only afford 1 byte per pixel, so I’ll have a limited number of color (Anyway, I’m colorblind :wink: ) but I intend to have (almost) 32 colors (2 bits per channel for 8 color, and 2 bit for 4 level of brightness). I still have to figure out how code it to make an output that would result in a signal from 0 to 0.7 volt for each channel. I could use 3 “analog” output pin for that, or 8 digital ones and make a circuit to produce different voltage level. I’m not there yet, but seeing how the Arduino is already too busy, I might have to go the hardware route. (software is easier to build and debug)

Also the 6502 databus is 8 bits, The arduino can only read 1 byte every 2-5 (6502) cycles (3 -6 arduino cycle) because it is interrupted quite often. A 10Mhz clock is connected to the INT pin of the arduino to trigger the output of the next (Mega)pixel to the monitor. Whenever it is not doing that, It try to read the next (Mega)pixel from the 6502 memory, if the address and data bus are free. (if not, it flash a led and try again!)

I found the CGA signal protocol to be more complicated than the VGA signal. I don’t know much about it and there isn’t as much information on how to build a circuit for it. There are a lot of project that explain how to output a signal compatible with the VGA protocol. So I went that way.

I don’t think I’ll do sprites. As fun as it could be, I would need a faster Arduino and a lot more time.

If I were to do it, like you suggested, I could have the 6502 upload the sprites before hand to the arduino (using those free GPIO pins or a I2C interface if not enough pin left ) and after that, just send the sprite number and the new position for the arduino can combine it in the “reading memory” at the same time it is reading of those memory locations from the 6502 memory…

It is a long reply. I get excited when I talk about this project. I am proud of my little 6502 computer and I would really like to use it for something useful. There is still a lot of work to get the video working. That is why I am asking for ideas on what to do with it. Some idea can work with the little 40 characters LCD, or I could buy a simple graphic LCD.

I could also just use a rPi with an apple II, C64 or NES emulator as a computer. No need for a home built video output! :wink:

But I would still not know what to do with it…

1 Like

It is late and my brain is starting to have funny ideas…
I could use 4 arduino in parallel to get more pixels on screen…

If you’re curious about how modeX works (i was actually referring to mode Y according to wikipedia, but same same) check out some of the references here.

Both are “tweaked” vga mode 0x13. From the wiki article, mode Q is probably even easier for 6502 due to being 256 pixels wide.

If your arduino is properly emulating VGA, modeX or modeY give you some advantages over regular chunky vga in terms of speed for blitting large amounts of data. good for fill rate on polygons for example. A lot of 90s games used mode X for speed. Requires some slightly more complex logic than chunky vga to program but the benefits are there. Especially when programming in PC real mode with 64K segments - you can access 4x 320x200 VGA pages at once via the 64k memory segment and the bitplane selector…

Whether that’s relevant exactly to what your arduino is doing or not, not sure; but it may also give you some speed ideas - essentially planar graphics and ability to write to multiple bitplanes at the same time can help get throughput.

1 Like

Answer : no. 6502 memory is still at 1Mhz.