* This file is intended to show real assembly language examples * to users who may be unfamiliar with the assembler specifics * of the THRAss11 (Build in the simulator THRSim11). * Comments are lines that begin with an asterisk in column 1 * These lines are examples of comments. * * Blank lines are also acceptable. * Comments are also any text on a line after the opcode * mnemonic and all operands. For example, in the * following line, the word this and all text afterwards * are comments: label ldx #$1234 this is a comment * Following is an example of each opcode mnemonic in the HC11 instruction * set and its format for the THRASS11 assembler: * Label Opcode Operands ;comment of addressing mode aba ;Inherent abx ;Inherent aby ;Inherent adca #00 ;Immediate adca $00 ;Direct adca $1234 ;Extended adca 0,x ;Index X adca 0,y ;Index Y adcb #00 ;Immediate adcb $00 ;Direct adcb $1234 ;Extended adcb 0,x ;Index X adcb 0,y ;Index Y adda #00 ;Immediate adda $00 ;Direct adda $1234 ;Extended adda 0,x ;Index X adda 0,y ;Index Y addb #00 ;Immediate addb $00 ;Direct addb $1234 ;Extended addb 0,x ;Index X addb 0,y ;Index Y addd #00 ;Immediate addd $00 ;Direct addd $1234 ;Extended addd 0,x ;Index X addd 0,y ;Index Y anda #00 ;Immediate anda $00 ;Direct anda $1234 ;Extended anda 0,x ;Index X anda 0,y ;Index Y andb #00 ;Immediate andb $00 ;Direct andb $1234 ;Extended andb 0,x ;Index X andb 0,y ;Index Y asla ;Inherent aslb ;Inherent asl $1234 ;Extended asl 0,x ;Index X asl 0,y ;Index Y asld ;Inherent asra ;Inherent asrb ;Inherent asr $1234 ;Extended branch1 asr 0,x ;Index X asr 0,y ;Index Y branch2 bcc branch1 ;Relative bclr $00,$80 ;first is direct, second is mask bclr $00 $80 Alternative for compatibility with other assemblers bclr $00,#$80 Alternative for compatibility with other assemblers bclr $00 #$80 Alternative for compatibility with other assemblers branch3 bclr 0,x,$80 ;Index X then mask bclr 0,x $80 Alternative for compatibility with other assemblers bclr 0,x,#$80 Alternative for compatibility with other assemblers bclr 0,x #$80 Alternative for compatibility with other assemblers bclr 0,y,$80 ;Index Y then mask bclr 0,y $80 Alternative for compatibility with other assemblers bclr 0,y,#$80 Alternative for compatibility with other assemblers bclr 0,y #$80 Alternative for compatibility with other assemblers branch4 bcs branch2 ;Relative beq branch3 ;Relative branch5 bge branch4 ;Relative bgt branch5 ;Relative branch6 bhi branch6 ;Relative bhs branch7 ;Relative branch7 bita #00 ;Immediate bita $00 ;Direct branch8 bita $1234 ;Extended bita 0,x ;Index X branch9 bita 0,y ;Index Y bitb #00 ;Immediate branch10 bitb $00 ;Direct bitb $1234 ;Extended branch11 bitb 0,x ;Index X bitb 0,y ;Index Y branch12 ble branch8 ;Relative blo branch9 ;Relative branch13 blt branch10 ;Relative bmi branch11 ;Relative branch14 bne branch12 ;Relative bpl branch13 ;Relative branch15 bra branch14 ;Relative brclr $00,$80 branch15 ;Direct address then mask then relative brclr $00 $80 branch15 Alternative for compatibility with other assemblers brclr $00,#$80 branch15 Alternative for compatibility with other assemblers brclr $00 #$80 branch15 Alternative for compatibility with other assemblers branch16 brclr 0,x,$80 branch16 ;Index X then mask then relative brclr 0,x $80 branch16 Alternative for compatibility with other assemblers brclr 0,x,#$80 branch16 Alternative for compatibility with other assemblers brclr 0,x #$80 branch16 Alternative for compatibility with other assemblers brclr 0,y,$80 branch17 ;Index Y then mask then relative brclr 0,y $80 branch17 Alternative for compatibility with other assemblers brclr 0,y,#$80 branch17 Alternative for compatibility with other assemblers brclr 0,y #$80 branch17 Alternative for compatibility with other assemblers branch17 brn branch18 ;Relative brset $00,$80,branch18 ;Direct address then mask then relative brset $00 $80 branch18 Alternative for compatibility with other assemblers brset $00,#$80 branch18 Alternative for compatibility with other assemblers brset $00 #$80 branch18 Alternative for compatibility with other assemblers branch18 brset 0,x,$80 branch19 ;Index X then mask then relative brset 0,x $80 branch19 Alternative for compatibility with other assemblers brset 0,x,#$80 branch19 Alternative for compatibility with other assemblers brset 0,x #$80 branch19 Alternative for compatibility with other assemblers brset 0,y,$80 branch20 ;Index Y then mask then relative brset 0,y,#$80 branch20 Alternative for compatibility with other assemblers brset 0,y #$80 branch20 Alternative for compatibility with other assemblers branch19 bset $00,$80 ;first is direct, second is mask bset $00 $80 Alternative for compatibility with other assemblers bset $00,#$80 Alternative for compatibility with other assemblers bset $00 #$80 Alternative for compatibility with other assemblers bset 0,x,$80 ;Index X then mask bset 0,x $80 Alternative for compatibility with other assemblers bset 0,x,#$80 Alternative for compatibility with other assemblers bset 0,x #$80 Alternative for compatibility with other assemblers branch20 bset 0,y,$80 ;Index Y then mask bset 0,y $80 Alternative for compatibility with other assemblers bset 0,y,#$80 Alternative for compatibility with other assemblers bset 0,y #$80 Alternative for compatibility with other assemblers bsr branch21 ;Relative branch21 bvc branch22 ;Relative bvs branch23 ;Relative branch22 cba ;Inherent clc ;Inherent branch23 cli ;Inherent clr $1234 ;Extended clr 0,x ;Index X clr 0,y ;Index Y clra ;Inherent clrb ;Inherent clv ;Inherent cmpa #$00 ;Immediate cmpa $00 ;Direct cmpa $1234 ;Extended cmpa 0,x ;Index X cmpa 0,y ;Index Y cmpb #$00 ;Immediate cmpb $00 ;Direct cmpb $1234 ;Extended cmpb 0,x ;Index X cmpb 0,y ;Index Y com $1234 ;Extended com 0,x ;Index X com 0,y ;Index Y coma ;Inherent comb ;Inherent cpd #$0000 ;Immediate cmpd #$0000 Alternative for compatibility with other assemblers cpd $00 ;Direct cmpd $00 Alternative for compatibility with other assemblers cpd $1234 ;Extended cmpd $1234 Alternative for compatibility with other assemblers cpd 0,x ;Index X cmpd 0,x Alternative for compatibility with other assemblers cpd 0,y ;Index Y cmpd 0,y Alternative for compatibility with other assemblers cpx #$0000 ;Immediate cmpx #$0000 Alternative for compatibility with other assemblers cpx $00 ;Direct cmpx $00 Alternative for compatibility with other assemblers cpx $1234 ;Extended cmpx $1234 Alternative for compatibility with other assemblers cpx 0,x ;Index X cmpx 0,x Alternative for compatibility with other assemblers cpx 0,y ;Index Y cmpx 0,y Alternative for compatibility with other assemblers cpy #$0000 ;Immediate cmpy #$0000 Alternative for compatibility with other assemblers cpy $00 ;Direct cmpy $00 Alternative for compatibility with other assemblers cpy $1234 ;Extended cmpy $1234 Alternative for compatibility with other assemblers cpy 0,x ;Index X cmpy 0,x Alternative for compatibility with other assemblers cpy 0,y ;Index Y cmpy 0,y Alternative for compatibility with other assemblers daa ;Inherent dec $1234 ;Extended dec 0,x ;Index X dec 0,y ;Index Y deca ;Inherent decb ;Inherent des ;Inherent dex ;Inherent dey ;Inherent eora #00 ;Immediate eora $00 ;Direct eora $1234 ;Extended eora 0,x ;Index X eora 0,y ;Index Y eorb #00 ;Immediate eorb $00 ;Direct eorb $1234 ;Extended eorb 0,x ;Index X eorb 0,y ;Index Y fdiv ;Inherent idiv ;Inherent inc $1234 ;Extended inc 0,x ;Index X inc 0,y ;Index Y inca ;Inherent incb ;Inherent ins ;Inherent inx ;Inherent iny ;Inherent jmp $1234 ;Extended jmp 0,x ;Index X jmp 0,y ;Index Y jsr $00 ;Direct jsr $1234 ;Extended jsr 0,x ;Index X jsr 0,y ;Index Y ldaa #00 ;Immediate ldaa $00 ;Direct ldaa $1234 ;Extended ldaa 0,x ;Index X ldaa 0,y ;Index Y ldab #00 ;Immediate ldab $00 ;Direct ldab $1234 ;Extended ldab 0,x ;Index X ldab 0,y ;Index Y ldd #0000 ;Immediate ldd $00 ;Direct ldd $1234 ;Extended ldd 0,x ;Index X ldd 0,y ;Index Y lds #0000 ;Immediate lds $00 ;Direct lds $1234 ;Extended lds 0,x ;Index X lds 0,y ;Index Y ldx #0000 ;Immediate ldx $00 ;Direct ldx $1234 ;Extended ldx 0,x ;Index X ldx 0,y ;Index Y ldy #0000 ;Immediate ldy $00 ;Direct ldy $1234 ;Extended ldy 0,x ;Index X ldy 0,y ;Index Y lsla ;Inherent lslb ;Inherent lsl $1234 ;Extended lsl 0,x ;Index X lsl 0,y ;Index Y lsld ;Inherent lsra ;Inherent lsrb ;Inherent lsr $1234 ;Extended lsr 0,x ;Index X lsr 0,y ;Index Y lsrd ;Inherent mul ;Inherent neg $1234 ;Extended neg 0,x ;Index X neg 0,y ;Index X nega ;Inherent negb ;Inherent nop ;Inherent oraa #00 ;Immediate oraa $00 ;Direct oraa $1234 ;Extended oraa 0,x ;Index X oraa 0,y ;Index Y orab #00 ;Immediate orab $00 ;Direct orab $1234 ;Extended orab 0,x ;Index X orab 0,y ;Index Y psha ;Inherent pshb ;Inherent pshx ;Inherent pshy ;Inherent pula ;Inherent pulb ;Inherent pulx ;Inherent puly ;Inherent rola ;Inherent rolb ;Inherent rol $1234 ;Extended rol 0,x ;Index X rol 0,y ;Index Y rora ;Inherent rorb ;Inherent ror $1234 ;Extended ror 0,x ;Index X ror 0,y ;Index Y rti ;Inherent rts ;Inherent sba ;Inherent sbca #00 ;Immediate sbca $00 ;Direct sbca $1234 ;Extended sbca 0,x ;Index X sbca 0,y ;Index Y sbcb #00 ;Immediate sbcb $00 ;Direct sbcb $1234 ;Extended sbcb 0,x ;Index X sbcb 0,y ;Index Y sec ;Inherent sei ;Inherent sev ;Inherent staa $00 ;Direct staa $1234 ;Extended staa 0,x ;Index X staa 0,y ;Index Y stab $00 ;Direct stab $1234 ;Extended stab 0,x ;Index X stab 0,y ;Index Y std $00 ;Direct std $1234 ;Extended std 0,x ;Index X std 0,y ;Index Y stop ;Inherent sts $00 ;Direct sts $1234 ;Extended sts 0,x ;Index X sts 0,y ;Index Y stx $00 ;Direct stx $1234 ;Extended stx 0,x ;Index X stx 0,y ;Index Y sty $00 ;Direct sty $1234 ;Extended sty 0,x ;Index X sty 0,y ;Index Y suba #00 ;Immediate suba $00 ;Direct suba $1234 ;Extended suba 0,x ;Index X suba 0,y ;Index Y subb #00 ;Immediate subb $00 ;Direct subb $1234 ;Extended subb 0,x ;Index X subb 0,y ;Index Y subd #0000 ;Immediate subd $00 ;Direct subd $1234 ;Extended subd 0,x ;Index X subd 0,y ;Index Y swi ;Inherent tab ;Inherent tap ;Inherent tba ;Inherent tpa ;Inherent tst $1234 ;Extended tst 0,x ;Index X tst 0,y ;Index Y tsta ;Inherent tstb ;Inherent tsx ;Inherent tsy ;Inherent txs ;Inherent tys ;Inherent wai ;Inherent xgdx ;Inherent xgdy ;Inherent * Assembler directives are found in the opcode field and will * cause the assembler to perform a specific action. Following * are examples of the supported assembler directives and a * brief explanation of each. * Comments can optionally follow a line with an assembler directive registers EQU $1000 * EQU = Equate Symbol to a Value * This causes the assembler to add the label to the symbol table * and equates it to the given value. In this example, register is the * base address of the register block or hex $1000. * The label cannot be redefined elsewhere. The value must not be * forward-referenced or undefined. *#INCLUDE "hc11reg.inc" Read in EQUs for HC11 IO registers here. * INCLUDE = Include an other source file in THRASS11 assembler * This causes the assembler to read in the specified file. This * is often used to read in a lot of "standard" EQU's. numbers FCB 0,1,$02,'A' * FCB = Form Constant Byte * This causes the assembler to store the operands in successive * 8-bit bytes. The operands must be 8-bit values or single character * constants. Each value is separated by a comma. string FCC 'This is a string of ASCII' * FCC = Form Constant Character String * This causes the label to be assigned the address of the first * letter in the string. The string is stored in successive bytes * with its ASCII value. Instead of double quotes single quotes can be * used. more_nums FDB 0000,$1234,"!! * FDB = Form Double Byte * Function is similar to that of FCB except 16-bit values are stored * sequentially in memory. These values may be numbers or double ASCII. ORG $c000 * ORG = Set location counter to origin * This allows the user to set the location counter to a specified value. * This is commonly used to ensure that code is assembled for the correct * addresses which correspond to your memory map. The above example sets * the location counter to the address $c000 which is the beginning of * ROM in some MC68HC11 microcontrollers. variables RMB 3 * RMB = Reserve Memory Bytes * This directive allows the user to reserve addresses and associate a * label to that address for variables, tables, etc. This example * reserves the next three sequential bytes for variables and * associates the first address with the symbol variables. END * END = End of assembler input * This causes the assembler to stop reading the file. All lines following this line are comments. If you do not use an END directive the assembler reads until the end of file.