home *** CD-ROM | disk | FTP | other *** search
-
- UCASM Micro-controller Assembler - copyright (c) 1987,1988 by J. L. Post
- Version 1.2 - Dec 21, 87.
-
-
- UCASM is a CP/M (Z80 only) assembler for the 80xx series of micro-
- controller chips. Controllers supported are the 8021 (subset), 8035,
- 8039, 8040, 8041, 8042, 8048, 8049, 8050, 8741, 8742, and 8748 (whew!).
- Release 1.2 is a very plain vanilla assembler, but it gets the job done.
- Other programmers are encouraged to add some bells and whistles.
-
- I request that anyone wishing to make additions or corrections to the
- source code first submit them to me. Hopefully many changes from dif-
- ferent sources can be included in one update and avoid the problem of
- umpteen versions floating around on various bulletin boards. Submit
- changes directly to me at 22726 Benner Ave, Torrance, CA 90505. Log re-
- cords of included changes will be put in the source code for subsequent
- releases.
-
- There are several "features" of UCASM that were done the way they
- were for the sake of speed of execution, efficiency, or just plain lazi-
- ness. Those that exist for one of the first two reasons should not be
- changed.
-
-
- Legal BS for the Lawyers:
- -------------------------
- While the source code and object code for UCASM has been made avail-
- able for free, this in no way invalidates my copyright. Feel free to
- pass it around or modify it in any way you see fit. The one thing you
- cannot do is sell it. Doing this would upset me greatly, to the point
- where I would feel obligated to cause you all kinds of legal difficul-
- ties and/or grief. UCASM is released to the public domain for personal
- use. Using it for business purposes is tantamount to selling it.
-
- This software is released without warranty. The author assumes no
- responsibility with respect to any liability, loss, or damage caused or
- alleged to be caused directly or indirectly by this software,including,
- but not limited to, any interruption of service, loss of business or
- anticipatory profits or indirect, special, or consequential damages. So
- there.
-
- UCASM is my own creation, and any credit or blame lies solely with
- me. I would like, however, to acknowledge the influence of Michael G.
- Lehman's Z80ASM. In particular, the expression evaluator was largely
- patterned after the one in Z80ASM. Thank you, Michael.
-
-
- Things Intentionally Left Out:
- ------------------------------
- There is no PAGE or EJECT pseudo-op and I would prefer that no one
- add one. This kind of nonsense wastes paper, and paper comes from
- trees. I happen to like trees very much. If you get a yen to add such
- a ridiculous function, consider that many people other than yourself may
- use it and how many trees will be killed in the long run. Be nice to
- the world; it's the only one we've got.
-
- There is no END pseudo-op. Any programmer who can't tell that he has
- reached the end of the file should consider going into plumbing or
- bricklaying. Programming is apparently too difficult for him or her.
- If you haven't noticed by now, I'm very opinionated, and I will express
- my opinions in this document. If you can't stand the heat......
-
- There are no macros and I don't want any. Macros are for dummies.
- Contrary to popular opinion, I think that macros make the code MORE ob-
- scure. If you need to have a section of code that can accept varying
- parameters as inputs, write an intelligent subroutine. See above com-
- ments about optional career choices.
-
- There is no INCLUDE statement. The 80xx series of micro-controllers
- have a small amount of ROM available and there is no reason why all of
- the source code won't fit into one file (unless you have a thing about
- going overboard with comments). If you have a common subroutine library
- that you want to use in various and sundry applications, PIP it into a
- new file and add your application code to it. Even I'm not that lazy.
-
-
- General Features of UCASM:
- --------------------------
- UCASM creates .HEX and/or .LST files from your .ASM source file. Al-
- though it is a two-pass assembler, the source file is read into memory
- only once. This is done for the sake of sheer, unadulterated, raw speed.
- Therefore you must have enough memory in your system to hold both the
- source code and the symbol table, plus hex and list output buffers. For
- all but the smallest systems, this should not be a problem. Note that
- UCASM makes no check for the size of available memory, it just eats up
- what it needs. As long as you have a full 64K of memory and you don't
- get crazy with comments in your source file, this should not be a prob-
- lem.
-
- There is not a typical parser in UCASM. Input lines are parsed "on
- the fly". This was not done because it seemed like a good idea, but
- simply because it was easier to implement. Someone may wish to add a
- real parser. Some more or less obvious advantages would result. Good
- luck if you want to attempt this.
-
-
- The Good Stuff:
- ---------------
- To invoke the assembler, type:
-
- UCASM filename<.typ> <hl>
-
- at the CP/M prompt. If no file type for the source file is specified,
- .Z80 is assumed. If no options are specified, no output file will be
- created; the assembler will just assemble the source code and report any
- errors on the console. The option 'H' will cause a .HEX output file to
- be created, and the option 'L' will cause the creation of a listing file.
- The output files will have the same filename as the source file, but with
- the extensions .HEX and .LST respectively.
-
- Valid pseudo-ops are EQU, ORG, DEFB, DEFW, and DEFS. These are the
- minimum that any assembler needs. Actually, DEFS isn't really needed.
- If there is enough interest, future releases may contain LIST, NOLIST,
- PHASE, DEPHASE, and any others that might be suggested. As mentioned
- above, EJECT (PAGE) and END are intentionally not present.
-
- Valid expression operators are addition (+), subtraction (-), multi-
- plication (*), division (/), logical and (&), logical or (%), exclusive
- or (!), shift left (<), shift right (>), and control character defini-
- tion (^). More may be added in future releases. Expression evaluation
- is strictly left to right. Parentheses will not only not give you what
- you expect, they will cause termination of the expression evaluation.
- Here is obvious room for improvement. Source code (but not comments)
- must be in upper case.
-
-
- Things That Go Bump in the Night:
- ---------------------------------
- o Labels, mnemonic names, and pseudo-ops are currently limited to six
- valid characters. This may change in future releases. As of
- version 1.2, labels will be truncated to six characters when
- they are defined. However, reference to that label elsewhere
- will always cause an undefined operand error. Labels must con-
- sist of alphanumeric characters only (A-Z, 0-9).
- o An exceptionally long source file with gobs of labels might cause
- UCASM to eat up critical parts of the operating system. Checks
- to prevent this may be put in future releases, but then again
- may not. What kind of micro-controller program are you assem-
- bling that requires such a long source file?
- o Not all operands are fully checked for validity. As an example, the
- EN opcode has only two valid operands, I and TCNTI. Only the
- first character of these operands is checked. Therefore EN IDIOT
- will be correctly assembled as if it were EN I with no visible
- error. I assume you know what you're doing.
- o Fields in the input line are defined by tabs or spaces. Lines with-
- out labels must start with a space or a tab, otherwise the as-
- sembler will define your mnemonic as if it were a label with
- predictable and disastrous results. Operands may be separated
- from their opcodes by a space instead of a tab. I think the
- source code looks prettier if the operand is in a separate col-
- umn, but there is no valid reason why it must be. Suit yourself.
- o I assume nothing about your printer. Tabs in the source code will
- be expanded with spaces in the listing file. If your operating
- system is capable of skipping over the perforations on your
- printer, then set the page length defaults to zero, otherwise
- line feeds will be inserted in the output stream to simulate a
- form feed at the end of a page. Line widths are truncated at 80
- characters.
- o No headers are put in the listing file. I think that this practice
- is a result of the ego of the programmer and/or company market-
- ing the assembler. I personally detest it and usually write
- printing utilities (filters) to remove this junk from the list-^
- ing file as it's being printed.
- o While the source file is read only once and kept in memory to speed
- execution of the program, the output files are not buffered but
- are written to disk as each record (128 bytes) is available.
- This is a good idea as far as the listing file is concerned,
- since to do otherwise would effectively more than double the
- memory requirements. The hex output data could however be kept
- in memory until the entire file is assembled and only then writ-
- ten out to disk. This would up the throughput and would not
- need all that much more memory. A suggestion to those who would
- like to add to the effort.
- o The DEFW pseudo-op will currently allow only one operand. Hopefully
- this limitation will be removed in the next release. This
- 'drawback' also applies to the DEFS pseudo-op. The DEFB pseudo-
- op should be used in place of DEFM (which doesn't exist), as in
- DEFB 'Hi there'. Multiple operands are allowed with DEFB
- (example: DEFB 12, 'test', 84H).
-
-
- Summary:
- --------
- Pseudo-ops are: EQU as in LABEL: EQU 123
- ORG as in ORG 100H
- DEFB or DB as in DEFB 'A'+1
- DEFW or DW as in DEFW STACK*2
- DEFS or DS as in DEFS LENGTH & 0FFH
-
- Expression operators are:
- + addition - subtraction
- * multiplication / divison
- & logical and % logical or
- ! exclusive or < shift left
- > shift right ^ control character
-
- The control character operator can be used with EQU or DEFB as in
- NTRLC EQU ^C (equivalent to CNTRLC EQU 3).
-
- Note that operators and values may or may not be separated from each
- other by spaces. A way around the strict left to right evaluation of
- expressions is to use something like:
-
- TEMP: EQU THAT/2
- VAL: EQU THIS+TEMP
-
- to get the equivalent of VAL: EQU THIS+(THAT/2)
-
- Please direct any comments, complaints, suggestions, additions,
- deletions, changes, or diatribes of any kind to me at the address given
- above. Useful alterations will be included in future updates, polite
- questions will be answered as promptly as possible, and abusive or
- obnoxious suggestions will produce a good laugh but will otherwise be
- ignored. Above all, do not bug your BBS sysop about this software.
-
- - Jeffery L. Post
-