asm(1.0), an AmigaDOS compatible 68010 assembler Deviations from AmigaDOS manual Copyright (c) 1986 Douglas J Leavitt Jr. 3005 OFW #2, Venice CA, 90291 Usenet: sdcrdcf!ism780c!dougl Suggested contribution: $25-$50 Intro This paper describes the functions and capabilities available with the asm(1.0) macro assembler. The asm assembler is designed to be a 68010 macro assembler that is compatible with the assembler described in the AmigaDOS Manual, from Commodore-Amiga Inc., and Bantam Computer Books. Because this assembler tries to be as compatible as possible with the AmigaDOS assembler, only the deviations from that manual will be discussed here. At some later point in time, a totally new manual may be written. The asm(1.0) assembler was designed with three principles in mind. 1. An assembler that is available to everyone. 2. An assembler capable of assembling any currently available assembly language written for the Amiga. 3. An assembler with more power than is available in the standard AmigaDOS macro assembler. The first goal of has been met by making this assembler a shareware product. By making this assembler shareware product it is hoped that it's availability will become widespread, providing a general increase in Amiga software, and ultimately providing a better Amiga environment for all people. This assembler is intended as the first part of an entire C compilation system that will eventually be provided as a shareware system for all Amiga users. This paper is organized in the same sections as the AmigaDOS assembler manual chapter. Deviations from The AmigaDOS Manual Chapter 3 3.1 Introduction to the 68000/68010 Microchip This assembler is capable of compiling the new instructions that are available with the 68010. This means that three new registers and three new instructions are available. These are: 1. sfc, dfc, vbr 2. movec, movec.l 3. moves.b, moves.w, moves.l 4. rtd This assembler is also capable of determining whether a branch may be generated in the 8 or 16 bit form automatically. The way that this is accomplished, is by using a jcc instruction. For example, if the assembler encounters a jne instruction, it will automatically determine if it can generate a bne.s or if must generate a bne instruction. 3.2 Calling asm(1.0) For the most part asm(1.0) tries to be as flexible as possible whenever possible. The assembler does not require a specific command line argument order. The current legal arguments are: asm [options] assembly_file [options] options: ? - Display command line format -q - Silent mode (copyright notice not shown) -l file - Generate listing file -h file - Include header file -o file - Output file name -i incl - Add include list to searching -v file - Gererate errors to verification file The -c flag does not currently exist with this release of the assembler. These options are expected to appear in a later release. 3.3.2.3 This assembler is capable of accepting either upper case or lower case opcodes. Whenever an instruction is encountered without a size specifier, word sized opcodes are assumed. Whenever the opcode field contains a local label that has been defined to be an absolute constant, asm(1.0) will generate the equivalent of a dc.w whose value is the value of the label. Opcodes may not currently start in the first character of an assembly line. Asm(1.0) is not capable of determining whether an opcode starting in the first character position is a label or an opcode. 3.3.2.4 The restriction of not allowing whitespace characters, blanks and tabs, between operands has been removed. 3.3.2.5 If a comment immediately follows a zero operand instruction and the comment starts with a word rather than a comment delimiter such as ';', the word will be taken as a symbol. This is not currently seen as a problem because the comment character ';' may always be placed immediately after a zero operand instruction. 3.4.1 All expression calculations are in signed 32 bit calculations which are then truncated if necessary. 3.4.3 A symbol is a string of up to 64 characters. The special symbol '.' has the value of the current program counter. This symbol is equivalent to '*'. The symbol '*' does exist in this assembler. The '.' symbol has been provided because of it's significance in many other assembly languages. 3.4.4 When a hex constant is being parsed, the characters 'a'-'f' as well as 'A'-'F' are legal values for the numbers 10-15. Ascii literals are normally contained in single quotes "'". Ascii strings are legal operands in many assembler directives. An ascii string is very similar to a C type string. An ascii string is a sequence of ascii characters contained in double quotes. The following sequences exist in strings: 1. \r - carraige return 2. \n - newline 3. \t - tab character 4. \f - formfeed 5. \b - backspace 6. \\ - backslash 7. \07 - \ followed by 1-3 octal characters generates the desired 8 bit character sequence. Double quoted strings will work with any operand that requires a string. Single quoted strings will work for those directives that document it as such. These directives, ifc/ifnc, accept both singly or doubly quoted strings and treat them the same. 3.5 Absolute short addresses are denoted by appending a '.w' suffix to the address. The '.l' suffix may also be appended to a long absolute address. The REG directive does not currently exist in this assembler, however it is possible to specify by name a list of registers that will be saved in a movem instruction other than a simple immediate value constant. The following operand form is legal for the movem instruction: register_name[|register_name[|register_name...]] An example: movem.l d7|d6|d5|a4|a3,-(sp) The asm(1.0) assembler will generate the correct mask for all legal addressing modes, predecrement included. 3.6 Currently many of the "I", "A", and some of the "M" variants do not exist in this version of the assembler. This assembler will generate the correct opcode based on the operands given. 3.7 As many directives as possible have been supported in this assembler. This section describes the current limitations and additions to the existing assembler directives. The following directives are not currently supported in this version of the assembler. They are accepted, however they are ignored. 1. offset 2. rorg 3. reg The following directives are supported in this assembler, but do not exist in the standard Amiga macro assembler. 1. text, code, data, bss 2. global, globl 3. comm 4. even, align 5. ascii, asciz 6. else Assembler Control Directives SECTION The section directive currently supports only 3 sections. These sections are one each of CODE, DATA, and BSS. Each of these sections may share a common section name, or they may be unnamed, which is the default. TEXT, CODE These directives change the current section to become the code section. Neither directive takes an operand, and the section name is assumed to the current section name. DATA This directive change the current section to become the data section. This directive does not take an operand, and the section name is assumed to the current section name. BSS This directive change the current section to become the bss section. This directive does not take an operand, and the section name is assumed to the current section name. Data Definition Directives COMM This directive has the following form: COMM symbol,N This directive places the given symbol into the BSS section with a size of N. N is a constant expression that defines the size of the symbol in byte units. ASCII This directive has the following form: [