Physics 413 Chapter 2
6800 Architecture A B X SP PC CCR
Straight-line Programming In Paris they simply stared when I spoke to them in French ; I never did succeed in making those idiots understand their own language Mark Twain , The Innocents Abroad, 1869
My First Program CLRA Clears accumulator A ( A = 0 ) INC A This instruction does this: A + 1 A WAI Stop (Wait)
Op-codes Assembly Language Memory Location Op-codes CLRA 0000 4F INCA 0001 4C WAI 0002 3E
My Second Program LDAA # $ 12 ADDA # $ 15 WAI
Object Code . . . Program # 2 Assembly Language Memory Location Op-codes LDAA # $ 12 0000 86 0001 12 ADDA # $ 15 0002 8B 0003 15 WAI 0004 3E
Addressing Modes Inherent (implied) : Simplest with no operand. One-byte op-code. Examples: INCA and CLRA Immediate : Operand specified is immediate (no memory access). Examples: LDAA # $ 12 and ADDA # $ 15
Immediate and Direct Modes Immediate LDAA # $ 12 Load 12 op-code 86 12 Direct LDAA $ 12 Load from memory 0012 op-code 96 12
My Third Program Assembly Language Memory Location Op-codes LDAA # $ 04 STAA $ 15 LDAA # $ 08 ? ? ADDA $ 15 WAI
My Third Program Assembly Language Memory Location Op-codes LDAA # $ 04 0000 86 04 STAA $ 15 0002 97 15 LDAA # $ 08 0004 86 08 ADDA $ 15 0006 9B 15 WAI 0008 3E
Extended Addressing Mode The extended addressing mode becomes indispensable when memory locations beyond the zero page must be addressed. Here, as always, an example is worth a thousand words: LDAA $$ 3C5E Load A from memory 3C5E Op-codes B6 3C 5E
Three Trick Questions What is the outcome of B6 00 2A ? What is the outcome of LDAA # $ 3C5E ? What is the outcome of STAB $$ 3C44 ?
Trick Questions . . . Answered! What is the outcome of B6 00 2A ? Legal but not very smart. What is the outcome of LDAA # $ 3C5E ? Not Legal What is the outcome of STAB $$ 3C44 ? O.K. and op-code is F7 3C 44