Category Archives: Apple ][

6502 emulated in microcontroller (Part 5) IT LIVES!

I found the 74hc299 shift register was giving me fits, so I removed it for now and wired the data bus temporarily directly to the arduino to work through reading and writing to ram.  I started by writing a repeating but easily distinguishable pattern to the ram to make sure it can write to all the ram and read it back.  64kb in 2 chips of 32kb.
I can come back later and add the shift register back.
I then patched the 6502 emulator code to read and write to the RAM. There seems to be some slower performance that I am tracking down.  I hope that the shift register performance isnt too slow.  I did notice that splitting the address into two bytes by doing bitshift seems slow.  And I haven’t started figuring out what to use for rom or sdcard, and memory mapping.

It lives! Running EHBasic 2.22 rom.

I have to collect up the links for the EHBasic project and the Arduino 6502 project I based my modifications on.  I do plan on cleaning up the code and posting it.

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.