User manual

PAL tutorial
par
{
PalVideoOutRun (VideoOut);
PalFastRAMRun (FastRAM);
// main program here
}
Enabling the RAM resource
Once the RAM resource is being run, it needs to be enabled before it can be accessed. This is done
using the
PalFastRAMEnable() macro. In this application, it is done at the same time as the enabling
of the video resource:
par
{
PalFastRAMEnable (FastRAM);
PalVideoOutEnable (VideoOut);
}
Writing data to the RAM
This application uses a single-bank of RAM as a frame-buffer. While the video scan position is visible,
the RAM is being read and the contents interpreted and displayed on the screen. While the scan position
is in the blanking period at the end of a frame, the image of the square in its new position is written to the
RAM.
As the application packs the colour information for eight pixels into a single 32-bit word, the write
procedure uses a register as temporary storage before writing out to the RAM. If the location to be
written to in the frame-buffer is stored in the same physical RAM location as the last pixel location written
to, then the temporary register store is used. If not, then the temporary register is written out to RAM and
a new value read into it from the RAM. The 4-bit pixel information for the square is then written into this
register. This is implemented in the macro
WriteValue(), where the PAL API macro
PalFastRAMWrite() is called:
PalFastRAMWrite (FastRAM, LastAddress, RAMRegister);
There is also a simple command to flush the contents of the temporary register store to RAM. This is
used to update the RAM after the whole of the square has been drawn.
Reading data from the RAM
The read process reads a 32-bit value from the RAM every eight clock cycles and interprets this word as
colour information for eight 4-bit pixels. This colour information is used as an index to a colour palette
and the result is displayed on the screen.
The read itself is wrapped up in a macro procedure called
ReadValue(). The value read from the RAM
is assigned into a signal in parallel with an assignment of the value of that signal into the
Data argument
of the procedure. This means that the data from the RAM is directly assigned into the register supplied in
the call to the procedure. This is implemented in the
ReadValue() macro, which calls the PAL API
macro
PalFastRAMRead().
PalFastRAMRead (FastRAM, 0 @ Address, &DataSignal);
www.celoxica.com
Page 13