CROWECPM --- A Z80 ASSEMBLER The assembler provides all the features of Zilog's assembler except for macros, conditional assembly and lower case. It was originally written to be used with cassette or paper tape, with the desired pass number entered from the console. The assembler is now set up to receive the pass numbers from a buffer in the program itself. The output of the assembler is sent to files except the error listing which is sent to the console. For each pass, the source is re-read and the appropriate output generated. Pass 1 builds the symbol table and is required. Pass 2 outputs the assembly listing, pass 3 writes Intel format hex object and pass 4 gives an assembly listing of those lines containing errors on the console. The assembler has been modified to perform pass 4 before writing the files (passes 2 and 3) so that errors can be seen and corrected before the time consuming output is done. The linkage routines are written so that the assembler can be run as a standard CP/M .COM file with the following command format: CROWECPM FILENAME.YY The characters in the normal file extension position are Y/N selects (default is Y), the first for listing file and the second for the hex object file. The source must have a file extension of .Z80 while the listing is created with an extension of .PRN and the object with an extension of .HEX. Only minimal error checking and reporting is done when creating files. If no source file with the correct name is found a message is displayed. If any other disk error on a BDOS call occurs, that is reported. In either case, the routine waits for a keystroke before exiting to CP/M. SYNTAX The CROWECPM assembler requires that the source file be written using standard Zilog mnemonics. In addition it requires that tabs be used as field delimiters. Labels may have colons following but this is not required. Comments can be entered anywhere (in any field) following a semicolon as is usually the case. Hexidecimal numbers that begin with a letter must be preceded by a 0 and conclude with an H with no imbedded spaces. Since the source of the assembler is included, and it is syntactically correct, it can be used as a model of assembly language programming. FUNCTIONAL OPERATORS + MONADIC PLUS - MONADIC MINUS ** EXPONENTIATION * MULTIPLICATION / DIVISION + ADDITION - SUBTRACTION PSEUDO-OPS The following Pseudo-ops are supported by CROWECPM: ORG ---Sets the address reference EQU ---For assigning a value to a label (can appear only once per label) DEFL --Also assigns a value to a label but can be used to assign different values to a label at different places in the program END ---Must conclude the program. Can be followed with the starting address of the target program. DEFB --Defines the content of one byte of memory at the address the OP appears in the program. DEFB 'x'--Same as above but defines the byte to be the ascii code for the character between the quotes. (x in the example) DEFW --Defines the contents of two bytes of memory DEFS --Reserves bytes in memory beginning with the address the OP appears DEFM 'x'--Defines the contents memory to be the ascii code of the characters appearing between the quotes----MUST NOT EXCEED 32 CHARACTERS----- TITLE 's'-Defines the program title. It is printed in the listing headers. An additional note about the assembler the way it stands: there is a limit of 32 characters for a quoted string as operand of a DEFM statement. If this limit is exceeded NO error message is generated, the string is truncated. If you're not careful, the terminating '$' for a CP/M output string could be lost and the results would be unpredictable. The CROWCPM.Z80 file has the linkages incorporated into it, near the end. As it now stands, the symbol table is limited only by the amount of available memory since the assembler reads the start address of BDOS from locations 6&7 and sets that as the top of available symbol space. There has been one minor improvement to the assembler: you can now specify that the .LST or .HEX files should be sent to drive B rather than the current default drive by putting a B in the proper position in the normal filename extension. E.g. CROWECPM CROWECPM.NB would assemble the file CROWECPM.Z80, skip the .LST file and send the .HEX file to drive B. The source file must still reside on the same drive as the assembler. The source is currently set up for the CROWECPM assembler. To assemble it with M80 you will need to add ASEG and .Z80 commands to it. Bug fixes from Thomas Hameenaho The first bug resulted when the single quote character in EX AF,AF' caused the assembler to expect the following characters to be a text string. Now I test if the character preceding the ' is a 'F', if so, the 'QUOTE' flag should not be set. The other bug (LBFSZ-1) resulted because the minus character (instead of the "_" character) was declared legal in a label. Probably a typing error when entering the source code. So now CROWCPM.COM will assemble CROWECPM.Z80. Thomas Hameenaho Djaknegatan 7 S-754 23 Uppsala Sweden ***************************************************************************** Enhancements from Micro Cornucopia The assembler we received was machine dependent. Rather than just changing it so that it would run on the Kaypro we replaced the machine dependent code with standard CP/M function calls. As a result the assembler should now run on any standard CP/M machine. We have tested it with the Big Board running double density and a Kaypro with a Winchester sub-system. If you have any problems with the assembler or improve it in any way please contact us. Micro Cornucopia PO BOX 223 Bend OR 97709