Professional Documents
Culture Documents
2. Assembly language:
Native to a processor: executed directly by hardware True False .
Uses symbolic names to represent operations, registers and
memory locations True False .
Slightly higher-level language True False .
Readability of instructions is better than machine language True False .
Instructions consist of binary: 1s and 0s True False .
One-to-one correspondence with machine language instructions True False .
3. Find the five-hex-digit address that corresponds to each of these segment : offset pairs
85FE:9ABC => 8FA9C
D9FA:1000 => DAFA0
The peripheral interrupts the normal application execution, requesting to send or receive data.
The processor jumps to a special program called Interrupt Service Routine to service the peripheral.
After the processor services the peripheral, the execution of the interrupted program continues.
Write student’s name and ID into your exam paper Page 1/7
Problem 2: (L.O.5) (10pts) Answer the value of registers after the instruction is executed.
Problem 3: (L.O.5) (10pts) Write 80x86 assembly language code for the following C procedure:
Write student’s name and ID into your exam paper Page 2/7
Problem 4: (L.O.5) (10pts) Write 80x86 assembly language code for the following C function.
Determine the address of ISR of a device with the interrupt vector FBh.
Write student’s name and ID into your exam paper Page 3/7
bool isTwoPower (int n)
{
if (n <= 0)
return 0;
return !(n&(n-1));
}
Rewrite this function in Assembly language (assume that n is stored in EBX, the return value is stored in
EAX):
Problem 8: (L.O.5) (10pts) Answer the following questions about virtual memory.
Write student’s name and ID into your exam paper Page 4/7
No Question Answer
.
1 Explain the principle of limit checking in Chapter 7, Slide 15:
protection mode. The limit checking is to prevents programs or
procedures from addressing memory locations
outside the segment.
The effective value of the limit depends on the
setting of the G (granularity) flag.
For data segments, the limit also depends on the E
(expansion direction) flag and the B (default stack
pointer size and/or upper bound) flag.
The E flag is one of the bits in the type field when
the segment descriptor is for a data segment type.
2 Consider the memory segments: This instruction causes violation, because the EAX
500 is 32-bit register, ie. 4-byte register. When 4-byte
EAX data move to ES:498, it will exceed the limit
CS 1000
of the segment ES.
ES 1500
2000
SS
Problem 9: (L.O.5) (10pts) What are memory problems with the following C codes? How to
solve the problems?
Write student’s name and ID into your exam paper Page 5/7
s[i] = new student[20]; first, then free the array delete[] s;
pointer.
// After using s
delete[] s;
Write student’s name and ID into your exam paper Page 6/7