News:

The Savage///Circuits website has been upgraded to a more efficient theme.

Main Menu

Z80 Emulation Using the RP2040

Started by Chris Savage, Dec 31, 2025, 09:05 AM

Previous topic - Next topic

granz

Okay, I've received it, but the box was opened and one of the packs was torn down the side and the SD Card breakout was sitting outside the wrapper. This did not happen in shipping - they just took a return, and without even checking it out they just sold it again as new. They should probably get a minimum review (they earned a zero) and let them know that you don't appreciate paying for new, and getting returned merchandise.

Chris Savage

Quote from: granz on Feb 25, 2026, 05:09 PMOkay, I've received it, but the box was opened and one of the packs was torn down the side and the SD Card breakout was sitting outside the wrapper. This did not happen in shipping - they just took a return, and without even checking it out they just sold it again as new. They should probably get a minimum review (they earned a zero) and let them know that you don't appreciate paying for new, and getting returned merchandise.

I've had this issue so many times. As someone who pays for Prime membership, I am constantly dismayed at how much less I get for my money every month. More often than not, I do not get the 2-day shipping promised when I placed the order. Most orders are followed by, "Your package has been delayed". Likewise, I no longer review any item on Amazon, because they reject any review that isn't specific to your experience with the product as intended for use. When I have mentioned the way a product is packaged or arrived (damaged), those reviews are rejected.

                     Bringing concepts to life through engineering.

granz

#62
Some points that I/we need to consider

  • Quote from: granz on Feb 23, 2026, 01:33 PMI'm re-thinking our target market right now - continuing on with getting started with CP/M assembly intro.
    Our target market would, most likely, be hackers/hobbyists and not true newbies. It seems to me that someone with no experience in electronics/controllers/etc would probably start with more modern stuff like Arduino, Pico, Raspberry Pi, PIC, etc. So, this will probably be more geared to the hobbyist who is interested in learning retro-programming.

  • The assembler: CP/M was originally written for the Intel 8080 CPU. As such, the Digital Research ASM assembler uses Intel mnemonics, rather than Zilog mnemonics. On many of the instructions, the source and destination are swapped from the Intel version. You had mentioned that you wanted this to be for the Z-80 CPU. The Z-80 does run all Intel 8080 object code, but the source code (what the programmer writes) would be different with Z-80 vs. I8080 object. What would you prefer, stick to Z-80 (my recommendation,) or Intel assembly?

    If we stick to Z-80 code, a good recommendation (from Bill McMullen on Google Retro Comp group) is:
    Quote from: Bill McMullen - https://groups.google.com/g/retro-comp/c/_aLLm6uOjgw?pli=1My preference for Z80 assembler code is to use Microsoft's M80 / L80.  The reason is simply that it is quite commonly available, has a rudimentary macro facility and also the .PHASE / .DEPHASE instructions which are really handy for moving code around such as from ROM to RAM.
    I fully agree, for all the reasons that he lists
    He even gives his SUBmit script (the CP/M equivalent of a DOS batch file) to launch the Microsoft assembler, and linker.

  • Thoroughness - how newbie-ish do you want this? I try to make most of my directions very thorough. Do you want directions like the "Learn About Microcontrollers" Instructable (https://www.instructables.com/Learn-About-Microcontrollers/), or higher level (considering the target market mentioned above)?

  • Scope - Am I just supposed to do the instructions for the hardware and setting up the software? Are you going to write the introduction to Z-80 programming under CP/M?


Can you think of anything else that we should consider?

Chris Savage

I'm not going to quote, since your reply covers a lot. What I will say is this...you're right that Z80 assembly would be for the retro-computer enthusiast. I suppose, so would CP/M. If you look back at the first post in this thread, this whole thing cam about because, while looking for Z80 emulation, I found the Z80 Emulator for Raspberry Pi Pico and other RP2040 based MCU boards and thought that would be an inexpensive way to do either / both.

The problem was, I wasn't sure if there was a Z80 assembler for CP/M. I have used TASM for DOS / Linux since day one. The ONLY CP/M system I have is the RC2014 Pro Homebrew Z80 Computer Kit on the main site, which does have an option to boot to CP/M from a Compact Flash card, which I have done.

However, I didn't buy it for the CP/M, I bought it for the Z80, I/O and ease of expansion. It uses a serial interface via terminal, so I assumed the link above would be the same. But my interest was in writing assembly code for it, which I have been doing as I work on it. I thought we were making an SD Card image that would boot the RP2040 into CP/M and provide an assembler for Z80 assembly, plus whatever you had in mind. Is that still possible?

                     Bringing concepts to life through engineering.

granz

#64
Quote from: Chris Savage on Mar 23, 2026, 05:20 PMI'm not going to quote, since your reply covers a lot. What I will say is this...you're right that Z80 assembly would be for the retro-computer enthusiast. I suppose, so would CP/M.
Okay, so hobbyist-level it is. Thanks.

Quote from: Chris Savage on Mar 23, 2026, 05:20 PMIf you look back at the first post in this thread, this whole thing cam about because, while looking for Z80 emulation, I found the Z80 Emulator for Raspberry Pi Pico and other RP2040 based MCU boards and thought that would be an inexpensive way to do either / both.

The problem was, I wasn't sure if there was a Z80 assembler for CP/M.
There are several. We will go with the Microsoft M80 and T80 combo. Nice and easy.

Quote from: Chris Savage on Mar 23, 2026, 05:20 PMI have used TASM for DOS / Linux since day one. The ONLY CP/M system I have is the RC2014 Pro Homebrew Z80 Computer Kit on the main site, which does have an option to boot to CP/M from a Compact Flash card, which I have done.
We will do all of our programming work on the Pico itself (using a serial terminal emulator, of course.)

The advantage of using a serial terminal emulator is that you can develop in TASM and upload it to the Pico using CP/M's XMODEM program (or any of several other commands.) But, we will concentrate on developing under CP/M itself - unless you would prefer development on the PC, using TASM. Let me know - they are both doable.

Quote from: Chris Savage on Mar 23, 2026, 05:20 PMHowever, I didn't buy it for the CP/M, I bought it for the Z80, I/O and ease of expansion.
I do not believe that the RunCPM system allows access to any of the GPIO capabilities of the Raspberry Pi Pico. RunCPM will give the environment of a 1970's business-class system. It will be more for writing standard user type programs, rather than control-system programs. Will this scuttle this project?

Quote from: Chris Savage on Mar 23, 2026, 05:20 PMIt uses a serial interface via terminal, so I assumed the link above would be the same. But my interest was in writing assembly code for it, which I have been doing as I work on it. I thought we were making an SD Card image that would boot the RP2040 into CP/M and provide an assembler for Z80 assembly, plus whatever you had in mind. Is that still possible?
Kind of... We will be using a firmware file installed onto the Pico, plus a set of Z-80 programs on the SD card. I will be setting up a downloadable .ZIP file to extract onto the SD card. This will give the Pico CP/M system a single hard drive (A:) with the CP/M Operating System and necessary utilities in user area 0 (like the root of the hard drive.) The programming software (editor, assembler, linker, etc.) will be in user area 1 (like a sub-directory.) That will be all that I will provide (to keep it simple,) however it is very easy to get up to 16 hard drives with up to 16 user areas each - just create additional sub-directories on the SD card.

granz


Chris Savage

Quote from: granz on Mar 23, 2026, 05:53 PMThe advantage of using a serial terminal emulator is that you can develop in TASM and upload it to the Pico using CP/M's XMODEM program (or any of several other commands.) But, we will concentrate on developing under CP/M itself - unless you would prefer development on the PC, using TASM. Let me know - they are both doable.

I like the flexibility of having both options available.

Quote from: granz on Mar 23, 2026, 05:53 PMI do not believe that the RunCPM system allows access to any of the GPIO capabilities of the Raspberry Pi Pico. RunCPM will give the environment of a 1970's business-class system. It will be more for writing standard user type programs, rather than control-system programs. Will this scuttle this project?

Not at all. This is for learning and experience. If you really want a control board, use a real Z80.  ;)

Quote from: granz on Mar 23, 2026, 08:25 PMInterestingly, I just saw this on Hack-A-Day. Funny timing, considering our project here.

So the question is, are these for sale? If so, how much? I followed through several links, but could not find them for sale at a glance.

                     Bringing concepts to life through engineering.

granz

Quote from: Chris Savage on Mar 23, 2026, 09:30 PM
Quote from: granz on Mar 23, 2026, 05:53 PMThe advantage of using a serial terminal emulator is that you can develop in TASM and upload it to the Pico using CP/M's XMODEM program (or any of several other commands.) But, we will concentrate on developing under CP/M itself - unless you would prefer development on the PC, using TASM. Let me know - they are both doable.

I like the flexibility of having both options available.
Both are available, but I will not be covering the on-PC option in this setup.

Quote from: Chris Savage on Mar 23, 2026, 09:30 PM
Quote from: granz on Mar 23, 2026, 05:53 PMI do not believe that the RunCPM system allows access to any of the GPIO capabilities of the Raspberry Pi Pico. RunCPM will give the environment of a 1970's business-class system. It will be more for writing standard user type programs, rather than control-system programs. Will this scuttle this project?

Not at all. This is for learning and experience. If you really want a control board, use a real Z80.  ;)
I fully agree - we'll do this for education.

Quote from: Chris Savage on Mar 23, 2026, 09:30 PM
Quote from: granz on Mar 23, 2026, 08:25 PMInterestingly, I just saw this on Hack-A-Day. Funny timing, considering our project here.

So the question is, are these for sale? If so, how much? I followed through several links, but could not find them for sale at a glance.
On @eaw's site (https://eaw.app/picoz80/), about one third of the way down, there is a section titled Build Instructions. It looks like you need to build your own boards for now.

Chris Savage

Sounds good. As you post information, I will build on my end and draft to the main site with photos of my build.

                     Bringing concepts to life through engineering.

MicroNut

#69
I decided to join the fun ;D . My setup is the following:
Pico WH
GeeekPi Basic Starter Kit for the breadboard
Parallax 32312 Micro SD Card adapter

The GeeekPi costs $13.59, a little more than the breadboard @granz suggested, It comes with a smaller breadboard but it has a socket for the Pico and well labeled pins to connect jumpers to. It would be a good starter for someone new to microcontrollers. It does have a design flaw though. The input for the onboard buzzer is left floating so when you power the Pico it usually starts buzzing unless you jumper the buzzer input to ground,

I did have a SD card init problem due to using the Pico's 3.3V output for the SD card. I did the suggested doubling of the ground and power jumpers and I got the SD card running so now I'm running RunCPM.

Next I'll try the emulator that Chris pointed out to see if I can use the Pico's Wifi.
Always looking to the stars.

Chris Savage

Quote from: MicroNut on Mar 25, 2026, 10:03 PMNext I'll try the emulator that Chris pointed out to see if I can use the Pico's Wifi.

Very interesting. Can't wait to see what you come up with.

                     Bringing concepts to life through engineering.

granz

Quote from: MicroNut on Mar 25, 2026, 10:03 PMI decided to join the fun ;D . My setup is the following:
Pico WH
GeeekPi Basic Starter Kit for the breadboard
Parallax 32312 Micro SD Card adapter

The GeeekPi costs $13.59, a little more than the breadboard @granz suggested, It comes with a smaller breadboard but it has a socket for the Pico and well labeled pins to connect jumpers to. It would be a good starter for someone new to microcontrollers.
I have seen that board, but decided on the one with the LCD (GeeekPi GPIO Expansion Module) instead.


Quote from: MicroNut on Mar 25, 2026, 10:03 PMIt does have a design flaw though. The input for the onboard buzzer is left floating so when you power the Pico it usually starts buzzing unless you jumper the buzzer input to ground,
That is pretty strange as the one (actually a couple) shown above, that I have, does not have that trouble with the buzzer. ???

Quote from: MicroNut on Mar 25, 2026, 10:03 PMI did have a SD card init problem due to using the Pico's 3.3V output for the SD card. I did the suggested doubling of the ground and power jumpers and I got the SD card running so now I'm running RunCPM.

Next I'll try the emulator that Chris pointed out to see if I can use the Pico's Wifi.

Sounds good. Did you run CP/M back in the '70s/'80s?

MicroNut

I had a job back in 1986 that had a computer that ran CP/M. We didn't use it but during some of my down time I played Monopoly on it.

I thought about getting that Geeekboard with the LCD. The buzzer doesn't always buzz on the boards but when I connected mine to power it usually did so I have it tied to ground. It annoys my wife since my "workshop" is my side of the recliner couch with a lapboard. It drowns out the audio from the episode of Gilmore Girls she's watching :)
Always looking to the stars.

Chris Savage

#73
Quote from: granz on Mar 26, 2026, 08:09 AMI have seen that board, but decided on the one with the LCD instead.

I couldn't help but notice one thing missing from the Pico Breadboard Kit...namely, the breadboard! LOL


                     Bringing concepts to life through engineering.

MicroNut

That's why I didn't get it! :)  I have many Arduino TFTs I could wire up to it plus I have Pico mini LCD  module that can plug into a Pico expander that takes 5 modules.
Always looking to the stars.

SMF spam blocked by CleanTalk