• Please review our updated Terms and Rules here

Just a 'simple' Assembler for CP/M 3.....

MykeLawson

Experienced Member
Joined
Mar 21, 2014
Messages
382
Soon, I shall be making the leap from 2.2 to 3.0, and as I go through the various docs I have downloaded, I'm trying to find a simple, native Z-80, assembler, that I can run in a CP/M 3 environment. I see the MAC and RMAC, but I'm just looking for something that I can write some Z-80 (not 8080) code, assemble, and then run the .COM program. I will confess, that every program I have ever written for the STD bus CP/M 2.2 system I currently have, was written on my PC, assembled, and then downloaded to the CP/M machine; so this will be the first time (in an extremely long time) that I will have written and assembled something natively on a CP/M machine. I have a copy of the CP/M 2.2 ASM.COM that I 'think' would work, but it seems to be the "CP/M 8080 assembler" and I'm reallyyyy hoping for something that speaks native Z-80. This old brain of mine can only handle just so much these days. So, if anyone of something I should take a peek at, please let me know.
 
So, if you are looking for something that recognizes the Zilog mnemonics, you can get Microsoft's M-80 (and L-80). As you have observed, using Digital Research's assemblers requires use of Intel mnemonics, possibly expanded by Z80.LIB to add Z-80 instructions as envisioned for Intel mnemonics. These are the tools that were originally available. Others probably exist.
 
So, if you are looking for something that recognizes the Zilog mnemonics, you can get Microsoft's M-80 (and L-80).
Just note that M80 won't create the .COM directly, you'll need L80 to link it. I don't know if there are simpler assemblers.
 
Well, I had figured that might be the case. Odd that in all these years, there was never just something simple that was ever written for this. I suspect possibly due to a memory size limitation maybe. I do have both M-80 & L-80 combined in an .LBR file, but I'm not sure how to extract them into separate programs, or if they even can, or should be. And for the life of me, writing a program on paper, figuring out the right op codes, and hand entering it just is not gonna happen. It was worth a shot though. Thanks
 
Well, I had figured that might be the case. Odd that in all these years, there was never just something simple that was ever written for this. I suspect possibly due to a memory size limitation maybe. I do have both M-80 & L-80 combined in an .LBR file, but I'm not sure how to extract them into separate programs, or if they even can, or should be. And for the life of me, writing a program on paper, figuring out the right op codes, and hand entering it just is not gonna happen. It was worth a shot though. Thanks
M-80 and L-80 must be extracted from the LBR before they can be used. I thought there were tarballs of these tools out there, but can provide one if you need it. Not even ASM.COM from DRI will produce a .COM file - it creates a HEX file that you must run LOAD on to convert to COM. This is also an area that people used SUB files for - to "script" the assemble/link so that they run a single command and just wait for the COM file to come out the other end.
 
Okay Chuck, Doug, and the rest of y'all; you have me figured out..... Looks like I'll be 'edumicating' myself on that collection of assemblers. But, I do actually have a copy of ZASMB amongst all the FoxHollow, Walnut Creek, etc stuff I have downloaded. I really should catalog that stuff someday... As for the Z80ASM, what I have is from Peter Hanratty back in 2006:

1711395475792.png

And that is actually a pretty good assembler. Not full of a lot of features, but it runs on Win10 and I used it back in the early 2010's..... But ZASMB looks to have some promise for the simple stuff I want to do on the actual machine. Just chunks of test code.
 
I must have misunderstood your original post. You said "An assembler for CP/M 3", which to my benighted mind automatically removed cross-assemblers from consideration. Back around 1984 or so, when I was doing some Z80 contract work, I used the Avocet cross-assembler for MSDOS. It did the job.
 
Hi Myke,

You're welcome to give my assembler a try if it interests you at all. it currently exists as a cross-assembler and a native z80 assembler, so it can run native under Windows 10/11 in the command line, or under CP/M on a z80 system.

I'm still writing the z80 part to add includes and macros, but the z80 part currently assembles itself in z80 as a test code, so it seems to work OK, though I haven't tested it extensively outside of the emulator yet. A lack of time has slowed down the Macro inclusion, but

There is no IDE though. It's just a case of write the ASM file in a text editor ( I use Notepad++ with suggestions turned off ) and then assemble the ASM file at the command line.

Interestingly, you had a part to play in it's development IIRC back when we both started on the forum, and you mentioned what you wanted and I like the idea and so wrote a simple cross-assembler to take an ASM file and write a COM file. Then I used the assembler to write my own CP/M version, and now I'm writing the next generation of assembler ( native CP/M assembler ) in z80 also.

As a final thought, the source on Github also allows some testing of code in my environment under CP/M 2.2 - I've never tried it with CP/M 3, but it might be able to run CP/M 3 binaries in it's emulator. I could be wrong about that too - I didn't look into what's required to run CP/M 3 yet.

One useful thing also to keep in mind - the PC version is written in basic ( if you're familiar with basic ) and the CP/M version is written in z80 assembler and source is available for both.

The PC cross assembler is available in the LokiOS package - https://github.com/cj7hawk/LokiOS
The z80 native CP/M assembler is here: https://github.com/cj7hawk/Loki-Z80-Assembler though I have a more recent version also if you find it useful.

David
 
The Exidy Sorcerer came with a Z80 assembler but for more serious programming I recommend crossassembling on a PC (I use Linux and there are several good Z80 assemblers to find) and a serial cable to the CPM machine for testing.
 
David, I will absolutely check that out. Wow, I didn't know I had a part to play. Thanks. I will grab the ASM.BAS file and see how QB64 works with it. Other than the native BASIC languages that are native to CP/M, QB64 is my goto for PC based work.
 
David, I will absolutely check that out. Wow, I didn't know I had a part to play. Thanks. I will grab the ASM.BAS file and see how QB64 works with it. Other than the native BASIC languages that are native to CP/M, QB64 is my goto for PC based work.

It was when you were talking about a simple assembler idea some time ago to just write a com file... Back when you were making your serial card... It made sense what you said to have a very simple assembler that could just write a COM. And you probably remember talking about assembling for relocating code as well, which is something else I added to my assembler for the same reason you posted (eg, loading up a COM to install a driver ). Another idea you suggested I liked.

I've almost completed the first beta version of the CP/M assembler, and have the macro code now storing macros in memory, though I still have to write the macro read code into the parser, but that's just a case of a flag swapping out the source and reading from a pointer, so should be finished soon. I was stuck on deciding what was a macro, what was an include, and how to nest includes, which is solved now. The macro code was more complex than I thought, since I never considered macros when I started writing the assembler.

Then I need to rewrite the PC version so that it has the extra features the CP/M version already has, and I'm going to modify the Loki code so that it switches into CP/M from Windows 10, and just reads all the files in the current directory, allowing CP/M programming on the PC for testing. Just like it's a CP/M shell. The current PC assembler still works, though doesn't handle undocumented codes like the CP/M one already does. It's not a great assembler, but it was sufficient to write an entire OS in.

Freebasic is an extension also of QBasic, but it's a bit like someone wrote a version of C to use QBasic. And it also uses the C libraries, though all written in basic... I think it translates basic to C then uses GCC or something like that.

I'm kind of envious and impressed at the same time about how far you've progressed your hardware. But then again I've been shamelessly stealing all the good assembler ideas you've posted here too. ;)

I have been working on assemblers, emulators and OSs instead of my hardware since it's something I can do during my morning commute... It's been fun since I'm more of a hardware person than a software person. But I can't make hardware on the train ride and I don't have time when I'm at home since I work two jobs. So writing software has bewen my alternative escape :)
 
Cool. Well, I'm making the final tweaks to the serial card in my S-100 so I can start testing some real software downloads. Up to this point it has mainly been test code stuff like repeatedly sending the same code to the port to make sure it shows up correctly on the other end, an end to end wrap test to input from the keyboard, out the serial, back in, then to the display. And I have some simple code (30 bytes) to hand load, in order to download a much bigger program that I can use to start loading more code as I get hold of it, or write it. One of these days I'll post something about how all of these machines are interconnected.
 
Back
Top