Bitmapped Video Basics - FIGnition FUZE Hardware Reference Manual

Table of Contents

Advertisement

VSync part of a frame is slightly different for even frames. Since FIGnition doesn't use in-
terlacing, we won't cover it any further here.
NTSC Video. FIGnition is capable of displaying NTSC video using slightly different firm-
ware. NTSC video is used in the US, Canada and parts of South America and provides
525 lines each of 63.9µs. This means there are 14 x 31.95µs periods in the VSync portion
leaving 31 scans for the top margin and 32 scans for the bottom margin.

3.2.6 Bitmapped Video Basics

The Bitmapped video and Blitter (Sprite Engine) are covered in more detail in the Firm-
ware Reference, but some of the basics are worth covering here.
Bandwidth. After FIGnition was designed it was discovered that the serial SRAM could be
read fast enough to generate a full bitmapped image on a TV. The Serial SRAM is read at
10MHz and requires 9 bit times to read each byte. Therefore in a single 64µs video scan
we can (in theory) read up to 64µs x 10MHz / 9CyclesPerByte = A theoretical maximum of
71 bytes. Video data is pumped out of the USART at 5MHz for 40µs requiring only 25
bytes per scan. Therefore we can copy bitmapped data from the serial SRAM to the
USART quickly enough. A 160x160 bitmapped image was chosen (using 3200 bytes) to
leave adequate room for programs from a FIGnition's standard 8Kb of SRAM.
Interrupting SRAM. FIGnition uses the serial SRAM to execute Forth programs. To read a
bitmapped video image from the SRAM means interrupting its use for reading programs
and then restoring it at the end. However, it's not possible to read the current SRAM ad-
dress from the chip and it's not practical to analyze the firmware to work out which address
was last read or written.
The solution is to only use the SRAM for video when the SRAM gets deselected, which
happens every time a Forth program jumps to a different location; reads or writes a vari-
able or executes a Forth command
1
in ROM. When the SRAM is deselected, PortB1 goes
high and because it's possible to automatically generate an interrupt when a port pin
changes (Chapter 13 of AtMega328 User Manual) it's possible to notify the AVR when the
SRAM is free to be used to generate bitmapped video.
Bitmapped Image Format. The goal for the bitmapped video mode is to enable sprites
and bitmap images to be copied quickly to the screen. If the bitmapped video memory was
organised in the same way as a TV image, scan line by scan line [Fig 3.8], then copying,
for example an 8x8 image would require writing at least 8x3 = 24 command bytes + 8 data
bytes to SRAM = 32 in total. However, by organising the bitmapped video memory as 8x8
bit tiles then the same example would require writing as little as 3 command bytes + 8 data
bytes = 11 in total, about 3x faster
2
[Fig 3.9].
1
FIGnition Forth executes byte codes (which are byte values in the range 0 to 79) and compiled commands
which are two-byte addresses in ROM or RAM.
2
The worst case for a scan line order would be 24 command bytes + 16 data bytes = 40 if the 8x8 images
weren't aligned and 30b for the tiled version (2x3 = 6 command bytes + 24 data bytes).

Advertisement

Table of Contents
loading

Table of Contents