CP/M on AVR (ATmega88) [message #3357] |
Mon, 21 August 2017 03:48 |
rhkoolstar
Messages: 276 Registered: October 2015
|
Senior Member |
|
|
Hi all,
A while ago, when I was considering using an Arduino for an i/o co-processor, Alan Cox suggested that at that point I could just as well use the Arduino to emulate the whole Z80 system. This suggestion stuck with me, and I decided to look into it further.
I stumbled on the CP/Mega88 project of Takashi Toyoshima on github <https://github.com/toyoshim/cp-mega88>, which is an i8080 emulator, console and SD-card interface, supporting 128 kBytes of static RAM (multiplexed Address Hi/Lo/Data), all in a single ATmega88 AVR (and also running in various other systems)
This is a work in progress, it needed some work in the SD-card and the FAT code. (I issued a pull request with the changes) and now it works quite nicely.
I abandoned using a FAT image to boot from, because it slows down disk access quite a lot (in particular on larger disks). Deleting the FAT code also gave me a lot more space on the AVR.
Then I added some extra features like a 32k banked memory system, bigger disk support and several enhancements of the "monitor" (which runs in the AVR).
Continuing with a dedicated CP/M 2.2 BIOS and CP/M 3.0 BNKBIOS and a dual boot option, using 4 8 MB diskdrives, I ended up with a 59k CP/M 2.2 or 61k CP/M 3.0 system with 32 MB disk space.
I was quite surprised to see the speed to be comparable to 2.5 - 3 MHz (compared to a 25 MHz searle-FPGA) using "ASM CPM22.ASM" as a benchmark.
I decided I needed a PCB, so that came out to be a 40x60 mm board using SMD parts, compatible with a 5V FTDI cable. (or 3v3 if you so desire)
The total building cost was less than $4.50
1 PCB 0.77
1 SRAM 1.57 Bs62lv1027
2 74HC374 1.20
1 ATMEGA88 0.49
1 XTAL 20 MHz 0.23
1 AMS117-3.3 0.03
1 TF card Socket 0.11
7 C 0.03
2 R 0.01
1 D 0.02
-----
TOTAL 4.47 (rounding error)
Next logical step would be to use a serial SRAM (23LC1024) which would save another $ 0.70, but would undoubtably slow down the system. It would free up a lot of pins on the AVR so extra features could be implemented (like handshake, more I/O etc)...
I'll update my builderpages shortly, detailing the whole project, including sources and gerbers. (and yes, I have some spare boards too)
Rienk
-
Attachment: CPMega88.jpg
(Size: 156.40KB, Downloaded 2048 times)
-
Attachment: CPMega88.pdf
(Size: 94.28KB, Downloaded 460 times)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: CP/M on AVR (ATmega88) [message #3459 is a reply to message #3457] |
Thu, 14 September 2017 23:43 |
rhkoolstar
Messages: 276 Registered: October 2015
|
Senior Member |
|
|
CP/Mega88 is i8080 though. Also it is a simple emulator. it is not 'counting' t-cycles.
Also the exerciser does not consider disk access.
But a good place to start. Thanks.
I think that the problem with CP/M (and Z80) is that it is (too) well documented, making it less challenging.
Rienk
[Updated on: Thu, 14 September 2017 23:49] Report message to a moderator
|
|
|
|
|
|
|
|
Re: CP/M on AVR (ATmega88) [message #6834 is a reply to message #6829] |
Sun, 24 November 2019 00:55 |
rhkoolstar
Messages: 276 Registered: October 2015
|
Senior Member |
|
|
Thanks for the ideas,
Integral USB could probably be achieved by using a ATmega32U4, but that would add some $2.50 to the total cost. This is compensated somewhat by eliminating the need for a USB-serial interface. On the other hand, the current configuration allows you to implement RS-232 as well as USB.
I don't know if using the SD card for system RAM is such a good idea. I am toying with the idea to use serial SRAM (23LC1024) instead. That would reduce the card size by at least 50%, and would free up some pins for extra I/O, like handshake. Serial SRAM is comparable in price with the current configuration. It will make the system slower though.
I kind of like the idea that a lowly ATmega88 can do for less than a dollar what we used to pay in excess of $1000 for in 1980.
Also consider that for a minimal extra cost you can implement a much bigger system in a raspberry pi zero (W)
|
|
|