Close
0%
0%

LEM6502

It's a Lemon Powered Retro computer need I say more :D

Public Chat
Similar projects worth following
Once again, another strange project to ask the question is it possible to run a retro computer on lemons at least in a feasible way ie. so that it is portable.
It's another project that I'm not sure if it is even achievable, but let's go for it anyhow.

Well, maybe I should explain a little better. This idea came to my head after listening to an episode of the Retro Computing Roundtable podcast, If I recall correctly there was a discussion about powering an Apple ii (2) from lemon batteries.
A ridiculous crazy idea it would require thousands and thousands of lemons to run a power-hungry vintage computer.

Unfortunately, these kinds of thoughts seem to stay with me and have to ask myself what would be possible with 10-12 lemons. There are MCU's out there that can run on almost zero power operating at 1-2mA and 1.8-3.3v.

What if I could run an interpreter for a classic CPU something like a Z80, 8086 or 6502 inside a modern MCU that can execute machine code for a classic machine and then run that from lemons, that's doable, right?

No real reason for choosing the 6502, could be because I haven't got anything with that processor at the moment. So, as usual,  googled 6502 emulators for MCU's and low and behold there was one for an STM32F103 by JEELABS ( unrelated to me :D ). He has squeezed a 6502 interrupter and a basic ROM into the MCU. 

SO just a rough out line to this project is:

Pick an MCU almost any is possible.

Find and implement a 6502 interpreter for the MCU type.

Get some 6502 software up and running on it, this will probably be BASIC.

Optimise the power consumption as much as possible.

Test Lemon batteries.

Build it all together.

Make a cool case ( thinking along the lines of tubes of lemons to represent batteries. 

  • Get something working (Part 1) Research:

    Gee Bartlett09/03/2020 at 21:16 0 comments

    First thing was some initial investigation about whether implementing a 6502 emulator/interpreter has ever been done. I found two good sources of information were a blog post but JEELABS and a pure C interpreter written by Mike Chambers for a NES emulator which uses the 6502 processor. 

    The JEELABS project was amazing as he also had a version of Microsoft BASIC running as well as a low level kernel. The only thing that put me off of the project was the whole interpreter was contained within the same C file. The other point with the JEELABS code it was using the Arduino IDE which although I like and often used there isn't an easy way to trace and debug which I would really feel far more comfortable, and the Arduino IDE is pretty good at adding unnecessary code. 

    This is the point I took a deep dive in to the both sets of code to see how it is implemented. 

    the basic outline is first you call:

    reset6502() 

    Which resets all the registers and sets the 6502 Program Counter to 0xFFFC which is the reset vector this is the memory location that the 6502 loads the address of the first instruction/Opcode. 

    Then you use a loop with either:

    step6502()  

    This will perform an individual 6502 CPU cycle. Or:

    exec6502(uint32_t tickcount) 

    This will perform multiple CPU cycles give by 'uint32_t tickcount'

    The emulator performs one of two callbacks.

     uint8_t read6502(uint16_t address) 

    Can be used inside your main.c and expects a value to be returned so if you returned nop values the system would endlessly nop.

    void write6502(uint16_t address, uint8_t value)

    Can be used inside your main.c to store data as if it was a memory location or peripheral device.     

    At this point it was time to think about what I was going run this all on. JEELABS had used an STM32F103 (bluepill) which was bigger and more powerful than i as going to need for this.

    I first picked an STM32F030C8 for my platform, but as i'll explain in another post failed for a bit. 

    So just because I had it lying around I decided to use a STM32F401RB which I just happened to have laying around as a Nucleo-64 development board.

    Will update more at a later point.....

View project log

Enjoy this project?

Share

Discussions

Dan Maloney wrote 08/28/2020 at 00:04 point

I'm from Idaho, so I'd use potatoes instead...

  Are you sure? yes | no

Gee Bartlett wrote 08/28/2020 at 10:05 point

:) hehehhe. Whichever electrolyte floats your boat. Need to see which ones have the lowest internal resistance. 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates