The Motorola 6800 Instruction Set (Byte) (January 1978)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

The Motorola 6800 Instruction Set

Paul M Jessop
Two Programming Points of View 1157 Warwick Rd
Solihull
West Midlands 891 3HQ
ENGLAND

Instruction Field Encoding. When faced with the problem of trying to


hand assemble a machine language program,
the task of looking up each of the op codes
I 1 I X IX I X I I I Group 1: Du al operand instructions in the manufacturer's data can be quite
daunting. Admittedly, some become familiar
o = A, S00 = I OP
before very long but the less common in·
1= B, X 01 = D
10 = X structions still cause problems (do you 6800
11 = E users remember the hexadecimal op code for
TPA?) . Two solutions to this dilemm a are
suggested here . The first is suitable for
I 0 I IX IX I I I I I Group 2: Single operand instructions "switch flippers" and the second for users
00 I = OP of MIKBUG and other systems with hexa-
01 0 = decimal dump and load functions.
10 = X
11 = E The First Solution: Use Instruction Fields
Anyone who has seen the programming
books for the DEC PDP 8 will be familiar
10 10 10 10 10 I 1 Group 3: TPA, TAP and NOP
with the principles involved. In the PDP 8
OP instruction set, the first three bits of the
12 bit word define the type of instruction
and the remaining bits each have a separate
I 0 I 0 I 0 I 0 11 1 Group 4: Condition code instructions
function. This is of course a gross simplifi-
cation and is not true for memory reference
OP and 10 instructions but it underlines the
basic ideas. NoW, study of the 6800 op
codes reveals some interesting facts at the bit
1010101 11 1 1 1 1 Group 5 : Accumulator instructions level. These are outlined in figure 1.
--..- These patterns are naturally related to the
OP instruction decoding which goes on
inside the ch ip, but they are a godsend to
the programmer who must work in binary . A
10 10 11 10 1 1 1 1 1 Group 6: Branches couple of words of explanation are needed .
Branch to subroutine occurs in an unex-
Condition
pected place but it is easy to remember if
thought of as Jump, mode immediate. The
general ization in group 1 bit 6 that a zero
10 10 11 11 10 1 Group 7: Stack and index register control implies accumulator or stack pointer
OP
ad.dressing does not hold true for compare
index register (CPX), where it implies index
register addressing. Naturally, the store
instructions (ST A, STS and STX) do not
10 10 11 11 1 Group 8: Interrupt and subroutine control exist in immediate mode in the published
--..- definition of the 6800 instruction set.
OP

Figure 7: One way to organize one's viewpoint of the Motorola 6800 instruc- The Second Solution : The Ordered
tion set is to view it as a number of instruction groupings, broken down by Manual Lookup Table
internal binary fields for selection of instructions within the group. This The appropriate information is contained
viewpoint is most appropriate for those working directly in binary, or or- in figure 2. This should be a great boon to
ganizing the code generation parts of an assembler or compiler. anyone who, for lack of memory or 10

84 BYTE January 1978


devices, has no assemb ler. The table is fal l into gmups and the address ing modes
arranged in such a way that the first hexa- fall into neat vertica l lin es.
decimal dig it is the horizontal coordinate, By way of a fina l word, the tab le can, if
just as the x component comes first in a reduced sma ll enough, make a very handy
pair of Cartesian coordinates. The credit for reference card . Mine has, on the front,
inspiring this technique must go to Mr Fugi tt tables to convert between hexadecimal,
(March 77 BYTE, page 36) for his 6502 octal and decima l, and, on the reverse,
table, but this tab le for the 6800 is some- the cond ition s required for branches, '
what more useful for both assembling and the restart vecto rs, details of the control
disassembling because of the way the codes code register and the stack register. -

The Ordered Manua l


Lookup Table

D Accumulator A
as one operand
NBA = And accumulators
HCF = Halt and catch fire
STS. STX, STA, STB = store immediates

D Accumulator B
as one operand See "Undocumented 6800 In structions"
by Gerry Wheeler, page 46, December

D Miscellaneous
instructions
1977 BYTE.

8 Unimplemented

Undocumented
instruction:

ACCA ACCB X E I D X E I D X E

F SEI • BLE SWI CLR CLR CLR CLR STS STS STS STX STX STX

E CLI • BGT WAI • • JMP JMP LDS LDS LDS LDS LDX LOX LOX LOX

0 SEC • BLT • TST TST TST TST BSR JSR JSR • • •


C CLC • BGE • INC INC INC INC CPX CPX CPX CPX • • • •
B SEV BMI RTI • • • • ADD ADD ADD ADD t ADD AbO ADD t}.DD
<

A CLV • BPL • DEC ? DEC DEC DEC ORA ORA ORA ORA ORA ORA ORA . OflA

9 DEX DAA BVS RTS ROL ,. ROL ROL ROL ADC ADC ADC ADC ADC ADC ADC ADC
III
:c.<:I 8 INX • BVC • ASL ' ASL ASL ASL EOR EOR EOR EOR EdR EOR ' EOR EOR
>
Z ' f' pSH ',i','
7 TPA ) leA-*' BEQ ASR ASR ASR ASR ST A STA STA STA S'l"A

""
c:
0
III
6 TAP BNE
mB

PSH
'

ROR ROR ROR ROR LDA LD A LDA LOA i:{ LDA


17'

l:DA LDA lOA

0
':,: ' A .,: ·l

-'
5 • • BCS TXS • • • • BIT BIT BIT BIT 'SrT BIT BIT 'SI,T .
, "
4 • BCC DES LSR lSR LSR LSR AND AND AND AND ;;:f.l.ND ANq;, AND
I

3 • • BlS 1"l,< P.Uk COM COM COM COM • • • • • • • •


.... :.,
2 • • BHI PUL • • • • SBC SBC SBC SBC SBC IX'SBC 'l' :' SBC ' !lBC
A
li' "
NOP • INS • • • • CMP CMP CMP CMP CMf> I," CII(1 P" CMP <;:MP

o • BRA TSX NEG NEG NEG NEG SUB SUB SUB SUB SUe SU B .
, . :. "'. ':

o 2 3 4 5 6 7 8 9 A B C D E F

High (First) Nybble

Figure 2: A second way of viewing the 6800 instruction set is from the viewpoint of a hexadecimal matrix, Here a map of the
6800 instruction set has been broken up into several overall regions, with color coding indicating references to accumulators A
and B. Unimplemented and undocumented instructions are shown with a black dot; undocumented, but implemented instruc-
tions are shown with cross hatching to indicate "use at own risk."

BYTE January 1978 85

You might also like