EER-018
Introduction to Digital Computers
Assignment #8
|
instruction: |
ADD #$23 |
SUB #$23 |
EOR #$F3 |
|
accumulator: |
|
|
|
|
CCR flags: |
|
|
|
|
LDA #$F3 |
|
SUB #$03 |
|
ADD #$80 |
|
RORA |
|
ASRA |
b. set the middle 4 bits of A to one without changing any of the other bits?
c. complement all the bits of A?
d. complement only the rightmost 4 bits of A?
5. Analyze the program shown
below by filling in the worksheet that follows for each instruction that is
fetched and executed.
|
Address |
Label |
Instruction |
Operand |
Comment |
|
$0200 |
START: |
LDA |
#$60 |
; Load A immediate |
|
$0202 |
|
AND |
$0034 |
; AND with contents of RAM |
|
$0204 |
|
LDX |
#$4F |
; Load X immediate |
|
$0206 |
|
STX |
$0036 |
; Store X in RAM |
|
$0208 |
|
SUB |
$0035 |
; Subtract M[0035] from A |
|
$020A |
|
STA |
$0037 |
; Store A in RAM |
|
Accumulator |
Cond. Codes |
Index Register |
Program |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Memory |
Memory |
|
|
|
$0034 |
$84 |
|
|
|
$0035 |
$04 |
|
|
|
$0036 |
|
|
|
|
$0037 |
|
|
|
6. Hand assemble the following short program and
give the resulting addresses and machine code.
|
|
org |
$300 ; put program in memory starting at location $300 |
|
start: |
LDX |
#$64 |
|
|
ROLX |
|
|
|
STX |
$C6 |
|
|
BSR |
put_out |
|
|
STOP |
|
|
put_out: |
LDA |
#$FF |
|
|
STA |
$00 |
|
|
RTS |
|
7. Give the final values of the A and X
registers and the memory locations shown when the program below terminates.
|
|
org |
$3FF ;initialize one data value in memory |
|
|
data_v: |
fcb |
$67 |
|
|
|
org |
$300 ;put program in memory at $300 |
Memory |
|
start: |
LDX |
#$C0 |
address: contents |
|
|
LDA |
$3FF |
$C0 |
|
|
STA |
,X |
$C1 |
|
|
LSRA |
|
$C2 |
|
|
INCX |
|
$C3 |
|
|
STA |
,X |
|
|
|
INCX |
|
|
|
|
INCA |
|
|
|
|
STA |
,X |
|
|
|
STOP |
|
|
|
|
ORG |
$7FE |
|
|
|
FDB |
START ; to set the reset address |
|