Appendix A
Instruction directory for the 6809 and 6309
You have stopped on BNE. Does it test the accumulator? It reads one bit in CC. Look up BNE, then find the instruction that last wrote Z. In the receiver’s counting loop, that writer is DECB. At the packet check it is CMPA. Identical branch instructions answer different questions because they inherit different evidence.
Pick an operation
| What do you want the processor to do? | Go to |
|---|---|
| Get a value, store a value, or calculate where it lives | Move a value or compute an address |
| Add, subtract, multiply, divide, or extend a signed value | Calculate with integers |
| Test, clear, set, invert, or combine bits | Test and change bits |
| Move bits and use carry between operations | Shift and rotate |
| Compare numbers or select the next instruction | Compare and choose a path |
| Call a routine, protect registers, or return to a caller | Call, save and return |
| Interpret an interrupt, a processor mode or a wait | Interrupts and processor control |
| Copy a sequence of bytes with the HD6309 | Transfer a block |
Each family begins with an alphabetical list. Alternative spellings lead to the same entry. Search this book from its contents page to find a particular mnemonic. In the Assembly editor, put the caret on an instruction and choose Look Up in Assembly Quick Reference for the corresponding native topic.
Read a card from the listing
An instruction card identifies the processor, operands, operation, flags and a printed source. The operand line gives patterns. Pick one pattern and supply your register, constant, expression or label. A blank operand field in the listing is normal for an inherent instruction such as RTS. The register and addressing card explains the punctuation.
MC6809 and HD6309 means the hardware operation exists on both. HD6309 only means the guest needs the Hitachi processor for that hardware instruction. These entries can execute in its startup emulation mode as well as native mode. Selecting the 6309 assembler target admits the encodings. Selecting the 6309 processor supplies the hardware. The program’s mode register controls execution mode and affects interrupt behavior and timing. See HD6309 modes before changing it.
Read Opcode bytes from left to right. For an indexed LDA the opcode is A6. A postbyte follows to say how to use the index register. For a long conditional branch, 10 26 selects LBNE, and the next two bytes hold the displacement. The directory gives just the opcode for each encoding. The listing in the Assembly workspace shows the complete instruction, operands included.
Flags describe the documented processor. When a flag is undefined, choose another test. If you need an earlier comparison, branch before issuing an instruction that rewrites its evidence. The signed comparison experiment shows how to read N and V together. The DIVQ entry flags differences in VCC Plus’s overflow and carry results. For a trace of TFM, debugger Step completes a transfer, whereas Continue can encounter an instruction breakpoint again between bytes.
There are 215 hardware instruction entries and 234 hardware spellings in this edition. An alias can have its own operand convention. For example, BHS is another spelling of BCC; the TFM aliases take bare register names and encode their direction in the mnemonic. For multiple-instruction expansions, data declarations, and link directives, use the LWASM index.
Move a value or compute an address
In the lab, follow the bytes of the receiver.
ABX · EXG · LDA · LDB · LDD · LDE · LDF · LDQ · LDS · LDU · LDW · LDX · LDY · LEAS · LEAU · LEAX · LEAY · STA · STB · STD · STE · STF · STQ · STS · STU · STW · STX · STY · TFR
ABX
MC6809 and HD6309
No operand
Opcode bytes. 3A.
Add the unsigned byte in B to X.
Flags. CC is preserved.
Reading: Atkinson (2009), pp. 4 · Motorola (1981), Appendix A, ABX · Astle, LWTools 4.25, ch. 3.
EXG
MC6809 and HD6309
source register,destination register
Opcode bytes. 1E.
Exchange the contents of the two registers.
Flags. Writing CC replaces its flags.
Use equal-width registers on the MC6809. The HD6309 has additional registers and defined mixed-width behavior. Writing PC transfers control.
Reading: Atkinson (2009), pp. 65–66 · Motorola (1981), Appendix A, EXG · Astle, LWTools 4.25, ch. 3.
LDA
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 96 · indexed A6 · extended B6 · immediate 86.
Copy the operand into A. Use # for a literal or read one byte from the addressed memory.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
LDA #$20 places $20 in A. LDA $0400 reads the byte at $0400. LDA ,X+ reads at X, then advances X by one. The remaining CC bits keep their values. Immediate LDA takes 2 cycles. Extended LDA takes 5 on MC6809 or HD6309 emulation mode and 4 in HD6309 native mode. Indexed timing depends on the postbyte.
Reading: Atkinson (2009), pp. 90 · Motorola (1981), Appendix A, LDA · Astle, LWTools 4.25, ch. 3.
LDB
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct D6 · indexed E6 · extended F6 · immediate C6.
Copy the operand into B. Use # for a literal or read one byte from the addressed memory.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 90 · Motorola (1981), Appendix A, LDB · Astle, LWTools 4.25, ch. 3.
LDD
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct DC · indexed EC · extended FC · immediate CC.
Copy the operand into D. Use # for a literal or read two bytes from the addressed memory.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 91 · Motorola (1981), Appendix A, LDD · Astle, LWTools 4.25, ch. 3.
LDE
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 11 96 · indexed 11 A6 · extended 11 B6 · immediate 11 86.
Copy the operand into E. Use # for a literal or read one byte from the addressed memory.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 90 · Astle, LWTools 4.25, ch. 3.
LDF
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 11 D6 · indexed 11 E6 · extended 11 F6 · immediate 11 C6.
Copy the operand into F. Use # for a literal or read one byte from the addressed memory.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 90 · Astle, LWTools 4.25, ch. 3.
LDQ
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 10 DC · indexed 10 EC · extended 10 FC · immediate CD.
Copy the operand into Q. Use # for a literal or read four bytes from the addressed memory.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 94 · Astle, LWTools 4.25, ch. 3.
LDS
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 10 DE · indexed 10 EE · extended 10 FE · immediate 10 CE.
Copy the operand into S. Use # for a literal or read two bytes from the addressed memory.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 91 · Motorola (1981), Appendix A, LDS · Astle, LWTools 4.25, ch. 3.
LDU
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct DE · indexed EE · extended FE · immediate CE.
Copy the operand into U. Use # for a literal or read two bytes from the addressed memory.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 91 · Motorola (1981), Appendix A, LDU · Astle, LWTools 4.25, ch. 3.
LDW
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 10 96 · indexed 10 A6 · extended 10 B6 · immediate 10 86.
Copy the operand into W. Use # for a literal or read two bytes from the addressed memory.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
LDW #$1234 encodes as 10 86 12 34. E becomes $12 and F becomes $34 in either HD6309 execution mode.
Reading: Atkinson (2009), pp. 91 · Astle, LWTools 4.25, ch. 3.
LDX
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 9E · indexed AE · extended BE · immediate 8E.
Copy the operand into X. Use # for a literal or read two bytes from the addressed memory.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 91 · Motorola (1981), Appendix A, LDX · Astle, LWTools 4.25, ch. 3.
LDY
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 10 9E · indexed 10 AE · extended 10 BE · immediate 10 8E.
Copy the operand into Y. Use # for a literal or read two bytes from the addressed memory.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 91 · Motorola (1981), Appendix A, LDY · Astle, LWTools 4.25, ch. 3.
LEAS
MC6809 and HD6309
offset,index
Opcode bytes. 32.
Calculate an indexed address and place it in S. Indirect addressing reads a pointer before producing the address.
Flags. CC is preserved.
Reading: Atkinson (2009), pp. 95 · Motorola (1981), Appendix A, LEAS · Astle, LWTools 4.25, ch. 3.
LEAU
MC6809 and HD6309
offset,index
Opcode bytes. 33.
Calculate an indexed address and place it in U. Indirect addressing reads a pointer before producing the address.
Flags. CC is preserved.
Reading: Atkinson (2009), pp. 95 · Motorola (1981), Appendix A, LEAU · Astle, LWTools 4.25, ch. 3.
LEAX
MC6809 and HD6309
offset,index
Opcode bytes. 30.
Calculate an indexed address and place it in X. Indirect addressing reads a pointer before producing the address.
Flags. Only Z changes, to indicate a zero address.
Reading: Atkinson (2009), pp. 95 · Motorola (1981), Appendix A, LEAX · Astle, LWTools 4.25, ch. 3.
LEAY
MC6809 and HD6309
offset,index
Opcode bytes. 31.
Calculate an indexed address and place it in Y. Indirect addressing reads a pointer before producing the address.
Flags. Only Z changes, to indicate a zero address.
Reading: Atkinson (2009), pp. 95 · Motorola (1981), Appendix A, LEAY · Astle, LWTools 4.25, ch. 3.
STA
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 97 · indexed A7 · extended B7.
Copy A to the destination address. Multi-byte stores write the high byte first.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 127 · Motorola (1981), Appendix A, STA · Astle, LWTools 4.25, ch. 3.
STB
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct D7 · indexed E7 · extended F7.
Copy B to the destination address. Multi-byte stores write the high byte first.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 127 · Motorola (1981), Appendix A, STB · Astle, LWTools 4.25, ch. 3.
STD
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct DD · indexed ED · extended FD.
Copy D to the destination address. Multi-byte stores write the high byte first.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 128 · Motorola (1981), Appendix A, STD · Astle, LWTools 4.25, ch. 3.
STE
HD6309 only
<direct · offset,X · >address
Opcode bytes. direct 11 97 · indexed 11 A7 · extended 11 B7.
Copy E to the destination address. Multi-byte stores write the high byte first.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 127 · Astle, LWTools 4.25, ch. 3.
STF
HD6309 only
<direct · offset,X · >address
Opcode bytes. direct 11 D7 · indexed 11 E7 · extended 11 F7.
Copy F to the destination address. Multi-byte stores write the high byte first.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 127 · Astle, LWTools 4.25, ch. 3.
STQ
HD6309 only
<direct · offset,X · >address
Opcode bytes. direct 10 DD · indexed 10 ED · extended 10 FD.
Copy Q to the destination address. Multi-byte stores write the high byte first.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 130 · Astle, LWTools 4.25, ch. 3.
STS
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 10 DF · indexed 10 EF · extended 10 FF.
Copy S to the destination address. Multi-byte stores write the high byte first.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 128 · Motorola (1981), Appendix A, STS · Astle, LWTools 4.25, ch. 3.
STU
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct DF · indexed EF · extended FF.
Copy U to the destination address. Multi-byte stores write the high byte first.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 128 · Motorola (1981), Appendix A, STU · Astle, LWTools 4.25, ch. 3.
STW
HD6309 only
<direct · offset,X · >address
Opcode bytes. direct 10 97 · indexed 10 A7 · extended 10 B7.
Copy W to the destination address. Multi-byte stores write the high byte first.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 128 · Astle, LWTools 4.25, ch. 3.
STX
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 9F · indexed AF · extended BF.
Copy X to the destination address. Multi-byte stores write the high byte first.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 128 · Motorola (1981), Appendix A, STX · Astle, LWTools 4.25, ch. 3.
STY
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 10 9F · indexed 10 AF · extended 10 BF.
Copy Y to the destination address. Multi-byte stores write the high byte first.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 128 · Motorola (1981), Appendix A, STY · Astle, LWTools 4.25, ch. 3.
TFR
MC6809 and HD6309
source register,destination register
Opcode bytes. 1F.
Copy the source register to the destination.
Flags. Writing CC replaces its flags.
Use equal-width registers on the MC6809. The HD6309 has additional registers and defined mixed-width behavior. Writing PC transfers control.
Reading: Atkinson (2009), pp. 137–138 · Motorola (1981), Appendix A, TFR · Astle, LWTools 4.25, ch. 3.
Calculate with integers
In the lab, observe the checksum and its flags.
ADCA · ADCB · ADCD · ADCR · ADDA · ADDB · ADDD · ADDE · ADDF · ADDR · ADDW · DAA · DEC · DECA · DECB · DECD · DECE · DECF · DECW · DIVD · DIVQ · INC · INCA · INCB · INCD · INCE · INCF · INCW · MUL · MULD · NEG · NEGA · NEGB · NEGD · SBCA · SBCB · SBCD · SBCR · SEX · SEXW · SUBA · SUBB · SUBD · SUBE · SUBF · SUBR · SUBW
ADCA
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 99 · indexed A9 · extended B9 · immediate 89.
Add the operand and incoming carry to A. Keep the low 8 bits in A.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks unsigned carry. H records carry from bit 3.
Reading: Atkinson (2009), pp. 5 · Motorola (1981), Appendix A, ADCA · Astle, LWTools 4.25, ch. 3.
ADCB
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct D9 · indexed E9 · extended F9 · immediate C9.
Add the operand and incoming carry to B. Keep the low 8 bits in B.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks unsigned carry. H records carry from bit 3.
Reading: Atkinson (2009), pp. 5 · Motorola (1981), Appendix A, ADCB · Astle, LWTools 4.25, ch. 3.
ADCD
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 10 99 · indexed 10 A9 · extended 10 B9 · immediate 10 89.
Add the operand and incoming carry to D. Keep the low 16 bits in D.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks unsigned carry. H is preserved.
Reading: Atkinson (2009), pp. 6 · Astle, LWTools 4.25, ch. 3.
ADCR
HD6309 only
source register,destination register
Opcode bytes. 10 31.
Add source and carry to destination.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks unsigned carry.
The destination selects the width. A word source supplies its low byte to a byte destination. For a word destination A/B supply D, E/F supply W, CC is zero-extended and DP supplies the high byte. PC is undefined in this family. See Atkinson, p. 143.
Reading: Atkinson (2009), pp. 7 · Astle, LWTools 4.25, ch. 3.
ADDA
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 9B · indexed AB · extended BB · immediate 8B.
Add the operand to A. Keep the low 8 bits in A.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks unsigned carry. H records carry from bit 3.
Reading: Atkinson (2009), pp. 8 · Motorola (1981), Appendix A, ADDA · Astle, LWTools 4.25, ch. 3.
ADDB
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct DB · indexed EB · extended FB · immediate CB.
Add the operand to B. Keep the low 8 bits in B.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks unsigned carry. H records carry from bit 3.
Reading: Atkinson (2009), pp. 8 · Motorola (1981), Appendix A, ADDB · Astle, LWTools 4.25, ch. 3.
ADDD
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct D3 · indexed E3 · extended F3 · immediate C3.
Add the operand to D. Keep the low 16 bits in D.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks unsigned carry. H is preserved.
Reading: Atkinson (2009), pp. 9 · Motorola (1981), Appendix A, ADDD · Astle, LWTools 4.25, ch. 3.
ADDE
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 11 9B · indexed 11 AB · extended 11 BB · immediate 11 8B.
Add the operand to E. Keep the low 8 bits in E.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks unsigned carry. H records carry from bit 3.
Reading: Atkinson (2009), pp. 8 · Astle, LWTools 4.25, ch. 3.
ADDF
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 11 DB · indexed 11 EB · extended 11 FB · immediate 11 CB.
Add the operand to F. Keep the low 8 bits in F.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks unsigned carry. H records carry from bit 3.
Reading: Atkinson (2009), pp. 8 · Astle, LWTools 4.25, ch. 3.
ADDR
HD6309 only
source register,destination register
Opcode bytes. 10 30.
Add source to destination.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks unsigned carry.
The destination selects the width. A word source supplies its low byte to a byte destination. For a word destination A/B supply D, E/F supply W, CC is zero-extended and DP supplies the high byte. PC is undefined in this family. See Atkinson, p. 143.
Reading: Atkinson (2009), pp. 10 · Astle, LWTools 4.25, ch. 3.
ADDW
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 10 9B · indexed 10 AB · extended 10 BB · immediate 10 8B.
Add the operand to W. Keep the low 16 bits in W.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks unsigned carry. H is preserved.
Reading: Atkinson (2009), pp. 9 · Astle, LWTools 4.25, ch. 3.
DAA
MC6809 and HD6309
No operand
Opcode bytes. 19.
Adjust A after adding packed BCD bytes, using H and C from the addition.
Flags. N reflects the sign bit. Z marks a zero result. C reports decimal carry. V is undefined.
Reading: Atkinson (2009), pp. 56 · Motorola (1981), Appendix A, DAA · Astle, LWTools 4.25, ch. 3.
DEC
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 0A · indexed 6A · extended 7A.
Operate on a memory byte. Subtract one.
Flags. N reflects the sign bit. Z marks a zero result. V sets on crossing from minimum negative to maximum positive. C is preserved.
Reading: Atkinson (2009), pp. 57–58 · Motorola (1981), Appendix A, DEC · Astle, LWTools 4.25, ch. 3.
DECA
MC6809 and HD6309
No operand
Opcode bytes. 4A.
Operate on register A. Subtract one.
Flags. N reflects the sign bit. Z marks a zero result. V sets on crossing from minimum negative to maximum positive. C is preserved.
Reading: Atkinson (2009), pp. 57–58 · Motorola (1981), Appendix A, DECA · Astle, LWTools 4.25, ch. 3.
DECB
MC6809 and HD6309
No operand
Opcode bytes. 5A.
Operate on register B. Subtract one.
Flags. N reflects the sign bit. Z marks a zero result. V sets on crossing from minimum negative to maximum positive. C is preserved.
Reading: Atkinson (2009), pp. 57–58 · Motorola (1981), Appendix A, DECB · Astle, LWTools 4.25, ch. 3.
DECD
HD6309 only
No operand
Opcode bytes. 10 4A.
Operate on register D. Subtract one.
Flags. N reflects the sign bit. Z marks a zero result. V sets on crossing from minimum negative to maximum positive. C is preserved.
Reading: Atkinson (2009), pp. 57–58 · Astle, LWTools 4.25, ch. 3.
DECE
HD6309 only
No operand
Opcode bytes. 11 4A.
Operate on register E. Subtract one.
Flags. N reflects the sign bit. Z marks a zero result. V sets on crossing from minimum negative to maximum positive. C is preserved.
Reading: Atkinson (2009), pp. 57–58 · Astle, LWTools 4.25, ch. 3.
DECF
HD6309 only
No operand
Opcode bytes. 11 5A.
Operate on register F. Subtract one.
Flags. N reflects the sign bit. Z marks a zero result. V sets on crossing from minimum negative to maximum positive. C is preserved.
Reading: Atkinson (2009), pp. 57–58 · Astle, LWTools 4.25, ch. 3.
DECW
HD6309 only
No operand
Opcode bytes. 10 5A.
Operate on register W. Subtract one.
Flags. N reflects the sign bit. Z marks a zero result. V sets on crossing from minimum negative to maximum positive. C is preserved.
Reading: Atkinson (2009), pp. 57–58 · Astle, LWTools 4.25, ch. 3.
DIVD
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 11 9D · indexed 11 AD · extended 11 BD · immediate 11 8D.
Divide signed D by a signed byte. The quotient goes in B and the remainder in A. A zero divisor traps.
Flags. For an in-range quotient, N and Z describe it, V clears, and C receives its low bit. Signed overflow sets V. Range overflow preserves the dividend and clears N, Z and C.
Reading: Atkinson (2009), pp. 59 · Astle, LWTools 4.25, ch. 3.
DIVQ
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 11 9E · indexed 11 AE · extended 11 BE · immediate 11 8E.
Divide signed Q by a signed word. The quotient goes in W and the remainder in D. A zero divisor traps.
Flags. For an in-range quotient, N and Z describe it, V clears, and C receives its low bit. Signed overflow sets V. Range overflow preserves the dividend and clears N, Z and C.
VCC Plus’s retained core has differences in DIVQ overflow and carry handling. Treat these flags as processor documentation.
Reading: Atkinson (2009), pp. 60 · Astle, LWTools 4.25, ch. 3.
INC
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 0C · indexed 6C · extended 7C.
Operate on a memory byte. Add one.
Flags. N reflects the sign bit. Z marks a zero result. V sets on crossing from maximum positive to minimum negative. C is preserved.
Reading: Atkinson (2009), pp. 67–68 · Motorola (1981), Appendix A, INC · Astle, LWTools 4.25, ch. 3.
INCA
MC6809 and HD6309
No operand
Opcode bytes. 4C.
Operate on register A. Add one.
Flags. N reflects the sign bit. Z marks a zero result. V sets on crossing from maximum positive to minimum negative. C is preserved.
Reading: Atkinson (2009), pp. 67–68 · Motorola (1981), Appendix A, INCA · Astle, LWTools 4.25, ch. 3.
INCB
MC6809 and HD6309
No operand
Opcode bytes. 5C.
Operate on register B. Add one.
Flags. N reflects the sign bit. Z marks a zero result. V sets on crossing from maximum positive to minimum negative. C is preserved.
Reading: Atkinson (2009), pp. 67–68 · Motorola (1981), Appendix A, INCB · Astle, LWTools 4.25, ch. 3.
INCD
HD6309 only
No operand
Opcode bytes. 10 4C.
Operate on register D. Add one.
Flags. N reflects the sign bit. Z marks a zero result. V sets on crossing from maximum positive to minimum negative. C is preserved.
Reading: Atkinson (2009), pp. 67–68 · Astle, LWTools 4.25, ch. 3.
INCE
HD6309 only
No operand
Opcode bytes. 11 4C.
Operate on register E. Add one.
Flags. N reflects the sign bit. Z marks a zero result. V sets on crossing from maximum positive to minimum negative. C is preserved.
Reading: Atkinson (2009), pp. 67–68 · Astle, LWTools 4.25, ch. 3.
INCF
HD6309 only
No operand
Opcode bytes. 11 5C.
Operate on register F. Add one.
Flags. N reflects the sign bit. Z marks a zero result. V sets on crossing from maximum positive to minimum negative. C is preserved.
Reading: Atkinson (2009), pp. 67–68 · Astle, LWTools 4.25, ch. 3.
INCW
HD6309 only
No operand
Opcode bytes. 10 5C.
Operate on register W. Add one.
Flags. N reflects the sign bit. Z marks a zero result. V sets on crossing from maximum positive to minimum negative. C is preserved.
Reading: Atkinson (2009), pp. 67–68 · Astle, LWTools 4.25, ch. 3.
MUL
MC6809 and HD6309
No operand
Opcode bytes. 3D.
Multiply unsigned A by B and place the 16-bit product in D.
Flags. Z marks a zero product. C receives product bit 7.
Reading: Atkinson (2009), pp. 100 · Motorola (1981), Appendix A, MUL · Astle, LWTools 4.25, ch. 3.
MULD
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 11 9F · indexed 11 AF · extended 11 BF · immediate 11 8F.
Multiply signed D by a signed 16-bit operand and store the 32-bit product in Q.
Flags. N reflects the sign bit. Z marks a zero result. V and C clear.
Reading: Atkinson (2009), pp. 101 · Astle, LWTools 4.25, ch. 3.
NEG
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 00 · indexed 60 · extended 70.
Operate on a memory byte. Subtract the value from zero.
Flags. N reflects the sign bit. Z marks a zero result. C sets for a nonzero input. V marks negation of the most negative value.
Reading: Atkinson (2009), pp. 102–103 · Motorola (1981), Appendix A, NEG · Astle, LWTools 4.25, ch. 3.
NEGA
MC6809 and HD6309
No operand
Opcode bytes. 40.
Operate on register A. Subtract the value from zero.
Flags. N reflects the sign bit. Z marks a zero result. C sets for a nonzero input. V marks negation of the most negative value.
Reading: Atkinson (2009), pp. 102–103 · Motorola (1981), Appendix A, NEGA · Astle, LWTools 4.25, ch. 3.
NEGB
MC6809 and HD6309
No operand
Opcode bytes. 50.
Operate on register B. Subtract the value from zero.
Flags. N reflects the sign bit. Z marks a zero result. C sets for a nonzero input. V marks negation of the most negative value.
Reading: Atkinson (2009), pp. 102–103 · Motorola (1981), Appendix A, NEGB · Astle, LWTools 4.25, ch. 3.
NEGD
HD6309 only
No operand
Opcode bytes. 10 40.
Operate on register D. Subtract the value from zero.
Flags. N reflects the sign bit. Z marks a zero result. C sets for a nonzero input. V marks negation of the most negative value.
Reading: Atkinson (2009), pp. 102–103 · Astle, LWTools 4.25, ch. 3.
SBCA
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 92 · indexed A2 · extended B2 · immediate 82.
Subtract the operand and incoming borrow from A. Write the difference to A.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow. H is undefined.
Reading: Atkinson (2009), pp. 122 · Motorola (1981), Appendix A, SBCA · Astle, LWTools 4.25, ch. 3.
SBCB
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct D2 · indexed E2 · extended F2 · immediate C2.
Subtract the operand and incoming borrow from B. Write the difference to B.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow. H is undefined.
Reading: Atkinson (2009), pp. 122 · Motorola (1981), Appendix A, SBCB · Astle, LWTools 4.25, ch. 3.
SBCD
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 10 92 · indexed 10 A2 · extended 10 B2 · immediate 10 82.
Subtract the operand and incoming borrow from D. Write the difference to D.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow.
Reading: Atkinson (2009), pp. 123 · Astle, LWTools 4.25, ch. 3.
SBCR
HD6309 only
source register,destination register
Opcode bytes. 10 33.
Subtract source and borrow from destination.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow.
The destination selects the width. A word source supplies its low byte to a byte destination. For a word destination A/B supply D, E/F supply W, CC is zero-extended and DP supplies the high byte. PC is undefined in this family. See Atkinson, p. 143.
Reading: Atkinson (2009), pp. 124 · Astle, LWTools 4.25, ch. 3.
SEX
MC6809 and HD6309
No operand
Opcode bytes. 1D.
Copy B’s sign bit across A to extend B into D.
Flags. N reflects the sign bit. Z marks a zero result. V and C are preserved.
Reading: Atkinson (2009), pp. 125 · Motorola (1981), Appendix A, SEX · Astle, LWTools 4.25, ch. 3.
SEXW
HD6309 only
No operand
Opcode bytes. 14.
Copy W’s sign bit across D to extend W into Q.
Flags. N reflects the sign bit. Z marks a zero result. V and C are preserved.
Reading: Atkinson (2009), pp. 126 · Astle, LWTools 4.25, ch. 3.
SUBA
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 90 · indexed A0 · extended B0 · immediate 80.
Subtract the operand from A. Write the difference to A.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow. H is undefined.
Reading: Atkinson (2009), pp. 131 · Motorola (1981), Appendix A, SUBA · Astle, LWTools 4.25, ch. 3.
SUBB
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct D0 · indexed E0 · extended F0 · immediate C0.
Subtract the operand from B. Write the difference to B.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow. H is undefined.
Reading: Atkinson (2009), pp. 131 · Motorola (1981), Appendix A, SUBB · Astle, LWTools 4.25, ch. 3.
SUBD
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 93 · indexed A3 · extended B3 · immediate 83.
Subtract the operand from D. Write the difference to D.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow.
Reading: Atkinson (2009), pp. 132 · Motorola (1981), Appendix A, SUBD · Astle, LWTools 4.25, ch. 3.
SUBE
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 11 90 · indexed 11 A0 · extended 11 B0 · immediate 11 80.
Subtract the operand from E. Write the difference to E.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow. H is undefined.
Reading: Atkinson (2009), pp. 131 · Astle, LWTools 4.25, ch. 3.
SUBF
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 11 D0 · indexed 11 E0 · extended 11 F0 · immediate 11 C0.
Subtract the operand from F. Write the difference to F.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow. H is undefined.
Reading: Atkinson (2009), pp. 131 · Astle, LWTools 4.25, ch. 3.
SUBR
HD6309 only
source register,destination register
Opcode bytes. 10 32.
Subtract source from destination.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow.
The destination selects the width. A word source supplies its low byte to a byte destination. For a word destination A/B supply D, E/F supply W, CC is zero-extended and DP supplies the high byte. PC is undefined in this family. See Atkinson, p. 143.
Reading: Atkinson (2009), pp. 133 · Astle, LWTools 4.25, ch. 3.
SUBW
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 10 90 · indexed 10 A0 · extended 10 B0 · immediate 10 80.
Subtract the operand from W. Write the difference to W.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow.
Reading: Atkinson (2009), pp. 132 · Astle, LWTools 4.25, ch. 3.
Test and change bits
In the lab, see which value controls a pixel.
AIM · ANDA · ANDB · ANDD · ANDR · BAND · BEOR · BIAND · BIEOR · BIOR · BITA · BITB · BITD · BOR · CLR · CLRA · CLRB · CLRD · CLRE · CLRF · CLRW · COM · COMA · COMB · COMD · COME · COMF · COMW · EIM · EORA · EORB · EORD · EORR · LDBT · OIM · ORA · ORB · ORD · ORR · STBT · TIM
AIM
HD6309 only
#mask,address · #mask,offset,X
Opcode bytes. direct 02 · indexed 62 · extended 72.
Combine the literal mask and the addressed byte with AND. Write the result to that address.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 11 · Astle, LWTools 4.25, ch. 3.
ANDA
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 94 · indexed A4 · extended B4 · immediate 84.
Keep bits set in both inputs. Combine A with the operand and save the result in A.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 12 · Motorola (1981), Appendix A, ANDA · Astle, LWTools 4.25, ch. 3.
ANDB
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct D4 · indexed E4 · extended F4 · immediate C4.
Keep bits set in both inputs. Combine B with the operand and save the result in B.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 12 · Motorola (1981), Appendix A, ANDB · Astle, LWTools 4.25, ch. 3.
ANDD
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 10 94 · indexed 10 A4 · extended 10 B4 · immediate 10 84.
Keep bits set in both inputs. Combine D with the operand and save the result in D.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 14 · Astle, LWTools 4.25, ch. 3.
ANDR
HD6309 only
source register,destination register
Opcode bytes. 10 34.
Apply bitwise AND to the destination using the source.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
The destination selects the width. A word source supplies its low byte to a byte destination. For a word destination A/B supply D, E/F supply W, CC is zero-extended and DP supplies the high byte. PC is undefined in this family. See Atkinson, p. 143.
Reading: Atkinson (2009), pp. 15 · Astle, LWTools 4.25, ch. 3.
BAND
HD6309 only
A|B|CC,source bit,destination bit,direct address
Opcode bytes. 11 30.
Combine the selected memory bit with the destination register bit using AND. Only the destination bit changes.
Flags. CC can change when a destination bit in CC is selected.
Reading: Atkinson (2009), pp. 20 · Astle, LWTools 4.25, ch. 3.
BEOR
HD6309 only
A|B|CC,source bit,destination bit,direct address
Opcode bytes. 11 34.
Combine the selected memory bit with the destination register bit using exclusive OR. Only the destination bit changes.
Flags. CC can change when a destination bit in CC is selected.
Reading: Atkinson (2009), pp. 23 · Astle, LWTools 4.25, ch. 3.
BIAND
HD6309 only
A|B|CC,source bit,destination bit,direct address
Opcode bytes. 11 31.
Combine the selected memory bit with the destination register bit using AND with the inverted source. Only the destination bit changes.
Flags. CC can change when a destination bit in CC is selected.
Reading: Atkinson (2009), pp. 29 · Astle, LWTools 4.25, ch. 3.
BIEOR
HD6309 only
A|B|CC,source bit,destination bit,direct address
Opcode bytes. 11 35.
Combine the selected memory bit with the destination register bit using exclusive OR with the inverted source. Only the destination bit changes.
Flags. CC can change when a destination bit in CC is selected.
Reading: Atkinson (2009), pp. 30 · Astle, LWTools 4.25, ch. 3.
BIOR
HD6309 only
A|B|CC,source bit,destination bit,direct address
Opcode bytes. 11 33.
Combine the selected memory bit with the destination register bit using OR with the inverted source. Only the destination bit changes.
Flags. CC can change when a destination bit in CC is selected.
Reading: Atkinson (2009), pp. 31 · Astle, LWTools 4.25, ch. 3.
BITA
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 95 · indexed A5 · extended B5 · immediate 85.
Test the bits of A selected by the operand. Preserve both inputs.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 32 · Motorola (1981), Appendix A, BITA · Astle, LWTools 4.25, ch. 3.
BITB
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct D5 · indexed E5 · extended F5 · immediate C5.
Test the bits of B selected by the operand. Preserve both inputs.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 32 · Motorola (1981), Appendix A, BITB · Astle, LWTools 4.25, ch. 3.
BITD
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 10 95 · indexed 10 A5 · extended 10 B5 · immediate 10 85.
Test the bits of D selected by the operand. Preserve both inputs.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 33 · Astle, LWTools 4.25, ch. 3.
BOR
HD6309 only
A|B|CC,source bit,destination bit,direct address
Opcode bytes. 11 32.
Combine the selected memory bit with the destination register bit using OR. Only the destination bit changes.
Flags. CC can change when a destination bit in CC is selected.
Reading: Atkinson (2009), pp. 41 · Astle, LWTools 4.25, ch. 3.
CLR
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 0F · indexed 6F · extended 7F.
Operate on a memory byte. Write zero.
Flags. Z sets. N, V and C clear.
Reading: Atkinson (2009), pp. 48–49 · Motorola (1981), Appendix A, CLR · Astle, LWTools 4.25, ch. 3.
CLRA
MC6809 and HD6309
No operand
Opcode bytes. 4F.
Operate on register A. Write zero.
Flags. Z sets. N, V and C clear.
Reading: Atkinson (2009), pp. 48–49 · Motorola (1981), Appendix A, CLRA · Astle, LWTools 4.25, ch. 3.
CLRB
MC6809 and HD6309
No operand
Opcode bytes. 5F.
Operate on register B. Write zero.
Flags. Z sets. N, V and C clear.
Reading: Atkinson (2009), pp. 48–49 · Motorola (1981), Appendix A, CLRB · Astle, LWTools 4.25, ch. 3.
CLRD
HD6309 only
No operand
Opcode bytes. 10 4F.
Operate on register D. Write zero.
Flags. Z sets. N, V and C clear.
Reading: Atkinson (2009), pp. 48–49 · Astle, LWTools 4.25, ch. 3.
CLRE
HD6309 only
No operand
Opcode bytes. 11 4F.
Operate on register E. Write zero.
Flags. Z sets. N, V and C clear.
Reading: Atkinson (2009), pp. 48–49 · Astle, LWTools 4.25, ch. 3.
CLRF
HD6309 only
No operand
Opcode bytes. 11 5F.
Operate on register F. Write zero.
Flags. Z sets. N, V and C clear.
Reading: Atkinson (2009), pp. 48–49 · Astle, LWTools 4.25, ch. 3.
CLRW
HD6309 only
No operand
Opcode bytes. 10 5F.
Operate on register W. Write zero.
Flags. Z sets. N, V and C clear.
Reading: Atkinson (2009), pp. 48–49 · Astle, LWTools 4.25, ch. 3.
COM
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 03 · indexed 63 · extended 73.
Operate on a memory byte. Invert every bit.
Flags. N reflects the sign bit. Z marks a zero result. C sets and V clears.
Reading: Atkinson (2009), pp. 53–54 · Motorola (1981), Appendix A, COM · Astle, LWTools 4.25, ch. 3.
COMA
MC6809 and HD6309
No operand
Opcode bytes. 43.
Operate on register A. Invert every bit.
Flags. N reflects the sign bit. Z marks a zero result. C sets and V clears.
Reading: Atkinson (2009), pp. 53–54 · Motorola (1981), Appendix A, COMA · Astle, LWTools 4.25, ch. 3.
COMB
MC6809 and HD6309
No operand
Opcode bytes. 53.
Operate on register B. Invert every bit.
Flags. N reflects the sign bit. Z marks a zero result. C sets and V clears.
Reading: Atkinson (2009), pp. 53–54 · Motorola (1981), Appendix A, COMB · Astle, LWTools 4.25, ch. 3.
COMD
HD6309 only
No operand
Opcode bytes. 10 43.
Operate on register D. Invert every bit.
Flags. N reflects the sign bit. Z marks a zero result. C sets and V clears.
Reading: Atkinson (2009), pp. 53–54 · Astle, LWTools 4.25, ch. 3.
COME
HD6309 only
No operand
Opcode bytes. 11 43.
Operate on register E. Invert every bit.
Flags. N reflects the sign bit. Z marks a zero result. C sets and V clears.
Reading: Atkinson (2009), pp. 53–54 · Astle, LWTools 4.25, ch. 3.
COMF
HD6309 only
No operand
Opcode bytes. 11 53.
Operate on register F. Invert every bit.
Flags. N reflects the sign bit. Z marks a zero result. C sets and V clears.
Reading: Atkinson (2009), pp. 53–54 · Astle, LWTools 4.25, ch. 3.
COMW
HD6309 only
No operand
Opcode bytes. 10 53.
Operate on register W. Invert every bit.
Flags. N reflects the sign bit. Z marks a zero result. C sets and V clears.
Reading: Atkinson (2009), pp. 53–54 · Astle, LWTools 4.25, ch. 3.
EIM
HD6309 only
#mask,address · #mask,offset,X
Opcode bytes. direct 05 · indexed 65 · extended 75.
Combine the literal mask and the addressed byte with exclusive OR. Write the result to that address.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 61 · Astle, LWTools 4.25, ch. 3.
EORA
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 98 · indexed A8 · extended B8 · immediate 88.
Set bits where the inputs differ. Combine A with the operand and save the result in A.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 62 · Motorola (1981), Appendix A, EORA · Astle, LWTools 4.25, ch. 3.
EORB
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct D8 · indexed E8 · extended F8 · immediate C8.
Set bits where the inputs differ. Combine B with the operand and save the result in B.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 62 · Motorola (1981), Appendix A, EORB · Astle, LWTools 4.25, ch. 3.
EORD
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 10 98 · indexed 10 A8 · extended 10 B8 · immediate 10 88.
Set bits where the inputs differ. Combine D with the operand and save the result in D.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 63 · Astle, LWTools 4.25, ch. 3.
EORR
HD6309 only
source register,destination register
Opcode bytes. 10 36.
Toggle destination bits selected by the source.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
The destination selects the width. A word source supplies its low byte to a byte destination. For a word destination A/B supply D, E/F supply W, CC is zero-extended and DP supplies the high byte. PC is undefined in this family. See Atkinson, p. 143.
Reading: Atkinson (2009), pp. 64 · Astle, LWTools 4.25, ch. 3.
LDBT
HD6309 only
A|B|CC,source bit,destination bit,direct address
Opcode bytes. 11 36.
Combine the selected memory bit with the destination register bit using copy. Only the destination bit changes.
Flags. CC can change when a destination bit in CC is selected.
Reading: Atkinson (2009), pp. 92 · Astle, LWTools 4.25, ch. 3.
OIM
HD6309 only
#mask,address · #mask,offset,X
Opcode bytes. direct 01 · indexed 61 · extended 71.
Combine the literal mask and the addressed byte with OR. Write the result to that address.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 105 · Astle, LWTools 4.25, ch. 3.
ORA
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 9A · indexed AA · extended BA · immediate 8A.
Set bits present in either input. Combine A with the operand and save the result in A.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 106 · Motorola (1981), Appendix A, ORA · Astle, LWTools 4.25, ch. 3.
ORB
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct DA · indexed EA · extended FA · immediate CA.
Set bits present in either input. Combine B with the operand and save the result in B.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 106 · Motorola (1981), Appendix A, ORB · Astle, LWTools 4.25, ch. 3.
ORD
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 10 9A · indexed 10 AA · extended 10 BA · immediate 10 8A.
Set bits present in either input. Combine D with the operand and save the result in D.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 108 · Astle, LWTools 4.25, ch. 3.
ORR
HD6309 only
source register,destination register
Opcode bytes. 10 35.
Apply bitwise OR to the destination using the source.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
The destination selects the width. A word source supplies its low byte to a byte destination. For a word destination A/B supply D, E/F supply W, CC is zero-extended and DP supplies the high byte. PC is undefined in this family. See Atkinson, p. 143.
Reading: Atkinson (2009), pp. 109 · Astle, LWTools 4.25, ch. 3.
STBT
HD6309 only
A|B|CC,source bit,destination bit,direct address
Opcode bytes. 11 37.
Copy the selected register bit to the destination bit in direct-page memory.
Flags. CC can change when a destination bit in CC is selected.
Reading: Atkinson (2009), pp. 129 · Astle, LWTools 4.25, ch. 3.
TIM
HD6309 only
#mask,address · #mask,offset,X
Opcode bytes. direct 0B · indexed 6B · extended 7B.
Combine the literal mask and the addressed byte with AND. Use the result only to test flags.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 139 · Astle, LWTools 4.25, ch. 3.
Shift and rotate
In the lab, interpret the high bit and carry.
ASL · ASLA · ASLB · ASLD · ASR · ASRA · ASRB · ASRD · LSL · LSLA · LSLB · LSLD · LSR · LSRA · LSRB · LSRD · LSRW · ROL · ROLA · ROLB · ROLD · ROLW · ROR · RORA · RORB · RORD · RORW
ASL
Other spellings: LSL.
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 08 · indexed 68 · extended 78.
Operate on a memory byte. Shift one place left and fill bit 0 with zero.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old top bit. V is N XOR C. H is undefined.
Reading: Atkinson (2009), pp. 16–17 · Motorola (1981), Appendix A, ASL · Astle, LWTools 4.25, ch. 3.
ASLA
Other spellings: LSLA.
MC6809 and HD6309
No operand
Opcode bytes. 48.
Operate on register A. Shift one place left and fill bit 0 with zero.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old top bit. V is N XOR C. H is undefined.
Reading: Atkinson (2009), pp. 16–17 · Motorola (1981), Appendix A, ASLA · Astle, LWTools 4.25, ch. 3.
ASLB
Other spellings: LSLB.
MC6809 and HD6309
No operand
Opcode bytes. 58.
Operate on register B. Shift one place left and fill bit 0 with zero.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old top bit. V is N XOR C. H is undefined.
Reading: Atkinson (2009), pp. 16–17 · Motorola (1981), Appendix A, ASLB · Astle, LWTools 4.25, ch. 3.
ASLD
Other spellings: LSLD.
HD6309 only
No operand
Opcode bytes. 10 48.
Operate on register D. Shift one place left and fill bit 0 with zero.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old top bit. V is N XOR C.
Reading: Atkinson (2009), pp. 16–17 · Astle, LWTools 4.25, ch. 3.
ASR
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 07 · indexed 67 · extended 77.
Operate on a memory byte. Shift right, preserving the sign bit.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old bit 0. V is preserved. H is undefined.
Reading: Atkinson (2009), pp. 18–19 · Motorola (1981), Appendix A, ASR · Astle, LWTools 4.25, ch. 3.
ASRA
MC6809 and HD6309
No operand
Opcode bytes. 47.
Operate on register A. Shift right, preserving the sign bit.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old bit 0. V is preserved. H is undefined.
Reading: Atkinson (2009), pp. 18–19 · Motorola (1981), Appendix A, ASRA · Astle, LWTools 4.25, ch. 3.
ASRB
MC6809 and HD6309
No operand
Opcode bytes. 57.
Operate on register B. Shift right, preserving the sign bit.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old bit 0. V is preserved. H is undefined.
Reading: Atkinson (2009), pp. 18–19 · Motorola (1981), Appendix A, ASRB · Astle, LWTools 4.25, ch. 3.
ASRD
HD6309 only
No operand
Opcode bytes. 10 47.
Operate on register D. Shift right, preserving the sign bit.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old bit 0. V is preserved.
Reading: Atkinson (2009), pp. 18–19 · Astle, LWTools 4.25, ch. 3.
LSR
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 04 · indexed 64 · extended 74.
Operate on a memory byte. Shift right, bringing zero into the top bit.
Flags. N clears. Z marks zero. C receives the old bit 0. V is preserved.
Reading: Atkinson (2009), pp. 98–99 · Motorola (1981), Appendix A, LSR · Astle, LWTools 4.25, ch. 3.
LSRA
MC6809 and HD6309
No operand
Opcode bytes. 44.
Operate on register A. Shift right, bringing zero into the top bit.
Flags. N clears. Z marks zero. C receives the old bit 0. V is preserved.
Reading: Atkinson (2009), pp. 98–99 · Motorola (1981), Appendix A, LSRA · Astle, LWTools 4.25, ch. 3.
LSRB
MC6809 and HD6309
No operand
Opcode bytes. 54.
Operate on register B. Shift right, bringing zero into the top bit.
Flags. N clears. Z marks zero. C receives the old bit 0. V is preserved.
Reading: Atkinson (2009), pp. 98–99 · Motorola (1981), Appendix A, LSRB · Astle, LWTools 4.25, ch. 3.
LSRD
HD6309 only
No operand
Opcode bytes. 10 44.
Operate on register D. Shift right, bringing zero into the top bit.
Flags. N clears. Z marks zero. C receives the old bit 0. V is preserved.
Reading: Atkinson (2009), pp. 98–99 · Astle, LWTools 4.25, ch. 3.
LSRW
HD6309 only
No operand
Opcode bytes. 10 54.
Operate on register W. Shift right, bringing zero into the top bit.
Flags. N clears. Z marks zero. C receives the old bit 0. V is preserved.
Reading: Atkinson (2009), pp. 98–99 · Astle, LWTools 4.25, ch. 3.
ROL
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 09 · indexed 69 · extended 79.
Operate on a memory byte. Shift left, moving the old carry into bit 0.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old top bit. V is N XOR C.
Reading: Atkinson (2009), pp. 116–117 · Motorola (1981), Appendix A, ROL · Astle, LWTools 4.25, ch. 3.
ROLA
MC6809 and HD6309
No operand
Opcode bytes. 49.
Operate on register A. Shift left, moving the old carry into bit 0.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old top bit. V is N XOR C.
Reading: Atkinson (2009), pp. 116–117 · Motorola (1981), Appendix A, ROLA · Astle, LWTools 4.25, ch. 3.
ROLB
MC6809 and HD6309
No operand
Opcode bytes. 59.
Operate on register B. Shift left, moving the old carry into bit 0.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old top bit. V is N XOR C.
Reading: Atkinson (2009), pp. 116–117 · Motorola (1981), Appendix A, ROLB · Astle, LWTools 4.25, ch. 3.
ROLD
HD6309 only
No operand
Opcode bytes. 10 49.
Operate on register D. Shift left, moving the old carry into bit 0.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old top bit. V is N XOR C.
Reading: Atkinson (2009), pp. 116–117 · Astle, LWTools 4.25, ch. 3.
ROLW
HD6309 only
No operand
Opcode bytes. 10 59.
Operate on register W. Shift left, moving the old carry into bit 0.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old top bit. V is N XOR C.
Reading: Atkinson (2009), pp. 116–117 · Astle, LWTools 4.25, ch. 3.
ROR
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 06 · indexed 66 · extended 76.
Operate on a memory byte. Shift right, moving the old carry into the top bit.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old bit 0. V is preserved.
Reading: Atkinson (2009), pp. 118–119 · Motorola (1981), Appendix A, ROR · Astle, LWTools 4.25, ch. 3.
RORA
MC6809 and HD6309
No operand
Opcode bytes. 46.
Operate on register A. Shift right, moving the old carry into the top bit.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old bit 0. V is preserved.
Reading: Atkinson (2009), pp. 118–119 · Motorola (1981), Appendix A, RORA · Astle, LWTools 4.25, ch. 3.
RORB
MC6809 and HD6309
No operand
Opcode bytes. 56.
Operate on register B. Shift right, moving the old carry into the top bit.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old bit 0. V is preserved.
Reading: Atkinson (2009), pp. 118–119 · Motorola (1981), Appendix A, RORB · Astle, LWTools 4.25, ch. 3.
RORD
HD6309 only
No operand
Opcode bytes. 10 46.
Operate on register D. Shift right, moving the old carry into the top bit.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old bit 0. V is preserved.
Reading: Atkinson (2009), pp. 118–119 · Astle, LWTools 4.25, ch. 3.
RORW
HD6309 only
No operand
Opcode bytes. 10 56.
Operate on register W. Shift right, moving the old carry into the top bit.
Flags. N reflects the sign bit. Z marks a zero result. C receives the old bit 0. V is preserved.
Reading: Atkinson (2009), pp. 118–119 · Astle, LWTools 4.25, ch. 3.
Compare and choose a path
In the lab, test signed and unsigned decisions.
BCC · BCS · BEQ · BGE · BGT · BHI · BHS · BLE · BLO · BLS · BLT · BMI · BNE · BPL · BRA · BRN · BVC · BVS · CMPA · CMPB · CMPD · CMPE · CMPF · CMPR · CMPS · CMPU · CMPW · CMPX · CMPY · JMP · LBCC · LBCS · LBEQ · LBGE · LBGT · LBHI · LBHS · LBLE · LBLO · LBLS · LBLT · LBMI · LBNE · LBPL · LBRA · LBRN · LBVC · LBVS · TST · TSTA · TSTB · TSTD · TSTE · TSTF · TSTW
BCC
Other spellings: BHS.
MC6809 and HD6309
target label
Opcode bytes. 24.
Continue at the target when C is clear (unsigned higher or equal after a compare). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 21 · Motorola (1981), Appendix A, BCC · Astle, LWTools 4.25, ch. 3.
BCS
Other spellings: BLO.
MC6809 and HD6309
target label
Opcode bytes. 25.
Continue at the target when C is set (unsigned lower). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 22 · Motorola (1981), Appendix A, BCS · Astle, LWTools 4.25, ch. 3.
BEQ
MC6809 and HD6309
target label
Opcode bytes. 27.
Continue at the target when Z is set (equal). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 24 · Motorola (1981), Appendix A, BEQ · Astle, LWTools 4.25, ch. 3.
BGE
MC6809 and HD6309
target label
Opcode bytes. 2C.
Continue at the target when N equals V (signed greater or equal). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 25 · Motorola (1981), Appendix A, BGE · Astle, LWTools 4.25, ch. 3.
BGT
MC6809 and HD6309
target label
Opcode bytes. 2E.
Continue at the target when Z is clear and N equals V (signed greater). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 26 · Motorola (1981), Appendix A, BGT · Astle, LWTools 4.25, ch. 3.
BHI
MC6809 and HD6309
target label
Opcode bytes. 22.
Continue at the target when C and Z are both clear (unsigned higher). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 27 · Motorola (1981), Appendix A, BHI · Astle, LWTools 4.25, ch. 3.
BLE
MC6809 and HD6309
target label
Opcode bytes. 2F.
Continue at the target when Z is set or N differs from V (signed less or equal). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 35 · Motorola (1981), Appendix A, BLE · Astle, LWTools 4.25, ch. 3.
BLS
MC6809 and HD6309
target label
Opcode bytes. 23.
Continue at the target when C or Z is set (unsigned lower or equal). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 37 · Motorola (1981), Appendix A, BLS · Astle, LWTools 4.25, ch. 3.
BLT
MC6809 and HD6309
target label
Opcode bytes. 2D.
Continue at the target when N differs from V (signed less). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 38 · Motorola (1981), Appendix A, BLT · Astle, LWTools 4.25, ch. 3.
BMI
MC6809 and HD6309
target label
Opcode bytes. 2B.
Continue at the target when N is set (negative). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 39 · Motorola (1981), Appendix A, BMI · Astle, LWTools 4.25, ch. 3.
BNE
MC6809 and HD6309
target label
Opcode bytes. 26.
Continue at the target when Z is clear (unequal). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 40 · Motorola (1981), Appendix A, BNE · Astle, LWTools 4.25, ch. 3.
BPL
MC6809 and HD6309
target label
Opcode bytes. 2A.
Continue at the target when N is clear (nonnegative). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 42 · Motorola (1981), Appendix A, BPL · Astle, LWTools 4.25, ch. 3.
BRA
MC6809 and HD6309
target label
Opcode bytes. 20.
Continue at the target. A branch to its own label forms a hold loop.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 43 · Motorola (1981), Appendix A, BRA · Astle, LWTools 4.25, ch. 3.
BRN
MC6809 and HD6309
target label
Opcode bytes. 21.
Read the displacement and continue at the next instruction.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 44 · Motorola (1981), Appendix A, BRN · Astle, LWTools 4.25, ch. 3.
BVC
MC6809 and HD6309
target label
Opcode bytes. 28.
Continue at the target when V is clear (no signed overflow). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 46 · Motorola (1981), Appendix A, BVC · Astle, LWTools 4.25, ch. 3.
BVS
MC6809 and HD6309
target label
Opcode bytes. 29.
Continue at the target when V is set (signed overflow). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 47 · Motorola (1981), Appendix A, BVS · Astle, LWTools 4.25, ch. 3.
CMPA
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 91 · indexed A1 · extended B1 · immediate 81.
Subtract the operand from A. Keep A intact for a later branch.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow. H is undefined.
Reading: Atkinson (2009), pp. 50 · Motorola (1981), Appendix A, CMPA · Astle, LWTools 4.25, ch. 3.
CMPB
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct D1 · indexed E1 · extended F1 · immediate C1.
Subtract the operand from B. Keep B intact for a later branch.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow. H is undefined.
Reading: Atkinson (2009), pp. 50 · Motorola (1981), Appendix A, CMPB · Astle, LWTools 4.25, ch. 3.
CMPD
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 10 93 · indexed 10 A3 · extended 10 B3 · immediate 10 83.
Subtract the operand from D. Keep D intact for a later branch.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow.
Reading: Atkinson (2009), pp. 51 · Motorola (1981), Appendix A, CMPD · Astle, LWTools 4.25, ch. 3.
CMPE
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 11 91 · indexed 11 A1 · extended 11 B1 · immediate 11 81.
Subtract the operand from E. Keep E intact for a later branch.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow. H is undefined.
Reading: Atkinson (2009), pp. 50 · Astle, LWTools 4.25, ch. 3.
CMPF
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 11 D1 · indexed 11 E1 · extended 11 F1 · immediate 11 C1.
Subtract the operand from F. Keep F intact for a later branch.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow. H is undefined.
Reading: Atkinson (2009), pp. 50 · Astle, LWTools 4.25, ch. 3.
CMPR
HD6309 only
source register,destination register
Opcode bytes. 10 37.
Compare destination minus source, preserving both.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow.
The destination selects the width. A word source supplies its low byte to a byte destination. For a word destination A/B supply D, E/F supply W, CC is zero-extended and DP supplies the high byte. PC is undefined in this family. See Atkinson, p. 143.
Reading: Atkinson (2009), pp. 52 · Astle, LWTools 4.25, ch. 3.
CMPS
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 11 9C · indexed 11 AC · extended 11 BC · immediate 11 8C.
Subtract the operand from S. Keep S intact for a later branch.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow.
Reading: Atkinson (2009), pp. 51 · Motorola (1981), Appendix A, CMPS · Astle, LWTools 4.25, ch. 3.
CMPU
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 11 93 · indexed 11 A3 · extended 11 B3 · immediate 11 83.
Subtract the operand from U. Keep U intact for a later branch.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow.
Reading: Atkinson (2009), pp. 51 · Motorola (1981), Appendix A, CMPU · Astle, LWTools 4.25, ch. 3.
CMPW
HD6309 only
#literal · <direct · offset,X · >address
Opcode bytes. direct 10 91 · indexed 10 A1 · extended 10 B1 · immediate 10 81.
Subtract the operand from W. Keep W intact for a later branch.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow.
Reading: Atkinson (2009), pp. 51 · Astle, LWTools 4.25, ch. 3.
CMPX
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 9C · indexed AC · extended BC · immediate 8C.
Subtract the operand from X. Keep X intact for a later branch.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow.
Reading: Atkinson (2009), pp. 51 · Motorola (1981), Appendix A, CMPX · Astle, LWTools 4.25, ch. 3.
CMPY
MC6809 and HD6309
#literal · <direct · offset,X · >address
Opcode bytes. direct 10 9C · indexed 10 AC · extended 10 BC · immediate 10 8C.
Subtract the operand from Y. Keep Y intact for a later branch.
Flags. N reflects the sign bit. Z marks a zero result. V marks signed overflow. C marks a borrow.
Reading: Atkinson (2009), pp. 51 · Motorola (1981), Appendix A, CMPY · Astle, LWTools 4.25, ch. 3.
JMP
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 0E · indexed 6E · extended 7E.
Set PC to the effective address.
Flags. CC is preserved.
Reading: Atkinson (2009), pp. 69 · Motorola (1981), Appendix A, JMP · Astle, LWTools 4.25, ch. 3.
LBCC
Other spellings: LBHS.
MC6809 and HD6309
target label
Opcode bytes. 10 24.
Continue at the target when C is clear (unsigned higher or equal after a compare). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 71 · Motorola (1981), Appendix A, LBCC · Astle, LWTools 4.25, ch. 3.
LBCS
Other spellings: LBLO.
MC6809 and HD6309
target label
Opcode bytes. 10 25.
Continue at the target when C is set (unsigned lower). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 72 · Motorola (1981), Appendix A, LBCS · Astle, LWTools 4.25, ch. 3.
LBEQ
MC6809 and HD6309
target label
Opcode bytes. 10 27.
Continue at the target when Z is set (equal). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 73 · Motorola (1981), Appendix A, LBEQ · Astle, LWTools 4.25, ch. 3.
LBGE
MC6809 and HD6309
target label
Opcode bytes. 10 2C.
Continue at the target when N equals V (signed greater or equal). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 74 · Motorola (1981), Appendix A, LBGE · Astle, LWTools 4.25, ch. 3.
LBGT
MC6809 and HD6309
target label
Opcode bytes. 10 2E.
Continue at the target when Z is clear and N equals V (signed greater). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 75 · Motorola (1981), Appendix A, LBGT · Astle, LWTools 4.25, ch. 3.
LBHI
MC6809 and HD6309
target label
Opcode bytes. 10 22.
Continue at the target when C and Z are both clear (unsigned higher). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 76 · Motorola (1981), Appendix A, LBHI · Astle, LWTools 4.25, ch. 3.
LBLE
MC6809 and HD6309
target label
Opcode bytes. 10 2F.
Continue at the target when Z is set or N differs from V (signed less or equal). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 78 · Motorola (1981), Appendix A, LBLE · Astle, LWTools 4.25, ch. 3.
LBLS
MC6809 and HD6309
target label
Opcode bytes. 10 23.
Continue at the target when C or Z is set (unsigned lower or equal). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 80 · Motorola (1981), Appendix A, LBLS · Astle, LWTools 4.25, ch. 3.
LBLT
MC6809 and HD6309
target label
Opcode bytes. 10 2D.
Continue at the target when N differs from V (signed less). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 81 · Motorola (1981), Appendix A, LBLT · Astle, LWTools 4.25, ch. 3.
LBMI
MC6809 and HD6309
target label
Opcode bytes. 10 2B.
Continue at the target when N is set (negative). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 82 · Motorola (1981), Appendix A, LBMI · Astle, LWTools 4.25, ch. 3.
LBNE
MC6809 and HD6309
target label
Opcode bytes. 10 26.
Continue at the target when Z is clear (unequal). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 83 · Motorola (1981), Appendix A, LBNE · Astle, LWTools 4.25, ch. 3.
LBPL
MC6809 and HD6309
target label
Opcode bytes. 10 2A.
Continue at the target when N is clear (nonnegative). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 84 · Motorola (1981), Appendix A, LBPL · Astle, LWTools 4.25, ch. 3.
LBRA
MC6809 and HD6309
target label
Opcode bytes. 16.
Continue at the target. A branch to its own label forms a hold loop.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 85 · Motorola (1981), Appendix A, LBRA · Astle, LWTools 4.25, ch. 3.
LBRN
MC6809 and HD6309
target label
Opcode bytes. 10 21.
Read the displacement and continue at the next instruction.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 86 · Motorola (1981), Appendix A, LBRN · Astle, LWTools 4.25, ch. 3.
LBVC
MC6809 and HD6309
target label
Opcode bytes. 10 28.
Continue at the target when V is clear (no signed overflow). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 88 · Motorola (1981), Appendix A, LBVC · Astle, LWTools 4.25, ch. 3.
LBVS
MC6809 and HD6309
target label
Opcode bytes. 10 29.
Continue at the target when V is set (signed overflow). Otherwise execute the next instruction.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 89 · Motorola (1981), Appendix A, LBVS · Astle, LWTools 4.25, ch. 3.
TST
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 0D · indexed 6D · extended 7D.
Operate on a memory byte. Test the value while preserving it.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 140–141 · Motorola (1981), Appendix A, TST · Astle, LWTools 4.25, ch. 3.
TSTA
MC6809 and HD6309
No operand
Opcode bytes. 4D.
Operate on register A. Test the value while preserving it.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 140–141 · Motorola (1981), Appendix A, TSTA · Astle, LWTools 4.25, ch. 3.
TSTB
MC6809 and HD6309
No operand
Opcode bytes. 5D.
Operate on register B. Test the value while preserving it.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 140–141 · Motorola (1981), Appendix A, TSTB · Astle, LWTools 4.25, ch. 3.
TSTD
HD6309 only
No operand
Opcode bytes. 10 4D.
Operate on register D. Test the value while preserving it.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 140–141 · Astle, LWTools 4.25, ch. 3.
TSTE
HD6309 only
No operand
Opcode bytes. 11 4D.
Operate on register E. Test the value while preserving it.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 140–141 · Astle, LWTools 4.25, ch. 3.
TSTF
HD6309 only
No operand
Opcode bytes. 11 5D.
Operate on register F. Test the value while preserving it.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 140–141 · Astle, LWTools 4.25, ch. 3.
TSTW
HD6309 only
No operand
Opcode bytes. 10 5D.
Operate on register W. Test the value while preserving it.
Flags. N reflects the sign bit. Z marks a zero result. V clears. C is preserved.
Reading: Atkinson (2009), pp. 140–141 · Astle, LWTools 4.25, ch. 3.
Call, save and return
In the lab, follow a return address on S.
BSR · JSR · LBSR · PSHS · PSHSW · PSHU · PSHUW · PULS · PULSW · PULU · PULUW · RTS
BSR
MC6809 and HD6309
target label
Opcode bytes. 8D.
Push the following instruction’s address on S, then continue at the target. RTS returns to the caller.
Flags. CC is preserved.
The signed 8-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 45 · Motorola (1981), Appendix A, BSR · Astle, LWTools 4.25, ch. 3.
JSR
MC6809 and HD6309
<direct · offset,X · >address
Opcode bytes. direct 9D · indexed AD · extended BD.
Push the return address on S, then set PC to the effective address.
Flags. CC is preserved.
Reading: Atkinson (2009), pp. 70 · Motorola (1981), Appendix A, JSR · Astle, LWTools 4.25, ch. 3.
LBSR
MC6809 and HD6309
target label
Opcode bytes. 17.
Push the following instruction’s address on S, then continue at the target. RTS returns to the caller.
Flags. CC is preserved.
The signed 16-bit displacement is relative to the following instruction.
Reading: Atkinson (2009), pp. 87 · Motorola (1981), Appendix A, LBSR · Astle, LWTools 4.25, ch. 3.
PSHS
MC6809 and HD6309
register[,register…] · #mask
Opcode bytes. 34.
Save selected registers on S. The stack grows toward lower addresses.
Flags. CC is preserved.
Select CC, A, B, DP, X, Y, U or PC. LWASM also accepts D for A and B. Hardware determines the register order.
Reading: Atkinson (2009), pp. 110 · Motorola (1981), Appendix A, PSHS · Astle, LWTools 4.25, ch. 3.
PSHSW
HD6309 only
No operand
Opcode bytes. 10 38.
Push both bytes of W onto S, subtracting two from the pointer.
Flags. CC is preserved.
Reading: Atkinson (2009), pp. 111 · Astle, LWTools 4.25, ch. 3.
PSHU
MC6809 and HD6309
register[,register…] · #mask
Opcode bytes. 36.
Save selected registers on U. The stack grows toward lower addresses.
Flags. CC is preserved.
Select CC, A, B, DP, X, Y, S or PC. LWASM also accepts D for A and B. Hardware determines the register order.
Reading: Atkinson (2009), pp. 110 · Motorola (1981), Appendix A, PSHU · Astle, LWTools 4.25, ch. 3.
PSHUW
HD6309 only
No operand
Opcode bytes. 10 3A.
Push both bytes of W onto U, subtracting two from the pointer.
Flags. CC is preserved.
Reading: Atkinson (2009), pp. 112 · Astle, LWTools 4.25, ch. 3.
PULS
MC6809 and HD6309
register[,register…] · #mask
Opcode bytes. 35.
Restore selected registers from S, advancing the stack pointer. Pulling PC transfers control.
Flags. Pulling CC replaces all its flags.
Select CC, A, B, DP, X, Y, U or PC. LWASM also accepts D for A and B. Hardware determines the register order.
Reading: Atkinson (2009), pp. 113 · Motorola (1981), Appendix A, PULS · Astle, LWTools 4.25, ch. 3.
PULSW
HD6309 only
No operand
Opcode bytes. 10 39.
Pull two bytes into W from S, advancing the pointer by two.
Flags. CC is preserved.
Reading: Atkinson (2009), pp. 114 · Astle, LWTools 4.25, ch. 3.
PULU
MC6809 and HD6309
register[,register…] · #mask
Opcode bytes. 37.
Restore selected registers from U, advancing the stack pointer. Pulling PC transfers control.
Flags. Pulling CC replaces all its flags.
Select CC, A, B, DP, X, Y, S or PC. LWASM also accepts D for A and B. Hardware determines the register order.
Reading: Atkinson (2009), pp. 113 · Motorola (1981), Appendix A, PULU · Astle, LWTools 4.25, ch. 3.
PULUW
HD6309 only
No operand
Opcode bytes. 10 3B.
Pull two bytes into W from U, advancing the pointer by two.
Flags. CC is preserved.
Reading: Atkinson (2009), pp. 115 · Astle, LWTools 4.25, ch. 3.
RTS
MC6809 and HD6309
No operand
Opcode bytes. 39.
Pull the return address from S into PC and advance S by two.
Flags. CC is preserved.
Reading: Atkinson (2009), pp. 121 · Motorola (1981), Appendix A, RTS · Astle, LWTools 4.25, ch. 3.
Interrupts and processor control
In the lab, examine the saved interrupt frame.
ANDCC · BITMD · CWAI · LDMD · NOP · ORCC · RTI · SWI · SWI2 · SWI3 · SYNC
ANDCC
MC6809 and HD6309
#mask
Opcode bytes. 1C.
Keep only CC bits selected by the mask.
Flags. Any CC bit can clear.
Reading: Atkinson (2009), pp. 13 · Motorola (1981), Appendix A, ANDCC · Astle, LWTools 4.25, ch. 3.
BITMD
HD6309 only
#mask
Opcode bytes. 11 3C.
Test the masked trap status bits of MD. Reading a selected sticky error clears it.
Flags. Z sets if no selected error was pending.
Reading: Atkinson (2009), pp. 34 · Astle, LWTools 4.25, ch. 3.
CWAI
MC6809 and HD6309
#mask
Opcode bytes. 3C.
AND CC with the mask, stack the full interrupt context on S, then wait for an eligible interrupt.
Flags. The mask updates CC. E sets for the stacked full context.
Reading: Atkinson (2009), pp. 55 · Motorola (1981), Appendix A, CWAI · Astle, LWTools 4.25, ch. 3.
LDMD
HD6309 only
#mask
Opcode bytes. 11 3D.
Write the low two mode-control bits of MD.
Flags. CC is preserved.
Reading: Atkinson (2009), pp. 93 · Astle, LWTools 4.25, ch. 3.
NOP
MC6809 and HD6309
No operand
Opcode bytes. 12.
Advance to the following instruction.
Flags. CC is preserved.
Reading: Atkinson (2009), pp. 104 · Motorola (1981), Appendix A, NOP · Astle, LWTools 4.25, ch. 3.
ORCC
MC6809 and HD6309
#mask
Opcode bytes. 1A.
Set each CC bit selected by the mask.
Flags. Any CC bit can set.
Reading: Atkinson (2009), pp. 107 · Motorola (1981), Appendix A, ORCC · Astle, LWTools 4.25, ch. 3.
RTI
MC6809 and HD6309
No operand
Opcode bytes. 3B.
Pull CC and the return state from S. Stacked E determines whether to restore a full frame.
Flags. Restores saved CC.
Reading: Atkinson (2009), pp. 120 · Motorola (1981), Appendix A, RTI · Astle, LWTools 4.25, ch. 3.
SWI
MC6809 and HD6309
No operand
Opcode bytes. 3F.
Save a full interrupt frame on S and fetch the new PC from $FFFA.
Flags. E sets. I and F set after stacking.
Reading: Atkinson (2009), pp. 134 · Motorola (1981), Appendix A, SWI · Astle, LWTools 4.25, ch. 3.
SWI2
MC6809 and HD6309
No operand
Opcode bytes. 10 3F.
Save a full interrupt frame on S and fetch the new PC from $FFF4.
Flags. E sets. I and F keep their values.
Reading: Atkinson (2009), pp. 134 · Motorola (1981), Appendix A, SWI · Astle, LWTools 4.25, ch. 3.
SWI3
MC6809 and HD6309
No operand
Opcode bytes. 11 3F.
Save a full interrupt frame on S and fetch the new PC from $FFF2.
Flags. E sets. I and F keep their values.
Reading: Atkinson (2009), pp. 134 · Motorola (1981), Appendix A, SWI · Astle, LWTools 4.25, ch. 3.
SYNC
MC6809 and HD6309
No operand
Opcode bytes. 13.
Wait for an interrupt request. Even a masked request can release the wait.
Flags. CC is preserved.
Reading: Atkinson (2009), pp. 135 · Motorola (1981), Appendix A, SYNC · Astle, LWTools 4.25, ch. 3.
Transfer a block
In the lab, inspect the destination and W.
COPY · COPY+ · COPY- · EXP · EXPAND · IMP · IMPLODE · TFM · TFRM · TFRP · TFRR · TFRS
TFM
Other spellings: COPY, COPY+, COPY-, TFRP, TFRM, IMP, IMPLODE, TFRS, EXP, EXPAND, TFRR.
HD6309 only
r+,r+ · r-,r- · r+,r · r,r+
Opcode bytes. r+,r+ 11 38 · r-,r- 11 39 · r+,r 11 3A · r,r+ 11 3B.
Copy W bytes between addresses held in D, X, Y, U or S. Each suffix advances, retreats or holds its pointer after a byte. W counts down to zero. Without interruption the transfer costs 6 cycles plus 3 per byte.
Flags. CC is preserved.
LWASM’s alternative spellings take two bare registers. COPY/COPY+/TFRP advance both, COPY-/TFRM retreat both, IMP/IMPLODE/TFRS advance the source and EXP/EXPAND/TFRR advance the destination. In VCC Plus, debugger Step finishes the block. Continue can hit a breakpoint again between bytes.
Reading: Atkinson (2009), pp. 136 · VCC Plus, Native Debugger, HD6309 Step · Astle, LWTools 4.25, ch. 3.