Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

My project - CP/M computer on Arduino Nano 3.0

1,072 views
Skip to first unread message

FoxyLab

unread,
Mar 21, 2017, 10:53:11 AM3/21/17
to
Greetings to all lovers of old school computing! Nostalgia for the eight-bit computers of my youth led me to this project :-) - CP/M 2.2 computer from ... what would you think? ... Arduino Nano 3.0!

For weeks two or three I made the i8080 processor emulator for Arduino Nano (it passes the test from MICROCOSM) and adapted the CP / M.
The main problem - Arduino has only 2 (!) KB of RAM. But we also have an SD card - I made a 4-line cache (32 bytes) to this card, and the card itself emulated all 64 KB of RAM. Although I applied the most primitive cache management algorithm, the speed of work is not so bad.
At the same time, this card also emulates four floppy disks.

Here's the [b] quick-and-dirty [/ b] prototype of my work:
https://acdc.foxylab.com/sites/default/files/cpm_mk1.jpg

Yes, I did not use the adapter for the card, I inserted it into the connector of the cable from the five-inch drive. :-)

To communicate with a computer, I use a terminal program (in the future I plan a PS/2 keyboard and an LCD screen or connect to a TV).

Here is a screenshot of the memory check:
https://acdc.foxylab.com/sites/default/files/cpm_memtest.png

CP/M Download:
https://acdc.foxylab.com/sites/default/files/cpm_loading.png

CPU Test:
https://acdc.foxylab.com/sites/default/files/cpm_mctest.png

My first program in BASIC for the past twenty (!)))) years:
https://acdc.foxylab.com/sites/default/files/cpm_tinybas.png
(I launched TinyBASIC).

A more detailed description I began to make here -
https://acdc.foxylab.com/node/76 - russian version (use Google Translate please, in the future I plan to make an English version of the project description)

Are you interested in such a project?

Jeremy

unread,
Mar 22, 2017, 2:21:56 AM3/22/17
to
Seems very much along the same lines as this -> http://spritesmods.com/?art=avrcpm Except that guy actually wired up a ram chip, albeit one with a slightly different addressing than usual (4 bits instead of 8?).

Bill Lewis

unread,
Mar 22, 2017, 8:34:04 AM3/22/17
to

I enjoy projects like this myself.

I did one with a small STM32, and used a SPI serial interface RAM
chip to expand the memory.

Bill

FoxyLab

unread,
Mar 22, 2017, 5:26:49 PM3/22/17
to
среда, 22 марта 2017 г., 9:21:56 UTC+3 пользователь Jeremy написал:
> Seems very much along the same lines as this -> http://spritesmods.com/?art=avrcpm Except that guy actually wired up a ram chip, albeit one with a slightly different addressing than usual (4 bits instead of 8?).

In my project i use SD Card only (without any RAM chip):

emulated i8080 <----> cache <-----> buffer <-----> SD Card
| ATmega RAM |

FoxyLab

unread,
Mar 22, 2017, 5:31:42 PM3/22/17
to
среда, 22 марта 2017 г., 15:34:04 UTC+3 пользователь Bill Lewis написал:
Ferroelectric RAM (FRAM) is great now :-)
FM24C256-S: 1 MHz, 32 KBytes, 10000000000 cycles R/W = $0.6

Jeremy

unread,
Mar 22, 2017, 10:37:02 PM3/22/17
to
I noticed, but the concept is essentially the same. You write a hardware emulator in AVR C/assembly because the AVR itself can't run software from RAM and then you pull code from an outside source and run it on the emulated machine. I suspect you will cause more wear and tear using the SD card as ram rather than a piece of hardware intended to be read/written constantly. It's very wasteful to ignore the other 512-32=480 bytes of a sector in the case of ram. I'm not sure how difficult it would be, but writing code that assumes you somehow have a 512k floppy seems like it would be useful and I think a modern static ram (perhaps using I2C or SPI) would be more productive than the SD card. Might be hard to obtain in russia though?

Jeremy

unread,
Mar 22, 2017, 10:44:43 PM3/22/17
to
512 byte floppy, rather.

http://hackaday.com/2009/03/02/parts-32kb-spi-sram-memory-23k256/

If you have a spare arduino (or compatible), you might be interested in this http://www.gammon.com.au/forum/?id=11608 (output VGA with Arduino).

FoxyLab

unread,
Mar 23, 2017, 1:23:17 AM3/23/17
to
четверг, 23 марта 2017 г., 5:37:02 UTC+3 пользователь Jeremy написал:
I wrote Intel 8080 emulator as Arduino sketch. After CP/M (original CCP and BDOS) loading this emulator runs original CP/M code.
4 GByte SD card has very-very free area for CP/M, so 480 bytes may be wasted :)
In future i plan to connect cool Ferroelectric RAM:
FM24C256-S: 1 MHz, 32 KBytes, 10000000000 cycles R/W = $0.6
I will buy this thing on eBay.

Bill Lewis

unread,
Mar 23, 2017, 9:04:49 AM3/23/17
to
The one I used was 23LC1024, 128KB. Available (at the time)
in DIP or SOIC form.

I do like your idea of the cache, though. I was thinking of
doing that myself to speed up the external accesses.

Bill

FoxyLab

unread,
Mar 23, 2017, 10:04:26 AM3/23/17
to
четверг, 23 марта 2017 г., 16:04:49 UTC+3 пользователь Bill Lewis написал:
I uploaded on YouTube realtime video of my project in action:
https://youtu.be/LHFmt3qWAuY

FoxyLab

unread,
Mar 25, 2017, 3:56:59 PM3/25/17
to
I uploaded very draft source code of my project to Github:
https://github.com/Dreamy16101976/cpm4nano

I did the emulation of ports 0 and 1 in Altair-style and run Altair TinyBASIC without (!) CP/M. He works quick!

Ivan Shmakov

unread,
Mar 30, 2017, 2:50:54 PM3/30/17
to
>>>>> FoxyLab <dreamy1...@gmail.com> writes:

[...]

> A more detailed description I began to make here -
> https://acdc.foxylab.com/node/76 - Russian version (use Google
> Translate please,

(I'd rather not.)

> in the future I plan to make an English version of the project
> description)

If you care to release the existing description under CC BY-SA
3.0+ [1] or the like, I'd try to come up with an English
version. I cannot promise a faithful translation, though.

[1] http://creativecommons.org/licenses/by-sa/3.0/

--
FSF associate member #7257 58F8 0F47 53F5 2EB2 F6A5 8916 3013 B6A0 230E 334A

Ivan Shmakov

unread,
Mar 31, 2017, 3:20:38 AM3/31/17
to
Do you, by chance, mean a project involving i8080 emulation on
STM32? If so, are there any details available from somewhere on
the Web?

FoxyLab

unread,
Mar 31, 2017, 9:42:52 AM3/31/17
to
четверг, 30 марта 2017 г., 21:50:54 UTC+3 пользователь Ivan Shmakov написал:
Thanks!

My tool for easy tuning CP/M to RAM size - https://groups.google.com/forum/#!topic/comp.os.cpm/DDoid6AkplY

FoxyLab

unread,
Apr 1, 2017, 4:42:46 AM4/1/17
to
I found and fixed an error in INR M/DCR M emulation.
Now the TYPE command works correctly!!!
The emulator is almost ready to use widely.
I will write instructions on how to prepare a SD-card for use in the emulator.

FoxyLab

unread,
Apr 2, 2017, 2:49:58 AM4/2/17
to
I added an LRC-checksum for the memory data when writing/reading to the SD-card. While failures were not :-)

FoxyLab

unread,
Apr 4, 2017, 6:10:47 PM4/4/17
to
I made the input from the console more versatile - through interrupts - to connecting the PS/2 keyboard in the future + added a command R monitor to reset the Arduino.
Also i did 200 runs of the memory test (added a command to the monitor) - failures not detected:
https://acdc.foxylab.com/sites/default/files/cpm_memtests.png

Ivan Shmakov

unread,
Apr 7, 2017, 5:35:56 AM4/7/17
to
>>>>> FoxyLab <dreamy1...@gmail.com> writes:
>>>>> Ivan Shmakov:
>>>>> FoxyLab writes:

[...]

>>> A more detailed description I began to make here -
>>> https://acdc.foxylab.com/node/76 - Russian version

[...]

>> If you care to release the existing description under CC BY-SA 3.0+
>> [1] or the like, I'd try to come up with an English version.
>> I cannot promise a faithful translation, though.

(In the "faithful to the letter of the source" sense.)

>> [1] http://creativecommons.org/licenses/by-sa/3.0/

> Thanks!

I'm yet to start working on it.

And I'd rather see the licensing settled beforehand. Could you
please put a notice to the effect that "Text is available under
the Creative Commons Attribution-ShareAlike License (CC BY-SA),
either version 3.0 of the license, or, at your option, any
latter version" to the page linked above (preferably next to the
copyright notice already there)?

I advocate in favor of "CC BY-SA 3.0 or latter" license
specifically because of its use on Wikimedia projects --
including Wikibooks and Wikiversity, which may at some point
become interested in the material. (Check [1] for instance.)

[1] http://ru.wikiversity.org/wiki/?curid=20857

[...]

FoxyLab

unread,
Apr 9, 2017, 2:08:18 PM4/9/17
to
Using emulation of address and data buses, as well as internal registers (W, Z, ACT, TMP), made emulation of micro-operations as close as possible to the "iron" processor + with #define made the emulation code much more visible. The new code is already laid out on GitHub.
Message has been deleted

FoxyLab

unread,
Apr 19, 2017, 3:45:36 PM4/19/17
to
I ran the Ada language compiler on my Arduino !!!

Compilation of the program TOWERS.ADA for solving the problem of the "Hanoi Tower":

https://acdc.foxylab.com/sites/default/files/towers_ada_comp.png

Running the compiled program TOWERS.COM:

https://acdc.foxylab.com/sites/default/files/towers_ada_3.png

FoxyLab

unread,
Apr 27, 2017, 1:56:45 PM4/27/17
to
I made an emulation of the memory management device (MMU) with switching banks, which allowed access to 256 KByte of memory.
I divided the address space 0x0000 ... 0xFFFF into 16 blocks (with numbers from 0x0 to 0xF) of 4 KByte in size. Each block can be mapped to one of 8 banks (the size of the bank is 64 KByte). The correspondence of banks to blocks is determined by the values ​​(bank numbers from 0 to 7) in a set of 16 registers (only bank 0 is active when the emulator is started).
To specify the bank number for a specific block, two output commands are used in the port:
OUT D0, block number
OUT D1, banknumber
Also, you can use the YXY monitor command to switch the X memory unit to the Y memory bank.

FoxyLab

unread,
May 17, 2017, 2:19:46 PM5/17/17
to
cpm4nano Mk II
(used an adapter to connect a microSD-card)
https://acdc.foxylab.com/sites/default/files/cpm_mk2.jpg

Andy Norrie

unread,
May 18, 2017, 1:50:38 AM5/18/17
to
Does the Arduino Nano 3.0 have the same processor as any of the Raspberry Pi range?

Cheers, Andy

Ivan Shmakov

unread,
May 18, 2017, 8:48:55 AM5/18/17
to
Not even close. In fact, most of the Arduino boards use one or
another of 8-bit Atmel (or should I say Microchip now?) AVR RISC
MCUs [1]. And even more advanced boards (say, ARM-based ones,
such as Arduino Due) are in no league with the fully-featured
SoC such as used on
Raspberry Pi.

[1] http://arduino.cc/en/Products/Compare

--
FSF associate member #7257 np. Delta -- Breakbeat Heartbeat B6A0 230E 334A

FoxyLab

unread,
Dec 23, 2019, 8:54:38 AM12/23/19
to
Current project state - a complete CP/M system based on Arduino Nano 3.0.

Currently one Arduino Nano in my project:

- emulates the Intel 8080 processor, 64 KBytes RAM (with two FRAM chips) + 4 FDD with 100 diskettes (with SDHC card);
- with the help of the PS/2-UART converter on STM8 allows you to enter information from the keyboard (allows you to switch English/Russian languages, upper/lower case, enable lock for scrolling text on screen);
- displays text information on the TV screen (20 rows with 40 cols or 80 cols on two virtual screens, between which you can switch) without jitter (with duplication of information to the PC through serial channel);
- receives/sends data from/to the PC through serial port via XMODEM;
- data input/output via magnetic tape or audiofile;
- loads the OS CP/M and runs its programs (including BASIC, C, ADA, FORTH, LISP, FORTRAN, FOCAL, MINOL).

I started a chess duel between the "nanocomputer" running Microchess (playing white) and the "big" computer with the chess engine Sunfish (written in Python, written by Thomas Dybdahl Ahle) .
After 22 moves the situation is as follows:
https://blog.foxylab.com/wp-content/uploads/2019/12/cpm4nano_sunfish_22.png

As it turned out, the Spanish party was played in the opening, then Black used the Berlin Defense, and White used anti-Berlin.

All moves and pictures are recorded here - https://blog.foxylab.com/shahmatnyj-battl/ (comments - on russian).

The game continues :-)

FoxyLab

unread,
Jan 3, 2020, 3:36:43 PM1/3/20
to
A companion project has begun - an i8080-based system emulator on Rust - me select from the list of binary files in the program directory the desired one (for example, BASIC, Minol or chess) and run:

https://blog.foxylab.com/wp-content/uploads/2019/12/fe2o3_uchess.png

The emulator successfully passed the famous "exerciser" test:

https://acdc.foxylab.com/sites/default/files/fe2o3_8080_test.png

FoxyLab

unread,
Dec 9, 2020, 12:50:12 PM12/9/20
to
I did a redesign of the project, now it looks like this:
https://acdc.foxylab.com/sites/default/files/cpm4nano_MkVI_overview.jpg

Alexey Voronin

unread,
Dec 10, 2020, 12:22:21 PM12/10/20
to
Added indication of access to the I2C bus (in fact, access to FRAM) - an LED that lights up when the SCL line is low. The quick-and-dirty approach to connect the LED through a 2 kOhm resistor did not pass at all - there was not a single memory module on the bus - it turned out to be too strong pull-up, although it worked after 4.7 kOhm, but in 7407 there are free pins, so through this buffer it turned out more reliable.

Alexey Voronin

unread,
Dec 10, 2020, 1:23:48 PM12/10/20
to
Currently one (!) Arduino Nano (!) in my project:

emulates the Intel 8080 processor, 64 KBytes RAM (with two FRAM chips) + 4 FDD with 100 diskettes (with SDHC card);
with the help of the PS/2-UART converter on STM8 allows you to enter information from the keyboard (allows you to switch English/Russian languages, upper/lower case, enable lock for scrolling text on screen);
displays text information on the TV screen (20 rows with 40 cols or 80 cols on two virtual screens, between which you can switch) without jitter (with duplication of information to the PC through serial channel);
receives/sends data from/to the PC through serial port via XMODEM;
data input/output via magnetic tape or audiofile;

Josef Möllers

unread,
Dec 17, 2020, 10:00:46 AM12/17/20
to
On 10.12.20 19:23, Alexey Voronin wrote:
> Currently one (!) Arduino Nano (!) in my project:
>
> emulates the Intel 8080 processor, 64 KBytes RAM (with two FRAM chips) + 4 FDD with 100 diskettes (with SDHC card);

How do you emulate these floppies? I would like to replace the FDDs on
my SB180FX with something more robust and have considered replacing the
entire FDC and drives with some uController and glue logic.

Josef

Randy McLaughlin

unread,
Dec 17, 2020, 2:47:26 PM12/17/20
to

Randy McLaughlin

unread,
Dec 17, 2020, 2:48:06 PM12/17/20
to
Gotek etc.


Randy

Josef Möllers

unread,
Dec 18, 2020, 5:12:22 AM12/18/20
to
On 17.12.20 20:48, Randy McLaughlin wrote:
> Gotek etc.

Looks good, especially the price.

Do you happen to know if these support 1K sector size, the preferred
size of SB180FX floppies?

Thanks,

Josef

Randy McLaughlin

unread,
Dec 18, 2020, 6:58:17 AM12/18/20
to
It supports basically all floppy disk formats.

It's two parts the Gotek controller plus you buy an updated firmware. Optionally you can add LCD display and a speaker.

The hardware is available from ebay and other outlets, the firmware from:

https://hxc2001.com/

Please note you can create custom disk images sizes to have huge storage by increasing number of tracks to say 200 tracks double sided. This requires modifying the BIOS.


Randy

Steven Hirsch

unread,
Dec 18, 2020, 2:56:14 PM12/18/20
to
On 12/18/20 6:58 AM, Randy McLaughlin wrote:

> It supports basically all floppy disk formats.
>
> It's two parts the Gotek controller plus you buy an updated firmware.
> Optionally you can add LCD display and a speaker.
>
> The hardware is available from ebay and other outlets, the firmware from:
>
> https://hxc2001.com/

For firmware choices there's also FlashFloppy (free-as-in-beer):

https://github.com/keirf/FlashFloppy

Each type of firmware has certain things it will do better/easier from the
other. I use both here.

Alexey Voronin

unread,
Dec 19, 2020, 3:35:49 PM12/19/20
to
четверг, 17 декабря 2020 г. в 15:00:46 UTC, Josef Möllers:
At level CP/M BIOS (commands SET TRACK, SET SECTOR, READ etc ).

Josef Möllers

unread,
Dec 20, 2020, 5:19:17 AM12/20/20
to
Ah ... OK.
I'd need to change the monitor SW to load the OS as well as the BIOS.
A little too much work for heaps too little time ;-)
Stay healthy!

Josef

PS My first problem is that my glue logic (an FPGA) is 3V3 only and my
HW is 5V only, so I need to put some level shifters in between. Come to
think of it ... probably even more work :-)
0 new messages