COAL_2023 - Lecture 16 - Exam Examples
COAL_2023 - Lecture 16 - Exam Examples
Write content of the memory byte N+4(two hexadecimal digits without any other
symbols).
ANSWER: F6
Explanation:
R R+1
ANSWER (hexadecimal value): 02 00
.code
start proc
mov dx, 0
mov edi, 0
check: cmp txt[edi], 0 Write missing
je done instructions here
cmp txt[edi],’&’
jne next
jne next
inc
inc dx
eax
next: inc edi
jmp check
done: ; number of ampersand symbols is in dx
Explanation
Each input impulse from the oscillator decrements the counter register by 1. When the
counter has reached 0 the output is generated and the counter is reset again to the
initial value. For example, if the initial counter value is 10 the output impulse will be
generated after each 10 input impulses, i.e. output frequency will be 1193182/10 ≈
119328 Hz (Output = Input/Counter).
To calculate counter value for the output frequency required you may use a formula
Counter = Input frequency / Output frequency.
In this case to generate 100 Hz sound the counter register should contain value
1193182/100 = 11932.
Video adapter is in the VGA graphics mode 12h with 16 colors and 640x480 pixels
resolution. How many bytes are used to store information in the video memory about
one horizontal line of 640 red color pixels?
ANSWER: 320
Explanation
In the VGA graphics mode each pixel on the screen corresponds to one bit in all display
planes of the video memory. High order bit of the byte A000:0000 corresponds to the
pixel in the upper left corner of the screen. Each display plane memory has the same
starting address A000:0000.
Combination of bits from all display planes determines the colour of the pixel. To encode
16 different colours 4 display planes are used (4 bits may store 16 different unsigned
values from 0 to 15). To store the information about one pixel VGA uses one bit in each
of the 4 display planes.
For 640 pixels of the horizontal line 80 bytes are used in each of the display planes (one
byte for 8 pixels). So 320 bytes are used to store information about 640 pixels long
horizontal line (80 bytes x 4 planes). Colour of the line does not matter.
Explanation: In this VGA text mode each two bytes (one word) in the video memory contains
information about one symbol on the screen. Information about the first symbol in the first
row is in two bytes at address B800:0000. To calculate offset value you may use formula
12