CMZASM.BA Written by Camz. 1989 Calgary Portable Computer Group Documentation for Camz Personal Assembler ------------------------------------------- This is an improved version of CMZASM.100 written in 1987. The changes are as follows: 1) Improved speed by utilizing some machine code and some optimizing on the string handling. This also saved some memory. 2) Some minor bugs were found and corrected. 3) If the earlier version ran out of memory, it reported the wrong error. This has been fixed. This program was specifically designed to suit my own personal preferences, and programming style. It came about when I found I had a need to create assembler files that I could load ANYWHERE in memory. I wrote this program to do just that, and as a result, it lacks some of the advanced features of the other assemblers available for the Model 100. This program allows for the use of labels (in fact, they are mandatory for relocatible code), ASCII strings, and hex-digits. Its use is simple, once one gets used to it. Labels *MUST* end with a colon ":" when defining their position within your source code. If they do not have the colon, the assembler will attempt to insert their position value (two bytes) into the code. All fields within the source code are separated by spaces and/or tabs. These characters can't be used as part of a label name, all other characters CAN, including control characters. All HEX values *MUST* be preceded with a dollar sign "$". If the dollar sign is left out, they will be treated as labels. The assembler supports *ONLY* hex values. Decimal, binary, and octal are *NOT* supported. ASCII strings can be inserted into the code by containing the string inside quote characters. (The final quote can be left off, in which case the string is considered to end at the end of the line.) Single hex-digits can also be placed within the code (only 8-bit values) if they are once again preceded with the dollar sign. All opcodes *MUST* be entered in lower case, and all hex-digits in uppercase. The assembler does not require the pseudo-opcode "org" to specify the start address of the object code. This is because the output of the assembler is in the form of a BASIC program that will load the file to any specified start address. The pseudo-opcode "end" is not used, the assembler is smart enough to know that the end of the file is also the end of the source code. Comments are allowed anywhere in the code. They are started with a semicolon and everything to the end of the line is considered to be in the comment. Sample: ;Sample of source code for CMZASM.BA ; Entry: mvi a,$21 ;Put a 1 into the accumulator rst 4 ;Restart 4 (call $0004) 8085 opcode mov b,a ;Transfer that 1 to the b register lhld $F600 ;Get the 2-byte value at hex F600 Loop: dcx h ;Decrement the hl register pair mov a,h ora l ;Transfer hl to accumulator (sorta) jnz Loop ;Loop until hl = 0 lda Code ;Put the byte at location 'Code' in accumulator mov e,a ;Transfer it to the e register jmp $045D ;Generate error code 'e' Code: $FE ;Byte value of 254 decimal Text:"This is some ASCII text" ;ASCII text to be inserted in code $00 ;Byte value of 0 Text ;Two-byte value representing the label Here: Here ;Two-byte value representing the label ; ;This is the end of the sample The above sample will assemble with CMZASM.BA without any errors. You cannot put a two-byte digit directly on a line by itself. You must instead use two separate hex digits on lines by themselves. A label can be used wherever a two-byte value is required or on a line by itself. A string cannot be used as the operand of ANY opcode, it must be on it's own line. Any line can use a colon terminated label. CMZASM.BA will allow source and destination files to me on some other device (ie. CAS:, Disk, COM: MDM:). Be careful though, during the creation of the output file. There are TWO files being accessed, so CAS:, COM:, and MDM: can not be used for both source and output files. Also, due to the hardware of the Model 100, it is not possible to use COM: and MDM: files simultaneously. RAM is used for the temporary storage of the label table, so if you use disk as source and destination, you need only enough free RAM for the label table and can then assemble large source programs. For those that are interested, the program output is in the form of a BASIC program stored as a .DO file. One follows the same procedures to convert it to a .BA file as one would with a downloaded file. The BASIC program will normally place the code directly under HIMEM. One can modify this by changing the line that has a "ClearHimem-"... to "Clear" address "-" If you need more information, you can contact me at the electronic mail id at the top of this file, by leaving a message on the Calgary Portable Computer Group BBS, 403-271-1699, or by conventional mail to: Martin Zimmerman 36 Midglen Road SE Calgary, Alberta T2X 1H2 CANADA