home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpminfo
/
cpm-cc14.art
< prev
next >
Wrap
Text File
|
1994-07-13
|
9KB
|
166 lines
==============================================================================
[ THE KAY*FOG RBBS | CPM-CC14.ART | posted 01/18/86 | 163 lines 9k ]
The CP/M Connection Originally published in
by Computer Currents
Ted Silveira 2550 9th Street
(copyright and all rights reserved) Berkeley, CA 94710
November 5, 1985
ONE FOR THE PROGRAMMERS
In my last column, I mentioned some books that will introduce you to
the inner workings of CP/M and assembly language. If that aroused your
curiosity, or if you're already a programmer, you'll also want to start
collecting some of the assembly language utilities available from the
public domain. These utilities were written by and for programmers,
patchers, and other people who like to know what's going on inside their
computers. (If you're not interested in assembly language, just skip to
the end to see what's coming up next time.)
[TWO KINDS OF ASSEMBLY LANGUAGE]
The CP/M operating system was originally designed for the Intel 8080
microprocessor chip and written in 8080 assembly language (the native
language of the 8080), and all its accompanying tools are designed to work
in that language. Most modern CP/M computers use the newer Z80 chip
instead of the 8080. The Z80 can execute all the instructions that the
8080 can plus a number that the 8080 can't, so a Z80 chip can run any
program written in 8080 assembly language, but an 8080 chip can't
necessarily run a program written in Z80 assembly language.
Most public domain assembly language programs are written in 8080
assembly language, the lowest common denominator. Lately, however, more
programs are being written in Z80 assembly language to take advantage of
that chip's extra power. Since almost all CP/M computers now use the Z80
chip, you probably won't have any trouble running either kind of program.
You will, however, need a different set of tools for each language--you
can't feed Z80 assembly language to an 8080 assembler and vice-versa.
[ASSEMBLERS]
You need an assembler and a loader to turn an assembly language source
file into a runnable program (a COM file). Digital Research's ASM.COM and
LOAD.COM are the standard 8080 assembler and loader. They aren't public
domain, but they are included with all CP/M 2.2 computers (CP/M Plus owners
get the MAC assembler instead). With these two, you can assemble most
public domain 8080 assembly language programs. You can't, however,
assemble an assembly language file that uses _macros_ or external _library
files_. For these, you need a macro-assembler like Digital Research's MAC.
Unfortunately, there is no 8080 macro-assembler available in the public
domain.
You can find several Z80 assemblers in the public domain. The best
I've found is Z80MR, a macro-assembler, which you may also find under the
names ZASM and ZMAC. (Just to confuse matters, there is another public
domain Z80 assembler circulating under the name of ZASM.) With this
assembler, you can use the Digital Research loader LOAD.COM, which you
already have.
No matter whether you're using 8080 or Z80 assembly language, you can
replace LOAD.COM with the public domain loader MLOAD.COM. MLOAD is faster
than LOAD and can be used (in place of DDT) for installing assembly
language patches.
[DEBUGGERS]
A debugger is a very useful program that lets you examine, modify, and
even trace (execute instruction by instruction) another program in memory.
It's useful not only for debugging programs but also for patching them to
run on your own computer. The standard 8080 debugger is Digital Research's
DDT, which you should have received with your computer (CP/M Plus users get
SID instead).
There is no alternative to DDT in the public domain--you don't need
one--but there is a useful set of patches to DDT that you can find in the
library file RDDT.LBR. The most useful patch allows you to specify where
in memory DDT will load itself. By loading DDT lower than you usually
would, you can examine and modify those parts of CP/M that DDT normally
overlays.
For debugging Z80 assembly language programs, there's a new public
domain program called Z8E, a terrific tool that does everything DDT does
and more. It's most fascinating feature is a trace function that executes
a program step by step. During the trace, Z8E shows you the assembly
language instructions with an arrow pointing to the instruction currently
being executed. At the same time, Z8E shows you what's happening in each
of the Z80 chip's registers (on-chip memory areas) so that you can follow
the effects of each instruction. Watching the contents of the registers
change while the pointer arrow steps through a program can be mesmerizing
(if sometimes incomprehensible). Z8E has a few problems--it gets lost if
you try to trace through CP/M itself--but it's close to being a dream tool.
[DISASSEMBLERS]
A disassembler lets you take a COM file (a runnable program) and
recreate the assembly language source file that it came from. This kind of
tool isn't for everybody, but it's invaluable for learning how someone
else's program works (or doesn't work). And disassembling a well-written
program, even a small one, will teach you a tremendous amount about
programming in assembly language. It's also sometimes the only way to
modify a program written for one computer so that it will run on your own.
The best public domain 8080 disassembler is RESOURCE. It's been
around for years, and it's quirky in some ways, but it does the job. Best
of all, it's interactive. Unlike some "brute force" disassemblers,
RESOURCE lets you decide whether a particular byte is an assembly language
instruction or a value to be used by the program.
My favorite Z80 disassembler is DASM, a Z80 version of RESOURCE. It
has all of RESOURCE's good features plus a few improvements.
Recently, however, a challenger has appeared from England. DAZLSTAR
(DazzleStar) is an amazing piece of work. It has more features than DASM,
including some that make it much easier to trace a subroutine and then
return to your starting point. It also--believe it or not--looks and acts
a lot like WordStar, complete with on-screen menus and cursor movement
commands. It's a complicated program (most disassemblers are) that I
haven't really learned yet--when I need a disassembler I still tend to
reach for DASM. But I have the feeling that once I get used to DAZLSTAR,
I'll be converted for life. If this is a sample of English programming,
someone ought to set up an import business.
[TRANSLATORS]
People who write a lot of assembly language programs say that once you
start using Z80 assembly language, you'll never want to go back to 8080--
Z80 can produce faster and more compact programs, and its assembly language
mnemonics are more logical. But what do you do with those disks full of
8080 assembly language source files? You convert them into Z80 assembly
language with a translator.
There are two main programs in the public domain that will read in an
8080 assembly language source file and spit out a Z80 source file--XLATE5
and IZ. XLATE5 is the smaller and faster of the two programs, but IZ has a
nice feature that allows you to see the translation being made so that you
know what it's doing. I use IZ when I need such a program, but it's really
a toss-up--both are good.
[COMING UP]
You may have noticed this column now has a new name--[CP/M
Connection]. After writing about CP/M public domain software for some
months, I think it's time to broaden the horizons. I'll continue to let
you know about useful public domain software, but now I'll also cover good
commercial software, tricks for getting the most out of CP/M, and
interesting trends in the CP/M world. If you have any suggestions, let me
know.
------------------------------------------------------------------------------
Ted Silveira is a freelance writer and contributing editor to several
computer-oriented publications. He appreciates suggestions or feedback
and can be reached through the KAY*FOG RBBS (415)285-2687 and CompuServe
(72135,1447) or by mail to 2756 Mattison Lane, Santa Cruz, CA 95065.
------------------------- End of CPM-CC14.ART Text -------------------------