c Xerox Corporation 1979BCA / MLDRE. McCreightdraft of August 30, 1978 11:52 AMfiled under [Ivy]bca.pressBCA (Basic Cross-Assembler) is a general-purpose microcomputer assembler. It is written in Bcpl andruns on the Alto. It reads text files produced by an editor (such as Bravo) and produces listing filessuitable for printing (via Empress) and relocatable binary output files. To date, it has been used toassemble code for the following microcomputers: Intel 4004, Intel 4040, Intel 8080, Intel 8748, Intel8086, Motorola 6800, MOS Technology 6502, Zilog Z-80, Texas Instruments TMS1000. It is about aday's work to customize BCA for a new machine with an 8-bit-wide instruction word that doesn't havevery many peculiar features. It is possible, although not straightforward at present, to produce code for16-bit machines.BCA produces relocatable binary code in a slight generalization of the Micro binary format. MLDRthen combines several such files to produce one file in standard Micro binary format, suitable for Promprogramming, downloading via Midas, or what-have-you. Each assembly-language module containsone absolute block (whose name is "$absolute") and can contain an arbitrary number of relocatableblocks. At any point in the assembly the assembler is emitting code into only one of these blocks.However, each of these blocks has its own relative location counter, and one can switch back and fortheasily among blocks using the .LOC directive. MLDR must place bytes in the absolute block in theexact addresses specified by BCA, but can place each of the relocatable blocks independent of theothers. This implies some restrictions on expressions whose values must be computable at assemblytime, because BCA does not know what the final value of a symbol pointing into a relocatable block willbe.BCA is a line-oriented assembler. Only one operation may appear per line, and lines are terminated bycarriage-returns. Comments begin at a semicolon and end at the end of the line.; This entire line is a commentJMPExitIfRed; this part of this line is a commentEmpty lines can be sprinkled around to improve readability. You can also put in form feeds (control-L)to break up the listing intelligently.Numeric constants are evaluated in the current radix, except when followed by a "o" or "O" (meaningoctal), an "x" or "X" (meaning hexadecimal), or a "." (meaning decimal). A numeric constant that startswith a non-decimal digit must be preceded by a 0.175; will be evaluated according to the "current" radix300o; 300 octal35.; 35 decimal100X; 100 hexadecimal0fx; NOT fx, because the scanner would read that as a symbolOne can also specify the Ascii code for a character using " or $. Usually the two are the same, but $employs the same conventions as Bcpl and is slightly more civilized when specifying control characters(*n for carriage return, *l for line feed, *t for tab, *s for space).$A; 101 octal, the Ascii code for A"a; 141 octal, the Ascii code for a$*s; 40 octal, the Ascii code for space" ; also 40 octal, but it's hard to tell there's a space there",pqX ] Y Xu" V% Sc Raf Pe OWe M^ LMc Ji IC F9` Dg C/\ Aa @%b >f =` ;a :a 8g 7 3e 2xO2/n,d% )Zf '& &Pc $g #F12 <42( 22 2(2(9 e f E2 (!2(!2$2 {<  =YK2A symbol is a string of alphabetic or numeric characters whose first character is alphabetic. In additionto the usual upper- and lower-case Roman alphabet, BCA considers the following characters to bealphabetic:[ ] @ # ~ _ < > { } 'Symbols can be very long (up to 50 characters or so). Two symbols are considered to be the same only ifthey are identical including capitalization.ShrtSymthisIsIndeedAVeryVeryVeryLongSymbol[Garbage]9@FooThe single-character symbol "." means the value of the active location counter as it was at the beginningof the line.Labels are symbols followed by a colon and appearing as the first item on a line. They can be the onlyitem on the line, if you like.ThisIsALabel:NOPThisIsAlsoALabel:JMPExitIfGreenExpressions can be put together using +, -, *, /, & (logical and), % (logical or), | (remainder afterdivision by), and ^ (left-shift; x^y means x left-shifted y bits, where y can be negative to indicate right-shift). Expressions are evaluated from left to right except where parentheses indicate otherwise. Itemdelimiters (space, comma, tab) are not allowed inside expressions.-11+3Arg+Boo-1*3; = (((Arg+Boo)-1)*3)Arg+(Boo-(1*3))Expressions must generally be evaluable at assembly time. There is one important exception to this rule.If Rel1 and Rel2 are symbols that point into relocatable blocks, or imported symbols, thenRel1+constantRel1-constantRel1-Rel2+constantRel1-Rel2-constantare all legal expressions. In addition, if Rel1 and Rel2 are both symbols defined in this assembly, and ifboth point into the same relocatable block, then the sub-expressionRel2-Rel1is a constant, and can be used in the same context as any other constant.You can equate a symbol to an expression using the equals sign. This is frequently done to improve thereadability of a program. For example,B = Arg+(Boo-(1*3))Key = 0c42x; a memory-mapped peripheral deviceLDAKeyNfq bXi `_ _ 2\  Yg W{,2Tq2R#2Qg 2O Li KS HIf F2C 2@?+ >E.relative eq currentLCifso ValueGen(FORCEVALUE(Expr>>E.value-(currentLC>>S.value+1),-128, 127, 8, 15))ifnotNfq bXg `c _g ]g \ b Zi Yb W{ Tqd R[ QgZ Ob Lb KSh Ig HIi F C @#2=      H :<\9UpToKExpressionsFORCEVALUEREPORTFORCEFIELDFULLADROUTGETABSSYMAddToPCSKIPDELIMSEXPRESSIONISEXPRESSIONGETSTRINGGETSTRINGCHARNEWCHARVariables:PCAtBegincurrentLCCURCHARNfq b ` _ ] \ Z Y W{ U Tq R Qg O L KS I HI D #LMATH  TIMESROMAN +O 1f= 0$B*C.0j/3 1  bca.bravo SwinehartSeptember 15, 1979 9:12 PM