• Stars
    star
    116
  • Rank 303,894 (Top 6 %)
  • Language
    C
  • License
    MIT License
  • Created almost 8 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Z80-CP/M2.2 emulation on ESP8266 NONOS SDK + the NoSDK from cnlohr

cpm8266

Z80-CP/M 2.2 emulator running on ESP8266

Screenshot boot

What

This is my attempt to run CP/M 2.2 for Z80 softwares on an ESP8266. The CP/M machine have 64K RAM, 15 floppy drives @ 250KB each and an autobauding serial port as a console device.

Since the ESP8266 only have 96KB of Data RAM and even when runnig the "NONOS-firmware from Espressif the free heap, after the WIFI & TCP/IP stacks are loaded, is less than 48KB which was my minimum goal for CP/M RAM.

Luckily the nosdk8266 project from cnlohr solves the RAM issue. By using the it I get more than 80KB of heap which is more than enough for the 64KB RAM in the Emulator. But this unfortunately comes with a cost - namlely no wifi. Not really a showstopper for me, but it would have been nice to be able to just Telnet into the CP/M machine to connect to the emulated terminal.

But not all hope is lost for those who want wifi and telnet - I'm currently patching in an option to compile a version with about 36K RAM, wifi and one less floppy disk.

Screenshot wifi/telnet

The 36K RAM wifi/telnet option works kinda ok, but it only leaves about 5.9K free memory in MBASIC. And it is also too small run Turbo Pascal or the classic Ladder game.

Installing, Compiling and Running

You will need ESP-Open-SDK installed. If you don't already have it you can get it at https://github.com/pfalcon/esp-open-sdk. Just follow the installation instructions there and be prepared for a lengthy (but automated) process.

I've only setup this for for Debian/Ubuntu but most dists should be fairly similar.

Unless you already have git installed you should install it

apt-get install git

Then install the prerequisites for pfalcon/esp-open-sdk

apt-get install make unrar-free autoconf automake libtool gcc g++ 
apt-get install gperf flex bison texinfo gawk ncurses-dev 
apt-get install libexpat-dev python-dev python python-serial 
apt-get install sed git unzip bash help2man wget bzip2 libtool-bin

Install the esp-open-sdk

git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
cd esp-open-sdk
make
export PATH=~/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
cd ..

Install prerequisites for cpm8266

apt-get install z80asm cpmtools zip vim-common

The vim-common is to get the xxd utility that some distros don't install by default. Thank you @drawkula for reporting this.

Clone the cpm8266 repo and config your environment

Instead of setting and exporting these environment variables you could change the settings in the top of the Makefile instead

git clone https://github.com/SmallRoomLabs/cpm8266.git
cd cpm8266/code
export ESP8266SDK=~/esp-open-sdk
export ESPTOOL=~/esp-open-sdk/esptool/esptool.py
export ESPPORT=/dev/ttyUSB0

Compile the emulator and all cp/m disks and upload it to the ESP8266

make full

Connect to the emulator and boot into CP/M

Run any serial terminal emulator set to 8N1 at any standard speed between 300 and 115200 baud. To run any full screen CP/M programs you should have VT100/ANSI terminal emulation.

Just to get started you can install the "screen" package and use that as a serial terminal.

apt-get install screen

And then connect with:

screen /dev/ttyUSB0 9600

Press Enter twice to autobaud and boot into the CP/M.

To compile with the wifi option enabled

Either do a BUILD=WIFI make full

or change the BUILD option in the Makefile.

After the full re-compile and upload of all disks you can connect via telnet port 23 (the default telnet port) after the red led (on the NodeMCU board) goes off. The led is lit as long as the wifi has not received the ip address via DHCP.

Code folder contents:

  • CPM22/ The Z80 assembly sources for CP/M 2.2
  • disks/ Have sub-folders with the files to be put into the simulated disks
  • dist/ Used to hold the file when creating the zipped binary distributions
  • espbin/ SDK bin-files from Espresif to be uploaded in high flash
  • include/ .h files from NoSDK
  • ld/ Linker scripts
  • nosdk/ Modified files from the NoSDK repo
  • z80/ Modified files from the Z80 emulator repo

Acknowledgements and thanks

I'm standing on the shoulders of a lot of really smart people here. Without their contributions I wouldn't even know where to start.

Paul Sokolovsky @pfalcon made the Esp-Open-SDK installer/setup. https://github.com/pfalcon

Lin Ke-Fong @anotherlin made the Z80 Emulator. https://github.com/anotherlin

Charles Lohr @CNLohr created the NoSDK for the ESP8266. https://github.com/cnlohr

Tim Olmstead (RIP) for managing to free the CP/M sources from their owners http://www.cpm.z80.de/

More Repositories

1

KCSviewer

Kansas City Standard tape decoder/viewer made with discrete transistors
C++
33
star
2

esppic

A stand-alone Microchip PIC programmer implemented on a ESP8266
JavaScript
16
star
3

xmodem80

Xmodem for CP/M Z80 for CON:
Makefile
12
star
4

Discrete-AY-3-8910

AY-3-8910 made out of discrete 74-series logic ICs
12
star
5

ladder

A reimplementation in golang of the 1982 game Ladder by Yahoo Software
Go
10
star
6

pdp8emu

PDP8 emulator running in console. Based on Douglas W. Jones code from 1995
C
10
star
7

Rom2k40

EPROM emulator based on RP2040
HTML
9
star
8

aytabtu

[All Your Transistors Are Belong to Us] - A computer built from transistors
Eagle
9
star
9

PDP8-X

PDP-8/X - The PDP that newer was, but might become
C
8
star
10

KimCard

AVR XMEGA based credit card sized KIM-1 6502 simulator
Eagle
7
star
11

Gorgon

A defender clone for ZX Spectrum
Assembly
7
star
12

NanoUtils

Small utility / breakout PCBs
5
star
13

Spypow

Monitor USB power consumption on six LEDs
5
star
14

MCC8

PCB with PIC24-based Chip-8 emulator
C
4
star
15

DimBlue

16 Channel USB & Bluetooth controllable light dimmer
Arduino
4
star
16

sed80

Screen EDitor for Z80 CP/M
Makefile
4
star
17

4bittube

ESP8266 NONOS SDK code to drive cheap 4-digit LED displays
C
4
star
18

PlingPlong

Two octave touch keyboard with four channel polyphonic synth
C
4
star
19

TraId

C
3
star
20

mxe11

Run UNIX on a microcontroller
C
3
star
21

Ringo3

120 LED clock
3
star
22

MudahSMD

Easy and simple projects for learning to solder SMD parts
C
3
star
23

OSUS

Tester for Open Source USB Stacks
3
star
24

TTL640x480

Low chip count 74xx-logic generating a proper 640x480 VGA sync/blanking signals
Prolog
3
star
25

PDP8-Verilog

Verilog
3
star
26

B52

Hardware and a game for the early 80's Z8671 MCU with built-in BASIC
Visual Basic
3
star
27

pt8exam

Examine contents of a PDP-8 paper tape
C
2
star
28

HSKLtag

Nametag with LEDs controlled by PIC10F202
Assembly
2
star
29

ICs-for-circuitjs

74-series logic ICs for the circuitjs simulator
2
star
30

pdp8-tape2bin

Converts PDP8 tape-files into plain binary files
Shell
2
star
31

DigiPot

Digital potentiometer with 7-segment readout
2
star
32

wwc-tdd-meetup

My code from the TDD meetup held by Women Who Code in Kuala Lumpur
JavaScript
2
star
33

TB8

Tiny Basic for PDP8 - WIP
Makefile
2
star
34

QuarterK

QuarterK Arduino 16x16 matrix led shield
C
2
star
35

espbtc

Display current BTC exchange rate on a LED display using ESP8266 NONOS SDK
C
2
star
36

HIZ

PCB and code for Human/Infected/Zombie game
Eagle
2
star
37

Butter

5-in-1 game with LEDs and Arduino
Arduino
2
star
38

Tetradeca

A game for the Hackaday.io 1KB competition
Assembly
1
star
39

LeDominoux

An SMD version of the Le Dominoux flashing toy from the #555contest
1
star
40

KhamsaShield

A 5x5 cm Arduino proto shield
1
star
41

tb8udp

Send stdin line-by-line slowly over udp
C
1
star
42

Tjipp8

Chip-8 game console with PAL TV-out using PIC16F17xx
Assembly
1
star
43

JavaCardDev

Scripts and setup for a JavaCard 2.2.1 & JDK 1.3
Shell
1
star
44

Clock72a

Small 72 SMD LED charlieplexed clock
C
1
star
45

MilleniumLander

Lunar Lander style game on PIC16 for the Hackaday 1kB competition
Assembly
1
star
46

XSNOR

Discrete transistor based calculator
AGS Script
1
star
47

BoomChak

16 step sequencer/sampler - Eagle PCB & AVR code
1
star
48

Curious-C

Eagle PCB files for The Curious C-Beeper - Capacitance tester
1
star
49

chkoverlap

Check for overlaps in data/code areas in PDP8 .rim and .bin files
C
1
star
50

Mined-Out

Source of the original Mined Out game for Spectrum from 1983
Visual Basic
1
star
51

BEEPoo

Standalone AY3-8912 sound player with ATMEGA32U4 and LCD display
C
1
star
52

palreport

Lists sizes of the functions in a listing file from Palbart (PDP-8)
Shell
1
star
53

KeyFob

Eagle files for the HSKL key fob.
1
star
54

PDP8

Website for my PDP-8 related repos - https://smallroomlabs.github.io/PDP8/
1
star
55

DemoPCB

A 5x5cm PCB with different sized silk texts & drill holes and some SMD footprints
1
star
56

palbart

Palbart - PDP-8 assembler
C
1
star
57

2MCUVGA

Generation of VGA Sync and Memory signals using two AVR Microcotrollers
Assembly
1
star
58

SockBlaster

Console/ncurses based TCP packet blaster for testing TCP servers
C
1
star
59

HoverHeist

(in-progress) Atari 2600 platform jumper game
1
star
60

Tetris

A game for the Verifone Vx 680 Terminals
C++
1
star
61

Eagle

Eagle configs and libraries
1
star
62

PCIeTestPCB

A test PCB having a dual PCIe-36 connector and card edge connectors.
1
star