Tag Archives: Apple ][

6502 emulated in microcontroller (Part 4)

One step closer.  I have both the address bus (orange wires) and data bus (green wires) working and reading.  I am able to select the memory address and bank (chip select) and the data bus latches and displays the bits stored.  I still have to work through the details of using the universal shift register and timing the memory writes with it so it can read and write bytes to the bus. 

A very photogenic breadboard!

Once I have that working I can patch the 6502 emulator to use the external ram instead of the microcontroller ram.  Turns out the method I used to select the ram, is similar to how you would do bank switching on an Apple II.  Once I have a method to dynamically map memory, I have to decide where the zero page and registers will reside,  if I use microcontroller ram,  I can’t spy on those items, but it may prove faster.  I haven’t even thought about video display or physical I/O

6502 emulated in microcontroller (Part 3)

After successfully getting address lookup, and read/writes to work using a common SPI like bus I decided to go a little further.

I removed the 8K x 8 chip and added two 32kb chips.  I am using the decoder chip on the last unused address bus line to do chip enable between the two chips allowing it to address 64kb by automatically switching to the second bank,  however later on I can leverage additional bank switching by hooking up the last two address lines to open pins on the arduino.  I put this together so I can use eeproms or other alternatives based on my configurable mapping.

I even got a rudimentary multitasking system experiment going on by swapping zero page and register address pages when memory is swapped, relying on the microcontroller to swap banks.

6502 emulated in microcontroller (Part 2)

Last night I added an 74HC138 3 into 8 line decoder to my project. Ignore the fact that I’m not using resistors with the LED’s. It’s just for testing until I decide just how I’m going to handle them.
2013-11-15 14.09.08
Essentially it takes a 3 bit binary value (3 address inputs) that represents 0 to 7, and enables one of 8 possible outputs. It has many uses, enabling one of several SPI devices, I’ve used it in the past to replace rotary switches to interface with analog devices. In this specific case, I’m going to use it to select what “slot” I want to look at to read/write an address bus, set registers, for my project. I have Apple II compatible card edge slot connectors that I can put onto a protoboard and interface with “Real” hardware. I’m not quite that far yet, as I’m just beginning to look at memory mapping, loading “Roms” from an SD card into the memory block on the RAM. One thing I did decide was using a configuration file for memory mapping. Since I can address the full 64K with the emulator I can map the memory however I want and load whatever I need into the map.
2013-11-15 14.07.45

Another thought crossed my mind, if I were to take a 40 pin DIP connector and wire the outputs and inputs as appropriate address bus, data bus, and other outputs, if I could emulate the 6502 directly in an Apple II, using the apple’s clock pulse to trigger an interrupt that stepped the emulator once cycle. It’s not actually that outrageous an idea. By doing that I can inspect and step data on a more modern PC, or even modify or replace portions of memory.