All,
Here's a mini-tutorial I just wrote (so I wouldn't forget) for doing
assembly on the M100, in CP/M 2.2. Corrections, suggestions welcome.
#********************************************************************
#** m100-assembly-on-cpm.txt
#********************************************************************
Notes:
Case is weird on CP/M, just turn off caps-lock and use lower case unless
upper is required for something
Tabs are better than spaces. Turn off spaces and set tab stops to 8
before editing asm files.
requirements:
CP/M is installed and running
dl or laddie are running
unix2dos - or some other way to convert line endings to DOS, I use
Sublime
xrefs:
CP/M Reference Manual
CP/M* Versions 1.4 & 2.X Programmer's Reference Guide
CP/M Operating System Manual
BTW, this is definitely the way to go for 8085 assembly language
programming.
The M100 normally only has 32K memory available and ZBG and TEENY take
up a lot of that space, leaving very little for programming. Still, that
is also a worthwhile endeavor.
We will write and assemble two assembly programs. One to read characters
from the console and echo them until an * is typed and another to print
"hello, world to the console". The process will be to:
1. Write the source code on host system.
2. Transfer the source to the M100 CP/M system, translating the filename
along the way.
3. Assemble the source to a HEX file
4. Load the HEX and create a CO file
5. Run the CO file
There are a couple of things we need to keep in mind as we go through
these steps. First, use tabs, not spaces to separate fields and use 8
character tab stops. Second, the TPDD emulation requires that files be
in 6.2 format, but on CP/M, we can use 8.3. So, when saving the file
into the TPDD directory, we will use all UPPER-CASE characters and
constrain the filenames to 6.2. The import/export funcionality in CP/M
will allow us to convert the names as we load/save files from the OS.
------------------- GETCS.AS
1. Write the source code on host system.
In this step, I'm using sublime and disabling spaces and setting tab
stops to 8... right click on Tab Size in the status bar and choose
according to your preferences.
; GETCS.AS
BDOS EQU 0005H
CONIN EQU 1
;
ORG 0100H
NEXTC: MVI C,CONIN
CALL BDOS
CPI '*'
JNZ NEXTC
RET
END
Be sure to have an empty line after END. Also make sure you have DOS
line endings. In Sublime, View->Line Endings->Windows.
Save the file into your TPDD directory (where you're running dl or laddie).
2. Transfer the source to the M100 CP/M system, translating the filename
along the way.
On the M100, in CP/M:
import getcs.as getcs.asm
3. Assemble the source to a HEX file:
asm getcs
4. Load the HEX and create a COM file:
load getcs
5. Run the COM file, remember to type stuff and end it with *.:
getcs
Now is the time for ...*
------------------- HOWDY.AS
1. Write the source code on host system:
; HOWDY.AS
BDOS EQU 0005H
PRIN EQU 9
ORG 0100H
LXI D,TEXT
MVI C,PRIN
CALL BDOS
RET
TEXT: db 'howdy, world', 0Dh, 0AH, '$'
END
Be sure to have an empty line after END. Also make sure you have DOS
line endings. In Sublime, View->Line Endings->Windows.
Save the file into your TPDD directory (where you're running dl or laddie).
2. Transfer the source to the M100 CP/M system, translating the filename
along the way.
On the M100, in CP/M:
import howdy.as howdy.asm
3. Assemble the source to a HEX file:
asm howdy
4. Load the HEX and create a COM file:
load howdy
5. Run the COM file:
howdy
howdy, world
Celebrate!
Alternatively, the source code can be created and edited on the CP/M
system using the built in editor, ED, or a visual editor such as VEDIT:
# install VED40.CO into CP/M
import ved40.co ved40.com
ESC-ESC to exit visual mode
EQ followed by ESC-ESC to abort and exit from command mode
EX and ESC-ESC to exit and save