ECE 426 Exam 1 Solved
ECE 426 Exam 1 Solved
ECE 426 Exam 1 Solved
Chapter 0
-Covert 14510 to binary.
145 - 128 (27) = 17 ---> 17 - 16 (24) = 1 ----> 1 - 20 = 0
1 0 0 1 0 0 0 1
--- --- --- --- --- --- --- --27 26 25 24 23 22 21 20
-Convert 19410 to hex.
First, convert to binary - 128 + 64 + 2 = 19410 = 1100 00102
View the binary in groups of four bits to determine the hex value: 1100 = C and 0010 = 2, so the hex value is C2.
-Convert A416 to decimal.
A = 10, so A416 = 10x161+ 4x160 = 160 + 4 = 164
-List the truth table for a two input XOR gate and a two input NOR gate.
X
0
0
1
1
XOR
Y
0
1
0
1
Z
0
1
1
0
X
0
0
1
1
NOR
Y
0
1
0
1
Z
1
0
0
0
-How many megabytes of memory can be addressed by a processor with a 24-bit address bus, assuming each memory
location is 16-bit?
(2 bytes per location) x (224 locations) / (220 bytes per megabyte) = 2(25-20) = 25 MB or 32 MB
-What is the purpose of the program counter, and what is another name for the program counter?
The program counter holds the offset address of the next address to be executed, and another name for it is the
instruction pointer.
-Show the ASCII representation of 12610.
31 32 36
Chapter 1
-What is pipelining?
Pipelining is the process by which instructions are fetched from memory while the CPU is still processing other
instructions.
18800
+ A780
22F80
-After the following instructions are performed, what are the contents (in hex) of register AX, and what is the value of
CF, AF, OF, and ZF?
MOV
ADD
AX,0A87H
AX,8049H
0A87
+8094
8B1B
CF = 0 since there was no carry from d15, AF = 0 since we had no carry from d3 to d4, OF = 0 since there was no carry
into d15 and no carry out of d15, and ZF = 0 since the result was not zero.
-Show an example of register indirect addressing mode.
MOV
AX,[BX]
AX,[BX] + 10
or MOV AX,[BX+10]
AX,[BX][SI]
or
MOV AX,[BX+SI]
Chapter 2
-What conditions are being tested for with the following conditional jump statements? Dont worry about listing the
flags, just tell me in words what conditions the statements are looking for.
JC: Tests to see if there was a carry out of the most significant bit of the last arithmetic operation
JNA: Tests to see if the value of an unsigned number is greater than (above) the value of another unsigned number
JNZ: Tests to see if the result of the previous operation was zero
-How many bytes are reserved by the assembler for the following data directives?
EQU:
DB:
DW:
DQ:
DD:
DT: 10
-For the following data declarations, assume DS is 0800 and list the memory contents.
ORG 0100H
DB
81, 58H
DW
8A7BH, 98AFH
ORG 0110H
DT
0123456789
DB
06443
0800:0100
0800:0101
0800:0102
0800:0103
0800:0104
0800:0105
51H
58H
7BH
8AH
AFH
98H
0800:0110
0800:0111
0800:0112
0800:0113
0800:0114
0800:0115
0800:0116
0800:0117
0800:0118
0800:0119
0800:011A
0800:011B
0800:011C
0800:011D
0800:011E
0800:011F
89H
67H
45H
23H
01H
0
0
0
0
0
30H
36H
34H
34H
33H
0
Chapter 3
-Show the contents of register AX after the following instructions are performed.
SUB
MOV
ADD
AH,AH
AL,85
AX,0ACEH
;AH = 00
;AX = 0085H
;AX = 0ACEH + 0085H = 0B53H
-Show the steps the processor takes to perform the following subtraction. Bear in mind that the processor never
actually performs subtraction, but performs a special kind of addition.
MOV
SUB
AL,80H
AL,05H
BX,0101H
;0101 = 257
MOV
AL,4
;AX = 0104
MUL
BX
AX,0A74H
CL,5
AX,CL
So, AX = 0053H
AX:
1st:
2nd:
3rd:
4th:
5th:
-List the steps you should take to convert a hexadecimal number to the ASCII representation of its decimal equivalent.
You dont have to use code, but you must explain the procedure by using any necessary logical operators (AND, OR, XOR,
etc.).
Assume the hexadecimal number is between 0 and 99 and is initially in register AL.
Divide AL by 10. AL has the quotient (our 10's value) and AH has the remainder (our 1's value).
Or AX with 3030H to get the ASCII representation of the two individual digits.
AH has the lower value digit (representing the digit for the one's column), and AL has the higher value digit (representing
the digit for the ten's column).
(At this point, we would usually swap AH and AL to get the lower value digit into AL and the higher value digit into AH,
and if you did this, it would be fine. But if we were going to load AX into a memory location that was later going to be
read to the screen by the appropriate interrupt, AL would be written to the lower memory location, and AH would be
written to the higher memory location. This means that when the buffer is read and printed to the screen, the first
value to be read will be the value from AL and the next value will be the value from AH. If we swapped our registers so
that AL was the ones and AH was the tens, our number would read backwards on the screen! So if you are going to
write this number to a buffer to be sent to the screen, don't swap AH and AL.) - Don't worry about this information for
the test.
-What is the difference between packed and unpacked BCD (say or show).
Packed - two digits per byte - 0100 1001 (49)
Unpacked - one digit per byte - 0000 0100 0000 1001 (49)
-Show the contents of register AL and the status of the carry flag after the following instructions are performed.
MOV
AL,48H
ADD
AL,64H
DAA
;AL = ACH
;AL = ACH + 66H = 12H and CF = 1
-------------------------------------------------------------------------------------------1010 1100
0110 0110
0001 0010
CF = 1
-Show the contents of register AX after the following instructions are performed:
CLC
MOV
MOV
RCR
(I'm adding this in the review key - I'd need to give this to you on the exam)
AX,A487H
CX,05
AX,CX
AX Initial:
Step 1:
Step 2:
Step 3:
Step 4:
Step 5:
CF = 0
CF = 1
CF = 1
CF = 1
CF = 0
CF = 0, so AX = 7524H