As8 is a simple assembler for an Intel 8008 microprocessor. It uses the original (old) mnemonics, unlike the 8080-like mnemonics of later compilers. It is written as a single ANSI-c source file, so should compile on any computer that has a C compiler.
To run it, the program is called from a command-line interpreter, such as a DOS window on an Windows computer. If you have an assembly file named "test.asm" you could simply call the program as...
and the program will open the file called "test.asm", assemble it, write the output list file into "test.lst" and write an intel hex output file called "test.hex".
More specifically, the program usage is...
Usage: as8 [options] infile where
is assembly code file, extension defaults to .asm and options include... -v verbose output -nl no list file (default is to make .lst file.) -d debug assembler (extra output) -bin makes output binary ROM file, otherwise intel hex -octal makes unidentified 3-digit numbers octal (default decimal) -single makes .lst file single byte per line, otherwise 3/line. -markascii makes highest bit in ascii bytes a one (mark).
where "infile" can have ".asm" specified, or just the base name of the file, with ".asm" inferred. The options are..
The program takes an assembly code ascii file full of lines of code and comments. Where ever the ';' or '\' character is seen, the rest of the line is considered a comment. The general format of the line is as follows:
label: opcode argument(s)
where "label:" is optional, if not included in a line, at least one white space character (a space or a tab is reasonable) before the opcode. Several pseudo-ops are available:
The opcodes or mnemonics are mostly 3-letter, and are as specified by early 8008 documents. It should be noted that after Intel came out with the 8080 microprocessor, they created slightly different opcodes for the 8008 to make the assembly code a bit more similar (and somewhat interchangeable.)
Numbers in the assembler may be specified in many ways.
A multiple digit number which does not start with zero is interpreted as a decimal number (unless the octal option is set, in which case any 3-digit number will be considered octal, even if it doesn't start with a zero.
A multiple digit number which starts with a zero is always interpreted as an octal number.
A number which starts with "0x" (like "0xFF" or "0x1F3") will be read as a hexadecimal number.
A string of ones and zeros followed by a "B" will be interpreted as a binary number (like "01001011B").
An argument can include simple arithmetic which will be interpreted from left to right. "LOC*2+1" would be valid if "LOC" is a valid defined label. Up to 4 arguments can be separated by 3 operands ("+","-","*", or "/").
The operand "\HB\" can precede an argument/label, and returns the high-byte of the value. Similarly, the operand "\LB\" can precede an argument/label, and returns the lower-byte of the value. These are useful for loading the "H" register with the high-byte of an address, and the "L" register with the low-byte.
Just as "\HB\" and "\LB\" can separate the high-order-byte and low-order-byte of a number, the "#" sign will attach them. This is commonly need in "ORG" statements where the high and low bytes are known, but must be placed into a single number (example "START: ORG 001#0120" is helpful when we work with octal numbers (common with the 8008) and it's not obvious how to combine them directly ("ORG 001*0400+120" would do the same thing, but is not as straightforward.)
As mentioned, the "DATA" pseudoop will either define numeric values to be inserted into the program, or reserve some number of bytes in the program. A list of comma delimited arguments may have up to 12 such arguments. They can be simple numbers (interpreted as above) or labels, or mathematic expressions, as mentioned above. More than 12 on a line, however, generates an error.
If the "DATA" statement has a string a few escape/control symbols are allowed, such as "HELLO\n" which will place a newline at the end of the string. The allowed sequences are "\n", "\t" or "\0" at this point. Other numbers will require a following DATA statment with numeric values specifically entered.
If the "DATA" statement is followed by a '*' and then a number, this number will be interpreted as decimal, and reserve that number of bytes.
Okay, the best way to learn this assembler is to look at example input files. Look at the "SCELBAL" source code or the "memtst.asm" code file. That's the best way to figure out what's allowed and not.
I'm a vintage computer hobbyist, have very little free time. If you have questions or suggestions, email me, but realize I may be hard to get a hold of. If you're persistent, I tend to reply. You can email me at tejones777 at (use the at sign) aol.com. If I don't respond, I may just be swamped, but don't give up if you really need something.