Path: utzoo!utgpu!cs.utexas.edu!uunet!pilchuck!ssc!markz From: markz@ssc.UUCP (Mark Zenier) Newsgroups: alt.sources Subject: Frankenstein Cross Assemblers, Base source, Part 1 of 3 Keywords: microcomputer cross assemblers Message-ID: <592@ssc.UUCP> Date: 4 Dec 90 07:46:53 GMT Organization: SSC, Inc., Seattle, WA Lines: 1707 Archive-name: Frankasm/Base01 Submitted-by: markz@ssc.uucp Here is a hobby grade cross assembler for Unix and Dos for a number of microprocessors. The various flavors of assember are determined by which Yacc input file is used. 13 sets of "Flavor" files will follow 1805, 2650, 6301, 6502, 6805, 6809, 6811, tms7000, 8048, 8051, 8096, z8 and z80 No macros, relocatable linkers, fancy print controls or structured control statments. But its a start. Mark Zenier markz@ssc.uucp ---- Cut Here and feed the following to sh ---- #!/bin/sh # This is Frankasm/Base, a shell archive (shar 3.43) # made 12/04/1990 06:57 UTC by markz@ssc.uucp # Source directory /usr/mark/frank.shar # # existing files will NOT be overwritten unless -c is specified # This format requires very little intelligence at unshar time. # "if test", "echo", "true", and "sed" may be needed. # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 2536 -r--r----- Makefile # 780 -r--r--r-- ascii.chd # 34184 -r--r--r-- base.doc # 30 -r--r--r-- cleanup.bat # 4440 -r--r--r-- devnote # 3545 -r--r--r-- filelist # 1354 -r--r----- fraebin.h # 571 -r--r----- fraeuni.h # 1446 -r--r----- fragcon.h # 14325 -r--r----- fraosub.c # 21010 -r--r----- frapsub.c # 7915 -r--r----- frasmain.c # 3145 -r--r----- frasmdat.h # 28586 -r--r----- fryylex.c # 2542 -r--r----- getopt.h # 2145 -r--r--r-- makefile.dos # 58 -r--r--r-- makeone.bat # # ============= Makefile ============== if test -f 'Makefile' -a X"$1" != X"-c"; then echo 'x - skipping Makefile (File already exists)' else echo 'x - extracting Makefile (Text)' sed 's/^X//' << 'SHAR_EOF' > 'Makefile' && X# HEADER: ; X# TITLE: Frankenstein Cross Assemblers; X# VERSION: 2.0; X# SYSTEM: Unix (microport system V/AT); X# FILENAME: Makefile ; X# DESCRIPTION: "Reconfigurable Cross-assembler producing Intel (TM) X# Hex format object records. "; X# KEYWORDS: cross-assemblers, 1805, 2650, 6301, 6502, 6805, 6809, X# 6811, tms7000, 8048, 8051, 8096, z8, z80; X# WARNINGS: "This software is in the public domain. X# Any prior copyright claims are relinquished. X# X# This software is distributed with no warranty whatever. X# The author takes no responsibility for the consequences X# of its use. X# X# Yacc (or Bison) required to compile." ; X# AUTHORS: Mark Zenier; X# COMPILERS: Microport System V/AT; X# X# usage X# make somename TARGET=somename X# make newmachine clean out machine dependent *.o X# make clean clean out for release disk X# X# Conditional Compilation Flags X# X# DOSTMP use the current directory for temporary intermediate X# file X# NOGETOPT use the getopt.h file X# USEINDEX redefine the strchr() library function to use X# the older equivalent name index() X# NOSTRING use internal definitions if the include X# file does not exist X# X X XTARGET = frasm XPRINTSPOOL = lpr X X# LEXERDEBUG = -DDEBUG=1 XLEXERDEBUG = X X# for microport and xenix XCFLAGS = -Ml -g XYACCLEXLIB = -ly XMAINNEEDS = XMAINDEPENDS = X X# for dos cross compiled on xenix X# CFLAGS = -dos -Ml X# YACCLEXLIB = X# MAINNEEDS = -DNOGETOPT -DDOSTMP X# MAINDEPENDS = getopt.h X X# for v7 X# CFLAGS = -DUSEINDEX -DNOSTRING X# YACCLEXLIB = -ly X# MAINNEEDS = -DNOGETOPT X# MAINDEPENDS = getopt.h X Xclean : X rm -f *.o fraytok.h X rm -f y.tab.[ch] X rm -f as*.c as*.h as*.o X Xnewmachine : X rm -f fraytok.h X rm -f fryylex.o X rm -f $(TARGET).c $(TARGET).h $(TARGET).o X X$(TARGET) : frasmain.o frapsub.o fryylex.o $(TARGET).o fraosub.o X cc $(CFLAGS) -o $(TARGET) frasmain.o frapsub.o \ X fraosub.o fryylex.o $(TARGET).o $(YACCLEXLIB) X rm -f fraytok.h X Xfrasmain.o : frasmain.c frasmdat.h $(MAINDEPENDS) X cc $(CFLAGS) $(MAINNEEDS) -c frasmain.c X X$(TARGET).c $(TARGET).h : $(TARGET).y X yacc -d $(TARGET).y X mv y.tab.c $(TARGET).c X mv y.tab.h $(TARGET).h X rm -f fraytok.h X Xfraytok.h : $(TARGET).h X cp $(TARGET).h fraytok.h X X$(TARGET).o : $(TARGET).c frasmdat.h fragcon.h X cc $(CFLAGS) -c $(TARGET).c X Xfrapsub.o : frapsub.c fragcon.h frasmdat.h fraeuni.h fraebin.h X cc $(CFLAGS) -c frapsub.c X Xfraosub.o : fraosub.c frasmdat.h fragcon.h fraeuni.h fraebin.h X cc $(CFLAGS) -c fraosub.c X Xfryylex.o : fryylex.c frasmdat.h fraytok.h X cc $(CFLAGS) $(LEXERDEBUG) -c fryylex.c X SHAR_EOF true || echo 'restore of Makefile failed' fi # ============= ascii.chd ============== if test -f 'ascii.chd' -a X"$1" != X"-c"; then echo 'x - skipping ascii.chd (File already exists)' else echo 'x - extracting ascii.chd (Text)' sed 's/^X//' << 'SHAR_EOF' > 'ascii.chd' && Xascii charset X chardef " !\"#$%&\'",$20,$21,$22,$23,$24,$25,$26,$27 X chardef "()*+,-./",$28,$29,$2a,$2b,$2c,$2d,$2e,$2f X chardef "01234567",$30,$31,$32,$33,$34,$35,$36,$37 X chardef "89:;<=>?",$38,$39,$3a,$3b,$3c,$3d,$3e,$3f X chardef "@ABCDEFG",$40,$41,$42,$43,$44,$45,$46,$47 X chardef "HIJKLMNO",$48,$49,$4a,$4b,$4c,$4d,$4e,$4f X chardef "PQRSTUVW",$50,$51,$52,$53,$54,$55,$56,$57 X chardef "XYZ[\\]^_",$58,$59,$5a,$5b,$5c,$5d,$5e,$5f X chardef "`abcdefg",$60,$61,$62,$63,$64,$65,$66,$67 X chardef "hijklmno",$68,$69,$6a,$6b,$6c,$6d,$6e,$6f X chardef "pqrstuvw",$70,$71,$72,$73,$74,$75,$76,$77 X chardef "xyz{|}~",$78,$79,$7a,$7b,$7c,$7d,$7e X chardef '"', $22 ; not the same table entry as '\"' X chardef "'", $27 ; X chardef "\n\t\v\b\r\f\a", $0a,$09,$0b,$08,$0d,$0c,$07 X charuse ascii SHAR_EOF true || echo 'restore of ascii.chd failed' fi # ============= base.doc ============== if test -f 'base.doc' -a X"$1" != X"-c"; then echo 'x - skipping base.doc (File already exists)' else echo 'x - extracting base.doc (Text)' sed 's/^X//' << 'SHAR_EOF' > 'base.doc' && X.TL XFrankenstein Cross Assemblers Users Manual X.AU "Mark Zenier" X.AF X.MT 4 X.H 1 "Disclaimer" XThis software is in the public domain. Any prior copyright claims Xare relinquished. X.P XThis software is distributed with no warranty whatever. The author Xtakes no responsibility for the consequences of its use. X.H 1 "Introduction" X.H 2 "This Manual" XThis manual covers the basic features for the Frankenstein cross assemblers. XThe specific features for a given target architecture will be covered Xin the appendix for that cross-assembler. X.H 2 "Notation" XItems enclosed in [] are optional. The "[]" are not entered in the Xsource statement or command line, and are just a notation. X.H 1 "Invocation" Xname [-o binary] [-l listing] [-s symbols] [-d] input X.P XThe optional operands on the command line can be in any order. X.H 2 "Input File" XThe input file must appear after the optional entries on the command line. XOnly one input file is used with this version. XIf the file name is a single minus sign, the standard input is used. X.H 2 "Listing File" X.DS I N X-l filename X.DE X.P XAn annotated listing will only be produced if an optional list file is Xprovided, otherwise the error messages and summary will be output to the Xconsole. XThere is no required suffix or default extension for the file name. X.H 2 "Hex Output File" X.DS I N X-h filename or X-o filename X.DE X.P XThe binary output will only be produced if the optional file is provided. XSee the section in the description of the output files for the format Xof the data records. XIf any errors occur, the hex output file is either not created Xor is deleted depending on whether the error occurred in the Xinput or output phases of processing. XThere is no required suffix or default extension for the file name. X.H 2 "Symbol Listing File" X.DS I N X-s filename X.DE X.P XThe symbol table is dumped with one entry per line for whatever use is Xdesired, normally with the sort utility to produce symbol listings in Xa different order that the one provided. XSee the section on the output files for a description of the format. XThere is no required suffix or default extension for the file name. X.H 2 "Debug" X.SP XThe -d debug option X.DL X.LI XSaves the intermediate file in the /usr/tmp directory X.LI XCalls the abort() system call to produce a "core" file X.LE X.H 2 "Processor Selection" X.DS I N Xassembler name or X-p string X.DE X.P XSome of these assemblers support related families of processors, and Xcan be limited to specific subsets of the total instructions by sending Xthe processor number or name as an operand. The operand is scanned for Xunique substrings which identify the target processor. XThe operand can be either the name of the executable, or the operand Xof the -p option, with the operand of the -p having precedence. XThe name of the executable may not available in some operating systems. XThe CPU pseudo-operation has precedence over both the name scan and Xthe -p operand [see the appendix for the specific processor]. X.DS I N XExample X.SP Xa6800 for the mc6800 instruction set Xa6801 for the 6801/6803 instruction set Xa6811 for the mc68hc11 instruction set X.DE X.H 1 "Source Input File" XThe source input is a text file a with one statement per line. XAdjacent symbols must be separated by spaces or tabs or special characters Xsuch as operators or parenthesis. X.H 2 "Input Lines" X.SP XSource lines consist of up to four parts X.DS I N X[Label] [Opcode [Operands] ] [; comments] X.DE X.VL +10 X.LI Labels XA symbol that starts in the first column of the line is a Xlabel. XA label is used as the defining instance of a symbol, the place Xwhere it is given a value, normally the address of the location Xin memory where the data generated by the rest of the statement is placed. XLabels are optional for target machine instructions statements. XLabel are required on some pseudo-operations, and are not allowed on others. X.LI Opcode XThe first symbol in a line that doesn't start in Xcolumn 1 is treated as an opcode, all symbols after that are Xtreated as symbol references. XOpcodes are treated as a separate set of symbols, so a label Xcan have the same character string as an opcode. XOpcodes are converted to uppercase for comparison, so case is not Xsignificant. X.LI Operands XThe rest of the line is the operands associated with the opcode. XThese are expressions, symbol references, or other syntactic elements Xdetermined by the specific operation. X.LI Comments XComments start with a ';', anything on a line after a Xsemicolon is ignored. XLines that consist of only a comment are treated as empty lines. X.LE X.DS I N XExample X X; just a little example X org $700 Xlabel equ * ; set label to current location X adda #$21 ; a 6800 example X end X.DE X.H 3 "Limitations" XInput lines should be shorter than 256 characters. XAn error message is issued if lines are longer. X.H 3 "Empty" XEmpty lines are ignored as input, but are copied to the listing Xfile. X.H 2 "Syntactic Elements" X.H 3 "Symbols" XSymbols are strings of characters. The first of which is one of Xthe following. X.DS I N XA-Z a-z ! & ^ _ ~ X.DE X.P XThe rest of the string consists of zero or more of the Xfollowing. X.DS I N X0-9 A-Z a-z ! & ^ _ ~ X.DE X.P XThere is no length limit to symbols, all characters are Xsignificant. Case is significant. X.H 3 "Reserved Variables Names" XMachine specific names, and operator names that can appear in Xsymbolic expressions share the same symbol table with labels, Xand cannot be used as labels. The list will vary from machine Xto machine. Case is significant for these symbols. X.DS I F XExamples X.SP Xand defined eq ge gt high le low lt mod ne Xnot or shl shr xor AND DEFINED EQ GE GT HIGH XLE LOW LT MOD NE NOT OR SHL SHR XOR X.DE X.H 3 "Numeric Constants" Xnumeric constants can be specified in decimal, hexadecimal, Xoctal, and binary. Constants are maintained as long Xvariables, but the instruction generation will cause an error Xif the value is too big to fit in its destination field. X.H 4 "Decimal Constants" X.DL X.LI Xone or more decimal characters (0-9) followed by an Xoptional "d" or "D" base designator. X.LE X.H 4 "Hexadecimal Constants" X X.P 1 XEither X.DL X.LI Xone or more hexadecimal characters X(0-9 a-f A-F) preceded by a "$" base designator. X.LI Xa decimal character (0-9) followed by zero or Xmore hexadecimal characters (0-9 a-f A-F) Xfollowed by a "h" or "H" base designator X.LE X.H 4 "Octal Constants" X X.P 1 XEither X.DL X.LI Xone or more octal characters (0-7) preceded Xby a "@" base designator X.LI Xone or more octal characters (0-7) followed Xby a "o" or "O" or "q" or "Q" base designator. XNote: this is the letter "O" not the number "0". X.LE X.H 4 "Binary Constants" X X.P 1 XEither X.DL X.LI Xone or more binary characters (0 or 1) preceded Xby a "%" base designator. X.LI Xone or more binary characters (0 or 1) followed Xby a "b" or "B" base designator. X.LE X.H 4 "Examples" X.VL +15 +5 1 X.LI 123 Xdecimal number X.LI 123d Xdecimal number X.LI $faf Xhexadecimal number X.LI 0fafh Xhexadecimal number, note leading zero used to differentiate this from symbol X"fafh" X.LI @1234 Xoctal number X.LI 1234Q Xoctal number X.LI %010101 Xbinary number X.LI 010101b Xbinary number X.LE X.H 3 "String Constants" XString constants are specified using either the quotation mark X" or the apostrophe '. A string starting with one of these Xcharacter is terminated by only that character and can contain Xthe other string delimiter as data. XA string with no characters is valid. X.P XThe values generated in the binary output can be different from Xthe host computers character set (the default). XSee the section on Defining Target Character Sets. X.P XWithin the character string, the backslash is an escape character. X.VL +20 +5 1 X.LI " \ec Character escapes" X.LI "\ " XThe only characters defined for Xthe default (no) translation are \e\e \e" \e\'. XAny other translation, (the control characters '\en', '\er', etc.) require Xa translation table be defined. XValues can be set up for any character following the backslash escape Xexcept x and 0 through 7. X.SP X.LI " \e777 Octal character escapes" X.LI "\ " XAn one, two or three character octal constant. The one byte value Xis the binary representation of the number. XThe value is masked off for a maximum value of 255. X.SP X.LI " \exFF Hexadecimal character escapes" X.LI "\ " XA one or two character hexadecimal constant, preceded by a lower Xcase x. Upper and lower case characters A through F are valid. XThe one byte value is the binary representation of the number. X.SP X.LE X.DS I N XExamples X.SP X "this isn't illegal" X 'this is the other delimiter' X '"' X "\exfe\e0\en" X.DE X.H 2 "Expressions" X.SP XExpressions consist of X.DL "" 1 X.LI XSymbolic References X.LI XLocation Counter References X.LI XNumeric Constants X.LI XString Constants X.LI XOperators X.LE X.P XExpressions are used as operands in statements where any numeric value or Xmemory address is desired. X.H 3 "Symbols" XA symbol reference is the name of an item in the symbol table, which Xhas a numeric value associated with it. XThis value is either the memory address of the statement which has this Xsymbol as a label, or the value of the expression defined in a SET or EQU Xstatement which has this symbol as a label. X.H 4 "Forward References" XDuring the input phase of processing, a symbol value may not be known if the Xdefinition of the symbol has not yet occurred. XSome pseudo-operations require that their operand expressions have a value Xat the input phase, so no references to as yet undefined symbols can occur Xin this case. XIn the output phase of processing, it will result in an error if any of the Xsymbols used in expressions do not have values defined. X.H 4 "Reserved Symbols for Operators" XUsing reserved symbols as labels will result in a syntax error as they Xare predefined as a different type of syntactic element than the rest Xof the symbol table. XOperators for which there is no special character representation, and items Xlike machine register names and condition code types will be represented by Xreserved symbols. XThe set of the reserved symbols will vary for Xeach target machine, and will be documented in the appendix for each target. X.H 3 "Location Counter" XThe special name '*' used in an expression represents the location of the Xfirst byte of the binary output for the current statement. XSome assemblers use some other character for source code compatiblity. X.H 3 "Constants" XThe form of numeric constants is defined in the previous section. X.H 3 "Strings" XString constants, as defined in the previous section, are valid in Xexpressions. XHowever, at most the first two characters are used. XIf the string is the null string, i.e. "", the numeric value is zero. XIf the string is one character long, the value is the value of Xthe current character set translation, or the host computers character Xset if no translation is active. XIf the string is two or more characters long, the value is X256*(the first character) + (the second character). X.H 3 "Operators" X.H 4 "Description" X.VL +20 +5 1 X.LI " '+' expression " X.LI "\ " XUnary plus. No real effect. X.SP X.LI " '-' expression" X.LI "\ " XUnary minus, the result is the negative of the expression. X.SP X.LI " NOT expression" X.LI "\ " XLogical negation. The result is 0 if the expression is nonzero, 1 if the Xexpression is 0. X.SP X.LI " HIGH expression" X.LI "\ " XResult is the High half of a two byte number, equivalent to X(expression SHR 8) AND $FF. X.SP X.LI " LOW expression" X.LI "\ " XResult is the Low order byte of the expression, equivalent to X(expression AND $FF) X.SP X.LI " expression '*' expression" X.LI " expression '/' expression" X.LI " expression '+' expression" X.LI " expression '-' expression" X.LI "\ " XStandard arithmetic operations. X.SP X.LI " expression MOD expression" X.LI "\ " XResult is the remainder of the division of the value of the left expression Xby the right. X.SP X.LI " expression SHL expression" X.LI " expression SHR expression" X.LI "\ " XShift the value of the left expression left or right by the number of bit Xpositions given by the right operation. X.SP X.LI " expression GT expression" X.LI " expression GE expression" X.LI " expression LT expression" X.LI " expression LE expression" X.LI " expression NE expression" X.LI " expression EQ expression" X.LI " expression '>' expression" X.LI " expression '>=' expression" X.LI " expression '<' expression" X.LI " expression '<=' expression" X.LI " expression '=' expression" X.LI " expression '<>' expression" X.LI "\ " XRelational expressions. XIf the relation is true, the value is 1. XIf false, the value is 0. XThe operators are nonassociative, the expression " 1 < 3 < 5 " is not legal. X.SP X.LI " expression AND expression" X.LI " expression OR expression" X.LI " expression XOR expression" X.LI "\ " XBitwise logical operations. X.SP X.LI " DEFINED symbol" X.LI "\ " XIf the symbol (not an expression) is defined, i.e. used as a label, before Xthis point in the input the value is 1. XIf not, the value is 0. X.SP X.LI " '(' expression ')'" X.LI "\ " XParenthesis are available to override the operator precedence. X.LE X.H 4 "Precedence" XThe precedence of the operators from lowest to highest. X.AL 1 "" 1 X.LI X HIGH LOW X.LI X OR XOR X.LI X AND X.LI X NOT X.LI X GT GE LE LT NE EQ '>' '>=' '<' '<=' '=' '<>' X.LI X '+' '-' X.LI X '*' '/' MOD SHL SHR X.LI X unary '+' '-' X.LI X ( expression ) X.LE X.H 1 "Statements" XThe names for the operations and pseudo-operations for each assembler are Xspecified in the adaptation files, Xand can be different from the examples given here. X.H 2 "Label Only Line" XA line with only a label starting in column 1 will define that symbol Xwith the current value of the location counter. X.H 2 "End" X.DS I N X[Label] END X.DE X.P XThe End statement terminates the processing of the current file. XFor an include file, the file is closed and input resumes in the Xfile that contained the include statement. XFor the main file, processing shifts to the following passes of the Xassembly. XThe end statement is optional, as the end of file condition is treated in the Xsame fashion. XIf the optional label is present, The symbol specified is used as the Xexecution start address that is output in the binary file. XThe symbol must be used as a label somewhere else in the file. XWhen more than one start address is specified, the last one in the file is Xused. X.H 2 "File Inclusion" X.DS I N XINCLUDE "filename" XINCL "filename" X.DE X.P XThe include statement shifts input from the current file to the file Xspecified. XInput resumes from the file containing the include statement when Xthe end of file or the End statement is reached in the included file. XIncludes can be nested up to the limits of the include file stack, Xcurrently a limit of 20 deep, or the limits of the operating system, Xwhichever comes first. XIncludes can be recursive, i.e., a file can include itself. XIf a file cannot be opened, either do to an bad filename or a lack of Xsystem resources, an error is issued. X.H 2 "Conditional Assembly" X.H 3 "If" X.DS I N XIF expression X.DE X.P XThe IF statement allows selective assembly. XIf the expression evaluates to a nonzero value, all statements between the XIF and the matching ELSE or ENDI are assembled. XIf the expression evaluates to zero, or the expression in noncomputable due Xto a forward reference, all statements between the IF and the matching XELSE or ENDI are ignored. X.P XNote: it is safer to use the DEFINED operator when testing for the existence Xof a symbol than to rely on the noncomputability of an expression. X.P XIF statements can be nested to a depth determined by a configuration Xconstant, currently 32. XNo label is allowed on an IF statement. X.H 3 "Else" X.DS I N XELSE X.DE X.P XThe ELSE statement causes all statements between it and its corresponding XENDI statement to be treated the opposite of the statements between the Xmatching IF and this statement. XWhen the expression on the matching IF is nonzero, the statements between Xthe ELSE and ENDI are ignored. XIf the IF expression failed, the statements between the ELSE and the ENDI Xare assembled. XLabels are not allowed on ELSE statements. X.H 3 "End If" X.DS I N XENDI X.DE X.P XThe ENDI statement terminates processing of its matching IF statement. XLabels are not allowed on ENDI statements. X.H 2 "Symbolic Constants" XSymbols can be assigned numeric values with the SET and EQU statements. XThe expressions cannot have forward references to as yet undefined symbols. X.H 3 "Equate" X.DS I N XLabel EQU expression X.DE X.P XThe EQU statement takes the value of the expression and creates a symbol Xwith that value. XSymbols defined in EQU statements cannot already exist, or be redefined. X.H 3 "Set" X.DS I N XLabel SET expr X.DE X.P XThe SET statement sets the symbol specified in the label field with the Xnumeric value of the expression. XThe SET statement can change the value of a symbol, but only if the Xsymbol is originally defined in a previous SET statement. X.DS I N XExample X.SP Xcounter set 1 Xcounter set counter+1 Xcounter set counter+1 X.DE X.H 2 "Location Counter Value Setting" XThe address of the generated binary data can be changed with the ORG and Xreserve statements. X.H 3 "Org" X.DS I N X[Label] ORG expression X.DE X.P XThe location counter is set to the numeric value of expression. XIt is an error if the expression contains references to symbols not Xyet defined. XThe optional label is set to the new value of the location counter. X.H 3 "Reserve Memory" X.DS I N X[Label] RMB expression X[Label] RESERVE expression X.DE X.P XThe reserve memory statement moves the location counter forward by Xthe number of bytes specified in the expression. XThe label is set to the first location of this area. X.H 2 "Data Definitions" X.H 3 "Define Byte Data" X.DS I N X[Label] BYTE expression [, expression] ... X[Label] FCB expression [, expression] ... X[Label] DB expression [, expression] ... X.DE X.P XThe define byte statement generates one character of data for each Xexpression in the expression list. XThere can be up to 128 expressions on a line, more than the line length will Xallow. XThe optional label is set to the first location of this area. X.H 3 "Define Word Data" X.DS I N X[Label] WORD expression [, expression] ... X[Label] FDB expression [, expression] ... X[Label] DW expression [, expression] ... X.DE X.P XThe define word statement generates a two byte integer for each expression Xin the expression list. XThere can be up to 128 expressions on a line, more than the line length will Xallow. XThe byte order of the data is determined by the adaptation files for Xthe target processor. XThe optional label is set to the first location of this area. X.H 3 "Define String Data" X.DS I N X[Label] STRING string [, string] ... X[Label] FCC string [, string] ... X.DE X.P XThe define string statement generates data encoded in the current character Xset translation, Xone byte per character, excluding the delimiter characters. XThe optional label is set to the first location of this area. X.H 2 "Defining Target Character Sets" XThe values generated for String Constants in both the Define String XData and in expressions can be specified on a character by character Xbasis. This is to support cross assembly where the target system Xhas a different character set from the host computer. X.H 3 "Define Character Set Translation" X.DS I N X.DE XLabel CHARSET X.P XThe define character set translation statement defines a name and creates Xan internal table for a character set. XThe label symbol is treated like the label on an EQU statement. XThe value is from an internal counter and has little or no meaning Xoutside of using it on a CHARUSE statement to specify which translation Xto use. There can be up to 5 [configurable] character Xtranslation sets. XA CHARSET statement must precede any CHARDEF statements. X.H 3 "Define Character Value" X.DS I N XCHARDEF string, expression [, expression ] ... XCHD string, expression [, expression ] ... X.DE X.P XThe define character value statement set the translation for one Xor more characters in the table defined by the preceding CHARSET Xstatement. XThere can be more than one character in the string, but the Xnumber of expression in the value list must match the number Xof characters. XOctal and Hexadecimal escape sequences cannot occur in the string. X.P XThere are two sets in each translation table. XThe first is for the characters, the second for characters escaped with Xthe backslash. X.P XNote: the characters '"' and '\e"' (and "'" and "\e'") each have an entry in Xdifferent halves of the translation tables. X.H 3 "Use Character Translation" X.DS I N XCHARUSE XCHARUSE expression X.DE X.P XThe use character translation statement changes the translation for the Xfollowing statements. XThe statement without an expression turns off the translation, so Xthe host character set is used. XThe statement with an expression (the name given on the CHARSET statement) Xsets the translation to the set defined in the respective CHARSET. X.DS I N XExample X.SP Xascii charset X chardef " !\e"#$%&\e'",$20,$21,$22,$23,$24,$25,$26,$27 X chardef "()*+,-./",$28,$29,$2a,$2b,$2c,$2d,$2e,$2f X chardef "01234567",$30,$31,$32,$33,$34,$35,$36,$37 X chardef "89:;<=>?",$38,$39,$3a,$3b,$3c,$3d,$3e,$3f X chardef "@ABCDEFG",$40,$41,$42,$43,$44,$45,$46,$47 X chardef "HIJKLMNO",$48,$49,$4a,$4b,$4c,$4d,$4e,$4f X chardef "PQRSTUVW",$50,$51,$52,$53,$54,$55,$56,$57 X chardef "XYZ[\e\e]^_",$58,$59,$5a,$5b,$5c,$5d,$5e,$5f X chardef "`abcdefg",$60,$61,$62,$63,$64,$65,$66,$67 X chardef "hijklmno",$68,$69,$6a,$6b,$6c,$6d,$6e,$6f X chardef "pqrstuvw",$70,$71,$72,$73,$74,$75,$76,$77 X chardef "xyz{|}~",$78,$79,$7a,$7b,$7c,$7d,$7e X chardef '"', $22 ; not the same table entry as '\e"' X chardef "'", $27 ; X chardef "\en\et\ev\eb\er\ef\ea", $0a,$09,$0b,$08,$0d,$0c,$07 X charuse ascii X.DE X.H 2 "Machine Instructions" X.DS I N X[Label] opcode operands? X.DE X.P XMachine instructions generate the binary output by evaluating the expressions Xfor the operands, and matching the opcode with the entry in the instruction Xgeneration tables. X.P XIf the instruction has more than one format which is selected by the Xvalue of the operands, the selection criteria must able to be determined at Xthe input phase of processing. XFor example, in the mc6800 architecture direct address mode, any memory Xvariables that are have an address between 0 and 255 must be defined before Xany reference to these symbols. X.P XThe optional label is set to the first location of the generated instruction. X.H 1 "Output" X.H 2 "Program Generated Messages and Errors" X.H 3 "Messages" X.VL 10 5 1 X.LI "`` ERROR SUMMARY - ERRORS DETECTED {count}''" X.LI "`` - WARNINGS {count}''" X.LI "\ " Xoutput at the end of the listing and on the console. X.LE X.H 3 "System Errors" X.VL 10 5 1 X.LI "``cannot open hex output {filename}''" X.LI "\ " Xfile cannot be opened for output. The assembly continues Xas if the -[oh] option was not specified. X.SP X.LI "``cannot open input file {filename}''" X.LI "\ " Xfile cannot be opened for reading. Fatal error. X.SP X.LI "``cannot open list file {filename}''" X.LI "\ " Xfile cannot be opened for output. The assembly continues Xas if the -l option was not specified. X.SP X.LI "``cannot open symbol file {filename}''" X.LI "\ " Xfile cannot be opened for output. The assembly continues Xas if the -s option was not specified. X.SP X.LI "``cannot open temp file {filename}''" X.LI "\ " Xfile cannot be opened for input or output. Fatal error. X.SP X.LI "``no input file''" X.LI "\ " Xno input operand specified. Fatal error. X.SP X.LI "``no match on CPU type {string}, default used''" X.LI "\ " Xoperand for a -p option can't be matched. X.SP X.LI "``cannot allocate string storage''" X.LI "\ " XRequest to operating system for more memory failed. XFatal error. The string storage pool is where the Xcharacter representation of symbols and names for Xinclude files are stored. X.SP X.LI "``cannot allocate symbol space''" X.LI "\ " XRequest to operating system for more memory failed. XFatal error. The symbol table is full. The symbol Xspace is the set of arrays where the symbol values Xand other numeric information is stored. X.SP X.LI "``cannot redefine reserved symbol''" X.LI "\ " XError in defining reserved symbols. Two calls to X"reservedsym()" with the same character string value Xexist in the setup. Fatal error. Should not occur Xin a production executable. X.SP X.LI "``excessive number of subexpressions''" X.LI "\ " XThe first pass ran out of element storage for the expression Xparse tree. The expression is too complex. Internal error Xwhich should never occur. Fatal error. X.SP X.LI "``unable to allocate symbol index''" X.LI "\ " XRequest to operating system for more memory failed. XFatal error. The symbol table is full. The symbol index Xis used in the output pass to direct symbol references to Xthe symbol table entry. X.LE X.H 3 "Error" X.VL 10 5 1 X.LI "``ELSE with no matching if''" X.LI "``ENDI with no matching if''" X.LI "\ " Xmismatched if/else/endi results in an else/endi left over X.SP X.LI "``IF stack overflow''" X.LI "\ " Xmore than IFSTKDEPTH (32) nested if statements X.SP X.LI "``Overlength/Unterminated Line''" X.LI "\ " Xline longer than input buffer, or not terminated with newline Xcharacter. X.SP X.LI "``active IF at end of file''" X.LI "\ " Xmismatched if/else/endi results in an unclosed if X.SP X.LI "``cannot change symbol value with EQU''" X.LI "\ " Xsymbol is already defined. X.SP X.LI "``cannot change symbol value with SET''" X.LI "\ " Xsymbol is already defined, but not with a Set statement. X.SP X.LI "``cannot create character translation table''" X.LI "\ " Xthe internal table for a character translation set Xcannot be allocated due to lack of space, or Xmore translation sets than the assembler is Xconfigured for. X.SP X.LI "``cannot open include file''" X.LI "\ " XThe include file cannot be opened for reading, or not enough Xsystem resources are available to open the file. X.SP X.LI "``character already defined 'char' ''" X.LI "\ " Xthe character is already present in a previous CHARDEF Xstatement for this translation set. X.SP X.LI "``expression exceeds available field width''" X.LI "\ " XThe value of an expression is too large to fit into Xthe field of the instruction. Relative branch target Xis too far away. X.SP X.LI "``expression fails validity test''" X.LI "\ " XAn explicit test programmed in the generation string for the instruction Xfailed. XThese conditions are documented in the appendix for the specific instruction Xset. X.SP X.LI "``expression stack overflow''" X.LI "\ " XToo many level of parenthesis or complex expression Xwith operator precedence that results in the expression Xevaluation stack overflowing. X.SP X.LI "``include file nesting limit exceeded''" X.LI "\ " Xinclude files are nested to more than FILESTKDPTH (20) Xlevels deep. "cannot open include file" usually occurs first. X.SP X.LI "``invalid char in instruction generation''" X.LI "\ " XInternal error, instruction generation string is not Xdefined properly. Should not occur in a production executable. X.SP X.LI "``invalid character constant 'char' ''" X.LI "\ " XA character specification in a string constant isn't Xproperly formed. X.SP X.LI "``invalid character to define 'char' ''" X.LI "\ " Xa constant in the string in a CHARDEF statement is of a form X(octal, hex, or improperly formed) that does not have a Xtranslation table entry. X.SP X.LI "``invalid opcode''" X.LI "\ " XNo such string occurs in the opcode symbol table. Opcode Xstrings are converted to uppercase before comparison, and Xtherefore are case insensitive. X.SP X.LI "``invalid operands''" X.LI "``invalid operands/illegal instruction for cpu''" X.LI "\ " Xstatement has a valid opcode, with the correct syntax, but Xno code generation can be found in the table for these operands X.SP X.LI "``invalid syntax for instruction''" X.LI "\ " Xopcode is valid, but not for this syntax form X.SP X.LI "``more characters than expressions''" X.LI "``more expressions than characters''" X.LI "\ " XA mismatch between the string constant and the number of expressions Xin a CHARDEF statement. X.SP X.LI "``multiple definition of label''" X.LI "\ " Xlabel symbol is already defined. X.SP X.LI "``no CHARSET statement active''" X.LI "\ " Xa CHARDEF statement occurs before any CHARSET statement. X.SP X.LI "``noncomputable expression for EQU''" X.LI "``noncomputable expression for ORG''" X.LI "``noncomputable expression for SET''" X.LI "``noncomputable result for RMB expression''" X.LI "\ " Xexpression contains reference to symbols that have not Xyet been defined, and thus has no numeric value. X.SP X.LI "``nonexistent character translation table''" X.LI "\ " Xexpression in a CHARUSE statement does not Xcorrespond to any CHARSET statements label. X.SP X.LI "``overflow in instruction generation''" X.LI "``overflow in polish expression conversion''" X.LI "\ " XThe intermediate file line being built exceeds the length Xof the buffer. The expression is too complex. X.SP X.LI "``syntax error at/before character ^{character}''" X.LI "``syntax error at/before character {character}''" X.LI "``syntax error at/before token {symbol/constant}''" X.LI "``syntax error at invalid token {constant/string} ''" X.LI "``syntax error at/before string {string} ''" X.LI "``syntax error at/before End of Line''" X.LI "``syntax error at/before {relational op}''" X.LI "``syntax error at/before Undeterminable Symbol''" X.LI "``syntax error - undetermined yyerror type''" X.LI "\ " Xstatement is in a form that the first pass parser cannot Xrecognize. The next syntactic element is inappropriate for Xwhatever language element the parser is working on. X.SP X.LI "``error or premature end of intermediate file''" X.LI "``syntax error - cannot backup''" X.LI "``unimplemented width''" X.LI "``unknown intermediate file command''" X.LI "``yacc stack overflow''" X.LI "\ " XInternal errors, should not occur. X.SP X.LI "``undefined character value 'char' ''" X.LI "\ " XA string constant contains a character not defined in Xa CHARDEF statement for the current character translation. X.SP X.LI "``undefined symbol {symbolname}''" X.LI "\ " Xsymbol has no definition anywhere in file. X.LE X.H 3 "Warnings" X.VL 10 5 1 X.LI "``character translation value truncated''" X.LI "\ " XAn expression in a CHARDEF statment has a value less than zero Xor greater then 255. X.SP X.LI "``forward reference to SET/EQU symbol''" X.LI "\ " XA symbol in an expression is defined in a set/equ statement Xthat occurs after the line. For set statements, the value Xof the symbol is that defined in the set statement closest Xto the end of the file. X.SP X.LI "``string constant in expression more than 2 characters long''" X.LI "\ " XThe first two characters are used as the numeric value of Xthe subexpression. X.LE X.H 2 "Listing" XWhen the -l option is used, the detailed listing is output Xto the given file. XThis consists of the symbol listing followed by the annotated listing. X.H 3 "Symbol Table" XThe symbol listing is printed three symbols across, with the Xvalue then name of the symbol. XUndefined symbols will have "????????" in their value field. XThe symbols are listed in order of first occurrence in the input. XOnly the first fifteen characters of a symbol are printed. X.H 3 "Instruction Lines" XThe source statements are printed in the same form as they were input with Xno reformatting. XFollowing the source line, will be any error or warning messages associated Xwith the line. XStatements which generate data will be preceded with the address and Xdata for them in hexadecimal format. XIf more than six bytes of data are generated, the remainder will be Xprinted on the following lines, with up to sixteen bytes per line. XAll data generated is printed in the file. XStatements that don't generate data but have some value oriented operation, Xlike EQU, SET, ORG, or RESERVE, will print that value in the first 24 Xcolumns of the source line. X.H 2 "Symbol File" XWhen the -s option is used, the symbol table is printed to the given Xfile. The format is one symbol per line, address then symbol name. XIf the symbol is undefined, "????????" is printed for the address. The Xsymbols are printed in the order of first occurrence, either definition Xor reference, in the source file. This feature is provided so the Xsystem sort utility can be used to produce symbol tables sorted by Xeither address or name. XThe entire symbol name is printed. X.H 2 "Binary Output" X.H 3 "Intel Hex Record Format" XThe Intel hex record is a printable text string with an ASCII character Xrepresenting 4 bits of a byte. XThe characters used are "0" through "9" and "a" through "f", representing Xbinary data 0000 to 01001, and 1010 through 1111. XThere are always two ASCII characters used to represent 1 byte, the high Xhalf, then the low half. XThere is one record per line in a text file. XThis format is accepted by most of prom programmers. X.P XRecord Layout X.VL 15 5 X.LI :ccaaaattddddddddddkk X.LI ':' Xindicator character X.LI cc Xascii-hex representation of an 8 bit count of data characters X.LI aaaa Xascii-hex representation of 16 bit address X.LI tt Xascii-hex representation of an 8 bit type X.VL +10 X.LI 00 is a data record Xthe address is the first location to store the data X.LI 01 is an end of file record Xthe address is the location to start execution, the Xcount is 00, no data is present. X.LE X.LI dd... Xascii-hex representation of the data, two characters per byte. XThe number of 8 bit bytes is given by the count field. X.LI kk Xascii-hex representation of an 8 bit checksum. The sum of the Xbinary representation, modulo 256, of the count, the high half Xof the address, the low half of the address, the type, all the Xdata bytes, and the checksum must be zero. X.LE X.H 1 "Program Limits" X.VL +30 "" X.LI "Line Length" X256 characters including end of line control characters X.LI "Number of Symbols" X.DL +2 X.LI XThe maximum allocatable block size divided by the size of a pointer. XFor a iAPX286, about 16000 entries. X.LI XThe amount of allocatable memory divided by the amount of space per symbol. XFor an iAPX286, 22 + 1 + the length of the string bytes. X.LE X.LI "Symbol Length" XSee line length X.LI "Output" XA 16 bit address in the output record format limits output to 65536 Xbinary bytes. X.LI "Expressions per Line" X128 (in BYTE and WORD statements) X.LI "Strings per Line" X128 (in STRING statements) X.LI "Nested If Statements" X32 levels X.LI "Nested Include Files" X20 or whatever the operating system allows X.LI "Subexpressions per Line" X258 symbols, constants, operators (total) X.LI "Character Translation Sets" X5 sets, plus the default (host) character set X.LE X.TC 1 1 7 SHAR_EOF true || echo 'restore of base.doc failed' fi # ============= cleanup.bat ============== if test -f 'cleanup.bat' -a X"$1" != X"-c"; then echo 'x - skipping cleanup.bat (File already exists)' else echo 'x - extracting cleanup.bat (Text)' sed 's/^X//' << 'SHAR_EOF' > 'cleanup.bat' && Xdel *.obj Xdel as*.c Xdel as*.h SHAR_EOF true || echo 'restore of cleanup.bat failed' fi # ============= devnote ============== if test -f 'devnote' -a X"$1" != X"-c"; then echo 'x - skipping devnote (File already exists)' else echo 'x - extracting devnote (Text)' sed 's/^X//' << 'SHAR_EOF' > 'devnote' && X X1. Disclaimer X X This software is in the public domain. X Any prior copyright claims are relinquished. X X This software is distributed with no warranty whatever. X The author takes no responsibility for the consequences X of its use. X X2. Size X X You can compile the assemblers small model (64k + 64k). X Getting them any smaller would be a real trick. X X3. Compilation X X The C source files that comprise a cross assembler are X in 3 categories. X X Common code (doesn't need recompiling between different X "flavors") X frasmain.c X fraosub.c X frapsub.c X X "Flavor" specific files (generated by Yacc, compiled X for every "flavor")) X as*.c X as*.h X X Common code that depends on the fraytok.h file (compiled X for every "flavor") X fryylex.c X X4. Fraytok.h X X The yacc program defines some data structures and assigns values X to various #define Macros used in the lexical analyzer. X The lexical analyzer (fryylex.c) file refers to these in the X fraytok.h include file. The {assembler name}.h file generated X by yacc (or renamed in the makefile) for the different .y files X will be different. If you compile manually, insure that the correct X {assembler name}.h file is copied to fraytok.h. X X5. Configuration Macros X X DOSTEMP X X If neither the current directory or /usr/tmp is an acceptable X directory for the temporary intermediate data file, change the X initialization in frasmain.c. X X NOGETOPT X X If you use the NOGETOPT to use the provided function, remember X to change the MAINDEPENDS makefile macro. X X NOSTRING, USEINDEX X X The version 7 system I used to test these for version 1 got sold X for scrap. Should still work ;-) X X6. Dos X X If you don't have a MS-DOS (or whatever) Yacc equivalent, but do have X access to a another computer with Yacc, you can run that step there X and take the resulting .c and .h files to the (whatever) system. X (I have not inquired at AT&T as to the copyright status of the X resulting code, although it is rumored that the output of Yacc X is public domain. Do this at your own risk. [The Yacc program X itself is definitly NOT public domain]). X X The combination used (Turbo C and Bison) will report a half X a dozen (varies) shift-reduce conflicts from Bison, and 3 (usually) X warnings from the C compiler for the parser. No big deal. X X The Bison (the Free Software Foundation's Yacc clone) I used X was disk 285 from the C Users Group. The version dated X January 1989. This is modified from the original, to X adapt it to MS-DOS compilers, conventions, and libraries. X X (The following paragraph was copied out of this release) X X The C Users' Group (CUG) collects, maintains and distributes X public domain C source code, publishes a magazine, The C Users' Journal X and serves as a resource for C users. Several vendors have named X CUG as the official users group for their implementation of C. X For membership and subscription information contact X X The C Users' Group X 2601 Iowa X Lawrence, KS 66047 X (913) 841-1631 X X7. Porting to non-ascii machines X X The fryylex.c file contains a translate table, chartrantab, X which classifies the input character set for the scanner's X state machine. The reference to this table masks off the X input character with 0x7f limiting the table to 128 elements. X So if you want a source file in EBCDIC or to have umlauts in X your variable names, a new table, and a new mask are called for. X X Debug in the lexical analyzer is turned on with a nonzero X value in the DEBUG macro. X X Host machines that don't use two-complement negative numbers X will have to compensate in the fraosub.c outeval() X switch statement for cases IFC_EMU8, IFC_EMS7, IFC_EM16, X IFC_EMBR16. X X8. History X X These used to be called the Framework cross assemblers, but X there's someone using the name for a database package or X something like that. Why Frankenstein? Well, if you don't X like the way it acts, chop off it's head and sew a new one on. X (It was around Halloween). X X The .y files are generated from a more general machine X description by an automated script. But this isn't X portable enough and is too disgusting to distribute. X X9. Bug reports X X Report bugs to markz@ssc.uucp. Especially screwups in the X instruction generation tables. X X There is no telephone that I can be reached at. X Please don't phone/fax Specialized Systems Consultants in X reference to this software. What I do for a hobby, and X what they do to make money are not connected. X X Mark Zenier X X SHAR_EOF true || echo 'restore of devnote failed' fi # ============= filelist ============== if test -f 'filelist' -a X"$1" != X"-c"; then echo 'x - skipping filelist (File already exists)' else echo 'x - extracting filelist (Text)' sed 's/^X//' << 'SHAR_EOF' > 'filelist' && XMakefile Unix makefile Xas1805.1 Man page, process with nroff -man Xas1805.doc Appendix, process with tbl and nroff -mm Xas1805.tst Test input file Xas1805.tut Test output, listing file Xas1805.y Yacc and instruction table source file Xas2650.1 Man page, process with nroff -man Xas2650.doc Appendix, process with tbl and nroff -mm Xas2650.tst Test input file Xas2650.tut Test output, listing file Xas2650.y Yacc and instruction table source file Xas6301.1 Man page, process with nroff -man Xas6301.doc Appendix, process with tbl and nroff -mm Xas6301.tst Test input file Xas6301.tut Test output, listing file Xas6301.y Yacc and instruction table source file Xas6502.1 Man page, process with nroff -man Xas6502.doc Appendix, process with tbl and nroff -mm Xas6502.tst Test input file Xas6502.tut Test output, listing file Xas6502.y Yacc and instruction table source file Xas6805.1 Man page, process with nroff -man Xas6805.doc Appendix, process with tbl and nroff -mm Xas6805.tst Test input file Xas6805.tut Test output, listing file Xas6805.y Yacc and instruction table source file Xas6809.1 Man page, process with nroff -man Xas6809.doc Appendix, process with tbl and nroff -mm Xas6809.tst Test input file Xas6809.tut Test output, listing file Xas6809.y Yacc and instruction table source file Xas6811.1 Man page, process with nroff -man Xas6811.doc Appendix, process with tbl and nroff -mm Xas6811.tst Test input file Xas6811.tut Test output, listing file Xas6811.y Yacc and instruction table source file Xas7000.1 Man page, process with nroff -man Xas7000.doc Appendix, process with tbl and nroff -mm Xas7000.tst Test input file Xas7000.tut Test output, listing file Xas7000.y Yacc and instruction table source file Xas8041.tst Test input file, for as8048 Xas8041.tut Test output, listing file Xas8048.1 Man page, process with nroff -man Xas8048.doc Appendix, process with tbl and nroff -mm Xas8048.tst Test input file Xas8048.tut Test output, listing file Xas8048.y Yacc and instruction table source file Xas8051.1 Man page, process with nroff -man Xas8051.doc Appendix, process with tbl and nroff -mm Xas8051.tst Test input file Xas8051.tut Test output, listing file Xas8051.y Yacc and instruction table source file Xas8096.1 Man page, process with nroff -man Xas8096.doc Appendix, process with tbl and nroff -mm Xas8096.tst Test input file Xas8096.tut Test output, listing file Xas8096.y Yacc and instruction table source file Xascii.chd assembler include file defining the Ascii character set X with the Ansi C control characters Xasz8.1 Man page, process with nroff -man Xasz8.doc Appendix, process with tbl and nroff -mm Xasz8.tst Test input file Xasz8.tut Test output, listing file Xasz8.y Yacc and instruction table source file Xasz80.1 Man page, process with nroff -man Xasz80.doc Appendix, process with tbl and nroff -mm Xasz80.tst Test input file Xasz80.tut Test output, listing file Xasz80.y Yacc and instruction table source file Xbase.doc Assembler manual, process with nroff -mm Xcleanup.bat MS-DOS cleanup script Xdevnote Notes for development and porting Xfilelist This file Xfraebin.h binary operator expression evaluation include source file Xfraeuni.h unary operator expression evaluation include source file Xfragcon.h generation constants include source file Xfraosub.c output phase routines source file Xfrapsub.c parse phase routines source file Xfrasmain.c main() source file Xfrasmdat.h global data include source file Xfryylex.c lexical analyzer source file Xgetopt.h getopt function (optional) source file Xmakefile.dos Turbo C MS-Dos make file Xmakeone.bat MS-Dos script to compile and test SHAR_EOF true || echo 'restore of filelist failed' fi # ============= fraebin.h ============== if test -f 'fraebin.h' -a X"$1" != X"-c"; then echo 'x - skipping fraebin.h (File already exists)' else echo 'x - extracting fraebin.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'fraebin.h' && X X X/* XHEADER: ; XTITLE: Frankenstein Cross Assemblers; XVERSION: 2.0; XDESCRIPTION: " Reconfigurable Cross-assembler producing Intel (TM) X Hex format object records. "; XFILENAME: fraebin.h; XSEE-ALSO: frapsub.c, fraosub.c; XAUTHORS: Mark Zenier; X*/ X X/* X description switch case actions for binary operators for X both the parse and output phase expression X evaluators X*/ X X X case IFC_MUL: X etop *= (estkm1p--)->v; X break; X X case IFC_DIV: X etop = (estkm1p--)->v/etop; X break; X X case IFC_ADD: X etop += (estkm1p--)->v; X break; X X case IFC_SUB: X etop = (estkm1p--)->v - etop; X break; X X case IFC_MOD: X etop = (estkm1p--)->v % etop; X break; X X case IFC_SHL: X etop = (estkm1p--)->v << etop; X break; X X case IFC_SHR: X etop = (estkm1p--)->v >> etop; X break; X X case IFC_AND: X etop &= (estkm1p--)->v; X break; X X case IFC_OR: X etop |= (estkm1p--)->v; X break; X X case IFC_XOR: X etop ^= (estkm1p--)->v; X break; X X case IFC_GT: X etop = (estkm1p--)->v > etop ? 1 : 0; X break; X X case IFC_GE: X etop = (estkm1p--)->v >= etop ? 1 : 0; X break; X X case IFC_LT: X etop = (estkm1p--)->v < etop ? 1 : 0; X break; X X case IFC_LE: X etop = (estkm1p--)->v <= etop ? 1 : 0; X break; X X case IFC_NE: X etop = (estkm1p--)->v != etop ? 1 : 0; X break; X X case IFC_EQ: X etop = (estkm1p--)->v == etop ? 1 : 0; X break; X SHAR_EOF true || echo 'restore of fraebin.h failed' fi # ============= fraeuni.h ============== if test -f 'fraeuni.h' -a X"$1" != X"-c"; then echo 'x - skipping fraeuni.h (File already exists)' else echo 'x - extracting fraeuni.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'fraeuni.h' && X/* XHEADER: ; XTITLE: Frankenstein Cross Assemblers; XVERSION: 2.0; XDESCRIPTION: " Reconfigurable Cross-assembler producing Intel (TM) X Hex format object records. "; XFILENAME: fraeuni.h; XSEE-ALSO: frapsub.c, fraosub.c; XAUTHORS: Mark Zenier; X*/ X/* X description switch case actions for unary operators for X both the parse and output phase expression X evaluators X*/ X X case IFC_NEG: X etop = -etop; X break; X X case IFC_NOT: X etop = ~ etop; X break; X X case IFC_HIGH: X etop = (etop >> 8) & 0xff; X break; X X case IFC_LOW: X etop = etop & 0xff; X break; X SHAR_EOF true || echo 'restore of fraeuni.h failed' fi # ============= fragcon.h ============== if test -f 'fragcon.h' -a X"$1" != X"-c"; then echo 'x - skipping fragcon.h (File already exists)' else echo 'x - extracting fragcon.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'fragcon.h' && X/* XHEADER: ; XTITLE: Frankenstein Cross Assemblers; XVERSION: 2.0; XDESCRIPTION: " Reconfigurable Cross-assembler producing Intel (TM) X Hex format object records. X X constants used in intermediate file code generation X as the expression node operation value and the polish X expression operation "; XFILENAME: fragcon.h; XSEE-ALSO: frapsub.c, fraosub.c, as*.y; XAUTHORS: Mark Zenier; X*/ X X#define IG_START '[' X#define IG_END ']' X#define IG_CPCON '#' X#define IG_CPEXPR '=' X#define IG_ERROR 'X' X X#define IGP_DEFINED 'U' X#define IGP_CONSTANT 'V' X X#define IFC_NEG '_' X#define IFC_NOT 'N' X#define IFC_HIGH 'H' X#define IFC_LOW 'Z' X#define IFC_MUL '*' X#define IFC_DIV '/' X#define IFC_ADD '+' X#define IFC_SUB '-' X#define IFC_MOD '%' X#define IFC_SHL '{' X#define IFC_SHR '}' X#define IFC_AND '&' X#define IFC_OR '|' X#define IFC_XOR '^' X#define IFC_GT '>' X#define IFC_GE 'G' X#define IFC_LT '<' X#define IFC_LE 'L' X#define IFC_NE '?' X#define IFC_EQ '=' X#define IFC_SYMB 'S' X#define IFC_PROGCTR 'P' X#define IFC_CURRLOC 'Q' X#define IFC_LOAD '.' X#define IFC_CLR '$' X#define IFC_CLRALL 'X' X#define IFC_POP '!' X#define IFC_DUP '~' X#define IFC_EMU8 ';' X#define IFC_EMS7 'r' X#define IFC_EM16 'x' X#define IFC_EMBR16 'y' X#define IFC_WIDTH 'W' X#define IFC_SWIDTH 'R' X#define IFC_IWIDTH 'I' X#define IFC_TESTERR 'T' X X#define PCCASE_BIN 1 X#define PCCASE_UN 2 X#define PCCASE_DEF 3 X#define PCCASE_SYMB 4 X#define PCCASE_CONS 5 X#define PCCASE_PROGC 6 X SHAR_EOF true || echo 'restore of fragcon.h failed' fi true || echo 'restore of fraosub.c failed' echo End of part 1, continue with part 2 exit 0 Brought to you by Super Global Mega Corp .com