Home
b8GlGl/b8Gl`1 - Bitsavers.org
Contents
1. Aoc BLER V1 4 USER S MANUAL a SOFIWARE DYNAMICS SOFTWARE DYNAMICS COPYRIGHT 1977 ASM 1 4 REFERENCE MANUAL 7th Printing COPYRIGHT C 1977 SOFTWARE DYNAMICS NOTICE This manual describes Software Dynamics ASM version 1 4 family of 680x assemblers Software Dynamics has carefully checked the information given in this manual and it is believed to be entirely reliable However no responsibility is assumed for inaccuracies Software Dynamics reserves the right to change specifications without notice kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk This manual describes software which is a proprietary product of Software Dynamics SD SD software is licensed for use on a single copy per computer basis and is covered by U S copyright laws Unless a written exception is obtained from SD the soft ware must be used only on the single computer whose unique SD assigned serial number matches that for which the software was purchased Copying the software for any purpose other than archival storage or use of the software on other than the as signed serial numbered CPU is strictly prohibited SD assumes liability regarding the use of the software Certain software programs and datafiles are delivered for use in an encrypted format content of such programs and data are considered to be a trade secr
2. 8 bits of operand embedded in the instruction form the lower S8 bits of the l6 bit memory reference address while the upper 8 bits of the address are implicitly zero If an instruction operand address evaluates within the range 50000 to SOGFF ASM automatically generates Direct Mode memory reference if appropriate for that instruction Direct references may be forced with prefix Use of this prefix prevents any default to the Extended Mode addressing An error is generated if the effective address does not map into the range 50000 to SOOFF Use of the prefix 15 illegal with opcodes that only allow extended mode addressing Syntax lt opcode gt lt prefix gt lt exp gt Example A EQU 510 5123 Generated SUBB A Direct reference to loc 19 INC B Extended reference to loc 123 ADDB A Direct reference to loc 510 LDA B Direct ref to loc 123 WITH ERROR ROR A Extended reference WITH ERROR Copyright C 1977 29 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION V 6800 68801 MACHINE INSTRUCTION LINES EXTENDED MODE Extended mode addresses memory with a l6 bit address embedded the instruction Any location in the memory space be referenced with this mode Extended mode may be forced by use of the gt prefix Certain 6800 6801 instructions can only use Extended modes to directly reference memory Instructions whose operand evaluates to address in the range 50100 t
3. B Reg CLRA A Reg REGISTER REGISTER MODE Register Register Mode addresses source and destination registers The registers come in two sizes S8 bit and 16 bit Only registers of like sizes may be addressed together This mode may only be used with TFR or EXG opcodes l6 bit Registers 8 bit Registers X X index reg A A reg Y Y index reg B B reg U User Stack Pointer CC Condition Codes S System Stack Pointer DP Data Page Register PC Program Counter D register Syntax lt opcode gt lt gt reg Examples TFR X Y EXG A B X A Tfr Illegal X amp A not same size Copyright 1977 43 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES DIRECT MODE Direct Mode is used to address a location the 256 byte memory page designated by the contents of the DPR Data Page Register The 8 bits of operand embedded in the instruction form the lower 8 bits of the 16 bit memory reference address while the upper S8 bits of the address are supplied by the DPR ASM must be informed what contents to assume in the DPR This is done via the SETDPR directive see Directives section an instruction operand address evaluates within the DPR page bounds ASM automatically generates Direct Mode memory reference Direct references may be forced with prefix Use of this prefix prevents any default to the Extended Mode addressing If the e
4. IMPLICIT DATA STATEMENT SET LOCATION COUNTER SET DATA PAGE REGISTER CONDITIONAL ASSEMBLY DIRECTIVES SIMPLE CONDITIONAL ASSEMBLY ALTERNATIVE ASSEMBLY au NESTED CONDITIONAL ASSEMBLY MORE COMPLICATED CONDITIONAL ASSEMBLY MULTI CASE CONDITIONAL ASSEMBLY MODE CONDTIONAL ASSEMBLY ON UNDEFINED SYMBOLS CONDITIONAL ASSEMBLY ON DEFINED SYMBOLS Copyright C 1977 Software Dynamic ASM REFERENCE MANUAL 6 01 83 FULL DESCRIPTION OF CONDITIONAL ASSEMBLY COMMANDS THE IF DIRECTIVE CLOSE CONDITIONAL ASSEMBLY BLOCK CONDITIONAL ASSEMBLY WITH CHECK IF SYMBOL NOT DEFINED IF SYMBOL DEFINED THE ELSE DIRECTIVE CONDITIONAL ELSE CASE CONDITIONAL ASSEMBLY SINGLE LINE ITERATIVE ASSEMBLY ASSEMBLY CONTROL DIRECTIVES TERMINATE SOURCE FILE SELECT ASSEMBLY OPTIONS THE OPT STATEMENT THE INCLUDE STATEMENT LISTING CONTROL AND FORMATTING PAGE HEADING FORMAT LINE LISTING FORMAT PRINT CONTROL CARDS TURN LISTING ON OFF VUES s SET TITLE AND EJECT PAGE SET SUBTITLE AND EJECT PAGE SET NAME e SPACE LISTING LINES SET LISTING TABS PRINT SKIPPED RECORDS PRINT GENERATED DATA PRINT CONDITIONAL ASSEMBLY COMMANDS OPERATING ASM o STARTING ASM w o OPERATOR INPUT LINES ERROR MESSAGES
5. Copyright C 1977 104 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION X OPERATING ASM SYMBOL TABLE DUMP FORMAT This section describes the format of ASM symbol table dumps The symbol table is dumped sorted by name and by value using a common format for the symbol entries 90123 gt This field contains the symbol s value If the symbol is undefined this field is gt This field contains the symbol s name gt This field contains a qualifier which gives additional information about the symbol Possibilities are arts Indicates unused symbol Indicates doubly defined symbol Blank indicates none of the above Copyright C 1977 105 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION X OPERATING ASM ERROR LINE SUMMARY FORMAT At the end of pass two after the symbol table dump ASM will print out a list of lines on which errors occurred Each item in the list has the following format ffff 1111 specifies the Form number that contained the line as printed in the Form field of the page header 1111 specifies the line within that form which was in error as listed in the line number field of the listing This is especially useful when using EDIT 1 1 as the offending line easily be found by telling the editor to do EBfilename ffffEY1111J3 which goes to the ffffth form llllth line MEMORY USAGE AND SIZING CONSIDERAT
6. JSR LBCC LBCS LBEQ LBGE LBGT LBHI LBHS LBLE LBLO LBLS LBLT LBMI LBNE LBRA LBRN LBSR LBVC LBVS LDA LDAA LDAB LDB LDD LDS LDU LDX LDY LEAS LEAU LEAX LEAY LSL LSLA LSLB LSLD LSR LSRA LSRB LSRD OPERAND AX WHY e t t e 44 Copyright C 1977 e 9X 0X 04 09 p mM oe MODE MM PA o o gt uu KOPI PA P S H JND OPCODE CLASS 6809 6800 680 6809 6800 680 6809 680 6809 680 6809 680 6809 680 6809 680 6889 688C 6809 680C 6809 680 6809 680 6809 680C 6809 680 6809 680 6809 680 6809 6809 6809 6809 680C 6809 6860C 6889 680C 6800 0 6800 0 6809 680 6809 680 6889 688C 6809 6809 6800 6809 6809 680 6809 6809 680 6809 6809 6809 6899 6800 6809 6800 680C 6809 6800 6809 6800 6809 6800 6809 680C 55 NOTES AND COMMENTS LDA LDB ASLB ROLA LSRA RORB Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES OPCODE OPERAND MUL NEG NEGA NEGB NEGD NOP OKRTS ORA ORAA ORAB ORB ORCC ORD PSHA PSHB PSHD PSHS PSHU P
7. and only one corresspondng right parenthesis failure here will result in a Syntax Error for the line containing the expression Parentheses may be nested to any level They may be used even if WITH MCM has been specified Copyright C 1977 24 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION IV LINE PROCESSING LINE PROCESSING ASM follows these rules when processing a line 1 If the first character of the Label field is a star the line is treated as a comment It is listed but otherwise ignored This is a comment Ignore me 2 If the command field consists of single symbol it is looked up in the list of opcodes see sections on Machine Instruction Lines for lists of opcodes accepted If found the line is treated as a machine instruction line LDX 3 TSX All of these CLV are machine instruction lines PUL A by rule 2 3 If the command field is not an opcode symbol then the symbol is checked in the list of ASM directives If found the line is treated as a directive line J EQU 17 This is a directive by rule 4 PAGE So is this ORG 47 As is this 4 Any line which does not qualify under rules 2 or 3 is processed as an implicit data statement see below LDAC 34 This is an implicit data statement 3 4 17 So is this TSX So is this Copyright C 1977 25 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION V 6800 6801 MACHINE INSTRUCTION LINES 6800 6801 MACHINE INSTR
8. ou SYMBOL TABLE DUMP FORMAT Em ERROR LINE SUMMARY FORMAT MEMORY USAGE e APPENDICES APPENDIX A ASM DIRECTIVES WHICH DISALLOW FORWARD REFERENCES APPENDIX B ASCII CHARACTER SET APPENDIX C I O ERROR MESSAGES APPENDIX D 680C COMPATIBILITY INSTRUCTION SET Copyright C 1977 107 108 109 119 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION I INTRODUCTION SOFTWARE DYNAMICS ASM 6800 6809 MICROPROCESSOR ASSEMBLY LANGUAGE INTRODUCTION ASM A SMART ASSEMBLER ON A LITTLE MACHINE ASM is a sophisticated family of assemblers for 6800 6801 and 6809 microprocessors is intended for operation under the SDOS operating system There are four such assemblers ASM6800 680 assembling 6800 6801 code and executing on a 6800 system 5 6800 689 assembling 6800 6801 code and executing on a 6809 system ASM6809 680 assembling 6809 code executing on a 6800 system ASM6809 689 assembling 6809 code and executing a 6809 system These assemblers powerful highly flexible development tools They are fast Most important they designed by professionals with the professional user in mind Significant features include Multi level conditional assembly ASM s facilities unrivalled in the industry Multi level INCLUDE files Extensive listing format control Big assem
9. 8 Bit Offset 6800 Addressing Accumulator 6849 Addressing Auto Decrement 68409 Addressing Auto Decrement 6800 Addressing Auto Increment 6809 Addressing Auto Increment 6890 Copyright C 1977 17 63 65 69 48 17 2 85 110 Software Dynamics ASM REFERENCE MANUAL 6 01 83 INDEX Addressing Direct 6800 29 Addressing Direct 6809 44 71 Addressing Extended 6800 30 Addressing Extended 6809 45 Addressing Extended Indirect 6800 30 Addressing Extended Indirect 6809 45 Addressing Immediate 6800 34 Addressing Immediate 6899 50 Addressing Indexed 6800 31 Addressing Indexed 6899 46 47 Addressing Inherent 6890 28 Addressing Inherent 6899 43 Addressing PCR 6809 48 Addressing Register 6806 28 Addressing Register 6809 43 Addressing Relative 6890 34 Addressing Relative 6899 50 Addressing Stack 6809 51 Addressing Zero Offset 6890 31 Addressing Zero Offset 6809 46 Ampersand 17 20 Angle Brackets 2 Argument Field 6 28 43 88 94 Arithmetic 17 Assembly Control Directives 84 Asterisk 6 Auto Decrement 6800 33 Auto Decrement 6809 49 Auto Increment 6800 33 Auto Increment 6899 49 BASIC 68 Backslash 17 19 Bang 19 Binary File 100 Binary Numbers 11 Binary Operators 17 18 Blank Lines 5 Branch 34 50 Branches Long 26 Branches Short 26 CASE 75 82 83 107 6 Carriage Return 4 Character 66 Character String 66 Character Values 13 Characters 13 Comma 5 26 58 63 Command Field 6 25 59 69 Comment 25 Comment Field
10. ASM switches to state l State 3 skips lines Lines are read and ignored unless they are one of the conditional assembly directives If a nested conditional assembly block is encountered all lines contained in that block are unconditionally skipped If a FIN is encountered we go to states 1 or 2 as appropriate If an ELSE is encountered ASM switches to state 2 If an ELSEIF is encountered then its argument is evaluated If true ASM switches to state 2 otherwise it remains in state 3 State 4 is like state 3 the difference is that ELSE and ELSEIF commands skipped The only directive that will get ASM out state 4 is FIN Copyright C 1977 77 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VIII CONDITIONAL ASSEMBLY DIRECTIVES State 5 is like state 3 but is used to process CASE blocks When state 5 is entered an internal counter records the number of ELSE or ELSEIF lines to be skipped Lines are processed as for state 4 but when an ELSE or ELSEIF is encountered the counter is decremented If the counter then has the value one ASM switches unconditionally to state 3 An unmatched FIN terminates the CASE block and ASM switches to state 1 In the following discussion of the individual directives the operation of each directive in each state will be described Again note that conditional assembly commands do not allow argument expressions involving forward references Copyright C 1977 78 Software D
11. An important feature of any assembler is the ability to represent values symbolically The user thus gains the ability to manipulate values without having to know what the actual values are THE VALUE ASM provides a special kind of implicit value the address that the next byte stored into memory will occupy This value is called the LOCATION COUNTER Whenever a star takes the place of a value in an expression ASM substitutes the current value of the location counter This value can be used like any other value it is never a forward reference At the beginning of each pass has the value zero does not neccessarily remain the same throughout the processing of a statement for example see FDB directive But on most statements particularly all machine language instructions it remains constant until all expressions on that line have been evaluated THE VALUE ASM for 6809 provides second type of instruction counter the location of the start of the next instruction Whenever the star apostrophe appears within an instruction operand it will yield the value of the following instruction s opcode byte If the star apostrophe appears a non instruction line its value is identical with star Examples FDB Same as Same as A SET x as The reason for this special implicit value is it represents the PC program counter value that is used in PC relative address
12. INCLUDE be the target of only if the repeat count is 9 or l Example 0004 0000 00 FCB 0001 00 0002 90 0003 00 0004 00 0000 EQU AB Note that AB has right value Generate 5 bytes of zero And EQUs AB to beginning of bloc Qu Generate ascending powers of 2 in 1 byte table 0008 TBL RPT 8 0005 01 FCB 1 TBL 0006 G2 0007 04 0008 08 0009 10 000 20 000 40 000 80 Copyright C 1977 83 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION IX ASSEMBLY CONTROL DIRECTIVES ASSEMBLY CONTROL DIRECTIVES ASM provides several commands which control various aspects of its operation TERMINATE SOURCE FILE END END lt expr gt MON The END or MON directive informs ASM that there are no more source lines to be assembled When encountered during pass one it causes ASM to rewind the source file open the binary and listing files reprocess the saved operator input lines see Using ASM and then process the source file When encountered during pass 2 it causes ASM to print summaries as requested on the WITH command to close the source binary and listing files and then to exit The following summaries may be printed at the end of pass two Symbol table sorted by name and by value Line numbers on which errors were detected Number of errors detected The last two items will also be printed on the console device END or MON need not be present at the end of a source
13. LSRA ki Hs f der A o 6800 LSRB ve ld cde CX 6800 LSRD e ss 680 LSRA RORB copyright C 1977 38 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION V 6800 6801 MACHINE INSTRUCTION LINES OPCODE OPCODE OPERAND MODE CLASS NOTES AND COMMENTS IEDIIBPR DXIMNRS XTRMHAHR MUL px s Ur diw s 6801 JSR MUL6809 NEG X SC 2 6800 NEGA TOP EDEN 6800 NEGB A P 6800 NEGD P JA 680C NEGA NEGB SBCA 0 NOP aa as Mw 6800 OKRTS Vol cn 680 CLC RTS ORA XX XX X 6800 ORA ORAA X Xx Xu a 6800 ORAB X ON X Xx SES 6800 ORB RNC 6800 ORB ORD XXXI Tu 680C ORB arg l ORA arg PSHA DEus 6800 5 EN E d c 6800 PSHD CCS 680C PSHB PSHA PSHX zc ue dde 6801 See Footnote 5 PULA ECCE ES EP 6800 PULB OU v 6800 PULD ss 680 PULA PULB PULX EI dE 6801 TSX LDX 0 INS INS ROL SCC d vc San van lanse 68900 ROLA Deu wq 6800 ROLB EM MC 6800 ROLD uA ur 680C ROLA ROR XX 6800 RORA K kg f t 6800 RORB 6800 RORD EU us E gt sen 680 RORB RTI yd 6800 RTS E XU 6800 SBA 3 den OCA St a 6800 SBCA Xo X K ub uu 5 6800 SBCB edu 6800 SBCD we 680 SBCB arg l SBCA arg SEC Wc ME nu Hans Geng 6800 Copyright C 1977 39 Software Dynamics ASM REFERENCE M
14. Overflow is reported 3 2 307 5 5 0 5100 5170 0 gt Copyright C 1977 its If the result cannot be represented sum of its two arguments No 5 SFBOO 104 No overflow is reported arithmetic difference 1 SF900 5106 sixteen bit as a arguments together as Overflow is reported 6 5 000 overflow SFCBQ Overflow The arguments zero 1 Integer division 61 SFE 0 Overflow 18 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION III EXPRESSIONS lt A gt lt B gt Doubleslash computes the Covered Quotient of lt A gt and lt B gt Covered Quotient is defined as lt A gt lt B gt 1 lt B gt This operator is useful in computing the number of lt B gt byte units needed to hold lt A gt bytes For example if PROGSIZE is the number of bytes ina program and SECTSIZE is the number of bytes in a disk sector PROGSIZE SECTSIZE is the number of disk sectors required to store that program 3 2 2 307 5 62 SFE00 S 1909 SFE 6170 0 gt 0 Overflow SFF03 109 gt 5100 Note that this works even though FF03 100 1 exceeds 16 bits lt A gt lt B gt 2 computes the remainder of lt gt divided by B 342 1 387 5 2 SFE00NS100 gt 17 C Overflow SFFO03NS100 gt 3 lt A gt lt B gt Doublehash performs logical shift operation lt gt 15 positive the result is A shifted left B b
15. Reserved Symbols SDOS SEDIT SET SET SDOS SETDPR SK1 SK2 SPACE SPC Select Assembly Options Semicolon Shift Short Branches Side Effects 680 Signed Numbers Size Skipped Records Slash Source File Source File Format Source Line Format Stack Addressing 6809 Stack Mode 6899 Star Star Apostrophe Start Address String Subfield Subtract Symbol Definition Directives Symbol Syntax Symbol Table Symbol Table Format Symbol A Symbol B Symbol CC Symbol D Symbol DP Symbol Default Value Symbol 6800 Symbol 6801 Symbol 6809 Symbol PC Symbol PCR Copyright C 1977 86 101 Software Dynamics ASM REFERENCE MANUAL 6 01 83 INDEX Symbol S 16 Symbol U 16 Symbol X 16 Symbolic Values 14 Symbols 15 26 106 Symbols Pre Defined 16 Symbols Reserved 16 Syntax 2 5 27 42 58 TABS 92 96 107 TFR 28 43 112 115 TITLE 6 94 95 TRUE 17 Tab 4 5 66 Times 18 Tutorial 3 Two Pass 3 Unsigned Numbers 9 Values 9 Values Character 13 Values Implicit 14 Values Manifest 10 Values Symbolic 14 WI EXP 86 WITH 7 9 24 84 85 98 199 Zero Offset 6800 31 Zero Offset 6809 46 6890 30 1 6809 45 Copyright C 1977 Software Dynamics
16. LDA X EA X LDB L X SEA Y Copyright C 1977 46 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES 5 BIT 8 BIT AND 16 BIT CONSTANT OFFSET INDEXED MODES Constant offset indexing forms an effective address equal to a constant plus the contents of an index register The constant is embedded in the instruction The constant may be positive or negative There are several sizes constant offsets available on the 6809 Notationally their invocations identical ASM attempts to assemble the shortest form The limitations of the two pass assembly technique force ASM to assume worst case 16 bit offset for those offset expressions containing forward references Prefix notations are provided to allow the programmer to force the offset size 5 8 or 16 bits even in the presence of a forward reference Index Registers X Y U S PC Syntax lt opcode gt lt prefix gt lt expr gt lt reg gt constant offse lt opcode gt lt prefix gt lt expr gt lt reg gt indirect constant offset Illegal for 1 Examples SUBA 2 X 5 DEC 61 Y EA Y 61 STY 27083 U EA U 27983 LEAX DOG S S DOG ADDD CAT Y LDD FRED PC FRED PC offset to FRED STD JOE PC EA JOE PCtoffset to JOE Special operand prefix notations lt lt force 5 bit offset illegal with indirection lt force 8 bit offse
17. Q SFFFE 0 SFFFE is interpreted here as 65534 lt A gt lt lt lt B gt Logical less is like Logical greater but returns l if A is less than lt B gt otherwise 0 3 lt lt 3 gt 3 lt lt 4 gt 1 4 lt lt 3 0 lt lt 0 9 Q SFFFE 1 SFFFE is interpreted here as 65534 lt A gt lt lt B gt Logical less equal is like Logical greater but returns 1 if lt A gt is less than or equal to B otherwise 9 3N 3 gt 1 3N 4 gt 1 4N 3 gt SFFFE lt 0 O lt SFFFE gt 1 SFFFE is interpreted here as 65534 Copyright C 1977 22 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION III EXPRESSIONS COMPLEX EXPRESSIONS ASM allows the user to create complex expressions involving many operators In such expressions the problem arises of order of computation ASM provides two methods of specifying this order OPERATOR HIERARCHY Unless otherwise instructed via the WITH directive the use of parentheses ASM evaluates expressions using an operator precedence algorithm the order of evaluation though generally left to right can be modified according to which operators are used In order to determine whether an operator gets to be evaluated ASM looks at the operators which follow that operator in the expression If the next operator gets to go first ASM performs that operator and uses the result as the right argument to this operator bu
18. SECTION III EXPRESSIONS MANIFEST VALUES Manifest values are those values which are entirely self defining that is the text of the manifest value completely specifies the value to be used This section describes the various manifest constants and their variations DECIMAL NUMBERS The simplest manifest value is a decimal number The value is represented by a string of decimal digits ordinary 10 notation DIGIT DIGIT If the value specified exceeds 65535 Overflow is reported If a letter is detected in the middle of a number Illegal Digit is reported Examples 346 000443 00000001 Many Leading Zeroes is OK 10000000 But this is too big Overflow is reported 1139A4 Also illegal bad digit Copyright C 1977 10 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION III EXPRESSIONS BINARY NUMBERS Numbers may be specified in bases other than base ten Binary base two numbers are represented as follows B DIGIT B DIGIT B DIGIT B DIGIT B lt B DIGIT gt must be either 0 or l If a digit outside this range is seen Illegal Digit is reported If the assembled value exceeds 65535 Overflow is reported Examples 319119 Binary repesentation of 22 base 10 10110 Same thing using suffixed form 111000111000111000 Too big causes overflow 010210 Illegal 2 is not a binary digit Lower case qualifiers are a
19. SECTION VIII CONDITIONAL ASSEMBLY DIRECTIVES FULL DESCRIPTION OF CONDITIONAL ASSEMBLY COMMANDS In this section we present a rigorous description of the conditional assembly commands This section may be skipped by those who do not need to know the exact details of conditional assembly in ASM ASM has five states with respect to conditional assembly Each command will have a different interpretation in each of the five States These states are STATE 1 No conditional assembly blocks are being processed This is the initial state of ASM STATE 2 Lines being assembled within a conditional assembly block STATE 3 Lines are being skipped to the next matching ELSE or ELSEIF STATE 4 Lines are being skipped to the next matching FIN i e to the end of this conditional assembly block STATE 5 Lines are being skipped to the n th matching ELSE State one needs no special description Lines read processed unconditionally When a conditional assembly command is encountered in state 1 ASM switches to one of the other four states depending on the command and its arguments State 2 is similar to state 1 Lines are read and processed unconditionally Unlike state 1 ELSE ELSEIF and FIN commands are valid If an ELSE or ELSEIF command is encountered ASM enters state 4 skipping to the next matching FIN FIN commands are ignored unless the FIN closes the outermost conditional assembly block in this case
20. The name field in the page header is affected PCC has no control over the listing of NAME NAME does not eject a page The following differences between the Motorola standard and ASM should be noted NAME need not be the first statement in a file More than one NAME directive is permitted No restrictions are placed on the possible contents of the name field Copyright C 1977 95 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION IX ASSEMBLY CONTROL DIRECTIVES SPACE LISTING N LINES SPACE EXP SPC SPACE directs ASM to insert EXP blank lines before printing the next line of the listing If EXP is negative no lines are spaced if EXP is zero or missing one line is spaced PCC controls whether SPACE is listed If listed the SPACE command is listed after the spacing operation has been performed In no case will SPACE cause more spaces to be inserted than remain on the current page If LIST Q is in effect no action is taken although the expression is evaluated SET LISTING TABS TABS lt EXPLIST gt TABS allows the user to tell ASM how tabs are to be expanded Each lt EXP gt specifies a column number relative to the first column of the source line which is numbered 1 No lt EXP gt may be less than 2 or greater that 234 No more than eight tab stops may be specified default values for tabs are 9 17 25 33 and 41 every eight columns The tabs must be
21. are EQU d to 0000 0002 00020004 FDB Note that s value changes 0006 0000 FDB Generates 2 bytes of zero 0008 00000000 FDB by Generates 6 zero bytes then 50003 000 00000003 0010 04270000 FDB 427 Note trailing zero pyright C 1977 65 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VII DIRECTIVES FORM CONSTANT CHARACTERS lt LF gt FCC lt DELIM gt lt CHARACTER gt lt DELIM gt FCC causes ASM to assemble the ASCII value of string of characters into memory The first character of the argument string is taken as the delimiter and may character except carriage return All characters between the delimiter and the second occurence of the delimiter character are assembled as the string the most Significant bit of each character will be zero If the line ends before a second occurence of the delimiter is found Illegal String is reported and the carriage return is treated as the end of the string digit may be used as the delimiter of a string provided that the string does not begin with a series of digits followed by a comma The string may contain any ASCII character with the exception of null and carriage return This is an extension over the Motorola standard which only allows characters whose values are between 20 and 55 Tabs contained in the string will be printed as I Any labels present will be EQU d to the location counter before the
22. conditional assembly blocks Instead of writing IF lt EXP1 gt ELSE IF lt 2 gt ELSE FIN FIN one can write lt EXP1 gt ELSEIF lt EXP2 gt ELSE FIN which both is clearer and minimizes the possibility of forgetting a FIN If lt 1 gt is true then the lines up to the first ELSEIF are assembled and the remaining lines up to the FIN are skipped If lt 1 gt is false then the lines up to the first ELSEIF are skipped If lt EXP2 gt is true then the block of lines between the first and second ELSEIFs is assembled and the remainder of the lines up to the FIN are skipped This process of skipping to the next ELSEIF continues until either a ELSE command is encountered or an ELSEIF is encountered with true expression either case all lines up to the next ELSE ELSEIF or FIN are assembled ASM then skips to the FIN which closes this block Copyright C 1977 74 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VIII CONDITIONAL ASSEMBLY DIRECTIVES MULTI CASE CONDITIONAL ASSEMBLY CASE EXP ELSE ELSE ELSE FIN If EXP is negative all lines are skipped to the FIN Otherwise the n th block of lines is selected to be assembled and all others are skipped If EXP is zero the lines between the CASE and the first ELSE is assembled if EXP is one the lines between the first and second ELSE is assembled and so on If EXP is greater than the number
23. file If none is found ASM will supply an END statement END statements accept an optional start address expression in the AF field The expression must evaluate on Pass 2 to non zero value If INCLUDE files are in use END statements INCLUDE d files may set the start address Multiple ENDs may set the start address if they all evaluate to the same value Differing values will cause an error The first value set will prevail NOTE Start addresses of 0 are illegal This is because the object format uses 0 to indicate NO start address Copyright C 1977 84 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION IX ASSEMBLY CONTROL DIRECTIVES SELECT ASSEMBLY OPTIONS WITH lt OPTION gt lt OPTION gt The WITH command provides control over miscellaneous features of ASM It is intended to be input by the operator at the start of the assembly see Using ASM but may also be included in the source file The options in effect at any time are the result of the last WITH command encountered options not specified are not affected The options in effect at the beginning of the second pass are the options in effect at the end of the first pass The following options are specified by default NMCM NLN NLF WI 132 DE 66 DMP EL LST DO Options and their meanings are MCM Motorola compatible Forces dyadic operators to be evaluated strictly left to right This option should be selected when assembling files o
24. of ELSE lines in this CASE block none of the lines are assembled Copyright C 1977 75 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VIII CONDITIONAL ASSEMBLY DIRECTIVES CONDITIONAL ASSEMBLY ON UNDEFINED SYMBOLS IFUND SYMBOL ELSE FIN If the symbol given as an argument 15 undefined or forward reference the block of lines between IFUND and ELSE is assembled otherwise the block of lines between ELSE and FIN are assembled The ELSE portion is optional This form of the IF directive be extremely useful for supplying default values to symbols used in controlling system generation When combined with console input see Using ASM below it allows certain parameters to be changable at assembly time without requiring that they be explicitly specified Example IFUND BUFSIZE BUFSIZE will be BUFSIZE EQU 17 EQU d to 17 only FIN if it isn t already defined CONDITIONAL ASSEMBLY ON DEFINED SYMBOLS IFDEF SYMBOL ELSE FIN This form of the IF directive is the logical opposite of IFUND If the symbol given as argument is defined and not a forward reference the block of lines between IFUND and ELSE assembled otherwise the block of lines between ELSE and FIN are assembled The ELSE portion is optional Example IFDEF BUFFERSIZE This defines BUFFER BUFFER RMB BUFFERSIZE only if BUFFERSIZE is defined FIN Copyright C 1977 76 Software Dynamics ASM REFERENCE MANUAL 6 01 83
25. opcode gt lt expr gt Examples PSHU PC S D DP PULS STKFRAME STKFRAME is some register subset NOTE The use of the D register is equivalent to A B copyright C 1977 51 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES OPCODE MNEMONICS RECOGNIZED BY ASM6809 This table lists all the opcode mnemonics recognized by the ASM6889 The operand modes accepted by ASM for each of the opcodes are marked in the table Additionally there are notations comments and opcode mnemonic classifications The notations will show expansions if the mnemonic causes alternative code or multiple machine instructions to be generated The opcode classes are as follows 6809 6809 Motorola standard mnemonic Generates a conventional 6809 instruction 6800 6800 standard mnemonic which has exact 6899 counterpart The 6809 counterpart is generated 6800EQ 6800 equivalent mnemonic there is no exact 6809 counterpart Notes and comments will show the 6899 instruction sequence substituted The sequence is as close to functionally equivalent to the 6890 mnemonic as possible 680C mnemonic supported in the 680C instruction set One or more 6809 instructions may be substituted Memory reference instructions are limited to a restricted subset of the 6809 indexed addressing forms See Appendix D for more detail OPERAND MODE KEY IDX INDEXED EXT EXTENDED DIR DIRECT IMM IMMEDIATE I
26. 11 labels present an opcode line will be equated to the location counter before the rest of the line is processed Two new inherent addressing mode opcodes are defined 5 1 and SK2 Skip 1 and Skip 2 These opcodes can used to cause the to skip one or two bytes before executing the next instruction changing only the condition code flags These opcodes will work on all standard 6800 6801 CPUs they are really the opcode bytes of Bit A Immediate and Compare X Immediate instructions Note that use of these instructions is NOT generally portable from 6800 to 6809 and vice versa B D S and X may be used as ordinary symbols as long as they are distinguishable from their use as register designators Copyright C 1977 26 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION V 6800 6801 MACHINE INSTRUCTION LINES ASM processes each machine instruction line as follows all labels are first equated to the location counter then the specified is inspected to determine which operand addressing modes legal Finally the operand field is scanned for an appropriate addressing mode specification The opcode is combined with the specified addressing mode to generate the object code corresponding to the desired instruction Many opcodes LDA STAA STX SUBD etc include a register specification A B D X or S as the last letter of the opcode mnemonic There are several opera
27. 3 SECTION X OPERATING ASM After the source file has been successfully opened the following message will be printed Listing File If a listing is to be produced the of the file or device which is to receive the listing should be entered Otherwise empty line indicating No listing desired should be entered If ASM cannot create the file an error message is printed and the prompt is issued again When the listing file has been established the following message will be printed Binary File If a binary object file is to be produced the name of the file which is to receive the binary must be entered otherwise an empty line indicating no object file desired must be entered If ASM cannot create the file an error message will be printed and the prompt will be reissued OPERATOR INPUT LINES At this point all files that need to be opened have been ASM then issues the following prompt and waits for input user now has the option of entering as many valid ASM source lines as desired The assembler will save them in internal scratch storage and process them at the beginning of each pass as though they were attached to the front of the source file This mode can be terminated by inputting an empty line At that point the assembler will enter pass one and begin assembling the user s program These operator input lines are typically used for two purposes to enter WITH directives to establish
28. 4 and COMB COMA EORB EORA arg TST BNE DEC DEC SEC RTS RORA RORB STX LDAA LDAB TSX TXD arg SBCB SBCA arg ANDB ANDA arg IF BNE TSTB FIN BEQ PSHB PSHA their APPENDIX D 680C COMPATIBILITY INSTRUCTION SET equivalent argtl arg argtl arg arg l TEMPX TEMPA TEMPB argtl arg argtl arg M6809 arg Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION XIV APPENDIX D 688C COMPATIBILITY INSTRUCTION SET TSTD TSTD TSTB 6809 6801 SUBD 0 6809 3 TSTA NOTE The instructions BEQD and BNED may be used only immediately following ORD EORD ADDD SUBD ADCD SBCD LDD STD ASLD ROLD COMD NEGD ANDD Side effects to watch for using 680 The side effects should be obvious if careful thought is given to the problem of making 680C code work on any of the 680 processors The contents of the X register will be undefined after execution of 680C instruction that uses S as an index register except LEAS or uses indirection an addressing mode Use of auto increment in an instruction leaves the condition codes in an undefined state The MUL instruction will alter the location TEMPX The PSHX instruction will alter the B register and the location TEMPX The TXD instruction will alter location TEMPX The ABX instruction will alter the B register and the location TEMPX The TDX instruction will alter location TE
29. 520 L 2 4 4 4 4 4 4 4 19 00 RO Software Dynamics 108 Copyright C 1977 ASM REFERENCE MANUAL 6 01 83 SECTION XIII APPENDIX C I O ERROR MESSAGES APPENDIX C Common I O Error Messages ERROR MEANING 1011 Can t find file 1015 Disk space exhausted 1023 File name doesn t start with A Z 5 1034 Illegal Device operation requested Error 1034 generally indicates that output only device has been specified as the source file or that input only device has been specified as the listing or binary file Copyright C 1977 109 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION XIV APPENDIX D 680C COMPATIBILITY INSTRUCTION SET APPENDIX D 680C Compatibility Instruction Set The 680C is an imaginary processor whose instruction set includes most of the 6800 6801 6802 and 6803 instruction sets the exceptions are those instructions dealing with processor context Many of the 6809 functions are supported by the 680 In addition the 680 instruction set includes some instructions which don t exist on any of the real 68Q8x processors but implement frequently used code sequences Note the 6805 is NOT covered by 680C The value of the 680C is that code written using its instruction set will execute any of the 68 x processors although more efficiently on some than on others This means that some features of the more advanced processo
30. 6 Copyright C 1977 Software Dynamics ASM REFERENCE MANUAL 6 01 83 INDEX Comment Line 5 83 Complement 17 Computation 9 17 Conditional Assembly 16 98 Conditional Assembly Details 77 Conditional Assembly General 72 Consecutive Blank 5 Control Characters 4 Covered Quotient 19 Curly Brackets 2 DE EXP 86 DMP 87 DO 79 83 87 98 187 Data Generation Directives 63 Decimal Numbers 19 Delimited 5 Direct Mode 6800 29 Direct Mode 6899 44 71 Directive 25 Directives 58 Divide 18 19 Doubleslash 19 Dyadic Operators 17 18 EDIT 3 99 EL 87 ELSE 72 73 74 75 81 83 98 ELSEIF 72 74 81 83 98 107 END 83 84 89 EQU 6 59 61 63 64 65 66 68 69 71 83 199 EQU Implicit 59 EXG 43 Ellipsis 2 Encryption im 1 Equal 20 Error Line Summary Format 106 Error Lines 87 106 Error Messages 193 Errors I O 109 Exclamation Point 19 Exclusive Or 20 Expression 5 Expression Evaluation Order 9 Expressions 9 23 Expressions 14 Expressions 14 Expressions Arithmetic 18 Expressions Binary 11 Expressions Boolean 20 Expressions Character 13 Expressions Forward References 16 Expressions Hexadecimal 12 Expressions Implicit Value 14 Copyright C 1977 Software Dynamics ASM REFERENCE MANUAL 6 01 83 INDEX Expressions Operators 17 Expressions Parentheses 24 Expressions Precedence 23 Expressions Relational 20 Expressions Special Symbols 14 Expressions Symbols 15 Expressions Values 19 Extended Indirect Mode 6800 3
31. 9 Extended Indirect Mode 6899 45 Extended Mode 44 Extended Mode 6800 29 30 Extended Mode 6809 45 Extensions 26 FALSE 17 FCB 63 69 FCC 6 66 FDB 14 65 69 FFC 68 FIN 72 73 75 79 83 98 Field Argument 6 Field Command 6 Field Comment 6 Field Label 6 Fields 5 Floating Point 68 Form Feed 4 Forward Reference 14 16 26 59 61 64 72 83 107 Greater 21 22 Greater Equal 21 22 Hash 19 Hash Mark 69 Hexadecimal Numbers 12 I O Errors 109 73 79 83 98 107 72 76 80 83 IFUND 72 76 80 83 98 INCLUDE 83 84 88 93 Immediate Mode 6800 Immediate Mode 6899 Implicit Data Implicit Data Generation Implicit Values Inclusive Or Indexed Mode 6890 Indexed Mode 6809 Indirect Mode Inherent Mode 6890 Inherent Mode 6899 Instruction Mnemonics 6800 Instruction Mnemonics 6899 Iterative Assembly Copyright C 1977 34 50 25 69 14 Software Dynamics ASM REFERENCE MANUAL 6 01 83 INDEX LF 6 58 86 LIST 93 96 LN 86 LO 90 LST 87 Label Field 6 58 59 61 Labels 26 27 42 Less 21 22 Less Equal 21 22 Line Format 5 6 7 Line Listing Format 92 Line Numbers 7 8 86 Line Processing 25 27 42 Listing 87 Listing Control 9 Listing File 100 Listing Depth 86 Listing Width 86 Location Counter 14 26 27 42 63 83 Logical Inverse 17 Long Branches 26 6800 16 6801 16 85 6809 16 M680C see 680 26 MCM 85 MON 83 84 Machine Instruction Line 25 Machine Instruction Line 6800 68901 26 Machine Instruction Line 68
32. 99 41 Manifest Constants 18 Manifest Values 19 Memory 106 Minus 17 18 Monadic Minus 69 Monadic Operators 17 Monadic Plus 69 Motorola 9 26 85 88 95 Multiply 117 NAM 95 NAME 95 NDMP 87 NDO 87 NEL 87 NLF 86 NLN 86 NLST 87 NMCM 85 Negate 17 Next Instruction Address 14 Copyright C 1977 Software Dynamics ASM REFERENCE MANUAL 6 01 83 INDEX Not Equal 20 Notation 2 27 34 35 42 50 52 58 Numbers Binary 11 Numbers Decimal 16 Numbers Hexadecimal 12 Numbers Octal 11 Numeric Values 9 OPT 88 ORG 71 107 Octal Numbers 11 Opcode 27 42 Opcode Mnemonics 6800 35 Opcode Mnemonics 6809 52 Opcodes 25 Operation of ASM 99 Operator Input Lines 100 Operator Precedence 9 23 85 Operators 9 17 23 Options 72 85 Or 19 Order of Evaluation 23 PAGE 95 PC 14 PCA 98 197 PCC 93 94 95 96 97 98 1907 PGEN 97 107 PSHS 51 PSHU 51 PSR 97 1907 PULS 51 PULU 51 Page Heading Format 91 Parentheses 9 24 Pass One 3 16 84 85 94 Pass Two 3 16 84 85 94 Plus 17 18 Pre Defined Symbols 16 Prefix 29 30 45 48 Prefix lt 6800 29 lt 6809 44 48 Prefix gt 6800 30 Prefix gt 6809 45 48 Program Counter Relative 6809 14 48 Push Pop 6809 51 Qualifiers 11 12 Quote Character 13 RMB 64 RMP 107 RPT 83 89 98 107 Redefinition 61 Register 27 42 Copyright C 1977 Software Dynamics ASM REFERENCE MANUAL 6 81 83 INDEX Register 6809 Register Register Mode Relational Operators Relative Mode 6800 Relative Mode 6809 Remainder
33. ANUAL 6 01 83 SECTION V 6800 6801 MACHINE INSTRUCTION LINES OPCODE SEI SEV STA STAA STAB STB STD STS STX SUBA SUBB SUBD SWI TAB TAP TBA TDS TDX TFR TPA TSD TST TSTA TSTB TSTD TSX TXD TXS WAI Footnote Footnote Footnote Footnote Footnote Copyright C 1977 OPRAND MODE CLASS PS PE 2 NOTES AND COMMENTS HJ tn 02 T I B M R M A s 6800 wo dw DE d 6800 STAB arg STAB arg l STAA arg o Co WO oue s 6801 SUBB arg l SBCA arg X X 680C STD TEMPX LDS TEMPX 680 TFR D X RC 4 680C TAB or TBA Hv 680c TSX TXD s ier 680 SUBD 50000 680C STX TEMPX LDD TEMPX OM 04 STAB TEMPX 1 ADDB TEMPX 1 STAB 1 LDAB TEMPX XV ADCB 0 5 TEMPX LDX TEMPX CMPB arg l BNE xxx CMPA arg TST arg l BNE xxx DEC arg xxx DEC arg l INC arg l BNE xxx INC arg STX TEMPX LDAB 1 PSHB LDAB PSHB 40 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES 6809 MACHINE INSTRUCTION LINES The major function of an assembler i
34. DED MODE EXTENDED INDIRECT MODE INDEXED ZERO OFFSET INDEXED MODE 8 BIT CONSTANT OFFSET INDEXED MODE AUTO INCREMENT DECREMENT INDEXED MODE RELATIVE MODE IMMEDIATE MODE OPCODE MNEMONICS RECOGNIZED Copyright C 1977 LINES MACHINE NADA AU i Software Dynamics ASM REFERENCE MANUAL 6 01 83 6809 MACHINE INSTRUCTION LINES INHERENT MODE e au au REGISTER REGISTER MODE e DIRECT MODE EXTENDED MODE o EXTENDED INDIRECT INDEXED MODE o o ZERO OFFSET INDEXED MODE E 5 8 AND 16 BIT CONSTANT OFFSET INDEXED MODE PROGRAM COUNTER RELATIVE INDEXED ACCUMULATOR OFFSET INDEXED MODE AUTO INCREMENT DECREMENT INDEXED MODE RELATIVE MODE e e a au a au a IMMEDIATE au au o STACK MODE e e e OPCODE MNEMONICS RECOGNIZED DI RECTIVES SYMBOL DEFINITION DIRECTIVES EQUATE EQU IMPLICIT EQUATE EQU e 8 e w a o SET e e e e DATA GENERATION DIRECTIVES FORM CONSTANT BYTE gt RESERVE MEMORY BYTES e FORM DOUBLE BYTE CONSTANT FORM CONSTANT CHARACTERS FORM FLOATING POINT NUMBERS
35. EQ ORCC 510 SEV a 68090EQ ORCC 2 SEX ee ae ae 6809 STA uh de s SEN PES 6809 680 ay 6800EQ STA STAB MOM See 68090EQ STB STB Rox MEE 6809 680 STD X X X wu x 6809 680C STS LX M RES 6809 6800 STU X XX 2 6809 STX X X Xu d du 6809 68900 STY dp dae 22422 Mos 6809 SUBA dae de c es PEE 6809 68090 SUBB X Fu 6809 68900 SUBD YON AN X wi uer i 6809 680 SWI 6 E CP ET 6809 68900 SWI2 a EP qe 6809 SWI3 gt X E 6889 SYNC NC Ae 3 25 0 6809 Ust 680 TFR A B TSTA C e MEE 6800EQ TFR A CC TBA TUN YO eee a 6800EQ TFR B A TSTA TDS M ee ues ts 680C TFR 5 TDX pex we QUI zu de 680C TFR D X TFR o chc tuo 68909 TPA TE m 6800EQ TFR CC A TSD af ce ee Ses Sw 680 TFR 5 0 TST gt gt e UP ME S 6809 68090 TSTA Ao 6809 6800 TSTB E 6809 6800 TSTD D dux 680 SUBD 50000 TSX gsr Se 680 TFR S X TXD ub v s 680 TFR X D TXS 6800 5 kod A 680 SFF Footnote l TST arg INBNE xxxNDEC arg xxx DEC arg l Footnote 2 arg INBNE xxx INC arg xxx Copyright C 1977 57 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VII DIRECTIVES DIRECTIVES Directives are used to control the action of in ways not directly related to the generation of machine language opcodes Through
36. Examples 16 Hex representation of 22 base 19 16H Suffix form of same number Suffix form of SAE AEH Invalid this is a symbol SEG Invalid G is not a hex digit SFFFE3 Invalid too big for 16 bits Overflow reported Lower case digits and qualifiers are accepted Copyright C 1977 12 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION III EXPRESSIONS CHARACTER VALUES A value may be specified in terms of the ASCII code of an input character Such values have the following form CHARACTER The is a single quote character ASCII 27 CHARACTER may be any character except carriage return subject to the restrictions mentioned in the section on Source File Format If the character is a tab it will be listed as I for improved readability hence the only time one will see followed by a blank in a listing is when the quoted character actually is a blank The value used will be the 7 bit ASCII value of the character with zeroes extended to fill the 9 most significant bits of the value Examples A Specifies the value 65 base 18 Specifies the value 32 i e quoted blank ENT Specifies the value 9 CR Invalid illegal string is reported Copyright C 1977 13 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION III EXPRESSIONS IMPLICIT VALUES Obviously manifest values would not very useful by themselves
37. FFE Q 0 Q SFFFE 1 Note that SFFFE is interpreted here as 2 lt A gt gt lt B gt lt A gt gt lt B gt Greater equal is like Greater but returns 1 if lt A gt is greater than or equal to lt B gt 3 gt 3 gt 1 3 gt 4 gt 0 4 gt 3 gt 1 gt 0 gt 4 Q SFFFE 1 is interpreted here 2 lt A gt B Less is like Greater but returns l if A is less than lt B gt 0 otherwise 3 3 gt 0 3 lt 4 gt 4 4 lt 3 gt 0 SFFFE lt gt 1 G SFFFE gt g SFFFE is interpreted here as 2 lt A gt lt lt B gt lt A gt lt lt B gt Less equal is like Greater but returns 1 if lt A gt is less than or equal to B 0 otherwise 3 3 1 3 lt 4 1 4 lt 3 gt 0 lt 0 gt 1 G SFFFE 0 SFFFE is interpreted here as 2 Copyright C 1977 21 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION III EXPRESSIONS lt A gt gt gt lt B gt Logical greater compares its arguments as UNSIGNED numbers it returns 1 if lt A gt is greater than lt B gt otherwise 0 3 gt gt 3 gt 0 3 gt gt 4 0 4 3 gt 1 SFFFE Q 1 Q SFFFE 0 SFFFE is interpreted here 65534 A B Logical greater equal is like Logical greater but returns l if A is greater than or equal to B 0 otherwise 3 3 1 3 4 gt 4 gt 3 gt 1 SFFFE Q 1
38. IONS ASM dynamically allocates memory at runtime for the following kinds of data User defined symbols require at least 7 bytes storage The amount used by a given symbol will be 6 LEN SYM where LEN SYM is the number of characters in the symbol name Only the first thirty two characters of a symbol name saved Operator input lines require amount of space that varies with the length of the line The formula is 3 LEN LINE where LEN LINE is the number of bytes in the line including carriage return error line numbers require 6 bytes of space each ASM will automatically use all the memory between the end of ASM and the top of the user space see SDOS manual It is recommended that ASM be run a system with at least 16K bytes of user space This will allow approximately 4K bytes of usable space for ASM runtime tables Copyright C 1977 106 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION XI APPENDIX A ASM DIRECTIVES WHICH DISALLOW FWD REF APPENDIX ASM Directives which Disallow Forward References The following directives will not allow the user to use forward references in their argument lists CASE DO ELSEIF IF ORG PCA PCC PGEN PSR RMB RPT SET SETDPR SPACE TABS Copyright C 1977 107 Software Dynamics APPENDIX B ASCII CHARACTER SET ASM REFERENCE MANUAL 6 01 83 APPENDIX B ASCII Character Set SECTION XII 30 540 550 60 79
39. LE PROCESS ASM LISTING FILE BINARY FILE gt 3 Assemble PROCESS ASM generate listing but do generate a symbol table dump the printer device The listing format used will match the printer s width and depth specified by the SET program ASM VERSION l x xxxx SOURCE FILE PROCESS ASM LISTING FILE LPT BINARY FILE WITH NLST DMP gt Copyright C 1977 191 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION X OPERATING ASM 4 Assemble 55 5 generate a PROCESS LPT and specify default used with files listing in file listing page sizes overriding the ASM VERSION l x xxxx SOURCE FILE PROCESS ASM LISTING FILE PROCESS LPT BINARY FILE gt WITH WI 195 DE 51 gt 5 Assemble PROCESS ASM generate listing before generate binary specify listing format and define certain symbols that control conditional assembly of PROCESS ASM VERSION 1 xxxx SOURCE FILE PROCESS ASM LISTING FILE PROCESS LPT BINARY FILE PROCESS BIN gt WITH 1 105 DE 51 gt MEMSIZE EQU 54000 PROGBASE EQU 51000 gt USEFLOPPY EQU 1 gt Copyright C 1977 102 Software Dynamics Pun ASM REFERENCE MANUAL 6 01 83 SECTION X OPERATING ASM ERROR MESSAGES If an error is detected while processing a source file the following actions are taken The line and the error messages are listed on the console unless WITH NDO was specified printed error message refers to th
40. M REFERENCE MANUAL 6 01 83 SECTION VII DIRECTIVES SET LOCATION COUNTER ORG EXP ORG directs ASM to set the location counter to the value given as the argument lt EXP gt is interpreted as a sixteen bit unsigned value and may not involve a forward reference Any labels will be EQU d to the NEW location counter If lt EXP gt is forward reference Illegal Value is reported and the location counter is not changed value of the location counter will be listed Examples 0010 ORG 510 loc is listed 0020 ORG 20 Labels are EQU d 0020 I After the ORG 0020 Illegal J is forward ref Tllegal Value 0020 0020 FDB Note that the ORG 0100 EQU 5100 wasn t performed SET DATA PAGE REGISTER LF SETDPR EXP SETDPR directs ASM to assume the DP Data Page register has the value EXP 100 the upper 8 bits of the 16 bit value EXP when attempting to generate Direct Mode addresses This pseudo op is only available in the 6899 assembler The default value selected at the start of each assembly pass is labels will be ignored If lt gt is a forward reference Illegal Value is reported and the assumed value for the DP is set to zero The address of the page to which DP is set is listed Examples 1 00 ORG 51 00 0100 SETDPR 5123 DP page address listed 0000 SETDPR J ILLEGAL J is forward refer
41. M switches to state 4 and skips all lines in this block If zero it switches to state 2 and processes the lines up to the first ELSE If 1 it switches to state 3 and skips to the first ELSE Otherwise it enters state 5 and skips to the n th ELSE clause STATE 2 Like state 1 with the additional checks described in IF state 2 STATE 3 All lines the conditional assembly block opened by the CASE are skipped STATE 4 Like state 3 STATE 5 Like state 3 Copyright C 1977 82 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VIII CONDITIONAL ASSEMBLY DIRECTIVES SINGLE LINE ITERATIVE ASSEMBLY LF RPT EXP RPT causes ASM to assemble the next source line zero or more times If lt EXP gt is zero or negative the next line is skipped If lt EXP gt is positive the next line is repeated as many times as specified EXP may not involve a forward reference Any labels present will be EQU d to the location counter before the line is processed The target of the RPT may not be any of the following directives CASE DO ELSE ELSEIF END FIN IF IFDEF IFUND MON RPT If such a line is discovered as a target of an RPT Nesting Error is reported and the line is always processed once Comment lines encountered between the RPT the next non comment line will be printed and ignored NOT repeated If EXP involves a forward reference Illegal Value is reported and the effect is RPT 0
42. MPX The CPX instruction will alter the carry condition The TFR instruction will alter all arithmetic conditions except carry The memory locations 00 18 do not exist on the 680C as this would be incompatible with the 6821 Double register instruction operations are not indivisible with respect to interrupts These instructions should NEVER be used in interrupt service routines The instruction sequence interrupted may use TEMPX Copyright C 1977 115 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION XIV APPENDIX D 680C COMPATIBILITY INSTRUCTION SET Sample 680C code works on 6800 6801 and or 6809 Search BUFFER in blocks of 4 for word TARGET SEARCHBUFFER LDD WORD Note we can do this on 6899 LDX BUFFEREND 2 SEARCHBUFFERLOOP LEAX 2 X CMPX BUFFERBASE buffer searched BEQ SEARCHBUFFERFAIL 5 yes didn t find it CMPD CMPD would destroy CC bits BNE SEARCHBUFFERLOOP note use of BNE not BNED here RTS assent carry is reset SEARCHBUFFERFAIL Signal fail exit with carry set ERRORRTS Copyright C 1977 116 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION XIV APPENDIX D 680 COMPATIBILITY INSTRUCTION SET NOTE When the target processor of an assembly is a 6890 the MUL instruction is emulated by emitting a JSR 1 6809 instruction The user is responsible for supplying that code preferably using conditional assembly IF 6800 MUL6809 Subroutine
43. NDED DIR DIRECT IMM IMMEDIATE INH INHERENT BRA BRANCH PSH PUSH PULL R R REG REG Copyright C 1977 35 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION V 6800 6801 MACHINE INSTRUCTION LINES OPCODE OPCODE OPERAND MODE CLASS NOTES AND COMMENTS IEDIIBPR DXIMNRS XTRMHAHR ABA AGE wu s S 6800 274 PEN 6801 See Footnote 1 ADCA X X X Xu 6800 ADCB X X DIRE A os 6800 ADCD XX X6 os 680C ADCB arg l arg ADDA qb db RENTE 6800 ADDB XX X X kn 6800 ADDD XX OX OX uo 6801 ADDB arg l arg ANDA e ge qe lab 6800 ANDB p up dp CE BAG 6800 ANDD OD qe 6800 ANDB arg l ANDA arg ASL EM 6800 ASLA MN fet AE EC 6800 ASLB EE 6800 ASLD NER X Dore 6801 ASLB ASLA ASR d APPLE 6800 ASRA OPES vie 3 6800 ASRB a ten 9 6800 DEC 680C ASRA RORB BCC E Gi 6800 BCS wow d ox ct ub 6800 Ws ah dam aie 6800 kn ki 680C BNE xxx V TSTA xxx BEQ arg BGE ve Vet uiuo gt 6800 BGT n DR 6800 BHI d wo 8 QU d 6800 BHS 6800 X esc DES us 6800 BITB X X X Ni ee 6800 BLE I NOE NE EE 6800 BLO mln oum 6800 BLS T D Bee 6800 BLT seus E E 6800 BMI e dep ade o tae ws 6800 BNE 5 w 6800 BNED ie OE d 680C BEQ xxx TSTA xxx BNE arg BPL AE o 68090 BRA w c
44. NH INHERENT BRA BRANCH PSH PUSH PULL R R REG REG Copyright C 1977 52 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES OPCODE OPERAND gt lt ADCD ADDA ADDB ADDD ANDA ANDB ANDC ANDCC ANDD ASL ASLA ASLB ASLD ASR ASRA e ASRD BCC BCS eO XXX X KKM KKK MM o eM XXX XXX wo XXX X XXXXX e e e BEQD BGE e BHI gt 2 BHS MEC BITA XX BITB XX BLE BLO BLS e BLT P BMI ET Us BNE BNED BPL P BRN ai l BSR M BVC BVS Copyright 1977 54 e MODE D uu 54 9A CLASS 6800EQ 680C 6809 680 6809 6800 6809 6800 680C 6809 68900 6899 6800 6809 680 6809 6800 6809 6800 6809 6809 680 6809 6800 6809 68900 6809 68900 680C 6899 6800 6809 68900 6809 6800 680C 6809 68900 6809 6890 6809 68900 680c 6809 6809 6809 6800 6809 68900 6899 68900 6809 68900 6899 6800 6899 6800 6809 6800 6809 68900 6809 68900 6809 6800 680C 6809 68900 6809 6800 6809 6809 6800 6809 6800 6809 6800 53 NOTES AND COMMENTS PSHS ADDA 5 ADCB arg l arg Alternative for ANDCC ANDB arg l MANDA arg ASLB ASLA AS
45. RA X RORB Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES OPCODE OPERAND CBA CLC CLI CLR X CLRA CLRB CLV CMPA CMPB CMPD CMPS CMPU CMPX CMPY COM COMA COMB COMD CPX CWAI DAA DEC DECA DECB DECD DES DEX EORA EORB EORD ERRORRTS EXG INC INCA INCB INCD INS INX Ke t PX Bt 2 e gt e Copyright C 1977 Pin ot non e gt MODE D uU Xr CLASS 6800 0 680 6800EQ 6800 6809 6800 6809 6800 6809 6800 6800EQ 6809 6809 6809 68090 6809 680 6809 6809 6809 6800 6809 6809 6800 6809 6800 6809 6800 680C 680EQ 6809 6809 6800 6809 6800 6809 6800 6809 6800 680 680 680EQ 6809 6800 6809 68909 680 680C 6809 6809 6800 6809 6800 6809 6800 680 680EQ 680EQ 54 NOTES AND COMMENTS PSHS B CMPA 5 ANDCC ANDCC SEF ANDCC SFD COMB CMPX See Footnote 1 LEAS 1 5 LEAX 1 X EORB arg l EORA arg ORCC 1 RTS See Footnote 2 LEAS 1 5 LEAX 1 X Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES OPCODE JMP
46. RAND MODE CLASS NOTES AND COMMENTS IEDIIBPR DX IMNRS XT RM HAHR gt gt ae a aa 6800 JSR X X 6 wy uj 6800 LBCC DIE E Pr 680 BCS xxx NV JMP arg LBCS EP EE E 680 xxx JMP arg LBEQ ke wc dee excu 5 680C BNE xxx N JMP arg LBGE KW sx v 68 BLT xxx JMP arg LBGT Wo ue el Yi 680C BLG xxx JMP arg LBHI wl us 680 BLS xxx JMP arg LBHS EPI REPRE Sa mi 680 BLO xxx JMP arg LBLE 2 A de 680C BGT xxx JMP arg LBLO RD EC 680 BHS xxx JMP arg xxx LBLS p Sur es 680C BHI xxx JMP arg LBLT UE QD US c 680C xxx JMP arg LBMI fe RUINIS 680C BPL xxx JMP arg xxx LBNE WE 680 BEQ xxx JMP arg xxx LBRA I CE 680C JMP xxx LBVC E Ue uva e 680 BVS xxx JMP arg xxx LBVS ICE ED ee ee 680C BVS xxx JMP arg xxx LDA X XXX e a 6800 LDAA arg LDAA X X X KX e es ou 6800 LDAB XX XX t 6800 LDB 6800 LDAB arg LDD 6801 LDAB argtl N LDAA arg LDS X XXX 6800 LDX X X XX 6809 LEAS Auf 680 arg INS LEAX XC ous Ue a INT 6800 RPT arg LSL X X Vx d cs 6800 ASL arg LSLA E npe vide v 6800 ASLA LSLB e uw SI Ja s 6800 ASLB LSLD s UE Wi 680C ASLB ROLA LSR KOX e ke 6800
47. SHX PULA PULB PULD PULS PULU PULX ROL X ROLA ROLB ROLD ROR RORA RORB RORD RTI RTS SBA SBCA SBCB SBCD SEC e e e Me e e 2 4 NX e o lt o JT Copyright C 1977 dd dd X e e e Me e e e e Me MODE CLASS 6809 680 6809 6800 6809 6800 6809 6800 680 6809 6800 680 6809 680 6800EQ 6800EQ 6809 680 6809 680 6800EQ 6800EQ 680C 6809 6809 680C 6800EQ 6800EQ 6800EQ 6809 6809 680C 6809 68900 6809 6809 6809 6800 680 6809 6800 6809 6800 6809 6800 680C 6809 6800 6809 68900 6800 0 680 6809 6800 6809 6800 680C 6800EQ 56 NOTES AND COMMENTS NEGA NEGB SBCA 0 ANDCC SFE RTS ORA ORB ORB arg l ORA arg PSHS PSHS PSHS PSHS PULS PULS PULS PULS ROLB RORA PSHS SBCB ORCC A B D ROLA RORB SUBA 5 arg l SBCA arg 501 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES OPCODE OPCODE OPRAND MODE CLASS NOTES AND COMMENTS IEDIIBPR DXIMNRS XTRMHAHR SEI E auc e 6800
48. The minus sign will have its usual effect Labels present on the line will be EQU d to the location counter before the statement is processed If an expression contains a forward reference or an undefined symbol it will be assembled into two bytes unless a prefix of or is present Each expression is output as soon as it has been evaluated This means that will have a different value for each expression across the line Copyright C 1977 69 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VII Examples 0000 07 0001 0105 0011 0003 11 0004 11 0005 0011 0000 Tllegal Argument 0007 009 0009 9F GOOF OF 3FQ1 0008 3F01 003 2000 3F1132 0010 FE 0011 0013 0015 020002 DIRECTIVES EQU SWI GETC EQU SWI Copyright C 1977 195 EQU 17 EQU EQU EQU EQU 7 7 SOF 7 3F01 SWI GETC EQU S3F SWI Z 58 70 Generates one byte Generates two bytes Define symbol called EQU Generate the value like this Like this or like this But not like this Generates 2 bytes as forward ref Unless qualified Define 7 Now it generates one byte This feature can be very useful Generates SWI followed by code Generates SWI followed by stuff Note minus sign forces 1 byte Brackets cause default Hash ensures two bytes Note all EXPs can be prefixed Software Dynamics AS
49. UCTION LINES The major function of an assembler is the translation of symbolically specified machine instructions into a form directly understandable by the target computer This section describes instructions translated by ASM6800 and presumes knowledge of the 6800 6801 instruction set which can be found in the Motorola MC6801 Programming Manual ASM is fully compatible with the Motorola 6800 standard assembler syntax with several useful extensions 6801 opcodes are assembled if enabled by use of WITH 6801 directive 6800 equivalent instructions are assembled for 6801 instructions if a WITH 6801 directive is not given 6809 assembly mnemonics and address modes are supported This considerably simplifies construction of programs that will run on either processor depending on which assembler is used See section on 680 Special set of opcodes to allow coding to work on 6800 6801 and 6809 These opcodes are called 680C opcodes See Appendix D Many convenience instructions included in 680 which act as logical extensions to the 00 09 instruction set such as double register shifts 16 bit memory increments and decrements etc Automatic long branching Short branches that are out of range will be assembled as a branch on complementary conditions around a JMP to the destination if the destination expression contains no forward references Multiple labels are allowed separated commas
50. at the line number can be absent TAB LABEL TAB LDAA TAB FROG LN d LF CF AF The moral is be careful with line numbers Copyright C 1977 8 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION III EXPRESSIONS EXPRESSIONS ASM provides the user with the ability to perform sophisticated computations at assembly time ASM expression handling represents a significant step beyond the capabilities provided by Motorola standard assemblers Many more operators are handled as well parenthetical and heirarchical grouping of subexpressions These extensions do not represent a burned bridge between ASM and Motorola standard assemblers in fact ASM be directed via the WITH command to supress heirarchical considerations evaluate operators from left to right thus sources currently in development using Motorola standard assemblers can be shifted to ASM without difficulty VALUES Numeric values can be specified in expressions in two ways manifestly and implicitly All values share certain attributes They are all sixteen bit quantities They are usually considered as two s complement signed numbers where the most significant bit is the sign of the number positive if reset negative if set Certain Operators treat the values l6 bit unsigned quantities in particular the multiply and divide group Copyright C 1977 9 Software Dynamics ASM REFERENCE MANUAL 6 01 83
51. ated immediate mode The size of an immediate operand is determined by the instruction not the operand some instructions use 16 bit immediate operands while Others use 8 bit immediate operands The notation lt expr gt is used to specify an immediate operand if only 8 bits are required by the instruction the expression value must be in the range 128 to 255 or an error will result Syntax opcode lt expr gt Examples ADDA 1 adds 1 to A register CMPD 54071 LDY BUFFER 2 SUBB BUFFERM256 same general effect SBCA BUFFER 256 as SUBD BUFFER Copyright C 1977 50 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES STACK MODE This mode may only be used with PSHS PSHU PULS and PULU instructions The operands in this mode are registers to be pushed or pulled from a stack user or system operand field consists of a sequence of register names separated by commas or a single immediate mode expression The ordering of registers is arbitrary since the order of PUSH PULL is fixed Mention of a register name sets the appropriate corresponding bit in the postbyte of the instruction If an immediate expression is used the lower 8 bits of the expression are used as the post byte The immediate form has the advantage of allowing register groups to be symbolically named Registers PC S U Y X DP B A D CC Syntax lt opcode gt lt reg gt lt reg gt lt
52. ause FDB s with values 10 down to 1 and 10 to be generated END statements are optional in INCLUDE files When they used they may specify a start address See END for more detail INCLUDE statements may be the target of RPT statements if the count is 8 or l other count will produce a nesting error Thus a RPT may be used for conditional INCLUDES Copyright C 1977 89 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION IX ASSEMBLY CONTROL DIRECTIVES LISTING CONTROL AND FORMATTING ASM has an range of listing formatting options allowing the professional user great flexibility in generating listings which will also serve as documentation It is important to understand two underlying design goals of the listing portion of ASM Any line which is determined to be in error will unconditionally be sent to the listing device regardless of the various listing control options Such lines will also be sent to the console device unless supressed WITH NDO The lines will be printed on the console exactly as formatted for the listing If WITH NLST was specified see Assembly Control then ONLY error lines will be listed particular the LIST directive cannot override the NLST option LIST was designed to be used in formatting listings as they are produced At no time will a totally blank page be printed Consecutive page eject commands or spacing operations which cross multiple page boundaries w
53. bed previously Examples LDA X X X 1 S Y Y 1 EA Y LDD X EA X X X 2 STX Y Y 2 EA Y LDX St EA Y 42 Y Y 2 Copyright C 1977 33 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION V 6800 6801 MACHINE INSTRUCTION LINES RELATIVE MODE The branch Bxx and LBxx class of instructions use this mode There are two offset sizes used in relative mode 8 and 16 bits The 8 bit form is invoked with instruction mnemonics of the form Bxx and the 16 bit with LBxx The effective address is equal to the address the next instruction plus the value of the sign extended constant offset embedded in the instruction The LBxx form generates 2 M6800 instructions a conditional branch on the opposite condition around a JMP extended to the destination Syntax Bxx lt expr gt LBxx lt expr gt Examples BRA BLIMP LBCC ZEPPELIN NOTE If the 8 bit form Bxx is requested and the lt expr gt expression is evaluable on Pass 1 to a destination that is out of range ASM will substitute the 16 bit LBxx form IMMEDIATE MODE Many 6890 instructions use a constant embedded in the instruction rather than an operand in a memory location separate from the instruction This is designated immediate mode The size of an immediate operand is determined by the instruction not the operand some instructions use 16 bit immediate operands while others use 8 bit immediate operands T
54. bler computational power due to extensive operator set Big assembler performance due to hash coded symbol table lookup Symbol table dumps sorted by name and by value unused symbols are flagged Big assembler error diagnosis Readable error messages produced on the listing error lines are always listed and a special summary at the end of the assembly tells you which lines had errors 68 0 coding style allows code to work on 6800 6801 or 6809 by simply reassembling Copyright C 1977 1 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION I INTRODUCTION NOTATION DEFINITION When introducing construct or command the following notation will be used to describe its allowable syntax Graphic characters e g and symbols printed in upper case denote strings of characters which must be present exactly as written in the manual Example X denotes the string Symbols written in angle brackets denote a class of possible inputs For example NUMBER denotes any string which conforms to ASM s definition of number Hence the string 345 would qualify Curly brackets are used to denote that a certain item is optional 6x indicates that the string X may occur but need not Ranges of possibilities of which one must be chosen are denoted by listing the alternatives vertically X X EXP X indicates that either X X or an expression followed by X
55. carry undefined TAB and TBA can be used if setting the CC bits is desired but TFR is faster otherwise Copyright C 1977 112 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION XIV APPENDIX D 680C COMPATIBILITY INSTRUCTION SET The 6809 instruction CMPD conditional branch restrictions the instructions subject to the addressing and above is included in 680C Only LBNE BCC BHI LBHI LBLO BHS but cannot have auto post increment of any kind in are not allowed 11 LBEQ BNE LBCC BCS LBCS BLS LBLS BLO LBHS may immediately follow the CMPD instruction The instructions JMP JSR are allowed any addressing mode The following 6809 instructions instructions using the U or this list ANDCC BRN CMPS LBRN LBSR ORCC PULS PULU SEX SYNC Copyright C 1977 Y registers are implicit members of CWAI EXG PSHS PSHU SWI2 SWI3 113 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION XIV Instructions expansions are NEGD ORD INCD OKRTS ROLD TDX TDS ASRD ADCD BNED PULD Copyright C 1977 peculiar NEGA NEGB SBCA ORAB ORAA arg INC BNE INC CLC RTS ROLB ROLA STAA STAB LDX TDX TXS ASRA RORB arg ADCB ADCA PULA PULB to the 0 arg l arg arg l arg TEMPA TEMPB TEMPX arg l arg 6809 arg arg 680C COMD EORD DECD ERRORTS RORD TXD TSD SBCD ANDD BEQD PSHD 11
56. constant offset Examples SUBA 2 X 5 61 5 EA 5 1 61 ADDD 1 opyright C 1977 32 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION V 6800 6801 MACHINE INSTRUCTION LINES AUTO INCREMENT DECREMENT INDEXED MODE Index registers on the 6809 may be automatically stepped by 1 2 1 2 bytes ASM6800 simulates this for 680 Increments done AFTER the memory reference and hence annotated FOLLOWING the index register i e the effective address is the original contents of the index register Decrements done PRIOR to the memory reference and annotated PRECEEDING the index register 1 Y the effective address is the contents of the index register after it is decremented Indirection is permitted but only with the double stepped forms Index Registers X S Syntax lt opcode gt lt gt lt opcode gt lt rego gt t lt opcode gt 7 lt reg gt lt opcode gt lt gt lt opcode gt lt reg gt lt opcode gt lt reg gt ASM6800 substitutes for each of the above lt opcode gt lt reg gt lt IN lt reg gt lt opcode gt lt reg gt lt reg gt t IN lt reg gt IN lt reg gt DE lt reg gt lt opcode gt lt reg gt lt gt DE lt reg gt reg DE lt reg gt lt opcode gt lt gt Indirect mode is treated as descri
57. ctive serves to separate groups of lines within a conditional assembly block into clauses STATE 1 Nesting Error is reported no other action is taken STATE 2 ASM unconditionally changes to state 4 and skips the remaining lines in this conditional assembly block STATE 3 ASM unconditionally changes to state 2 and begins assembling lines STATE 4 The directive is ignored STATE 5 The case counter is d cremented If its value is now l ASM switches to state 3 otherwise it remains in state 5 CONDITIONAL ELSE ELSEIF EXP The ELSEIF directive is designed to allow the user to have multiple alternatives without having to nest conditional assembly blocks ELSEIF is legal anywhere an ELSE is although CASE blocks it should be used with caution as its misuse can lead to difficult code to read STATE 1 Nesting Error is reported no other action is taken STATE 2 Exactly like ELSE STATE 3 It is this state which distinguishes ELSEIF from ELSE lt EXP gt is evaluated and if true positive and non zero ASM switches to state 2 Otherwise ASM remains in state 3 STATE 4 Same as ELSE STATE 5 Same as ELSE Copyright C 1977 81 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VIII CONDITIONAL ASSEMBLY DIRECTIVES CASE CONDITIONAL ASSEMBLY CASE EXP The CASE directive causes ASM to select one of the subsequent ELSE clauses to be assembled STATE l EXP is evaluated If negative AS
58. ddress 15 the contents of the index register after it is decremented Indirection is permitted but only with the double stepped forms Syntax lt opcode gt lt reg gt lt opcode gt lt reg gt lt opcode gt 7 lt reg gt lt opcode gt lt gt opcode lt reg gt lt opcode gt lt reg gt Examples LDA X X X 1 STA 7Y Y 1 EA Y LDD EA X X X 2 STX puny 7 2 EA Y LDX Y EA Y 2 2 Copyright C 1977 49 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES RELATIVE MODE The branch Bxx and LBxx class of instructions use this mode There are two offset sizes used in relative mode 8 and 16 bits The 8 bit form is invoked with instruction mnemonics of the form Bxx and the 16 bit with LBxx The effective address is equal to the address of the next instruction plus the value of the sign extended constant offset embedded in the instruction Syntax Bxx lt expr gt LBxx lt expr gt Examples BRA BLIMP LBCC ZEPPELIN NOTE If the 8 bit form Bxx is requested and the lt expr gt expression is evaluable on Pass 1 to a destination that is out of range ASM will substitute the 16 bit LBxx form IMMEDIATE MODE Many 6809 instructions use a constant embedded in the instruction rather than an in memory location separate from the instruction This is design
59. e adjusted by the user via the 5 directive A form feed character that does not follow a carriage return will always be treated like any other ASCII control character Copyright C 1977 4 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION II SOURCE FILE FORMAT LINE FORMAT ASM has a free format line syntax Fields may begin in column and separated from one another or delimited by blanks or tabs Each field may be broken into subfields each subfield being separated from the next by commas Some consequences of ASM s line syntax are Blank lines may be freely inserted to format the listirg as desired Comment lines may be specified either with star column l or with a series of blanks semicolon and the comment Examples THIS IS A COMMENT LINE THE IS IN COLUMN 1 THIS IS ALSO A COMMENT LINE THIS IS A COMMENT LINE TOO ANY NUMBER OF BLANKS CAN PRECEDE Blank or tab characters not embedded in a string ALWAYS terminate a field particular this means that a comma should not usually be followed a blank as one would ordinarily do when typing Also this means that blanks may not be inserted in the middle of an expression Consecutive blanks or tabs are treated as a single blank Copyright C 1977 5 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION II SOURCE FILE FORMAT A line consists of the following parts any of which may ab
60. e line printed immediately preceding it The line and the error messages are listed on the listing device if one was specified The following error messages can be reported Double Definition The line contains an attempt to define a symbol whose value is also defined elsewhere Only the first definition is honored End of Source File Encountered The end of the source file was encountered before an END command was seen Illegal Argument A bad argument field was detected Examples Y EQU ORG Tllegal Digit Indicates the presence of a malformed number Examples 34F SIHJ SLMN Illegal Label An illegal label was detected Either the label field contains a non symbol or a label was specified on a line without a command Illegal String Indicates attempt to define a string that included carriage return Illegal Value Usually indicates that a forward reference was present where forward references are not allowed see appendix A Impossible forced reference lt lt or Use of lt lt with PC or or used with DPR value not correctly set INCLUDE file not found INCLUDE file was not found INCLUDE was ignored Copyright C 1977 103 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION X OPERATING ASM Input Line Too Long Input line was too long and was truncated prior to processing Nesting Error The line vio
61. ence Illegal Value J FDB 0 Copyright C 1977 71 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VIII CONDITIONAL ASSEMBLY DIRECTIVES CONDITIONAL ASSEMBLY DIRECTIVES ASM supports a powerful set of conditional assembly commands These commands allow great flexibility in system generation and maintenance especially when multiple GOnEigurstioH or options are needed in a program Conditional assembly essentially allows the assembly of only selected portions of the source portions not assembled are treated effectively comments Selection of the desired portions can be specified at assembly time see Operator Input Lines General features of ASM conditional assembly are Conditional assembly commands may be nested up to total of 255 levels Source security is enhanced by listing options that suppress included files skipped lines and conditional assembly lines Conditional assembly commands are highly consistent all blocks are terminated by FIN and all clauses within blocks are separated by ELSE or ELSEIF depending on function desired It should be noted that labels specified on conditional assembly commands are completely ignored It should also be noted that forward references are STRICTLY FORBIDDEN as arguments to conditional assembly commands exception see IFUND and IFDEF If an expression is evaluated which contains a forward reference Illegal Value will be reported and zer
62. es Monadic operators which operate on one value to produce a result and Dyadic Operators which combine two values to produce a third MONADIC OPERATORS lt A gt Monadic plus does nothing Its usual use is for clarity 1 gt 1 0 0 lt A gt Monadic minus computes the two s complement of its argument 1 gt SFFFF 0 gt lt A gt Monadic backslash computes the one s complement of its argument Nd SFFFE 9 gt SFFFF amp lt A gt Monadic ampersand computes the logical inverse of its argument ASM considers any zero or negative value to be logically false any positive non zero value is true amp l amp 1 817 gt 0 amp 1 gt 1 Copyright C 1977 17 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION III EXPRESSIONS DYADIC OPERATORS lt gt lt gt Dyadic plus computes the arithmetic check is made for overflow 342 00 5100 S1QS5 SFFFF gt gt lt gt lt gt Dyadic minus computes the two s complement overflow check is made of its arguments No 3 2 5 0 5100 105 SFFFF gt gt lt A gt lt B gt Dyadic star multiplies unsigned quantities sixteen bit unsigned 3 2 57000 2 5 00 2 number gt gt lt A gt lt B gt Slash computes the quotient of lt A gt divided by lt B gt are treated as sixteen bit unsigned quantities If lt B gt is and the result is zero
63. et of SD Attempts to break the encryption method publishing copying or storage of such a program or file in clean text form will be treated as theft of a trade secret and prosecuted as such POSSESSION OR USE OF THIS MANUAL OR THE SOFTWARE IT DESCRIBES CONSTITUTES AGREEMENT BY THE USER TO THESE TERMS kk ek ek kk kk kk kk k k ck kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk This manual and the software it describes are the copyrighted property of Software Dynamics ASM REFERENCE MANUAL 6 01 83 TABLE OF CONTENTS INTRODUCTION ASM A SMART ASSEMBLER NOTATION DEFINITION GENERAL DISCUSSION SOURCE FILE FORMAT LINE FORMAT LABEL FIELD LF COMMAND FIELD OR CF ARGUMENT FIELD OR AF COMMENT FIELD SOURCE LINE NUMBERS EXPRESSIONS au VALUES o MANIFEST VALUES DECIMAL NUMBERS BINARY NUMBERS OCTAL NUMBERS HEXADECIMAL NUMBERS CHARACTER VALUES IMPLICIT VALUES THE VALUE THE VALUE SYMBOLS RESERVED SYMBOLS ON A LITTLE PRE DEFINED SYMBOLS FORWARD REFERENCES COMPUTATION a MONADIC OPERATORS DYADIC OPERATORS COMPLEX EXPRESSIONS OPERATOR HEIRARCHY PARENTHESES LINE PROCESSING 6800 6801 MACHINE INSTRUCTION INHERENT MODE OPCODES REGISTER REGISTER MODE DIRECT MODE EXTEN
64. ffective address does not map into the Data Page as specified by the last SETDPR directive an error is generated Syntax opcode lt prefix gt lt exp gt Example A EQU 510 5123 C EQU 456 SETDPR 5100 PAGE 1 5100 51 Generated CLR A Extended reference to loc 10 INC B Direct reference to loc 123 DEC C Extended reference to 456 ROR A Direct reference to loc 110 WITH ERROR ASL B Direct reference to loc 123 TST C Direct reference to loc 156 WITH ERROR Note The programmer is responsible for insuring that the value in the DPR during program execution matches the SETDPR value 199 Copyright C 1977 44 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES EXTENDED MODE Extended mode addresses memory with a l6 bit address embedded in the instruction location in the memory space can be referenced with this mode Extended mode may be forced by use of the prefix Syntax lt opcode gt lt prefix gt lt exp gt Example AA EQU 510 EQU 1234 SETDPR 00 Default DPR setting LDA AA was required to produce sextended mode addressing STA BB sExtended addressing EXTENDED INDIRECT MODE Extended Indirect Mode addresses memory using a l6 bit address embedded the instruction to retrieve the effective 16 bit address This mode is indicated by surrounding the operand field Syntax opcode lt exp gt E
65. files The argument field is totally ignored and none of the Motorola specific options are supported Assembly control directives are specified to ASM via the WITH command THE INCLUDE STATEMENT INCLUDE lt FILE NAME gt The INCLUDE command allows the inclusion of whole source files as part of the assembly An INCLUDE d file is assembled as though its contents were actually substituted for the INCLUDE statement An INCLUDE d file may also contain INCLUDE directives INCLUDE files may be nested in this fashion to a depth of 16 levels Common uses for INCLUDE are Inclusion of SDOSUSERDEFS to define SDOS symbols Sharing of common code between several assemblies Breaking up of huge source files to reasonable size files The FILENAME must be a valid SDOS file name it is written as though it were a symbol name Example INCLUDE SDOSUSERDEFS ASM INCLUDE D3 DATATABLES SRC Copyright C 1977 88 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION IX ASSEMBLY CONTROL DIRECTIVES INCLUDE supports recursion This means that by use of conditional assembly and recursion looping for multiple copies of a file is possible to the maximum include depth Example File A N SET 10 1 INCLUDE FACTORIAL FDB F word with Factorial END File FACTORIAL IF N FDB N Generate word with a factor F SET F N Compute Factorial N SET N 1 INCLUDE FACTORIAL FIN END When file A is assembled it will c
66. he notation lt expr gt is used to specify an immediate operand if only 8 bits are required by the instruction the expression value must be in the range 128 to 255 or an error will result Syntax lt opcode gt lt gt Examples ADDA 1 adds 1 to A register SUBD 54071 LDS BUFFER 2 SUBB BUFFER 256 same general effect as SBCA BUFFER 256 SUBD BUFFER Copyright C 1977 34 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION V 6800 6801 MACHINE INSTRUCTION LINES OPCODE MNEMONICS RECOGNIZED BY 5 6800 This table lists all the opcode mnemonics recognized by 5 6800 The operand modes accepted ASM for each of the opcodes are marked in the table Additionally there are notations comments and opcode mnemonic classifications The notations will show expansions if the mnemonic causes alternative code or multiple machine instructions to be generated classes are as follows 6800 6800 standard mnemonic 6801 6801 standard mnemonic 6800 instructions are substituted if WITH M6801 is not specified at assembly time 6809 6899 mnemonic Generates equivalent 6891 instructions 680 680C mnemonic supported in the 6800 instruction set One or more 6801 instructions may be substituted Memory reference instructions are limited to a restricted subset of the 6809 indexed addressing forms See Appendix D for more detail OPERAND MODE KEY IDX INDEXED EXT EXTE
67. ice On the first pass through the source file all assembly errors suppressed and certain operations like producing a listing or binary are not performed This pass is performed primarily to assign symbols their values At the end of the first pass all symbols should be defined ASM rewinds the source file processes it again This time it produces a listing file and a binary file according to the user s directions Copyright C 1977 3 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION II SOURCE FILE FORMAT SOURCE FILE FORMAT ASM places very few restrictions on the format of the source file Its only requirements are 1 Source lines must be terminated with carriage returns 2 Nulls may not be significant characters in the file they will always be ignored 3 If the file is divided up into forms using form feed characters the form feeds must immediately follow a carriage return All other ASCII characters are legal and will be printed in the listing without complaint Control characters with the exception of tab will always be printed as followed by an appropriate letter For example control A will be listed as eA l The tab character is treated somewhat differently If it appears as part of a character string it will be listed as otherwise it will cause one or more blanks to output until the print carriage is positioned at a tab stop or is past the last tab stop Tabs may b
68. if it is defined the effect is that of IF 0 From IFUND s point of view SYMBOL is undefined if it is either truly undefined or a forward reference STATE 1 If the argument is not solely symbol Illegal Argument is reported and ASM switches to state 3 If the argument is solely a symbol and the symbol is either a forward reference or undefined ASM switches to state two otherwise it switches to state 3 STATE 2 Like state l with the additional checks described for IF state 2 STATE 3 Same as IF STATE 4 Same as IF STATE 5 Same as IF IF SYMBOL DEFINED IFDEF SYMBOL IFDEF causes ASM to check the symbol given as the argument If the symbol given is defined the effect is that of IF 1 if it is undefined the effect is that of IF 0 From IFDEF s point of view SYMBOL is undefined if it is either truly undefined or a forward reference STATE 1 If the argument is not solely a symbol Illegal Argument is reported and ASM switches to state 3 If the argument is solely a symbol and the symbol is not a forward reference and is defined ASM switches to state two otherwise it switches to state 3 STATE 2 Like state l with the additional checks described for IF state 2 STATE 3 Same as IF STATE 4 Same as IF STATE 5 Same as IF Copyright C 1977 80 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VIII CONDITIONAL ASSEMBLY DIRECTIVES THE ELSE DIRECTIVE ELSE The ELSE dire
69. ificance This is the default mode of operation Files prepared with editors which use CR alone to separate lines should be processed in this mode WI EXP Set listing device page width 115 ASM how many physical columns there are on the listing device Any line that is longer than EXP characters long including assembler generated information such as the output data in the left portion of the page will be truncated The default width for a printing device is the page width established by the SDOS SET command for a disk file it is defaulted to 132 DE EXP Set listing device page depth 115 ASM how many physical lines there are on a page This information is used to control pagination The default depth for a printing device is the page depth established by the SDOS SET command for disk file the default depth is 66 A depth specification of less than 13 causes continuous form listing no page headers except the first Copyright C 1977 86 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION IX ASSEMBLY CONTROL DIRECTIVES DMP Dump symbol table Requests that a symbol table dump be produced on the listing device at the end of the assembly sorted by name and by value NDMP No dump of symbol table prevents a symbol table dump EL Save error line numbers Requests that a summary be printed at the end of the assembly on the listing device detailing which lines had errors Each error l
70. ill never cause more than one page to be ejected and if encountered at the top of a clean page they will be ignored There are three listing on off directives which control whether output goes to the LO Listing Output They are listed below in order of decreasing dominance WITH LST WITH NLST LIST Copyright C 1977 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION IX ASSEMBLY CONTROL DIRECTIVES PAGE HEADING FORMAT In the following discussions it will be important to know what the various fields of the page header are what they are called EN ak n ULIS e IM SB sak e gt Name of Assembler Version of Assembler gt PC at Time of Page Eject Program Name From Name Command gt Program Title From Title Command ASM 1 4 0000 NAME TITLE lt DATE TIME gt Page 1 Form 1 lt SUBTITLE gt Program Subtitle From Command uu gt Count of Control L s Encountered So Far in file Useful when using Editors based on L eM un ese gt Number this listing gt Date Time 50105 System Format SSS SSeS SSeS S gt Source File Being Processed When Page Throw Occur
71. index register notations ix Index register X 5 System stack pointer General syntax opcode C lt expr gt lt indexreg gt 1 Whenever indirect mode is encountered ASM6800 substitutes the following LDX lt expr gt lt opcode gt 0 Note that use of indirect addressing destroys the contents of the X register If the index register specified is S then a TSX instruction is inserted and the instruction treated as though X had been written instead ZERO OFFSET INDEXED MODE This mode is also known as a register indirect addressing The effective address is equal to the contents of the specified index register This form generates a zero offset byte for a conventional 8 bit constant offset indexed mode Index Registers 5 Syntax lt opcode gt reg register indirect lt opcode gt lt reg gt indirect register indirect Examples LDA X LDB C S EA 5 1 Zopyright 1977 31 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION V 6800 6801 MACHINE INSTRUCTION LINES 8 BIT CONSTANT OFFSET INDEXED MODE Constant offset indexing forms an effective address equal to constant plus the contents of an index register The constant is embedded in the instruction constant must be in the range 0 to 255 Index Registers X S Syntax lt opcode gt lt expr gt lt reg gt constant offset lt opcode gt lt expr gt lt reg gt indirect
72. ine saved requires six bytes of memory if there is no room to save an error line number no notification is given to the user and the 115 of lines at the end of the assembly may not complete However this situation will only arise when ASM has run out of space in the symbol table which will cause notification of space problems NEL No error line numbers Prevents ASM from saving or reporting error line numbers LST Produce listing Tells ASM to produce a full listing of the assembled source file Does not imply DMP NLST No listing please Tells ASM not to produce a full listing of the assembled source file on the listing device Note that LIST 1 occurring the source will NOT override this option note also that any lines on which errors are detected will be listed anyway This option does not prevent DMP nor does it imply NDMP DO Diagnostic output console Tells ASM to error lines and error messages to the console NDO No diagnostic output on console Tells ASM not to copy error lines and messages to the console This option should be used when a listing is being produced on the console device Otherwise the output may have intermixed listing and error messages Copyright C 1977 87 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION IX ASSEMBLY CONTROL DIRECTIVES THE OPT STATEMENT OPT lt CHAR gt The OPT command is provided only for compatibility with Motorola source
73. ing modes Example LDA 000 sRelative reference to loc 000 Copyright C 1977 14 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION III EXPRESSIONS SYMBOLS Symbols in ASM consist of a letter a colon a period followed by a string of letters digits colons periods dollar signs 5 percent signs or at signs Q A symbol may be of any length however only the first thirty two are used to distinguish one symbol from another Lower case letters which appear symbols are considered by ASM to be the same character their upper case equivalent They will appear in lower case on the listing but will match upper case versions of the same letters The following are symbols QRS qrs The same as QRS lower case matches upper case L34 A BEGIN WITH DOT LONGER THAN THIRTY BEGIN WITH DOT LONGER THAN THIRTY TWO ASM treats the last two as the same symbol BEGIN WITH DOT LONGER THAN FIFTEEN This symbol is different from both the above The following are NOT symbols SDOLLAR Does not begin with letter colon or period Copyright C 1977 15 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION III EXPRESSIONS RESERVED SYMBOLS ASM has no reserved symbols however some symbols have special interpretation in certain contexts For 6800 6801 ASM these symbols p S X For 6809 5 the symbols B TD X s Du
74. instruction line as follows all labels are first equated to the location counter then the opcode specified is inspected to determine which operand addressing modes legal Finally the operand field is scanned for an appropriate addressing mode specification The opcode is combined with the specified addressing mode to generate the object code corresponding to the desired instruction Many opcodes LDA STX CMPD etc include a register specification A D X U or S as the last letter of the mnemonic There are several operand modes for 6809 instructions A given instruction will have one or more modes as legal forms some opcodes require no operand specification whatsoever The syntax Of each of these modes is discussed in the following pages A few examples of each mode will be given A table of instruction mnemonics and their modes is given at the end of this section Throughout this section the notation lt gt means expression EA means Effective Address to the right of EA means the contents of Copyright C 1977 42 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES INHERENT MODE Inherent Mode need no specifications The argument field is ignored For portability purposes it should be left blank Syntax lt opcode gt Examples RTI Return from Interrupt MUL A Reg
75. ion of the 6809 instruction set replete with many of the more popular addressing modes and a few new instructions added due to popular demand First all 6800 instructions except the following are included in 688C TAP TPA The following 6801 instructions are included 6800 thus allowing their use on the 6800 ABX ADDD ASLD BHS BLO LDD LSLD LSRD MUL PSHX PULX STD SUBD The entire set of 6889 long conditional branches except LBRN are included 680 For the instructions ADCD ADDD ANDD CMPD DECD EORD INCD LDA LDB LDD ORA ORB ORD SBCD STA STB STD SUBD most of the 6899 addressing modes may be used The ones that may not be used are accumulator offset indexed program counter relative indexing using registers U Y PC or PCR Additional limitations are constant offsets may be positive only and must be the range 00 SFF auto post increment is not allowed in the indirect addressing mode Copyright C 1977 111 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION XIV APPENDIX D 680C COMPATIBILITY INSTRUCTION SET The following 6809 instructions are implemented in limited fashion LEAX k X LEAS k S where 16 lt k lt 15 Note that the destination index registers must be the same for each instance of the instruction The 6809 instructions TFR A B TFR B A are allowed No other TFR class instruction is allowed Note that 680C TFR leaves the CC bits except
76. it places with zeroes shifted into the least significant bits If lt B gt is negative the result is A shifted right B bit places with zeroes shifted into the most significant bits If lt B gt is zero the result is A 3 2 gt C SFE 8 gt FE 8 gt SFE 12345141416 gt 0 lt A gt lt B gt Bang computes the bitwise logical inclusive or of its arguments 211 gt 3 014 4 712 7 Copyright C 1977 19 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION III EXPRESSIONS lt gt amp lt gt Dyadic ampersand computes the arguments 2 amp 1 gt g 054 0 7 amp 2 gt 2 lt A gt I lt B gt Doublebang computes the bitwise arguments 2111 gt 3 0114 4 7112 5 lt A gt lt B gt Equal compares its arguments and otherwise 3 3 gt 1 3 4 gt 0 lt A gt lt B gt Hash compares its arguments and otherwise 3 3 gt 0 3 4 gt 1 Copyright C 1977 returns 0 20 bitwise logical and of its logical exclusive or of its It is defined as lt A gt amp lt B gt lt B gt amp lt A gt returns 1 if they are equal if they are equal 1 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION III EXPRESSIONS lt A gt gt B Greater compares its arguments as signed numbers returns 1 if left argument is greater than the right argument 0 otherwise 3 gt 3 gt 0 3 gt 4 0 4 3 1 SF
77. later be SET Any violation of these rules will result in Double Definition being reported Like EQU SET does not require that labels be present If symbols are present the label field SET is equivalent to EQU Note that forward references cannot be displayed with SET If EXP involves a forward reference Illegal Value is reported and the value zero is used instead If no argument field is present Illegal Argument is reported If an attempt to SET a symbol conflicts with another definition somewhere else in the assembly Double Definition is reported The first definition of the symbol is retained Copyright C 1977 61 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VII DIRECTIVES Examples A SET 10 Value of A is 10 FDB A Generates 5000 A SET 20 Value of A is now 26 FDB A Generates 0014 B EQU 5 B SET 510 The first definition applies Double def is reported both here and above Double def does not prevent a symbol that was SET first from being SET later SET 57 59 Double def FCB e Generates 07 C SET SA FCB C Generates SWA D SET E This is illegal E EQU 15 D ends up set to zero Copyright C 1977 62 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VII DIRECTIVES DATA GENERATION DIRECTIVES Several methods of generating data are provided by ASM FORM CONSTANT BYTE lt LF gt FCB lt EXPLIST gt FCB di
78. lates some rule regarding condtional assembly Possibilities are ELSE ELSEIF or FIN encountered when conditional assembly block was open IF CASE IFUND or DO encountered that would cause conditional assembly commands to be nested more than 255 deep The argument of an RPT command was a command which cannot be RPT d Out of Memory Indicates that there was no room to enter a new symbol into the symbol table Assembly continues but the symbol will remain undefined throughout the assembly No more error line numbers will be saved Phase Error Indicates that the assembler has been asked to give a symbol a different value in pass two than it was given in pass one Usually caused by Out of Memory Register Field Missing Indicates that a machine instruction which requires a register was written with an undecipherable register field Start address or does not match other end s Start address specified has value zero illegal under SDOS or multiple ENDs specified differing start addresses Multiple ENDS are possible when INCLUDE is used Syntax Error A malformed expression or addressing mode was encountered Examples 3 323 ADDB O S Undefined Symbol The line contains a symbol that was not defined This can occur with symbols which involve more than one level forward reference Use of Doubly defined Symbol The line contains a use of a doubly defined symbol
79. le reactions based upon activities by SDOS on behalf of the assembler such as opening files printing on the printer asking for keyboard data entry etc and actions by the assembler Interactions with and reactions of SDOS are beyond the scope of this manual it is assumed the operator is familiar with the SDOS command interpreter line editing conventions and how to deal with errors for more information refer to the SDOS manual See Appendix C for list of some SDOS related error messages that can be reported while using 5 and their meanings This manual covers only responses and actions ASM itself STARTING ASM Once the source file has been constructed the assembler must be invoked This is accomplished in the SDOS conventional way by typing its name while at the SDOS command interpreter prompt and then entering carriage return ASM will respond by identifying itself ASM Software Dynamics ASM 680d Version 1 4r d will be 0 if this assembler produces 6800 or 6801 object and 9 if the assembler produces 6809 object code is the revision letter of ASM It will then print Source File and wait for input Enter the name of the file which is to be assembled followed by a carriage return If bad file name is entered or the file cannot be found opened the prompt is typed again and file name entry is again requested Copyright C 1977 99 Software Dynamics ASM REFERENCE MANUAL 6 01 8
80. les 0001 1 we see the PGEN 0001 PGEN 1 we can see everything 0000 01020304 FCB 1 2 3 4 5 6 7 8 9 0004 05060708 0008 09 2000 0 50 we only see first part 0009 01020304 LI 1 2 3 4 5 6 7 8 9 0009 11 It really got generated Copyright C 1977 97 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION IX ASSEMBLY CONTROL DIRECTIVES PRINT CONDITIONAL ASSEMBLY COMMANDS PCA EXP The PCA directive is used to tell ASM whether to list conditional assembly command lines The expression is evaluated if false subsequent conditional assembly commands will not be listed If true subsequent conditional assembly commands will be listed The default is PCA 1 PCA controls the listing of the following commands DO ELSE ELSEIF FIN IF IFUND RPT If a conditional assembly command is being skipped it will be listed only if 1 and PSR 1 are both in effect PCC controls the listing of PCA commands Copyright C 1977 98 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION X OPERATING ASM OPERATING ASM To use ASM one must first construct a source file containing the text of the assembly language program to be assembled Under SDOS this can be accomplished using the context editor EDIT or the screen editor SEDIT Description of the use of these editors is beyond the scope of this manual Once the assembler has started two kinds of reactions possib
81. line is processed The first four bytes generated by the command will be listed on the line listing the source statement Further bytes will be listed as for FCB and FDB Note that if PGEN 1 has not been specified only the first four bytes will be listed To enhance portability to future SD assemblers we strongly recommend use of double quote as the lt DELIM gt character Copyright C 1977 66 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VII DIRECTIVES Examples 0001 0001 0000 53545249 0004 4 47 000A 4 472020 0000 0006 4 4 4 59 0013 0019 09 Copyright C 1977 PCC PGEN FCC PGEN FCC EQU FCC 1 1 STRING 0 50 we see the PGEN List everything please List only first 4 bytes Only 4 bytes listed K 67 But all here generated Look how nicely tabs get listed Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VII DIRECTIVES FORM FLOATING POINT NUMBER LF FFC lt floatingpointnumber gt FFC Form Floating Constant causes ASM to convert the floating point number specified to its corresponding binary form and place the results into memory Each floating point number is stored in the BASE 100 format used by the SD BASIC 1 4 Compiler range 15 limited to 10 126 The syntax of numbers accepted is identical to forms accepted by the compiler For more details refer to the BASIC 1 4 manual Any labels present wi
82. ll be EQU d with the location counter before the line is processed Unreasonably large numbers will get an overflow error and ASM s version of infinity will be substituted Examples 0000 00000000 4 FFC 0 0004 0000 0006 41010000 5 1 000A 0000 BOGC 41030 6 PI FFC 3 14159287 0010 5C57 0012 1010000 7 1 0016 0000 0018 530AO0000 8 FFC 1E37 001 0000 001 32624C36 000987654321 25 0022 200A Copyright C 1977 68 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VII DIRECTIVES IMPLICIT DATA STATEMENT lt LF gt EXPLIST ASM allows the user to generate data without writing FDB or FCB statements If the command field of a line cannot be interpreted as a machine language instruction or a directive ASM will interpret the entire command field as a list of expressions whose values are to be assembled as data Each expression will be assembled into one or two bytes depending on its value If an expression has a value between and SFF it will be assembled into one byte Otherwise it will be assembled into two bytes These defaults can be overriden in the following ways 1 If the expression is preceded by a hash mark the hash mark will ignored the expression will be assembled into two bytes regardless of its value 2 If the expression is preceded monadic plus or minus the expression will be assembled into one byte regardless of value
83. lso accepted 21011b Same as 1011 OCTAL NUMBERS Numbers may be specified in base eight octal notation Such numbers have the form O DIGIT lt O DIGIT gt lt O DIGIT gt O DIGIT The letter lt O DIGIT gt O DIGIT Q lt O DIGIT gt may be any of the digits through 7 if 8 or 9 are seen Illegal Digit is reported If the value exceeds 65535 Overflow is reported Examples Q26 Octal representation of 22 base ten 260 The same using suffix form 260 Alternate suffix form 759 Illegal 9 is not an octal digit 3777777 Too big overflow is reported Note that lower case qualifiers are also accepted 9264 730 Copyright C 1977 11 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION III EXPRESSIONS HEXADECIMAL NUMBERS Numbers may be specified in base 16 so called hexadecimal notation Each digit represents a number from 0 to 15 the digits 10 through 15 are represented the letters A through F There are two forms 5 HEXDIGIT HEXDIGIT lt DIGIT gt lt HEXDIGIT gt H A suffix form hexadecimal value MAY NOT begin with one of the hex digits A through F Numbers whose first significant digit is A through F must have a leading zero see examples If a letter that is not between A and F is seen Illegal Digit is reported If the value exceeds SFFFF Overflow is reported
84. must be present Note that this could also have been written as X lt EXP gt X or lt EXP gt X Finally ellipsis are used to indicate the possibility of indefinite repetition when embedded in text For example lt EXP gt lt EXP gt indicates that a series of one or more expressions separated by commas is acceptable Ellipsis on a line by itself represents some indefinite sequence of source lines For example line 1 line n indicates that some sequence of lines exists between line 1 and line n Copyright C 1977 2 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION I INTRODUCTION GENERAL DISCUSSION All assemblers in the ASM family have all the properties described in this manual unless specifically indicated For the most part differences between the assemblers are limited to the instruction set intended for assembly by ASM This manual assumes that the reader knows the 6800 6801 and or the M6809 machine instruction set It is a manual on the use of the assembler It is not nor is it intended to be a tutorial on the instruction set for these microprocessors To use ASM the programmer first prepares a source disk file This can be done by using EDIT SEDIT under SDOS Then ASM is invoked and given the name of the source file to be assembled and names of listing and binary object files to be produced ASM is a two pass assembler That is the entire source file is read tw
85. n produces the same result from destination PCR Indirection is permitted in this mode The prefixes and are valid Syntax lt opcode gt lt expr gt PCR lt opcode gt lt expr gt PCR Examples ORA MASK PCR EA MASK ADDD VALX PCR EA VALX JMP THERE PCR 8 bit offset JSR BEEP PCR Force l6 bits and indirection Copyright C 1977 48 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES ACCUMULATOR OFFSET INDEXED MODE Offsets on the 6809 may specified to be the contents of an accumulator The effective address 15 formed by 2 s complement addition of the accumulator contents sign extended to 16 bits and the index register contents Indirection be applied to this indexing mode Index Registers X Y U S Offset Accumulators B D Syntax lt opcode gt lt acc gt reg lt opcode gt acc reg Examples LDA B X B X CLR A Y A Y LDD D U SEA D U AUTO INCREMENT DECREMENT INDEXED Index registers on the 6809 may be automatically stepped by 41 2 1 and 2 bytes Increments are done AFTER the memory reference and hence annotated FOLLOWING the index register i e X the effective address is the original contents of the index register Decrements are done PRIOR to the memory reference and hence annotated PRECEEDING the index register i e Y the effective a
86. namics ASM REFERENCE MANUAL 6 01 83 SECTION II SOURCE FILE FORMAT SOURCE LINE NUMBERS ASM can accept files containing line numbers at the beginning of each line as long as the user alerts ASM via the WITH directive If line numbers are present in the file the line format is modified somewhat Line numbers are handled in the following fashion 1 Any string of zero or more digits or periods which starts a line will be listed but otherwise ignored 2 If the next character is a blank or a tab it will also be ignored 3 The next character in the file will the first significant character of the line 4 No error checking is done with respect to line numbers Copyright C 1977 7 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION II SOURCE FILE FORMAT Examples Note that TAB represents the ASCII tab character Assume that ASM has been directed to expect line numbers 409 17 TAB LABEL TAB LDAA TAB FROG LINE LF CF AF 409 17LABEL TAB LDAA TAB FROG LN LF Because of the definition of the line number format rather unexpected things can happen 409 17 TAB LDAA TAB FROG CF In the above example the LDAA is erroneously treated as a label The proper way to enter the line is 409 17 lt TAB gt lt TAB gt LDAA lt TAB gt FROG Note th
87. nd modes for 6800 6801 instructions A given instruction that is recognized by ASM will have one or more modes as legal forms some opcodes require no operand specification whatsoever The syntax of each of these modes is discussed in the following pages A few examples of each mode will be given A table of instruction mnemonics and their modes can be found at the end of this section Throughout this section the notation lt expr gt means any expression EA means Effective Address and expr to the right of EA means the contents of lt expr gt Copyright C 1977 27 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION V 6800 6801 MACHINE INSTRUCTION LINES INHERENT MODE Inherent Mode opcodes need no operand specifications The argument field is ignored For portability purposes it should be left blank Syntax lt opcode gt Examples RTI Return from Interrupt DES 5 5 1 CLRA A Reg PSHD Pushes A and B REGISTER REGISTER MODE Register Register Mode addresses source and destination registers This mode is used only for and 6809 equivalent instructions See M680C description Syntax lt opcode gt lt reg gt lt reg gt Examples TFR A Copyright 1977 28 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION V 6800 6801 MACHINE INSTRUCTION LINES DIRECT MODE Direct Mode is used to address a location in the range 0000 through 50 0
88. o SFFFF or which are extended mode only instructions are assembled with an extended address mode Syntax opcode lt prefix gt lt exp gt Example AA EQU 510 51234 LDAA gt was required to produce extended mode addressing STA BB Extended addressing ROR AA Always generates extended mode EXTENDED INDIRECT MODE Extended Indirect Mode addresses memory using l6 bit address embedded the instruction to retrieve the effective 16 bit address This mode is indicated by surrounding the operand field Syntax opcode lt gt 1 Whenever indirect mode is encountered 5 6800 substitutes the following LDX exp lt opcode gt 0 Note that use of indirect addressing destroys the contents of the X register This is an extension of M6800 assembly code and is supported for M682C Example LDD PNTR Load 1234 from loc 00 PNTR FDB QQ QQ 1234 Copyright C 1977 36 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION V 6800 6801 MACHINE INSTRUCTION LINES INDEXED MODE Indexed mode addressing forms an effective address equal to the sum of an offset value and the contents of an index register There are several types of indexing that may be specified to ASM Zero offset 8 bit offset Pre decrement Post increment All the above permit indirect addressing specified by enclosing the operand field in s Indexed Mode always involves one of the following
89. o dU uo Cr 4 6800 Be ge 6801 NOP BSR Se XR od 6800 BVC V eh AE 3 QUO 6800 BVS n EA 6800 Copyright C 1977 36 Software Dynamics ASM REFERENCE MANUAL 6 91 83 SECTION V 6800 6801 MACHINE INSTRUCTION LINES OPCODE OPCODE OPERAND MODE CLASS NOTES AND COMMENTS IEDIIBPR DXIMNRS XTRMHAHR CBA E RE PE 6800 CLC 6800 GLI OECD qe 6800 CLR pq P NECS 6800 CLRA Us CS 6800 CLRB ED SR 6800 CLV E 6800 JE EY SE 6800 Soe ue x 6800 CMPD X XXX ko ski ou 680 See Footnote 2 CMPX xx XX koud Se 6809 PES 6800 u dcos 6800 COMB TREE NES 6800 ales IPS 680 DOSYE X Se eie 6809 DAA Yo age ka UR NOUS NES 2 6800 DEC Da cae ak PIE 6800 DECA IP RC a DECRE 6809 DECB oo at ue DU ers 6800 DECD M AC DOU ae We das 1 680 See Footnote 3 DES de Ae AG a 03 6800 DEX VP meu S Y d 6800 EORA tat vii e al 6800 Gb Gp db ga E 6800 EORD pio dip di qp RE 680 EORB arg l EORA arg ERRORRTS 680 SEC RTS INC XK Wolke de ox d 6800 IMS ar uas d 6800 INCB L on a 6800 INCD ME EC 680 See Footnote 4 INS 2 ck th 6800 INX E a ru 6800 Copyright C 1977 37 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION V 6800 6801 MACHINE INSTRUCTION LINES OPCODE OPCODE OPE
90. o will be used as a value The following is intended to illustrate use of conditional assembly Details may be found under the full description of conditional assembly Copyright C 1977 72 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VIII CONDITIONAL ASSEMBLY DIRECTIVES SIMPLE CONDITIONAL ASSEMBLY IF EXP FIN The expression is evaluated If it is true i e positive and non zero the lines between the IF and the FIN are assembled otherwise they are skipped ALTERNATIVE ASSEMBLY IF EXP ELSE FIN The expression is evaluated If true the lines between the IF and the ELSE are executed If false the lines between the ELSE and the FIN are assembled i NESTED CONDITIONAL ASSEMBLY IF SEXPI IF EXP2 FIN FIN The first expression lt 1 gt is evaluated If false all lines up to the second FIN are skipped If true lines up to the second IF are assembled and EXP2 is evaluated If true the lines the inner block assembled if false they skipped Then the lines from the first FIN to the second FIN are assembled Copyright C 1977 73 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VIII CONDITIONAL ASSEMBLY DIRECTIVES MORE COMPLICATED CONDITIONAL ASSEMBLY IF lt EXP1 gt ELSEIF lt EXP2 gt ELSEIF lt EXP3 gt ELSE FIN The ELSEIF directive is designed to allow the user to have multiple alternatives without having to nest
91. oO DP have special interpretations See Machine Instruction Lines for details PRE DEFINED SYMBOLS ASM has three pre defined symbols 6800 6801 6809 The purpose of these symbols is to support the 680 concept permitting conditional assembly dependent on the target CPU For more information see Appendix D For the 5 6800 with 6801 option disabled no use of WITH 6801 directive the symbol M6800 has the value l and M6801 and 6809 have the value For ASM6800 with 6801 option enabled WITH M6801 directive used the symbol M6801 has the value 1 and 6800 and 6809 have the value ASM6809 has 6809 equal to l with M6800 and M6801 equal to 0 FORWARD REFERENCES A symbol may with some restrictions be used before it is defined Such a use is called FORWARD REFERENCE In general a forward reference may be used in any context that will allow 5 to allocate the same number of bytes at the same locations in pass one and pass two See Appendix A for a list of ASM directives which do not allow forward references Copyright C 1977 16 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION III EXPRESSIONS COMPUTATION Manifest and implicit values can be combined and operated upon at assembly time to produce new values This is done by means Operators ASM provides an extensive range of computational functions These functions are divided into two categori
92. out this section we will use the following notation to describe the syntax of directives SLF indicates list of zero or more symbols separated by commas occuring the label field of the line list may begin with comma and consecutive commas are allowed The exact syntax is l lt SYMBOL gt lt SYMBOL gt If such a list of symbols is malformed Illegal Label will be reported lt EXPLIST gt indicates a list of expressions separated by commas Consecutive commas leading commas and trailing commas are allowed and are interpreted as having a zero expression where an expression is missing The exact definition of lt EXPLIST gt is lt 2 EXP Copyright C 1977 58 Software Dynamic ASM REFERENCE MANUAL 6 01 83 SECTION VII DIRECTIVES SYMBOL DEFINITION DIRECTIVES Two commands are provided to allow users directly to assign a value to a symbol EQUATE LF EQU EXP EQU directs ASM permanently to associate the value given the argument with the symbols given in the label field lt gt may involve one level of forward reference if it does then the symbols specified the label field will be treated as forward references throughout the assembly Any attempt to redefine the value of an EQU d symbol will be diagnosed as an error If no symbols are present in the label field EQU merely evaluates the expression This can be u
93. overall listing or options selection or to enter EQUate directives to specify values for configuration symbols used by conditional assembly directives embedded in the source file It is convenient sometimes to build 52905 file that invokes ASM sets up source listig and object files and then specifies operator input lines a specific set of configuration parameters for the program being assembled The DO file then represents a particular configuration of the assembled program can be used to easily regenerate that configuration Other DO files would represent other configurations Copyright C 1977 199 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION X OPERATING ASM Examples of use 1 The following procedure allows the user to assemble a simple program typed in from the console ASM VERSION l x xxxx SOURCE FILE CONSOLE LISTING FILE MYLIST BINARY FILE MYBIN ORG 5100 gt LDX SFEQQ gt 11 CLR 0 gt gt SFEFF BNE LI RTS END The program will be assembled a listing produced Note that operator input was terminated not by an empty line but by ASM discovering the END directive 2 Assemble a file called PROCESS ASM generate no listing and no binary This can be useful when checking for errors The file name extension ASM is used purely convention valid SDOS filename can be used here ASM VERSION 1 xxxx SOURCE FI
94. rects ASM to output a series of one byte values to be loaded into memory starting at the current value of the location counter Expressions may be of any type however their values must be between 80 and SFF If labels are present they are EQU d to the location counter before data generation begins Null expressions 1 contiguous commas cause a zero value to be generated for that expression No error is reported Each expression is output as soon as it has been evaluated This means that will have a different value each expression across the line Examples FCB 19 12 Generates ZA followed by 50 A B FCB and B are EQU d to sone byte of 500 is output FCB 3 7 9 Note that leading sign is OK FCB KEES Generates 0 0 0 3 FCB 5105 Reports overflow generates 505 FCB 3 Generates byte of 3 then byte of 0 Copyright C 1977 63 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VII DIRECTIVES RESERVE MEMORY BYTES LF RMB EXP RMB directs ASM to reserve memory space without initializing its contents lt EXP gt is interpreted as a sixteen bit positive integer It may not be a forward reference Any labels present will be EQU d to the location counter before the RMB is processed If EXP is a forward reference Illegal Value is reported and the location counter is not moved If lt gt is not present Illegal Argument 15 reported and the location counter i
95. red 0 9 SRC FILE gt Copyright 1977 91 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION IX ASSEMBLY CONTROL DIRECTIVES LINE LISTING FORMAT ASM uses several formats when listing line Lines which generate data will be listed in the following form PPPP DDDDDDDD NNNN TTTTTTTT VVVV NNNN TTTTTTTT PPPP NNNN TTTTTTTT 5 NNNN TTTTTTTT NNNN TTTTTTTT PPPP VVVV NNNN TTTTTTTT The first form is used when a line generates data PPPP 15 the first location that the data will be loaded into DDDDDDDD are the data bytes Up to four bytes may be displayed on a given line NNNN is the line number this field is reset to l whenever a form separator is encountered in the source and incremented for every line read TTTTTTT is the text of the source line with tab characters expanded according to the tab stops currently in effect specified by TABS The second form is used for lines containing directives that do not generate data but do have a numeric result of some kind VVVV is the value field and generally is used to display the value of the directive s argument The third form is used to list lines containing an ORG command PPPP is the new value of the location counter The fourth form is used to list lines that were skipped due to conditional assembly commands S is printed in the value field The fifth form is used to list comment lines and lines
96. riginally prepared for assembly by Motorola standard assemblers Parentheses still available overriding Motorola precedence NMCM Not Motorola compatible Causes dyadic operators to be evaluated in the usual heirarchial order This is the default mode of operation 6801 Assemble 6801 instructions Accepted only by 5 6800 Tells ASM that M6881 instructions valid and should be assembled such If this option is not enabled all 6801 specific instructions treated M680C instructions and 6800 equivalent instructions substituted their place Copyright C 1977 85 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION IX ASSEMBLY CONTROL DIRECTIVES LN Line numbers Informs ASM that there are source line numbers present in the file See Source Line Numbers for a description of how source line numbers are processed NLN No line numbers Tells ASM not to expect line numbers in the file This is the default mode of operation LF Line feeds Informs 5 that extraneous line feeds are present in the source file and are to be ignored This option should be specified for all files prepared on systems which use CR LF or LF CR as line separators If specified all line feeds encounterd the source file will be completely ignored they will not even be listed NLF No line feeds Informs ASM that line feed characters encountered in the file have no special sign
97. rs may be used while preserving backward compatibility with earlier processors through emulation of the advanced instructions The ASM6800 and 5 6809 assemblers both accept 680 instructions ASM6809 of course also accepts the balance of the 6809 instruction set The emulation feature of the 680C assembler is a two edged sword on the one hand it offers a consistent instruction set across the family of 680 processors on the other hand emulated instructions often have side effects of which the coder should be aware Overall the value gained from a consistent instruction set outweighs the constraints introduced by the emulation of instructions In certain cases the emulation constraints are untenable The coder then has recourse to conditional assembly IF 6800 ELSEIF 6801 ELSEIF 6809 FIN to produce code sequences optimized for a particular processor Note that the meaning of a 680 istruction is the intersection of the meanings of the implementations of the 6800 instruction on all processors this generally means that many 680C instructions leave the condition code bits in an undefined state Other side effects are also possible such as damage to X register contents or the memory location TEMPX Copyright C 1977 110 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION XIV APPENDIX D 680C COMPATIBILITY INSTRUCTION SET The 680C instruction set includes nearly all of the 6800 6801 instructions a good port
98. s not moved The location counter s old value and the number of bytes reserved are listed Examples 0000 0030 RMB 530 Reserve 530 bytes 0030 EQU 0030 0010 510 label 0040 EQU x is EQU d to the 0030 EQU A first byte of the reserved space 0040 0000 0 Zero bytes can be reserved 0040 0040 0000 C This is illegal Illegal Value 0040 2 was a forward reference Copyright C 1977 64 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VII DIRECTIVES FORM DOUBLE BYTE CONSTANT LE FDB lt EXPLIST gt FDB directs ASM to assemble the expressions given in the argument field into memory as two byte values The expressions may be of any type Each expression is output as soon as it has been evaluated This means that will have a different value in each expression across a given line If there are labels on the line they will be EQU d to the location counter before the line is processed The most significant byte of each expression is output followed by the least significant byte Null expressions are treated zero values for FCB two bytes of zero will be output If more than 4 bytes generated only the first four are listed on the line with the statement Additional lines are used to list all bytes after the fourth will be listed only if PGEN 1 has been specified Examples 0000 0000 FDB 0
99. s the translation symbolically specified machine instructions into a form directly understandable by the target computer This section presumes knowledge of the 6809 instruction set which can be found in the Motorola 6809 Programming Manual ASM is fully compatible with the Motorola 6809 standard assembler syntax with several useful extensions 11 6800 6801 Opcodes are accepted and generate equivalent 6809 code Special set of opcodes to allow coding to work on 6800 6801 and 6809 These opcodes are called 688C opcodes See Appendix D Many convenience instructions are included 680 which act as logical extensions to the 00 09 instruction set such as double register shifts 16 bit memory increments and decrements etc Automatic long branching Short branches that are out of range will assembled as long branches if the destination expression contains no forward references Special offset prefix to force 5 bit offset form Multiple labels are allowed separated by commas All labels present on an opcode line will be equated to the location counter before the rest of the line is processed A B D S X U CC DP PC and PCR may be used as ordinary symbols as long as they are distinguishable from their use as register designators Copyright C 1977 41 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES ASM processes each machine
100. seful to display the value of a given expression in the listing If no expression is present Illegal Argument is reported IMPLICIT EQU LF A label found in the label field with a null command field is treated as shorthand for LF EQU This allows a notationally pretty method of placing very long labels in sequences of assembled machine instructions Copyright C 1977 59 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VII DIRECTIVES Examples A B EQU 10 Sets values of A and B to 16 EQU A Displays value of A C EQU Causes illegal argument error D EQU E level of forward E EQU 15 reference is allowed LDAA E This will generate a page zero reference 2 bytes LDAA D This will generate a long Preference 3 bytes I EQU 10 Note that once symbol is EQU d I EQU 99 sit may not be redefined this an F EQU G is illegal G EQU H H EQU 510 F It is diagnosed here THISISAVERYLONGLABEL Whose value is equated to Copyright C 1977 60 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VII DIRECTIVES SET LF SET EXP SET is like EQU see above with one difference symbols whose values have been defined by SET may later be redefined using SET EXP may NOT involve a forward reference SET and EQU are mutually exclusive If a symbol is SET in its first definition it may not later be EQU d if a symbol is FQU d first it may not
101. sent The scanning of a line is always stopped by a semi colon character encountered outside a text string 1 LABEL FIELD or LF The label field if non null must begin in the first column of the line see Line Numbers below for exception This field is generally used to specify symbols whose values to be changed or determined by the command given on the same line If the label field begins with an asterisk the entire line is treated as a comment It will be listed but otherwise ignored 2 COMMAND FIELD or command field is the second field of the line This field is examined by ASM in order to determine how to process the line If the command field is absent ASM will treat the line as an implicit EQU if a label 15 present otherwise the line will be treated as a comment 3 ARGUMENT FIELD or AF The argument field is the third field of the line It contains all arguments needed by the command For an argument field to be present there must also be a command field Example LDAA AF ARGUMENT FIELD COMMAND FIELD 4 COMMENT FIELD Any portion of the line which is not scanned for a given command or which 15 separated from the rest of the line by a semicolon is treated as commentary It is listed but otherwise ignored but note that this is not the case when the semicolon is part of or delimits a string See discussions of FCC TITLE directives Copyright C 1977 6 Software Dy
102. specified in ascending order If any argument to a TABS directive is erroneous the tabs are reset to their default values PCC controls whether the TABS command is listed At least one lt EXP gt must be present and null expressions NOT allowed Copyright 1977 96 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION IX ASSEMBLY CONTROL DIRECTIVES PRINT SKIPPED RECORDS PSR EXP The PSR directive allows the user to specify whether records skipped due to conditional assembly commands are to be listed lt gt is evaluated if false then skipped records are not to be included in the listing if true skipped records are to be included in the listing marked by S printed the data field of the listing This command can be especially useful when preparing listings of software for release to the users of the software Code not relevant to the particular system generated can be easily omitted from the listing PCC controls whether the PSR command is listed default is PSR 1 PRINT GENERATED DATA PGEN EXP The PGEN directive is used to tell ASM whether all data generated is to be included in the listing The expression 15 evaluated if false only the first four bytes of data will listed If true all data will be listed with additional lines included on the listing if necessary PCC controls the listing of the PGEN directive The default is PGEN 0 Examp
103. t gt force 16 bit offset Examples ORB lt lt BUGOUT U sAssumes BUGOUT fits 5 bits SUBB FAROUT X sForces offset to 16 bits LDA lt WAYOUT Y sAssumes WAYOUT fits in 8 bits Copyright C 1977 47 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES Notes l PC indexing does not have 5 bit offset form This means PC and PCR are illegal 2 There is no 5 bit offset indirect form This means lt lt 1 is illegal 3 If the offset expression has no forward references and evaluates to zero during Pass 1 then the zero offset form will be substituted The zero offset form saves one machine cycle over the 5 bit offset form Example BACKWARD EQU 0 LDA BACKWARD X Generates LDA X STA FORWARD Y Generates STA gt 0 FORWARD EQU 0 Notice that the FORWARD reference generated l6 bit offset This is because in ASM Pass l the value of FORWARD was not known and the worst case was assumed PROGRAM COUNTER RELATIVE INDEXED MODE This isa special form of constant offset indexing from the program counter It is an alternate to the form PC section IMPLICIT VALUES describes the value as being the location of the NEXT instruction This 15 the implicit value of the PC during the execution of any instruction If only the PC form were available PC relative addressing would usually be lt destination gt PC Program Counter Relative notatio
104. t not before checking the operator after next and so on The ordering decision is made as follows 1 The first operators performed will be monadic operators from right to left SYM lt gt SYM 4 lt gt M 2 The next operator performed will be double hash shift A 3 gt A 3 3 The next operators performed will be and going from left to right across the expression A B 5 lt gt A B 5 5 4 lt gt A 5 4 A B 2 lt gt A B 2 4 The next operators performed will be dyadic and again from left to right A 3 B A 3 B A 34B lt gt A 3 B A B C gt A B C A B 4 lt gt A B 4 5 The next operators evaluated will be the relational operators lt lt lt gt gt gt lt lt lt gt gt and 3 A lt B 3 A lt B A 2 5 A 2 lt gt 4 2 5 A 2 B 3 A lt gt gt 3 lt lt lt gt lt lt 6 Last come the logical operators 5 and 11 A lt B amp C D 2 lt gt A lt B amp C D 2 A B C D D G lt gt A gt B C D D lt Copyright C 1977 23 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION III EXPRESSIONS PARENTHESES As implied in the above descriptions parentheses can be used to specify explicitly the order of evaluation of a given expression Parentheses must always be matched that is for every left parenthesis there must be
105. the listing If any non blank characters occur in the argument field the title field in the page header 185 changed before the is ejected If no non blank characters appear the title is not changed If a semicolon appears as the first non blank character after the TITLE command it will ignored but the title field will be set to whatever characters remain on the line Thus a null title may be set by writing TITLE H The first title specified in pass one will be used as the initial value of the title field at the start of the listing in Pass Two controls whether TITLE is listed If LIST 0 is in effect the page eject is not issued However the title will be changed if a new title was specified If 0 has been specified then TITLE followed by PAGE will set both the title and the subtitle only one will be ejected Copyright C 1977 94 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION IX ASSEMBLY CONTROL DIRECTIVES SET SUBTITLE AND EJECT PAGE PAGE cHARACTERS The PAGE directive is identical in function to TITLE except that it changes the subtitle field of the header rather than the title field with TITLE the first subtitle encountered pass one will be used as the initial subtitle of the listing SET NAME NAME CHARACTERS NAM The directive is similar to the TITLE directive with the following differences
106. to simulate 6809 style ka MUL instruction MUL6809 STAA TEMPA Save multiplicand RORB Look at first multiplier bit BCS 3 B lst bit is CLRA lst mult bit is 8 set part prod LSRA Perform multiply iteration RORB BCC 4 RORA RORB BCC 4 RORA RORB BCC 4 ADDA TEMPA RORA RORB BCC 4 4 RORA RORB BCC 4 ADDA TEMPA RORA RORB BCC 4 RORB BCC 4 ADDA TEMPA RORA RORB RTS FIN Copyright C 1977 117 Software Dynamics ASM REFERENCE MANUAL 6 01 83 INDEX amp lt A gt lt gt lt A gt lt A gt l6 Bit Offset 6809 5 Bit Offset 6809 6800 6801 6801 6809 689C 1 16 26 28 30 33 35 5 8 Bit Offset 6890 8 Bit Offset 6809 lt A gt lt lt B gt lt A gt lt lt lt B gt lt A gt lt lt B gt lt A gt lt lt B gt lt A gt gt lt B gt lt A gt gt lt B gt lt A gt gt lt B gt lt A gt gt lt B gt lt A gt gt gt lt B gt lt A gt lt lt B gt lt A gt 1 lt B gt lt A gt lt B gt lt A gt lt B gt lt A gt lt B gt lt A gt amp lt B gt lt A gt lt B gt lt A gt lt B gt lt gt lt gt lt A gt lt B gt lt A gt lt B gt lt A gt lt B gt lt A gt lt B gt AF ASCII ASCII Character Set 5 6800 Accumulator Offset 6809 Add Addressing Mode Addressing 680 Addressing
107. which do not have any value per se The sixth form is used to list lines containing RMB commands PPPP is the value of the location counter at the beginning of the reserved block and VVVV is the number of bytes in the block Copyright C 1977 92 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION IX ASSEMBLY CONTROL DIRECTIVES PRINT CONTROL CARDS PCC lt EXP gt PCC instructs ASM as to whether listing control commands are to be printed on the listing If lt EXP gt is false subsequent control commands will not be printed in the listing If lt EXP gt is true subsequent control commands will be printed in the listing PCC is always printed The default at start of assembly is 0 TURN LISTING ON OFF LIST EXP LIST instructs ASM as to whether subsequent records to be included in the listing If EXP is true subsequent lines will be listed if false subsequent lines will not be listed LIST has no effect unless a listing is being produced WITH LST specified PCC controls whether LIST is listed EXP may be a forward reference LIST 1 in an INCLUDE d file will affect the listing of the file containing the INCLUDE directive Copyright C 1977 93 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION IX ASSEMBLY CONTROL DIRECTIVES SET TITLE AND EJECT PAGE TITLE STRING OF CHARACTERS a TITLE directs ASM to eject a page before printing the next line of
108. xample LDD PNTR Load 1234 from loc QQ PNTR FDB QQ 51234 Copyright C 1977 45 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VI 6809 MACHINE INSTRUCTION LINES INDEXED MODE Indexed mode addressing forms an effective address equal to the sum of an offset value and the contents of an index register There are many types of indexing that may be specified to ASM Zero offset 5 bit offset 8 bit offset l6 bit offset A Reg offset B Reg offset D Reg offset Pre decrement Post increment All the above except 5 bit offset permit indirect addressing specified by enclosing the operand field in s Indexed Mode always involves one of the following index register notations X Index register X Index register 5 System stack pointer U User stack pointer Program Counter PCR Special form of PC for easy relative addressing See section on PC relative addressing that follows General syntax 7 lt opcode gt lt prefix gt C lt expr gt lt indexreg gt ZERO OFFSET INDEXED MODE This mode is also known as a register indirect addressing The effective address is equal to the contents of the specified index register zero Offset Indexed Mode is the shortest and fastest M6899 form for addressing via a register Index Registers X Y U S Syntax lt opcode gt reg register indirect lt opcode gt lt reg gt indirect register indirect Examples
109. ynamics ASM REFERENCE MANUAL 6 01 83 SECTION VIII CONDITIONAL ASSEMBLY DIRECTIVES THE IF DIRECTIVE IF EXP IF is the basic conditional assembly command in ASM STATE l EXP is evaluated If false lt gt is zero or negative 5 transfers to state 3 and skips to an ELSE ELSEIF or FIN If true exp is positive and non zero state 2 is entered STATE 2 Exactly like state 1 except that if this IF would open the 255 th nested conditional assembly block Nesting Error is reported and the IF is ignored STATE 3 ASM unconditionally skips all lines contained in the conditional assembly block which this IF opens STATE 4 Same as state 3 STATE 5 Same as state 3 CLOSE CONDITIONAL ASSEMBLY BLOCK FIN FIN marks the end of the most recently opened conditional assembly block STATE 1 Nesting Error is reported STATES 2 3 4 and 5 ASM returns to the state it was in when it encountered the line that opened this block CONDITIONAL ASSEMBLY WITH CHECK DO lt EXP gt DO s operation is in all cases like IF with the added restriction that the value of lt EXP gt is restricted to be 1 0 any negative value Copyright C 1977 79 Software Dynamics ASM REFERENCE MANUAL 6 01 83 SECTION VIII CONDITIONAL ASSEMBLY DIRECTIVES IF SYMBOL NOT DEFINED IFUND SYMBOL IFUND causes ASM to check the symbol given the argument If the symbol given is undefined the effect is that of IF 1
Download Pdf Manuals
Related Search
Related Contents
Kinivo 501BN HDMI スイッチ GE 49-60562-2 Refrigerator User Manual FDM121 Display for LV Circuit Breaker - User Guide Wallander Instruments Sound Set User Manual Manual OCS-S-Eng Operating Instructions VEGAFLEX 83 manual eTrex® H - Tramsoft T/PUMP® - DIMAVET Copyright © All rights reserved.
Failed to retrieve file