Anda di halaman 1dari 9

EEL4767 Computer System Design 1, Spring 2005

Exam 1
Part I: ClosedBook INotes (75 pts) NAME

I. What register is used to keep track of the address of the next instruction to be
executed is:

a. Index Registers
b. Stack Pointer
.c) Program counter
d. Condition code register.

2. Which type of ROM can be erased by electrical signals and reprogrammed


a. MROM
b. EPROM
c. PROM
d. EEPROM

3. Which instruction is best performed by an ALU:

a. Store
b. Dec
c. Jmp
d. Load

4. In 68HCII, what are the size of the following registers in the order: B, D, SP,
CCR:

a. 8 bits, 16 bits, 8 bits, 16 bits


b. 8 bits, 16 bits, 16 bits, 16 bits
c. All are 16 bits.
d. 8 bits, 16 bits, 16 bits, 8 bits.

5. In a typical micro-processor, which of the following statements is true:

a. Data bus is bi-directional and the Address bus is unidirectional.


b. Data bus and Address bus are both unidirectional.
c. Data bus is unidirectional and the address bus bi-directional.
d. Data bus and Address bus are both bi-directional .
6. In assembly language programming, different prefixes are used to differentiate
between different kinds of data. Which statement gives the right prefix?

Decimal Hexadecimal
# $
#
c $
d Nothin

7. What kind of addressing is SUBA $2000?

a. Immediate
b. Register
c. Extended
d. Inherent

8. What kind of addressing is ADDA #$32?

a. Immediate
b. Register
c. Extended
d. Inherent

9. What kind of addressing is INX?

a. Immediate
b. Register
c. Extended
d. Inherent

10. Relative Mode is used only with ?????? instructions?

a. Arithmetic
b. Branching
c. Loading
d. Incrementing

11. How many different memory locations can the 68HCli address (hint: think of the
size of address bus):

a. 256
b. 262,144
c. 65536
d. 16384
12. When using branch instructions, the branch offset (BRA offset) has a range of:

,
'i
a. -64 to 63 bytes.
b. Dependson the size of the assemblyprogram.
c. Depends on the type of branch instruction used.
d. -128 to 127 bytes.
I 13. What are the contents of the D register and the memory locations after executing
LDD $00001 Before the instruction: [D] = $1010; [$0000] = $20; [$0001] = $30.

[D] r$OOO
11 [$0000]
a 1010 10 10
b) 0000 30 20
c 2030 30 20
d) 3020 30 20

14. The statement M[lOOO]f- Rl + [R2]

a. Add what is in Rl and R2 and store the result in memory location 1000.
b. Use Rl as an address to obtain the data £fom and add what is in R2 and
store the result in memory location 1000.
c. Use R1 as an address to obtain the data £fom and use R2 an address as an
address to get the data £fomand then add them together and store the
result in memory location 1000
d. Add what is in Rl to the data stored in memory given by the address in R2
and stores the result in memory location 1000

15. What does ABX do:

a. Add accumulator B and the index register X and store the result in X.
b. Add accumulator B and the index register X and store the result in B.
c. Add accumulator B and the contents of the memory address pointed by the
index register X and store the result in X.
d. Add accumulator B and the contents of the memory address pointed by the
index register X and stores the result in B.

16. What is the difference between LDX #$1000 and LDX $10001

a. They are basically the same.


b. The first instruction places the contents of memory locations $1000 and
$1001 into X and the second places the hex value $1000 into X register.
c. The first instruction places the hex value $1000 into X register and the
second places the contents of memory locations $1000 and $1001 into X.
d. One of the instructions is not valid.
17. Which cond~tionalbranch instruction in the following list will not branch if the
condition flags are N=C=1 and Z=V=O:

a. BCS target
b. B~ target
c. :a,CCtarget
d. Bve target

18. Find the values of the condition flags N, Z, V and e after executing SUBA #$50.
Given: [A] = #$70, N=O, Z=I, v=o and C=1. (IDNT: N is set ifMSB of the result
is set; Z is set if result is zero; V is set if tWos complement overflow results; e is
set if a carry is generated.):

'N Z V C
a 1 1 0 1
b) 0 0 1 1
c 1 0 0 0
d) 0 0 0 0

19. Compute the new values of accumulator A and the e flag after executing the
instruction ASLA. The original value in A is $74 (01110100) and the C flag is 1.
(Hint: 0 moves into LSB and MSB moves into C) :

a.
b.
11101000 and C flag is O.
10111010 and C flag is O.
"~"I
, .--l ~~ -~ ~.; \.~ ." Q 0 J:-_.
1 (;

c. 1110 1000 and C flag is 1.


d. 10111010 and C flag is 1.

20. If the memory location at $00 contains $F6 and the e flag is 1, what are the new
values of this memory location and the e flag after the execution ofLSR $OO?
(Hint: 0 into MSB and LSB into C):
1f b -::. \\ " 0 I \0
a. 11110110 and C flag is 1.
b. 11101101 and C flag is O. 0' / I.') ,~Q--"3--y LO
c. 01111011 and C flag is O.
d. 011110 11 and C flag is 1. ~~IC]---)? ,~!j

21. Compute the new values of accumulator B and the e flag after executing the
instruction ROLB. The original value in B is $BE and the C flag is 1.
(Hint: einto LSB and MSB into C): f PA~ -;:: " )~ ~ \0' \ \., 0
a. 01111101 and C flag is O.
b. 11011111 and C flag is O.
c. 01111101 and C flag is 1.
d. 11011111 and C flag is 1.
22. A program requires a delay of 1 msec. The frequency ofE clock cycle is 2 MHz.
Calculate the number ofE clock cycles required for this delay:

a. 20000.
b. 10000. f ~ + ~ 7. 1'1 ~l
c. 2000. .-:: ---' ~ 2Mtil
, ,..~
d. 1000. ~
- 1 ", - ~
-qJC)
- '11':r:l<;'...~.°
23. Suppose [A] = $33; [SP] = $OOFF.What will be the contents of [$OOFF]after
executingPSHA?
a. $33
b. $FF
c. $OF
d. Unknownvalue.

24. Suppose[SP] = $OOFB.What are the contents of index register X after executing
TSX?

a. $OOFA
b. $OOFB
c. $OOFC
d. Unknown value.

25. Suppose [SP] = $OOFC.[X] =;: $3040. [$OOFD] = $20. What are the contents of
[$OOFB],[$OOFC]and[$OOFD]after executing PSHX?
ii/&) f 6;::: ")9
a. $30,$40,$20
b. $40, $30,$20 Sf f
~ I} (1ft ., ~o 'f,:: b';7g/lf1.1
1{}t] fl7 :: 170
c. $20,$40,$30
d. $20, $30, $40

26. What are the contents of the A and B accumulators after executing ADDD
#$1050? The contents before executing the instruction: [A] = $20; [B] = $30:

a. [A] = $80; [B] = $30 1.n 1':1


-\,~ ~---=
79
b. [A]= $70; [B] = $40 --- "6 Q
1t)
c. [A]= $30; [B] = $80
d. [A]= $40; [B] = $70

27. What are the contents of the A accumulator after executing LDAA #100?

a. The instruction generates an error.


b. [A] = $64.
c. [A] = $100.
d. Depends on the previous contents of the accumulator.
28. What happens after executing STAA #$1001
A ~ ~DI ()9 ZZ 2
I

a. The accumulator remains unchanged.


b. The ccmtents of the accumulator are stored at the address $0100.
c. The Z flag is set if the accumulator has $00.
d. Invalid Instruction

29. What are the contents of the accumulator after executing these instructions:

LDX#VEC y.. -: )
LDAA I~X A -;. 1.
VEC FCB I, 2, 3, 4, 5

a. The code returns an "error.


I
b. [A] = 1
I c. [A] = 2
I
I d. [A] = 3

30. If the reg. SP = $F7C3, then the instruction PULA retrieves reg. A from the stack
and sets the SP to:

a. Remains unchanged.
b. $F7C2
c. $F7C4
d. Depends on the data in the stack.
EEL4767 Computer System Design I, Spring 2005
Exam1
Part I: Closed Book INotes NAME

Ques. A B C D
1 X
2 X
3 X
4 X
5 X
6 X
7 X
8 X
9 X
10 X
11 X
12 X
13 X
14 X
15 X
16 X
17 X
18 X
19 X
20 X
21 X
22 X
23 X
24 X
25 X
26 X
27 X
28 X
29 X
30 X
\q
----
'J-S
EEL4767 Computer System Design I, Spring 2005

E~l ~
Part 2: Closed Book/2 Pages of Notes (25 pts) NAME LlA.tc{ trJt,
Using the INCHAR and OUTA subroutines write a program that inputs two ASCn
numbers between 0 and 9. Your program should check and make sure that the keyboard
input is a valid number between (0-9). Once your program has determined that the key
entered is a valid number, it should echo it to the screen. Next, your program should
compute A(.L:f1 0-4 :::.~J-?:'"

Result = INumber 1 - Numher2 I where I I is equal to the absolute value.


Finally, your program should output the result to the screen as an ASCII number.

~ °100
O(~ iQOo1..
LV1-
Lf1- JS~ 1 i'lLBA(J.

(MfA ~1-;O
~t~ ..."''''
c.",fA li> ~ 1
ML\"
tEa
"" 1- >1-
["'fA
N"~
u&
c"'tA ~i 33
&£8- N"'~
CfI\ 'f\. ~19"
\)fG. "w fI\.
(f' p~ -Ii.1 )~
6tu 1W.f'1
[MPA ~13b
J'lL4T"\
1'J€tX
(/1 fJA ~j77
~£o. tJuf'1
c" fA ~." ~
1)£~ rJUM

c'" pA ~i~~
f;t El /,HpV\
¥JRA Lf1-
ORG $0100
ST LDS" #$OOFF
LPI JSR INCHAR GO GET THE INPUT CHAR
CMPA #$30 GO SEE IF IT'S A #
BLO LPI INVALID INPUT
CMPA #$39 GO SEE IF IT'S A #
BHI LPI INVALID INPUT
JSR OUTA GO ECHO THE CHARACTER
TAB PUT 1ST NUMBER IN A
LP2 JSR INCHAR GO GET THE INPUT CHAR
CMPA #$30 GO SEE IF IT'S A #
BLO LP2 INVALID INPUT
CMPA #$39 GO SEE IF IT'S A #
BHI LP2 INVAL ID INPUT
JSR OUTA GO ECHO THE CHARACTER
CBA
BHS SUBTR SEE WHICH IS POSITIVE
PSHA
PSHB SWAP ATHE #'S IN
PULA THE A AND B ACC
PULB
SUBTR SBA TAKE THE DIFFERENCE
ADDA #$30 CONVERT BACK TO ASCII
JSR OUTA
EQ JMP ST
INCHAR PSHB THIS ROUTINE INPUTS ONE CHAR IN A
RCHRI LDAB $102E IS THE RECEIVE BUFFER IS EMPTY
ANDB #$20
BEQ RCHRI
LDAA $102F SOURCE INPUT CHARACTER IN THE A
PULB
RTS
OUTA PSHB THIS ROUTINE OUTPUTS ONE CHAR IN A
WCHRl LDAB $102E IS THE TRANSMIT BUFFER IS EMPTY
ANDB #$80
BEQ WCHRl
STAA $102F GO WRITE THE CHAR
PULB
RTS
CRLF LDAA #$OD
JSR OUTA
LDAA #$OA
JSR OUTA GO WRITE THE LF AND CR
RTS
END

Anda mungkin juga menyukai