26
retrieve the data from the RAM, format it into lines of pixels, and send the lines to the
monitor with the appropriate pulses on the horizontal and vertical sync pulses.
The pseudocode for a single frame of this process is shown in
Listing 16
. The
pseudocode has two outer loops: one, which displays the
L
lines of visible pixels, and
another, which inserts the V, blank lines and the vertical sync pulse. Within the first loop,
there are two more loops: one, which sends the
P
pixels of each video line to the monitor,
and another, which inserts the H, blank pixels and the horizontal sync pulse.
Within the pixel display loop, there are statements to get the next byte from the RAM.
Each byte contains four two-bit pixels. A small loop iteratively extracts each pixel to be
displayed from the lower two bits of the byte. Then the byte is shifted by two bits so the
next pixel will be in the right position during the next iteration of the loop. Since it has only
two bits, each pixel can store one of four colors. The mapping from the two-bit pixel value
to the actual values required by the monitor electronics is done by the
COLOR_MAP()
routine.
•
Listing 16:
VGA signal generation pseudocode.
/* send L lines of video to the monitor */
for
line_cnt
=1 to
L
/* send P pixels for each line */
for
pixel_cnt
=1 to
P
/* get pixel data from the RAM */
data
= RAM(
address
)
address
=
address
+ 1
/* RAM data byte contains 4 pixels */
for
d
=1 to 4
/* mask off pixel in the lower two bits */
pixel
=
data
& 00000011
/* shift next pixel into lower two bits */
data
=
data
>>2
/* get the color for the two-bit pixel */
color
= COLOR_MAP(
pixel
)
send
color
to monitor
d
=
d
+ 1
/* increment by four pixels */
pixel_cnt
=
pixel_cnt
+ 4
/* blank the monitor for
H
pixels */
for
horiz_blank_cnt
=1 to
H
color
= BLANK
send
color
to monitor
/* pulse the horizontal sync at the right time */
if
horiz_blank_cnt
>
HB0
and
horiz_blank_cnt
<
HB1
hsync
= 0
else
hsync
= 1
horiz_blank_cnt
=
horiz_blank_cnt
+ 1
line_cnt
=
line_cnt
+ 1
/* blank the monitor for
V
lines and insert vertical sync */
for
vert_blank_cnt
=1 to
V
color
= BLANK
send
color
to monitor
Summary of Contents for XStend XS40
Page 17: ...16 Figure 5 Programmer s model of the XS40 XStend Board combination...
Page 18: ...17...
Page 20: ......
Page 31: ......
Page 33: ......
Page 41: ......
Page 58: ...Appendix A XStend Schematics...
Page 59: ...XStend V1 3 XS Board Connectors...
Page 60: ...XStend V1 3 RAM...
Page 61: ......
Page 62: ...XStend V1 3 Stereo Codec...
Page 63: ......