klotz@aicchi.UUCP (Klotzbach) (08/30/85)
# This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # makefile asm80.doc echo x - makefile cat | sed -e "s/^X//" > "makefile" << '//E*O*F makefile//' X# X# @(#)makefile 1.1 X# Xasm80: asmain.o as81.o as82.o as83.o as85.o X cc asmain.o as81.o as82.o as83.o as85.o -o asm80 Xasmain.o: asm.h Xas81.o: asm.h Xas82.o: asm.h Xas83.o: asm.h Xas85.o: asm.h //E*O*F makefile// echo x - asm80.doc cat | sed -e "s/^X//" > "asm80.doc" << '//E*O*F asm80.doc//' X X X X X X X X X X X X X X X X X ASM80 ASM80 ASM80 ASM80 X X A Cross Assembler A Cross Assembler A Cross Assembler A Cross Assembler X X for the Intel 8080-8085 X X With CPM[tm] syntax X - by - X X David A. Klotzbach X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X Introduction Introduction Introduction Introduction X X X X X X ASM80 is a two pass assembler for the Intel 8080 and the ASM80 ASM80 ASM80 X 8085. The input syntax is, in general, similar in style to X the CPM[tm] assembler. It is also possible to use the CPM[tm] CPM[tm] CPM[tm] X assembler for the z80 since it is object code compatible z80 z80 z80 X with the i8080 i8080 i8080 i8080 X X X X X X CP/M is a registered trademark of Digital Research Inc. CP/M CP/M CP/M X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X ASM80 User Manual X X X The Cross Assembler The Cross Assembler The Cross Assembler The Cross Assembler X X X X X X X X Usage Usage Usage Usage X X X asm80 is invoked from as follows: asm80 asm80 asm80 X X asm80 [-n] [-l] file [file ...] asm80 [-n] [-l] file [file ...] asm80 [-n] [-l] file [file ...] asm80 [-n] [-l] file [file ...] X X The specified files are assembled separately and the X object code is placed in a file (in the same directory) X having the same name as the source file but with a X filetype of HEX. The default filetype for source files X is ASM. File type must not be specified. X X The optional -n argument causes the assembler to X produce no object file. This option is primarily used X to prevent creating a lot of useless object files when X debugging the assembler; however, it may be of use when X one wishes to simply check a file for errors. X X The optional -l argument causes the assembler to create X a listing file of name <file>.LST. X X The object file is in standard CP/M HEX format. The X title of the object file is always set to the first six X characters of the source file name. X X X Lexical Convention Lexical Convention Lexical Convention Lexical Convention X X X Assembler tokens consist of identifiers ('symbols', X 'names','labels') , constants and operators. X X X Identifier Identifier Identifier Identifier X X X An identifier consists of a sequence of alphanumeric X characters (including the period '.' and the question X mark '?') the first of which may not be numeric. Only X the first nine characters of the name are significant; X the rest are discarded. Upper and lower case are X treated as the same. X X X - 3 - X X X ASM80 User Manual X X X Constants Constants Constants Constants X X X All numeric constants, octal, binary, hex or decimal, X must start with a a digit 0 through 9. A HEX constant X is a sequence of digits and the alpha characters A, B, X C, D, E, and F. The number is truncated to 16 bits and X interpreted in twos complement notation. If the base X type symbol is omitted the base is taken to be decimal. X The magnitude of the constant should be representable X in 15 bits; i.e., be less than 32,768. X X X b = Binary b = Binary b = Binary b = Binary X o,q = octal o,q = octal o,q = octal o,q = octal X d = decimal d = decimal d = decimal d = decimal X H = hexidecimal H = hexidecimal H = hexidecimal H = hexidecimal X X X A single character constant consists of the single A single character constant consists of the single A single character constant consists of the single A single character constant consists of the single X quote (') follo any ASCII character (except the quote (') follo quote (') follo quote (') follo X newline) and terminated with another ('). The X constant's value is the code for the character right X justified in the word, with zeros on the left. X X X Blanks and Tabs Blanks and Tabs Blanks and Tabs Blanks and Tabs X X X Blanks and tabs may be used freely between tokens, but X may not appear within identifiers. A blank or a tab is X required to separate adjacent tokens not otherwise X separated. X X X Comments Comments Comments Comments X X X The character ';' introduces a comment, which continues X until the end of line. Comments are ignored by the X assembler. X X X The Location Counter The Location Counter The Location Counter The Location Counter X X X The special symbol '$' is the location counter. Its X value is the offset into the current programme section X of the start of the statement in which it appears. X X X X X - 4 - X X X ASM80 User Manual X X X Statements Statements Statements Statements X X X A program consists of a sequence of newline separated X statements. There are three kinds of statements; null X statements, assignment statements and keyword X statements. X X Any statement may be preceeded by any number of labels. X X X Labels Labels Labels Labels X X X A name label consists of an identifier followed by a X colon (':'). The value of the label is set to that of X the location counter. It is an error for the value of a X label to change between pass 1 and pass2. X X X Null Statements Null Statements Null Statements Null Statements X X X A null statement is just an empty line (which may have X labels and be followed by a comment). Null statements X are ignored by the assembler. Common examples of null X statements are empty lines or lines consisting of only X a label. X X X Assignment Statements Assignment Statements Assignment Statements Assignment Statements X X X An assignment statement consists of an identifier X followed by the 'EQU' or 'SET' and an expression. The X value of the identifier is set to that of the X expression. Any symbol defined by an 'EQU' statement X may be redefined, either by another assignment X statement or by a label. X X X Keyword Statements Keyword Statements Keyword Statements Keyword Statements X X X Keyword statements are the most common type; all of the X machine operations and assembler pseudo operations are X of this type. A keyword statement begins with one of X the assembler's predefined keywords, followed by any X operands required by that keyword. All of the keywords X and their required operands are described in the X appendix A and B. X X X - 5 - X X X ASM80 User Manual X X X X X Expressions Expressions Expressions Expressions X X X An expression is a sequence of symbols representing a X value. Expressions are made up of identifiers, X constants, operators and parentheses. All binary X operators have equal precidence and are executed in a X strict left to right order (unless altered by X parentheses). X X X Types Types Types Types X X X Every expression has a type determined by its operands. X The types that will be met explicitly are: X Undefined Undefined Undefined Undefined X Upon first encounter, each symbol is X undefined. A symbol may also become undefined X if it is assigned to an undefined expression. X It is an error to assemble an undefined X expression in pass 2. Pass 1 allows assembly X of undefined expressions, but phase errors X may result if undefined expressions are used X in certain contexts (i.e., in a ds). X Absolute Absolute Absolute Absolute X An absolute symbol is one defined untimately X from a constant or from the difference of two X relocatable values. X X X Operators Operators Operators Operators X X X The operators are: X X '+' Addition X '-' Subtraction X '*' Multiplication X '^' - XOR Exclusive or X '%' - MOD Modulo X '&' - AND Bitwise AND X '|' - OR Bitwise OR X '-' Unary negation X '!' - NOT Unary ones complement X '<' - SHL Shift left X '>' - SHR Shift right X X Expressions may be grouped by means of parentheses ( X X X - 6 - X X X ASM80 User Manual X X X and ). X X X X db expression [ , expression ] ... db expression [ , expression ] ... db expression [ , expression ] ... db expression [ , expression ] ... X X X X The expressions in the comma separated list are X truncated to 8 bits and are assembled into successive X bytes. The expressions must be absolute. Strings are X also supported by this construct. X X X X dw expression [ , expression ] ... dw expression [ , expression ] ... dw expression [ , expression ] ... dw expression [ , expression ] ... X X X X The expressions in the comma separated list are X assembled into successive byte pairs, high byte first. X X X X ds expression ds expression ds expression ds expression X X X X This statement assembles into expression null bytes. X The expression must be absolute. X X X X title s title s title s title s X X X X This statement allows the programmer to change the X title line on the top of each listing page. Only the X first 20 characters in the string are considered. The X rest of the line is ignored. X X X ORG expression ORG expression ORG expression ORG expression X X X The program counter is set equal to the value X expression. It is not considered good form to set the X porgram counter to a value less than the current one. X There is no limit to the number of times this statement X is used in a program. X X X - 7 - X X X ASM80 User Manual X X X X X END expression END expression END expression END expression X X X This directive informs the assembler of the entry point X into the program. X X X Error messages Error messages Error messages Error messages X X X Syntactic or semantic errors in the source are reported X by displaying the offending line on the console < your console < your console < your console < your X terminal> , preceeded by the appropriate error flag. terminal> terminal> terminal> X X X X a Addressing X b Branching out of range X c Constant expression X e General error in expression X m Multiply defined symbol X n Error in number X o Unknown opcode X p Phasing / Port select X q Questionable syntax X t Byte truncation X u Undefined X z Code tabel overflow X ' Character constant X . Illegal use of DOT X ( Parentheses inbalance X X X X Errors encountered in the accessing of files or in X internal assembler operations are reported in english X on the console. X X X Shortcomings and Caveats Shortcomings and Caveats Shortcomings and Caveats Shortcomings and Caveats X X X X The assembler has some limitations. Some of the more X important ones are listed below, and are classified as X H (hard to fix), L (likely to remain), F (fixable, and X likely to be fixed) and G (go away). X X L No macro facilities X X X - 8 - X X X 8080 Instruction Summary X X X Instruction Summary Instruction Summary Instruction Summary Instruction Summary X X X X X X X X X X X X X X Psuedo Operations Psuedo Operations Psuedo Operations Psuedo Operations X X X X X X The following are extentions to the instructions set: X X X 1) ORG expression 1) 1) 1) X 2) dw expression,expression,... , expression 2) 2) 2) X 3) db expression,expression,... , expression 3) 3) 3) X 4) ds expression 4) 4) 4) X 5) END expression 5) 5) 5) X 6) TITLE string 6) 6) 6) X X X X X X X X X X X X X X X X X X X X X X X X X - B.9 - X //E*O*F asm80.doc// exit 0