Close
0%
0%

ESP65 Pocket Computer: KIM-I/Apple-1/esp32

Like a HP-200LX but better - because 6502

Similar projects worth following
I always wanted a 6502 pocket computer in the HP-200LX shape. But nobody else did, so I had to make/fake my own. Goal: make the ultimate 6502 system that could exist in 1977, just before home computers arrived.

An esp32 does everything: front panel, serial terminal, 64K, KIM-1/Apple-1 compatibility, DOS/65 (CP/M like) disk storage & built-in '6502 software museum'.

This is a retro toy with dual purpose:
- 6502 hacking fun in the pocket, from hex coding to disk assemblers
- a generic esp32 retro platform. Z80, 6809, or VT-100 firmware is easy to add on.

Mix modules in various combinations:
1: KIM-1 Hex 'front panel'
2: ASCII keyboard (Apple-1 or serial terminal)
3: 480*320 display

2 modules form a flip-shell pocket computer; the 3rd is an optional module over Bluetooth or serial. Multi-purpose too:
- Keyboard & display = pocket serial terminal
- Keyboard = Bluetooth mini-keyboard for phone/PC
- Hex panel = stand-alone KIM-1

The idea was to have a 6502 'super system' that would fit in a shirt pocket. Because I firmly believe that enhances my geek-factor. Besides, it would enable 6502 fun, any time, any place.

The esp32 builds on my KIM Uno project of some years ago. That is a pocket-sized KIM-1, with exactly the capabilities of the real machine (although with lots of software built-in). It neatly filled up an atMega328 microcontroller's available RAM, CPU capabilities and I/O pins.

Now we live in even more modern times with things like the esp32. All of a sudden there is loads of RAM, Flash storage and wireless connectivity to play with. In fact, so much capacity that it is hard to fill it all up with retro 6502 goodness.

So I tried to make the esp65 into a lot of things at the same time. That can be criticised as lack of focus. But this hardware set will open up lots of retro projects I can waste my time on. It can be a Z-80 CP/M system, a VT-100 terminal for my PiDP-11, a programmable 6502 calculator, anything really. Hence, the mix&match 'modular' approach. Of course, I hope others will find it fun enough to add their ideas to it.

The other design goal: make it as low-cost as it can be. Standard parts only, and nothing more than the esp32, switches, a display and a cheap, standard case. This is a toy, and high parts cost only diminishes its fun factor. That also means I accept shortcomings. For instance, the hinge of the case is simply screwed on and needs to be propped up with a pen or something to stand upright. Otherwise, it will just open up the full 180 degrees.

And the wiring between the two halves (keypad and display) is simple wires, not a fancy flat-cable that needs expensive connectors. The goal was to make it robust and sturdy (so I can really carry it around), but cheap enough to make many of them (so it's not a disaster if it gets lost).

  • 2 × esp32 module One for the keyboard, one for the hex pad. The 6502 simulation runs on either one, the second is just an optional peripheral
  • 1 × ILI9488 TFT display module ubiqitous on aliexpress
  • 20 × 1K resistors Around 20 are used in the various modules
  • 2 × 3461BS segment LEDs Long description:0.36 inch Common Anode 4-digit 7-segment LED with decimal point
  • 90 × Tact switches standard 2-pin footprint, mouse button switches recommended

View all 6 components

  • Progress...

    Oscarv02/02/2021 at 16:21 0 comments

    The hard work only comes when the first prototype hardware is done. I had a few free days to spend on polishing up the basics. Those all seem to work, I can use the KIM-1 and Apple-1 ROMs, run Wozmon and Apple-1 Basic, boot up DOS65, load applications like ehBasic and assemblers with it.

    It's shaping up to be what I want it to be: a 6502-based business computer with everything you could bolt on in 1977 - just before the home computer era started with the Apple II etc.

    I am really starting to like the keyboard with its mouse-button switches. They feel just right, unlike a lot of the commercial mini-keyboards I tried.

    On the to-do list next:

    - get half-decent VT-100 emulation (sub-decent now, and I want Dan Werner's full-screen editor SEDIT to work properly);

    - hook up the KIM-1 hex programmer's keypad over something that wastes less resources than BLE (later on, I want to add virtual Z80 and 6120 (PDP-8!) coprocessors plus 64K of extra RAM - bluetooth just eats way too much into my free space).

    - add fancy features, like a portrait split-screen terminal mode with display of FLTPT65's floating point registers, a disassembler/debugger and perhaps a blinkenlight mode for fun;

    - respin a new version of the PCB to improve fit in the case, make things prettier & simpler to build, implement a few extra ideas now I figured out how to free up more GPIO pins.

    - longer term, add a Tektronix 4010 graphics mode.

    - port more application software to DOS/65. It's simple.

    - party like it's 1977 - with the fanciest 6502 system that 1977 dollars could ever buy. Yay! ;)

  • Adding an OS to the Apple-1 or KIM-1

    Oscarv01/15/2021 at 14:42 0 comments

    From my previous KIM Uno project, I already had a 6502 simulator with KIM/Apple compatibility. But for the esp65, I had to add an operating system to implement disk storage.

    In the Z80 world, CP/M offered a 'standard' OS right from the early days. For whatever (interesting!) reason, standardisation did not happen for the 6502. Only proprietary systems, for the OSI computer and for some other early machines existed, but no standard emerged.

    I looked at porting the Ohio Scientific (OSI) disk operating system, and the interesting DOS65 for the Dutch Octopus computer. I might end up adding them, but because I am familiar with CP/M, I chose Richard Leary's DOS/65. Developed around 1980, Richard published this only some years ago. It really is CP/M for the 6502, and comes with the essentials: an assembler, Basic compiler, line editor, and debugger. As part of the Retrobrew 6x0x project, Dan Werner added a full-screen editor and Lee Davison's ehBasic. But for me, the attraction of DOS/65 is that it was *meant* to be added on to any 6502 system. Not just one specific computer.


    Bringing up DOS/65 turned out to be surprisingly simple. I wrote a 40-line disk interface simulator on the esp32 side, a little 70-byte boat loader ROM within the 6502 emulator, which loads DOS/65 from a disk image on the esp32. To make it live as an extension of the KIM-1 and Apple-1, and not a replacement for either one, I configured DOS/65 to claim $2000-$D000 as its RAM territory. But it allows you to load code anywhere, so it indeed can load Apple-1 and KIM-1 programs and lets you jump back to the KIM or Apple ROM firmware. It's perfect in that it truly is an enhancement to the original machines, not a replacement fo them. You can have KIM, Apple, or DOS/65 software live side by side on the disks and run any of it. That fits my ambition of having my esp65 be both KIM and Apple compatible at the same time!

    (Image: we start in Wozmon on the Apple-1, boot up DOS/65 and flip to the KIM-1 terminal mode - seamless integration :)

    For now, I have two 320K disk images preloaded with software in the esp32's SPIFFs file system, plus a tiny 16K ram disk for when you continuously edit a file and you don't want to wear out the disks ;)

    Future projects will be to add the similar-named but very different DOS65, and I will try to bring up 6502 fuzix. But fuzix, of course, will disable KIM/Apple compatibility and be its own thing. Still: it'd make the esp65 into a tiny unix-like system with even a C compiler. Ooh, the possibilities...

  • Figuring out how to make a good mini keyboard

    Oscarv01/15/2021 at 14:15 1 comment

    There's loads of mini-keyboards, but they are always unpleasant to type on. Partly, it's size and that cannot be changed. But trying out various BLE keyboards for this project, they all had bad 'tactile characteristics'.

    So I ordered samples of all tact switches and mini-buttons I could find. And found that by far the best was the type of mini switch used for mouse buttons: very light in touch (which you need on a tiny keyboard), and a decent tactile feedback. They really worked for a programmers' keyboard!

    That find sparked the keyboard part of the project. Making your own is fun anyway. I found almost ready-made BLE code on github from chegewara, the Apple II layout keyboard matrix was easy to implement.

    I initially developed it as a standard Bluetooth BLE 'HID keyboard', then added serial port output. So the keyboard hardware can serve three purposes: just as a generic BLE keyboard for PC or phone, then as a serial keyboard for projects, and lastly, because the esp32 inside has plenty of capacity, it can run my 6502 emulation and TFT display to be a stand-alone retrocomputer or terminal (either over serial, wifi, or Bluetooth even). So, multi-purpose, and that adds to the idea of the esp65 being a retro-playground and not just a 6502 supercomputer...

View all 3 project logs

Enjoy this project?

Share

Discussions

Jonson26 wrote 01/29/2021 at 13:08 point

Could you maybe publish the pcb files and your rom images so we can build this for ourselves?

  Are you sure? yes | no

Oscarv wrote 02/03/2021 at 01:24 point

Sure. Let me make one more respin of the PCB (this prototype does not easily fit in the case and I wasted some GPIO pins). But if you want, I can email you what I currently have. I don't want to publicly put it on Hackaday just yet, it's not good enough yet.

  Are you sure? yes | no

Con Cunningham wrote 01/20/2021 at 16:57 point

Oscar - more wonderful toys! Great stuff. I am curious to see the code for the 6502 Emulator on the ATMega - is it freely available?

Con

  Are you sure? yes | no

Oscarv wrote 02/03/2021 at 01:21 point

Con, sure, I can send you my horrible code (I'm less of a developer, more like a plumber) for the esp65. Or, somewhat more clean, download the KIM Uno code. Runs on atMega328, STM32 and esp32: https://obsolescence.wixsite.com/obsolescence/kim-uno-details , bottom of the page.

  Are you sure? yes | no

marazm wrote 01/19/2021 at 21:06 point

How long this device work? Is possible run unix? similar https://hackaday.io/project/643-minibsd-laptop-computer/log/29607-44-bsd-lite

  Are you sure? yes | no

Oscarv wrote 01/20/2021 at 01:21 point

I wanted to say, no, not unix. But I was wrong. SpritesMods just published 2.11BSD running on an esp32 that emulates a PDP-11. He uses the bigger WROVER version though, so that just triggered a respin on my PCB. Imagine that. 2.11BSD...

  Are you sure? yes | no

marazm wrote 01/20/2021 at 11:11 point

Linux on Psion 5 https://jm.iq.pl/psion-5mx-z-linuxem-na-pokladzie/ (cpu CL-PS7110 @ 18–36 MHz)

is possible too ;-) 

Many people need only small computer for writing a tex, vi, ssh, ruby, haskell etc.. But offgrid. I dream of a small computer running for a week on a single charge like the one above (psion work 1 week on 2 * AA bateries). Or longest

  Are you sure? yes | no

Anthony DiGirolamo wrote 01/19/2021 at 06:22 point

❤️ everything about this!! Genius idea to use tac switches for mice. I picked these panasonic ones (EVQ-Q2B03W Tactile Switch) but they turned out to be too easy to push. Pics here: https://github.com/AnthonyDiGirolamo/i2c-thumb-keyboard

  Are you sure? yes | no

Oscarv wrote 01/19/2021 at 16:04 point

You should look on Aliexpress for "Mute button 6*6*7.3 Silent switch wireless mouse". The manufacturer told me there are a few variants: black button = hard click, red = soft click, grey = does not exist but that's what I got(...). Also, there's variants with a 9mm stem rather than the flattish 7.3mm one.

I'm waiting for some more samples, I'll let you know. But they would fit your keyboard nicely!

  Are you sure? yes | no

Anthony DiGirolamo wrote 01/19/2021 at 18:24 point

Thanks! Looks like they are made by Kailh: https://www.kailhswitch.com/micro-switches/mouse-micro-switches/

  Are you sure? yes | no

Mike Szczys wrote 01/18/2021 at 17:34 point

Oh that clamshell is just perfect. The keyboard and screen sizes are just right. The 1980's me thought this is what the future would look like, not rectangular glass in everyone's pocket. I love it!

  Are you sure? yes | no

Oscarv wrote 01/19/2021 at 16:00 point

The clamshell is not so perfect: I fitted a $1 hinge to make the case into a clamshell and unless I think of something smart, it will not stand upright (it will open up 180 degrees) unless you stick a pen or something underneath the hinge. But - I wanted this to be low-cost. $3 for case & hinge makes it acceptable.

  Are you sure? yes | no

Mike Szczys wrote 01/19/2021 at 16:04 point

Yeah, I read that part in the write up and it didn't bother me at all. As a proof of concept this is just fine... if it were a real problem the next iteration can have some hinge that stays open with friction. (Hand-waving, I know.)

Honestly, if you're holding this in your hands and typing with thumbs, you can probably keep the screen tilted just right with your fingers?

  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