home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
crossasm
/
svasm02.arc
/
INFORMAL.DOC
next >
Wrap
Text File
|
1988-05-24
|
10KB
|
159 lines
S V A S M 0 2
SOME INFORMAL COMMENTS ON VERSION 1.0
May, 1988
I had been using an 8-bit (CP/M) commercial assembler for developing 6502 code
for an amateur radio 2 meter repeater system I had built. As the code grew, I
needed an assembler that would give me a cross reference listing of symbols.
I also wanted to try the 65C02 chip, which I had no assembler for. The price
for a new commercial product was ludicrous, and GEnie had nothing that would
suit my needs. The solution was obvious: write one. I started in the old
TRS-80 (CP/M) using 8080 assembly language, but soon outgrew the system. It
was time to upgrade anyway, so I switched to an IBM XT compatible. Then I had
to learn 8086 assembly and rewrite what I had thus far. After about a year of
work, I had a two pass assembler that would produce loadable hex code for a
6502 or 65C02, and give me a cross referenced symbol table.
SVASM02 is written in good tight 8086 assembly for efficiency. I once wrote a
cross referencing assembler in 8-bit CP/M BASIC. The compiled version was
over 27K long, and was still slow. The SVASM02 assembler is around 12K, and
runs quite rapidly. A single 64K segment is sufficient for the code, I/O
buffers, and the symbol table. No "temporary" files are generated, since the
symbol table is constructed in RAM. The second pass reads the source code
from the disk a second time, and undefined first pass symbols are resolved.
This approach is much more efficient than writing temporary information to
disk for later read back, and significantly reduces disk and CPU overhead.
There are no support files required for SVASM02.
The program was developed by first writing all of the support routines before
adding the instruction set decoder. This modular approach will allow the
generation of other assemblers by merely writing the instruction set decoder
for the chip in question. I plan to write one for the Motorola 6805 series (I
have an application for it), using the SVASM02 code as a foundation. Other
chips, like the 6800 or 6809 (for which I don't have an application) may also
be done if the demand (and rewards) are forthcoming.
The nice part about writing an assembler is that you get to define the syntax
of the code you are assembling. I had used a couple of commercial assemblers
for various chips, and liked some features of each. For example, I use the
asterisk (*) as the symbol for the program counter in preference to the dollar
sign. I also don't like the colon as a label delimiter. In SVASM02, labels
are the first thing on a line other than an instruction, pseudo-op, comment or
an equate, without the dumb colon. Future versions may permit the use of a
colon but not require it. Also, I don't like DB, DW, ORG, and similar Intel
type syntax. I use the pseudo-ops .BYTE and .WORD for bytes and words and "*
= " for defining the program counter and setting aside uninitialized storage.
The equal sign is used to define equates.
SVASM02 is easy to run. Once the program name is entered, prompts are given
for the filenames for source, object, and listing files. There are no
switches or modifiers. The program directives will do about anything a
switch would do, with less confusion and more options. Selection of object
and listing output is optional, and the listing output may be specified to go
to the screen or the printer by entering the destination at the filename
prompt.
Now a word or two about case. I don't like lower case for assembly language.
In fact, I can't STAND lower case for assembly language. This is probably a
quirk on my part, but I find lower case almost impossible to read in
expressions like "start1 = $a3c6". Perhaps it wouldn't be too bad if we had
lower case numbers. Except for filename entry during invocation, the SVASM02
assembler will not convert lower to upper, and is totally based on upper case
characters only. Lower case is fully acceptable within a quoted string or as
commentary information, however, as it should be.
There are a few other things SVASM02 will and will not do. It will assemble
6502 and/or 65C02 mnemonics and produce both a line-numbered source listing
with a cross referenced symbol table, and a HEX load file in Intel format.
Input is from disk only. The HEX file normally will go to disk. The source
listing output may be directed to disk, the printer, or the screen. Both the
source listing and HEX files are optional. While DOS supports the use of the
Reserved Device Names, SVASM02 may not perform as expected if they are used in
place of the usual disk name. Drivers have been included to permit correct
console (CON) and printer (LPT) output if desired. See the SVASM02.DOC file
for details.
Assembly time errors (all 25 of them) are shown in English words, and not a
single letter code that one has to waste time fumbling through a manual
looking for to get an explanation. Regardless of the I/O routes selected, all
errors are written to the screen as well as any other chosen output medium.
With regard to disk I/O, the present version does not support directory paths.
Valid disk designations (A:, B:, etc.) may be freely used.
SVASM02 Version 1.0 will not do macros, but I am looking at the possibility of
including macro assembly in a future version. SVASM02 will not do
parenthetical or hierarchical arithmetic, like "SCRADR = ((REW+WER)/ONE-
TWO)/DSF". For the present I recommend BASIC. SVASM02 will do simple
arithmetic, evaluating an expression from left to right as the terms are
encountered. For example, "TABADR = BASADR+OFFSET*2" will be correctly
evaluated from left to right. The value of OFFSET is added to the value of
BASADR and the sum is multiplied by 2. The four arithmetic operators are
supported as well as Boolean AND, OR, NOT, and XOR; also SHL and SHR (shift
left and right); MOD; and byte extraction operators. The left to right
restriction applies to the logical, MOD, and shift operators also. (A future
version may include the capability to do hierarchical and parenthetical
evaluations, as well as relational operations like less than, greater than,
etc.)
Labels and symbols are limited to six characters. I know some assemblers will
use up to 40 or even more, but why take up a lot of file and memory space, and
CPU time to evaluate them when a few characters will do the same thing? If
you need a lot of characters to describe a variable or code sequence, use a
comment. The CPU overhead is a lot less. I could be talked into 8 characters
for a future version.
There are several pseudo-ops in SVASM02, like .PAGE, .WIDTH, .INCLUDE, .CMOS,
conditional assembly, .LIST and .NOLIST, .PRINTC, and others. These are fully
described in the DOC file.
The TEST02.ASM file contains all of the 6502 and 65C02 instruction mnemonics
and addressing modes, as well as examples of syntax, errors, etc. This file
should be assembled and the output referred to to answer additional questions
the programmer may have regarding the program or its operation.
SVASM02 has been used to assemble 6502 code for the control of two amateur
radio repeaters, at KM2H and N2CEH. There are no known bugs. That is not to
say a bug may not be present. Other programmers, using their own style of
programming technique, may uncover a hidden bug. If I am informed of a bona
fide bug, I will fix it and return a free corrected version to the sender,
whether he or she is a registered user or not. This offer does not apply to
users who use the program for profit unless they were originally registered.
A software project of this magnitude is never really complete. There is
always something more one can add, and I plan to do so. Hierarchical
and parenthetical arithmetic (a bear to write!); relational operators like EQ,
NE, GT, LT, etc. (I've started looking at this one); more than 6 characters in
labels and symbols (will require more RAM and disk space and slow the program
a trifle); and maybe even macros (good-bye 64K memory use) are all being
considered. User comments and input will all be considered, but frivolities
and user-specific functions will be rejectd.
Now the tough part. While writing SVASM02 was a labor of love, it
nevertheless was a labor. I offer it to GEnie users and others for private,
non-commercial, non-profit use only. If you find it useful, a contribution of
$25.00 would be appreciated. If you intend to profit from its use, I must
also. Upon written application and receipt of $100.00, a license for
commercial use of SVASM02 will be issued. In either case, you will receive a
disk containing the latest versions of the code and documentation, and future
notification of any new versions. No future versions, even to fix a bug, will
be released to the public domain. Future assemblers referred to previously
will be released in their initial versions only. At no time will the source
code be released for any reason to anyone. Please contact me for terms of
commercial distribution. I may be reached by amateur packet radio (rapid), by
U.S. mail (less rapid), or by GE mail on GEnie (slowest, since I don't get to
log on as often as I would like). Comments, constructive or otherwise, are
welcome and will be appreciated. Please, no phone calls.
U.S. Mail: John Michne
10 Evergreen Ave.
Clifton Park, New York 12065
Amateur Packet Radio: KM2H @ WA2WNI-4
or KM2H @ WA2PVV
GEnie Mail Address: KM2H