Build your own 6502 BASIC

Continuing the discussion from Interactive Computer Museum:

Just in case you have the nostalgic notion to throw together your own 6502 system:

http://www.pagetable.com/?p=46

It would be incomplete not to have a BASIC interpreter for it.

2 Likes

Speaking of 6502 stuff, this is something I saw at the Bay Area Maker Faire: http://monster6502.com/ Some fellow actually made a 6502 on a PCB using discrete components with lots of LEDs to indicate various status registers & operations. Funny part is when I asked them if they’d made the 6532 (RIOT chip) peripheral, they looked at me like I had seven heads. Guess they never thought about doing serious I/O… :stuck_out_tongue:

1 Like

Would anyone be interested in a “wire wrap your own 6502 system” class? We’d likely use WDC65C816s due to availability.

Pre-reqs: have done some electronics work in the past, buy a kit of parts off of Digikey, and have had some experience with assembly programming.

1 Like

That “wire wrap” part sounds a bit painful to me… :stuck_out_tongue: However, I’m in the middle of trying to disassemble some 6502 assembly for an old pinball machine in order to garner a high-level understanding of what the code is doing and possibly add in more features to the game. So far, I’ve deduced where it does a bunch of AND, ORA, and CMP instructions before reading in memory that corresponds to “TILT” (luckily they encoded that in ASCII!), so maybe I’m into a different sort of pain. :wink:

Anyone want to help me? It’s been slow going since I’ve decoded a whole lot of low-level operations but haven’t deduced very much high-level meaning.

1 Like

Yes.

I wish you had mentioned this at the PotLuck. I could maybe have had it done by now.

You might want to investigate:

http://decompiler.org/

1 Like

I got busy on my contracting gig that pays for my DMS membership so I had to put on hold my efforts at improving/extending my 6502 disassembler. When I get some slack time I’m going to have another look at it, probably abandoning the original C code and starting fresh with a python version. Add this to my always increasing project list…

Got a github for the project?

I use to reverse engineer viruses and other software back in the day, just last month my gaming vm got a virus that took me ten minutes to reverse and track down the cnc source. Got to say they’re not trying anymore. What ever happen to the days when virii writers created thier own Polymorphic and stenographic engines that stumped even the NSA?

Long story, turn short, I’m bored with all the week malware now a days and need a challenge so I could spend a few cycles working on a few areas expectantly if there is documentation on the binary format we’re looking to dissect.

1 Like

Pagetable is an awesome site.

For those interested in building up a homebrew 6502, also consider Lee Davison’s EHBasic. It’s also designed to be portable, comes with the original source code in compilable form, and is nicer than the MS basic. Although Lee passed away a couple of years ago, someone place a copy of the source on GitHub here. Also, check out 6502.org.

1 Like

I can take a look at it with you. I think the free version of IDA can handle 6502 code, and is a great tool for reverse engineering.

1 Like

I would be up for such a course, if there is enough interest to actually make this a class let me know.

Would this be geared more toward building the hardware or programming the result?

If only the latter, maybe consider starting with a board like this? https://hackaday.com/2015/07/29/review-single-board-65c02-and-65c816-computers/

Both, but mostly building a microprocessor system with a CPU, memory, I/O, etc. and watching it come alive for the first time. It’s a must-do for anyone interested in embedded systems; the exercise will give you deep insight into how things work. You can then apply this knowledge to more modern, highly-integrated microcontrollers or Systems-on-a-chip.

I started a project on that for the z80 about a year ago. There’s a great write up on of something similar at https://hackaday.com/2015/04/15/the-rum-80-a-home-brew-z80-computer-built-from-scratch/

Edit:

Found a pdf of an early book on building pcs from scratch: https://www.modmypi.com/download/BuildYourOwnZ80.pdf

I’ve done that and do not want to cheat anyone else out of the experience.

The way I used to do it was to fill an Eprom with NOP opcodes and hook up the processor with only the power supply, the clock circuitry and the Eprom. When it is working properly, the address bus can be observed stepping. Then put in decoding logic and RAM, serial port, etc.

Maybe we should build Eprom emulators to avoid the erase, burn, test cycle.

Or just use some flash ROMs. :slight_smile:

2804 or 2816 anyone?

You can just wire 0xEA on the bus during reads, no need for an EPROM, etc.

Another option is a dual-port RAM chip. Many ways to skin this dog.

This class tempts me. Are we talking about a single evening, or a series?

Last time I did hardware side embedded work was in '87 with a z-80 - solo design, wire wrap prototype, and programming. Fun stuff!

I grew up on 6502. First Apple, then Commodore. First programming, then working in a local repair shop. We did Commodore repairs at a flat rate of $65. Sometimes people didn’t think it worth that to repair, so I’d offer them $25 for the dead machine. I’d cannibalize one dead one to fix a few others, then sell them refurbished. Not a bad teenager gig.

I probably won’t do the class for me… can’t quite justify the time for that temptation. But if timing works, I might come with my son. I’d fill in what he lacks in experience with assembly, and let it be his project primarily.

ROFL!

I have a pile of dead ones here for my retro business. They came from a defunct Commodore repair center in east Texas and I’ve been selling harvested and tested ICs out of those for years. :slight_smile: