This short guide will instruct you in getting started with the Microsoft Macro Assembler in CP/M. There are a few prerequisites to following the guide:
- A running CP/M 2.2 or CP/M 3 system (obviously!)
- Microsoft MASM tools installed in CP/M (specifically, we need M80.COM and L80.COM)
- Some source code editor of choice (ED.COM is an option, but ZDE.COM is better)
Create the assembler source code
This is the source code you must enter using your favorite editor on CP/M. Save the file with the name HELLO.MAC and exit the editor.
.Z80 BDOS EQU 0005h TPA EQU 0100h WRITESTR EQU 09h TERMCPM EQU 00h ASEG ORG TPA START: LD DE,MESSAGE LD C,WRITESTR CALL BDOS LD C,TERMCPM CALL BDOS MESSAGE: DB "Hello, world!$" END TPA
In this example I will assume that the HELLO.MAC file is on the same CP/M disk drive as the assembler tools.
Now, to assemble the file you first need to run the Macro Assembler, which is the program M80.COM. So at your CP/M prompt do the following:
A>M80 =HELLO.MAC No Fatal error(s) A>
If the source code was entered correctly, the above command should generate a file named HELLO.REL as output.
The final step is to link the executable by using the L80.COM tool:
A>L80 HELLO,HELLO/N/E Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft Data 0100 011B < 27> 44063 Bytes Free [0100 011B 1] A>
Assuming no errors, the output of the above command is an executable CP/M program, HELLO.COM. The switch /N defines that HELLO should be the name of the .COM file produced. /E tells the linker to exit when done. Let us test if the program works as expected:
A>HELLO Hello, world! A>
That’s it! Of course the tools can handle much more advanced assembler files, but the above should get you started. If you search the Internet you will easily find original user manuals in PDF for the complete Microsoft Macro Assembler tool chain.