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.
b.
.c)
d.

Index Registers
Stack Pointer
Program counter
Condition code register.

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

a.
b.
c.
d.

MROM
EPROM
PROM
EEPROM

3. Which instruction is best performed by an ALU:

a.
b.
c.
d.

Store
Dec
Jmp
Load

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

8 bits, 16 bits, 8 bits, 16 bits


8 bits, 16 bits, 16 bits, 16 bits
All are 16 bits.
8 bits, 16 bits, 16 bits, 8 bits.

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


a.
b.
c.
d.

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


Data bus and Address bus are both unidirectional.
Data bus is unidirectional and the address bus bi-directional.
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?

c
d

Decimal Hexadecimal
#
$
#
$
Nothin

7. What kind of addressing is SUBA $2000?

a.
b.
c.
d.

Immediate
Register
Extended
Inherent

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


a.
b.
c.
d.

Immediate
Register
Extended
Inherent

9. What kind of addressing is INX?


a.
b.
c.
d.

Immediate
Register
Extended
Inherent

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


a.
b.
c.
d.

Arithmetic
Branching
Loading
Incrementing

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

256
262,144
65536
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.

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.
a
b)
c
d)

[D]
1010
0000
2030
3020

r$OOO
11
10
30
30
30

[$0000]
10
20
20
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.
b.
c.
d.

BCS target
B~ target
:a,CCtarget
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

a 1
b) 0
c 1
d) 0

Z
1
0
0
0

V C
0 1
1 1
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.
c.
d.

11101000 and C flag is O.


10111010 and C flag is O.
1110 1000 and C flag is 1.
10111010 and C flag is 1.

"~"I
, .--l

~~

-~ ~.; \.~

."

J:-_.
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
a.
b.
c.
d.

11110110 and C flag is 1.


11101101 and C flag is O.
01111011 and C flag is O.
011110 11 and C flag is 1.

0'

-::.

\\

"

I \0

I.') ,~Q--"3--y

~~IC]---)?

LO
,~!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):
a.
b.
c.
d.

01111101 and C flag is O.


11011111 and C flag is O.
01111101 and C flag is 1.
11011111 and C flag is 1.

f PA~ -;::

"

)~

\0' \ \., 0

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.
b.
c.
d.

20000.
10000.
2000.
1000.

+
.-:: ---'
,..~
~

= $33;

[SP]

executingPSHA?
a.
b.
c.
d.

23. Suppose [A]

7. 1'1 ~l

= $OOFF.What

2Mtil
~

-qJC)
", - ~

'11':r:l<;'...~.

will be the contents of [$OOFF]after

$33
$FF
$OF
Unknownvalue.

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

$OOFA
$OOFB
$OOFC
Unknown value.

25. Suppose [SP] = $OOFC.[X] =;: $3040. [$OOFD] = $20. What are the contents of
[$OOFB],[$OOFC]and[$OOFD]after executing PSHX?
a.
b.
c.
d.

$30,$40,$20
$40, $30,$20
$20,$40,$30
$20, $30, $40

ii/&) f 6;::: ")9

Sf f
~

I} (1ft
., ~o
1{}t] fl7 :: 170

'f,::

b';7g/lf1.1

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.
b.
c.
d.

[A] = $80; [B] = $30


[A]= $70; [B] = $40
[A]= $30; [B] = $80
[A]= $40; [B] = $70

1.n
-\,~
--1t)

1':1
~---=
79
"6

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

~DI ()9

ZZ 2

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
LDAA I~X
VEC FCB I, 2, 3, 4, 5

I
I
I
I

a.
b.
c.
d.

y..

-: )

-;.

1.

The code returns an "error.


[A] = 1
[A] = 2
[A] = 3

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

a.
b.
c.
d.

Remains unchanged.
$F7C2
$F7C4
Depends on the data in the stack.

EEL4767 Computer System Design I, Spring 2005


Exam1
Part I: Closed Book INotes
Ques.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

C
X

D
X

X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X

NAME

\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

where

I is equal to the absolute value.

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

100

iQOo1..

LV1-

Lf1- JS~

1 i'lLBA(J.

(MfA ~1-;O
~t~

..."''''

c.",fA li> ~ 1

tEa
["'fA
u&
c"'tA

ML\"

"" 1- >1-

N"~

&8-

~i 33
N"'~

CfI\ 'f\.

~19"

\)fG.

(f' p~
6tu
[MPA
1'JtX
(/1 fJA

~o.

c" fA

"w fI\.
-Ii.1 )~
1W.f'1

~13b
J'lL4T"\

~j77
tJuf'1
~." ~

1)~

rJUM

c'" pA
f;t El

~i~~

JRA

/,HpV\

Lf1-

ST
LPI

ORG $0100
LDS" #$OOFF
JSR INCHAR
CMPA #$30

BLO LPI
CMPA

#$39

BHI LPI
JSR OUTA

TAB
LP2

JSR INCHAR
CMPA #$30

BLO LP2
CMPA

#$39

BHI LP2
JSR OUTA

GO GET THE INPUT CHAR


GO SEE IF IT'S A #
INVALID INPUT
GO SEE IF IT'S A #
INVALID INPUT
GO ECHO THE CHARACTER
PUT 1ST NUMBER IN A
GO GET THE INPUT CHAR
GO SEE IF IT'S A #
INVALID INPUT
GO SEE IF IT'S A #
INVAL ID INPUT
GO ECHO THE CHARACTER

CBA

SUBTR

BHS SUBTR

SEE WHICH

PSHA
PSHB
PULA
PULB

SWAP ATHE #'S IN


THE A AND B ACC

SBA
ADDA #$30
JSR OUTA

EQ
JMP ST
INCHAR PSHB
RCHRI LDAB $102E
ANDB #$20
BEQ RCHRI
LDAA $102F
PULB
RTS
OUTA PSHB
WCHRl LDAB $102E
ANDB #$80
BEQ WCHRl
STAA $102F
PULB
RTS
CRLF LDAA #$OD
JSR OUTA
LDAA #$OA
JSR OUTA

RTS
END

IS POSITIVE

TAKE THE DIFFERENCE


CONVERT BACK TO ASCII

THIS ROUTINE INPUTS ONE CHAR IN A


IS THE RECEIVE BUFFER IS EMPTY

SOURCE

INPUT

CHARACTER

IN THE A

THIS ROUTINE OUTPUTS ONE CHAR IN A


IS THE TRANSMIT BUFFER IS EMPTY

GO WRITE

THE CHAR

GO WRITE THE LF AND CR

Anda mungkin juga menyukai