• Please review our updated Terms and Rules here

Please recommend a Z80 monitor

alank2

Veteran Member
Joined
Aug 3, 2016
Messages
2,255
Location
USA
I've been messing around with my old NEC PC-6001 (which is not a S100 system, so if there is a better place for this question...) and one thing I'd like to do is make a monitor for it. It has a Z80 compatible CPU. Some of the later NEC models in this series had one built in, but I've seen it and it was very basic.

I would like something that is pretty small, has source so I can assemble it at any location and replace the screen/keyboard functions.
 
Yes, there are loads of them available.

I see my google search threw up a similar question you asked back in 2019.

I have recently used the source code from an early version of Cromemco’s RDOS and stripped out the various disk commands. This originally occupied 4K - but (with the stripping out) you can reduce this. RDOS uses a serial UART.

I have also used the Z80 monitors from NASCOM. These are highly optimised Z80 code, and use a memory-mapped VDU screen - but they do fit in 1K (early versions) and 2K (later versions). They all live at address 0 though (NAS-SYS makes extensive use of the single byte restart instructions).

Others are available of course...

You might want to consider something written for the RC2014?

This is probably way more than you need, but... https://smallcomputercentral.wordpress.com/2017/11/18/monitor-v0-2-1/.

Dave
 
Last edited:
Thanks Dave; I'm not surprised I asked this before! The system has ROM at 0x0000 and RAM that begins at 0x8000 or 0xC000 so that might be a limiting factor.
 
Perhaps it would help if you listed what you're looking for in a monitor.
 
Basic stuff, enough to get along with. The ability to read and write memory and execute an address.
 
I was able to get ALTMON working on it last night and am pretty pleased with the result.

I still have some more things I want to tweak and change, but I've made a few modifications already:
Changed name to necmon.
Changed B to exit back to basic. Save registers and SP from when it is started and restore them before exiting to basic.
Remove duplicate commands J/L/N/R.
Changed H to help.
Modify dump to 6 per line.

I've still got a number of things I want to do to it including changing which letters to what such as changing move to copy, program to edit, etc., but that will be the project for later tonight.
 

Attachments

  • necmon.png
    necmon.png
    42.5 KB · Views: 7
I thought I had posted the files to this, maybe not.

The ASM modified source is present along with:

Select 2 files/2 pages at startup.

D88 disk image - use bload"necmon",r to load it. It loads to 0xd400.
necmon-16k.cas or necmon-32k.cas are cassette images for emulators, maybe you need to rename to .p6. One for 16K (no extended ram) and one for 32K (extended ram).
necmon-16k.wav or necmon-32k.wav are the same for playback to real hardware.
The cassette versions use a tiny loader - you will CLOAD them and then RUN. If your tape is controlled by the PC and stops automatically this will be seamless. If your tape doesn't stop (or your computer doesn't stop playing) you may have to play the sound twice to get it to load, or hit pause the instant you see it stop CLOADing. Then RUN. Then unpause.

THIS ISSUE FIXED ZIP UPDATED- (For some reason on my real hardware, I could not exit from the monitor back to BASIC. It would restart and ask how many pages instead. I'll have to try to figure that out. EDIT: Seems to be a 16K issue. I'll have to work on this.)
 

Attachments

  • necmon.zip
    573.8 KB · Views: 2
Last edited:
The best small monitor was the one the Poly88 had. It was 8080 code but still the best I've used.
It didn't include a lot of features but fit in 1K.
If you have 8K of ROM space, the best for that is actually not a monitor but a language, Forth.
 
I had a working Poly88 at one point. IIRC the monitor could display memory on a screen that looked very much like a disk sector editor. You could even alter memory contents in hex much like a sector editor would alter a disk sector.

Was a lot more intuitive than many user interfaces I've seen.
 
The best small monitor was the one the Poly88 had. It was 8080 code but still the best I've used.
It didn't include a lot of features but fit in 1K.
If you have 8K of ROM space, the best for that is actually not a monitor but a language, Forth.
This is a really intriguing idea. I've never thought of Forth as a potential bare-metal monitor, but it does make some sense at that. Could you explain your thinking regarding how that substitution would work, and have you tried it? Say more ...
 
Simply, considering the space required, if you can afford it, a Forth can become a "programmable monitor". Or, rather, an easily extended monitor.

As they say, "Compiler, interpreter, assembler, and editor all in less than 8K". With a few higher level utility words to better fit the monitor space, it can be a nice tool. The downside of a forth is that it may have a higher RAM impact than a simple monitor (notably the stack, which isn't a lot, but it's "some").

If you want to keep the Forth to a small segment of memory (like an 8K footprint total), that's pretty readily done. You can do a lot with even as little of 1K of working RAM in terms of writing quick, one off routines. 1K of RAM is about 500 instructions, which it a lot really.

Lots of possibilities depending on your needs and limitations.

Sun workstations (among others I think) were know for booting in to a Forth monitor.
 
I guess, the question of what you want a monitor to do is why I'd recommend Forth.
Problems are the issue you want a monitor for. No matter how feature rich a monitor is it will never be able to be flexible enough to solve the typical issues you want a monitor for.
Eventually you need to write some code.
As an example, many machines have some boot code that does a simple memory test. On your troubled machine, it looks to have a memory issue but the machine says it is happy with what it has. As was mentioned, Forth has some RAM memory foot print. If it is working at all, it can be move around. This is not usually true of a typical monitor. It typically has at least one location that it has hard set for stack and variables.
At some time, you may be required to do some machine coding. This is no different in Forth than in a monitor but the idea of Forth is to keep it at a higher level of abstraction. Say you want to bit bang some port. Most monitors will let you do that, a line at a time. Having Forth running, you can quickly do a sequence that is more meaningful for the problem at hand. You can more easily explore the variations of how things work and don't work.
An example of doing this is one of my home projects. I'd gotten a NC4000 processor board that I wanted to add things to. The NC4000 is a 4000 gate stack based processor that was designed specifically to run Forth. It came out at a time when 386 processors were used. On it even code written in high level Forth were many times faster than a 33 MHz 386, using a 4 MHz clock.
Anyway, back on subject. I wanted to add a hard disk. The simplest way to do that was to use a PC disk controller and a typical hard drive. Being cheep, I bought a used XT controller and at the time everyone was dumping their 5Meg hard drives as they were no longer being supported. I wired it up to the bus of the NC4000 got the port specs for the controller and went to work adding a hard drive ( up to this time, I needed a serial link to a PC to store my programs ). I could now experiment with things like formatting, writing and reading sectors. I did this all with a high level language that included an interactive interface that allowed me to experiment until it did what I wanted. I could save source to a mass storage.
Another time, I was working with a Blue Pill ( look it up ). I needed to change the boot clock speed to support a particular interface. The problem was it would hang every time I tried to set the need registers. I needed to single step through the code to find the exact point that it failed. This is something normally done from a monitor but Forth was my monitor ( EForth a simple Forth for such uPs ). I quickly realized, it was a problem of a processor that has a local instruction cache. I needed to add a machine instruction that forced the processor to dump the cache and wait until the write to the port was completed.
An other case. One of my side projects was to restore a piece of 4004 code to put on an actual physical processor and hardware. I'd been searching the web for any interesting 4004 code. Years ago, I found a piece of code used to create an electronic maneuver board ( worth looking up what a maneuver board does ). The listing looked to be printer an an ASR33 with deep ruts on the platen. Many Cs, and 0s looked that same.
In Forth I wrote an assembler and simulator. I added the typical monitor operations of register displays, memory dumps an in some cases indirect memory accesses, into the targets memory. As I hand transferred the code from the poorly printed pdf, I noted locations that I couldn't be sure of the value. Such text as P and F were easy to tell because humans need a lot of redundancy. Computer need it right the first time.
I could now setup registers, memory and execute particular part of the code and see if they made sense. All with a quick interpretive/compiler that was dedicated to running 4004 code. It was a monitor for a machine that wasn't even there. ( I suppose now days one could use Python but with a larger memory footprint. )
I've since built a replica of the machine and I'm able to actually run the ~4K of 4004 code to solve the maneuver board problems.
One might ask, why I didn't just used one of the simulators available on the web. Besides most that are on the web do not faithfully actually run every aspect of the 4004, they have no easy way to do what I call instrument the simulator to be the target machine. They can run code but have no easy way to simulate the target machine. Since I wrote the simulator, I can also easily write the code to be the target machine. In this case it was a scanned display and special keyboard.
So, what is it that you desire a monitor to do? Do you expect to solve interesting problems or just dump and load memory?
Dwight
 
Back
Top