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

JKnightandKARR

I thought so.

Quote from: granz on Jan 21, 2026, 06:19 PMThe RP2040-GEEK takes that controller, adds the LCD, RAM, Flash Memory and a case and makes a pretty cool device for playing working.
I fixed it for ya. Lol

granz

Quote from: JKnightandKARR on Jan 21, 2026, 07:01 PMI thought so.

Quote from: granz on Jan 21, 2026, 06:19 PMThe RP2040-GEEK takes that controller, adds the LCD, RAM, Flash Memory and a case and makes a pretty cool device for playing working.
I fixed it for ya. Lol
Hah, nice. I guess that fits better now that I'm retired.  8)

Chris Savage

Gentlemen,

Would this setup allow for writing assembly code and viewing results? I'm going to be placing some orders this weekend and wanted to get what would be needed to realize a Z80 development system. I need to check the other thread as well, since I thought there was hardware I needed to order for that as well.

                    Bringing concepts to life through engineering.

JKnightandKARR

Quote from: Chris Savage on Jan 22, 2026, 01:54 PMGentlemen,

Would this setup allow for writing assembly code and viewing results? I'm going to be placing some orders this weekend and wanted to get what would be needed to realize a Z80 development system. I need to check the other thread as well, since I thought there was hardware I needed to order for that as well.
As far as emulation goes only exp I have is with ROMs for games.. This kinda stuff idk..

granz

Marilyn brought a package in and touched my arm with it. I about jumped out of my skin - apparently I had fallen asleep at my desk.  :o


The newest version of PicoMite (Ver 6.01.00 https://geoffg.net/Downloads/picomite/PicoMite_Firmware.zip) installed very quickly, and easily. That "Boot" button on the side is a pleasure to work with.

Notice the huge 16MB A: drive:


It was not a big trouble to get the SD Card working. The schematic shows the Chip Select pin as connected to GP23, but PicoMite won't use that - that pin is not available on a regular Pico. But there are a couple other pins that were not used, so I tried GP21, and it worked just fine:

OPTION SDCARD GP21, GP18, GP19, GP20

With the SD Card connections working in PicoMite, it looks good for RunCPM. I'll work on that in a little while.

I am having troubles with the LCD, the schematic shows a MOSI connected, but no MISO. PicoMite BASIC is supposed to work on LCDs without a frame buffer (I.E. no need for data from the LCD, or rather the slave, thus no need for MISO.) So far, I have not been able to find the way to set up PicoMite to use the LCD, yet! :P I'll get it, but time for dinner with my favorite girl, a movie, and then hit the sack (apparently I'm more tired than I thought. ::) )

JKnightandKARR

#20
Quote from: granz on Jan 22, 2026, 06:10 PMMarilyn brought a package in and touched my arm with it. I about jumped out of my skin - apparently I had fallen asleep at my desk.  :o


The newest version of PicoMite (Ver 6.01.00 https://geoffg.net/Downloads/picomite/PicoMite_Firmware.zip) installed very quickly, and easily. That "Boot" button on the side is a pleasure to work with.

Notice the huge 16MB A: drive:


It was not a big trouble to get the SD Card working. The schematic shows the Chip Select pin as connected to GP23, but PicoMite won't use that - that pin is not available on a regular Pico. But there are a couple other pins that were not used, so I tried GP21, and it worked just fine:

OPTION SDCARD GP21, GP18, GP19, GP20

With the SD Card connections working in PicoMite, it looks good for RunCPM. I'll work on that in a little while.

I am having troubles with the LCD, the schematic shows a MOSI connected, but no MISO. PicoMite BASIC is supposed to work on LCDs without a frame buffer (I.E. no need for data from the LCD, or rather the slave, thus no need for MISO.) So far, I have not been able to find the way to set up PicoMite to use the LCD, yet! :P I'll get it, but time for dinner with my favorite girl, a movie, and then hit the sack (apparently I'm more tired than I thought. ::) )
I wonder what the changes are? Still hoping I can do DTMF with it..

EDIT: Looks like:
' To play DTMF '1' (697Hz + 1209Hz)
PLAY TONE 697, 1209, 100 ' Play for 100ms
Will do it. Have to check!

granz

Quote from: JKnightandKARR on Jan 22, 2026, 06:43 PMI wonder what the changes are? Still hoping I can do DTMF with it..

EDIT: Looks like:
' To play DTMF '1' (697Hz + 1209Hz)
PLAY TONE 697, 1209, 100 ' Play for 100ms
Will do it. Have to check!
Available GPIO pins are: GP2, 3, 4, 5, 28 & 29. At least those are the ones brought out to the headers on the side. Using OPTION AUDIO, you can choose PWM1 (GP2 & 3) or PWM2 (GP3 & 4,) those are brought out to the headers. You would need to add the filter hardware on page 48 of the 6.01.00 manual - I would use the first one, just four 22nF caps, and four 680Ω resistors (although running it into an amplifier may do it without the filter.) Also, the example that you gave will produce the two different frequencies on the two channels (left & right.) So you will need to combine them (electrically, or audibly) to generate the DTMF tones.

Speaking of which, do you have a POTS line? Most modern phone service won't respond to DTMF directly any more. Or will this be used for something other than dialing on a phone line.

granz

Quote from: Chris Savage on Jan 22, 2026, 01:54 PMGentlemen,

Would this setup allow for writing assembly code and viewing results? I'm going to be placing some orders this weekend and wanted to get what would be needed to realize a Z80 development system. I need to check the other thread as well, since I thought there was hardware I needed to order for that as well.
Although I do not have RunCPM running on my RP2350-GEEK yet, I'm going to have to say "yes." The author/creator of RunCPM says, in his intro:
Quote from: MockbaTheBorg link=https://github.com/MockbaTheBorg/RunCPMRunCPM was written to serve as a test environment when I was restoring the only copy of Z80 MicroMumps v4.06 which exists online (https://github.com/MockbaTheBorg/MicroMumps).
Making changes, recompiling MicroMumps and loading it onto a regular CP/M emulator via a disk image every time I moved a bit forward on the restoration was becoming too time consuming. So I decided to write something that would allow me to run the executable right away after making any modifications.
RunCPM then evolved as more and more CP/M applications were added to its compatibility list.
My PicoCalc does have RunCPM, and there is a boat load of old CP/M stuff there, including several Z-80 languages and Z-80 assemblers: Microsoft Macro-80 assembler and Digital Research's ASM, RMAC & MAC assemblers. In fact, there is too much software for me - I need to weed out some of it (and organize what's left) so that I can make use of my RunCPM system.

The list of software included is listed on the Obsolescence Guaranteed site (https://obsolescence.wixsite.com/obsolescence/multicomp-fpga-cpm-demo-disk.) The list is truly impressive.

granz

Quote from: Chris Savage on Dec 31, 2025, 09:05 AMI'm considering building something like this as a quick / cheap way to get people familiar with Z80 programming.

Z80 Emulator for Raspberry Pi Pico and other RP2040 based MCU boards

It could run on this $4.00 Raspberry Pi Pico RP2040 from Adafruit.
Do you have a favorite "textbook" for learning Z80 Assembly, preferably under CP/M? Also what assembler do you prefer?

I am thinking of going through a refresher "course" on Z80 Assembly programming. My PicoCalc, running RunCPM could be a great, portable CP/M system for doing the exercizes.


Chris Savage

#24
Quote from: granz on Jan 28, 2026, 12:55 PMDo you have a favorite "textbook" for learning Z80 Assembly, preferably under CP/M? Also what assembler do you prefer?

Nothing specific. I like books like Programming the Z80 from Rodnay Zaks, but typically when I'm programming, I just need a really good instruction reference. My favorite Z80 Handbook was lost many years ago.

As for assembly, I have always used TASM (Table-Driven Cross Assembler). I forget which version, but I know that everything I wrote to run under DOS wouldn't run on modern computers, however TASM runs in a CMD window on Windows 10 Pro (I haven't yet tried it on Windows 11). I even have a batch file that feeds it all the parameters, including the filename, and outputs the correct files.

Back in the day it would then copy the binary to my device programmer and launch a macro to program a 27C256.

                    Bringing concepts to life through engineering.

granz

Quote from: Chris Savage on Jan 28, 2026, 02:48 PM
Quote from: granz on Jan 28, 2026, 12:55 PMDo you have a favorite "textbook" for learning Z80 Assembly, preferably under CP/M? Also what assembler do you prefer?

Nothing specific. I like books like Programming the Z80 from Rodnay Zaks, but typically when I'm programming, I just need a really good instruction reference. My favorite Z80 Handbook was lost many years ago.
I was actually looking for a "how to get started with assembly programming under CP/M" book.

My favorite reference was the old Radio Shack Series 1 Editor/Assembler manual (https://www.classic-computers.org.nz/system-80/software-manuals/manuals-Editor-Assembler-Tandy.pdf.) The reference section was fantastic - the layout was about perfect. Each machine op-code started on a new page - most were on a single page. Each op-code description had a complete description, including which registers were affected, and how.

Several other people, over the years, have mentioned that they thought that the EDTASM manual was great.

Quote from: Chris Savage on Jan 28, 2026, 02:48 PMAs for assembly, I have always used TASM (Table-Driven Cross Assembler). I forget which version, but I know that everything I wrote to run under DOS wouldn't run on modern computers, however TASM runs in a CMD window on Windows 10 Pro (I haven't yet tried it on Windows 11). I even have a batch file that feeds it all the parameters, including the filename, and outputs the correct files.

Back in the day it would then copy the binary to my device programmer and launch a macro to program a 27C256.

TASM is good, but like I said, I want to be able to use my PicoCalc as a portable CP/M system, and do all of my practicing/learning on the PicoCalc. If I ever get back to doing real Z80 work, I will probably use TASM, too. I believe that it can run under DOSBox-X, or at least a MS-DOS VirtuatBox session.

Chris Savage

Quote from: granz on Jan 28, 2026, 05:26 PMTASM is good, but like I said, I want to be able to use my PicoCalc as a portable CP/M system, and do all of my practicing/learning on the PicoCalc. If I ever get back to doing real Z80 work, I will probably use TASM, too. I believe that it can run under DOSBox-X, or at least a MS-DOS VirtuatBox session.

I just confirmed that TASM does run in the Windows 11 Command Window. Seems slow for some reason, but does run. I will be sticking with it.

You cannot view this attachment.

                    Bringing concepts to life through engineering.

granz

Quote from: Chris Savage on Jan 28, 2026, 07:56 PMI just confirmed that TASM does run in the Windows 11 Command Window. Seems slow for some reason, but does run. I will be sticking with it.

Thanks, that is good to know. However, especially after all the trouble that you have had with Win 11 (plus all the others that I have heard about their troubles,) I cannot imagine any situation where I will be installing Windows 11 any where. (One of the advantages of being retired - if someone offers me a job working with Windows, I can turn them down. 8) )

Chris Savage

Quote from: granz on Jan 28, 2026, 09:45 PMThanks, that is good to know. However, especially after all the trouble that you have had with Win 11 (plus all the others that I have heard about their troubles,) I cannot imagine any situation where I will be installing Windows 11 any where. (One of the advantages of being retired - if someone offers me a job working with Windows, I can turn them down. 8) )

Well, it's been working since DOS. So that's a good thing. Justifies me sticking with it. The batch file I use to assemble is:

@ECHO OFF
TASM -80 -a -b -c -fff -h -l -s -y %1.SRC %1.OBJ %1.LST %1.SYM

                    Bringing concepts to life through engineering.

granz

Quote from: Chris Savage on Jan 28, 2026, 10:55 PMWell, it's been working since DOS. So that's a good thing. Justifies me sticking with it.
I'm not sure that I could call it working (at least not cleanly, nor well.) I remember doing installs of XP, and the first service pack that came out made the system so slow that it took over twenty minutes to boot, and to shut down. Being on client's time, I had to force shutdown, then I had to research why the slowdown, and how to fix it. If I recall, I had to format the drive then reinstall Win XP, and NOT do the update, until I did something else (I forget what that was.) There have been hundreds, if not thousands, of known bugs in various releases of Windows, and their upgrades (Service Packs.) Also, I recently heard that some of the Win 11 installs cause the system to brick - it wasn't clear if that just caused a reinstall, or actually bricked the system.

But, to get back to the subject...
Quote from: Chris Savage on Jan 28, 2026, 10:55 PMThe batch file I use to assemble is:

@ECHO OFF
TASM -80 -a -b -c -fff -h -l -s -y %1.SRC %1.OBJ %1.LST %1.SYM
Thanks, that should be useful if I get back to assembling under a DOS emulator under Linux.

Interesting: Just looked up the manual for TASM - when I first used this back in the '90s, I thought that TASM stood for Table Assembler, but just found out (again?) that the "T" stands for Telemark.

Another "interesting", in the beginning of the Introduction:
QuoteThe Telemark Assembler (TASM) is a table driven cross assembler for the MS-DOS and LINUX environments. Assembly source code, written in the appropriate dialect (generally very close to the manufacturers assembly language), can be assembled with TASM, and the resulting object code transferred to the target microprocessor system via PROM or other mechanisms.
I had not realized that TASM works in Linux! TASM just went way up in my estimation.