110 likes | 256 Views
Physics 413 Chapter 3. Examples Galore. ADDA The outcome is A + M A ADDA # $ 2B 8B 2B ADDA $ 3C 9B 3C ADDA $$ 5B24 AB 5B 24. Carry Bit in CCR. ADCA The outcome is A + M + C A
E N D
Examples Galore • ADDA The outcome is A + M A • ADDA # $ 2B8B 2B • ADDA $ 3C9B 3C • ADDA $$ 5B24AB 5B 24
Carry Bit in CCR • ADCA The outcome is A + M + C A • Use this instruction when expecting a carry. Incidentally, CLC will clear the carry bit.
Logical AND • What is the outcome of ANDA #$ 4C if accumulator A contains 3 A ?
Logical AND 3A 0011 1010 4C 0100 1100 _________________________ 0000 1000 Hence A will contain 08 after the AND operation
DAA DAA Decimal Adjust Accumulator Converts binary addition of BCD numbers into BCD format What will the contents of A be with & without DAA ? LDAA # $ 2386 23 ADDA # $ 488B 48 DAA 19 WAI3E
DAA LDAA # $ 23 ADDA # $ 48 DAA WAI Without DAA the contents of A = 6B With DAA the contents of A = 71
Index Register X is a 16-bit register How are the following three instructions different? LDX # $ 5C42 LDX $$ 5C42 LDX $ 5C
Index Register • LDX #$ 5C42 The number 5C42 is loaded into X • LDX $$ 5C42 Numbers from 5C43 and 5C42 loaded • LDX $ 5C Numbers from 005D and 005C loaded
Stack • Stack is the area of RAM pointed to by the 16-bit Stack Pointer (SP) • LDS functions like LDX • LDS #$ 5C42 The number 5C42 is loaded into SP • LDS $$ 5C42 Numbers from 5C43 and 5C42 loaded • LDS $ 5C Numbers from 005D and 005C loaded
ASLA ASLA Arithmetic Shift Left Accumulator A. It shifts all the 8 bits of accumulator A one bit to the LEFT. The rightmost bit becomes 0 and the leftmost bit ends up as the carry bit of CCR C 0