Title: Final Review 2
1Final Review (2)
- Chapters 1 10 from
- Digital Design --- Principles and Practices
- by John F. Wakerly
- Computer Organization Assembly Language
- Covered by lecture notes
- Open book, notes, calculators laptops
- (You may load the lecture notes and other PDF
files to your laptop) - Note Thurs. 200-400PM class will be moved to
CII4050
2Prob.1 What values do the symbol AAA, BBB, CCC
have in this code fragment?
ORG 1000 AAA STAA CCC BBB SWI
ORG 2000 CCC FCB 44,33 DDD
FCB 55 END
ORG Set program counter to origin STAA Store
Accumulator A, EXT, 3 bytes FCB Form constant
byte
(ans AAA 1000, BBB 1003, CCC 2000, DDD
2002)
3Prob.2 What's the best addressing mode for
loading the constant 42 into accumulator B?
(ans immediate)
Prob.3 Name two advantages of direct addressing
vs extended.
(ans uses 1 less byte, and 1 less cycle)
Prob.4 Name an advantage of extended vs direct.
(ans can address all of memory)
4Prob.5 Contrast branch and jump.
(ans branch goes to a 1-byte relative offset
from the next instruction. jump goes to an
absolute 2-byte address.)
Prob.6 What does the V bit in the CCR signify?
(ansOverflow)
Prob.7 After this instruction is executed
LDAA 7 what are the values of bit 7 of
accumulator A and bit 8 of accumulator D?
(ans 0, 1)
5Prob.8 Consider this code ORG 2000
LDAA 20 While the instruction is being
executed, what is the value of the PC?
(ans 2002)
Prob.9 Consider this code ORG 1000
LDAA 1002 What value will A have at the end?
(ans 2)
6Prob.10 Consider this code ORG 1000
LDX 2000 LDAA 3,X SWI
ORG 2000 FCB 1,2,3,4,5,6 What will
A contain at the SWI instruction?
(ans 4)
7Prob.11 How many microseconds will the
following code take to execute? LDAB
10 LOOP2 DECB BNE LOOP2
(ans LDAB and DECB are 2 cycles, BNE is 3
cycles. First statement is executed once, 2nd 10
times, 3rd 9 times. Total 49 cycles, or 24.5
microseconds.)
Prob.12 What info did the BNE use to tell
whether or not to branch?
(ans Z bit of CCR).
8Prob.13 What is the numerical value of the
offset in the BNE line?
(ans -3)
Prob.14 Give 2 things we've seen stored on a
stack.
(ans return address, accumulator values that are
to be restored.)
Prob.15 Is using a stack for a recursive
subroutine particularly good or bad?
(ans good)
9Prob.16 If you reserve memory locations 100 to
200 inclusive for a stack, what's the initial
value of SP?
(ans 200)
Prob.17 Assume that a subroutine saves the
accumulators thus PSHX PSHA PSHY
PSHB List the corresponding pull instructions
in the right order.
(ans PULB PULY PULA
PULX)
10Prob.18 What are the ASCII values of the
characters A, 0, a?
(ans 41, 30, 61)
Prob.19 How do the BUFFALO routines that
operate on strings a) know where the string
starts?
(ans X points to the start)
b) know where it ends?
(ans the last char is followed by a byte with
value 4)
11Prob.20 Name an advantage and a disadvantage
of polling to check if a peripheral needs
attention.
(ans simple, but prevents the CPU from doing
anything else.)
Prob.21 How could a piece of code tell if it
had been interrupted?
(ans check a real time clock to see if too much
time elapsed.)
Prob.22 What controls what registers get
connected to the bus and when?
(ans control logic or microcontroller)
12Prob.23 Each instruction of a user-visible
machine instruction is formatted thus first
there are several bits for the opcode, then,
depending on the opcode, several bits for an
address. How is a microinstruction formatted?
(ans each bit corresponds to one control signal
in the ALU or gate connecting a register etc to a
bus. Of course those signals can be considered
control signals to encoders and decoders, so each
bit corresponds to one control signal.)