# SPORT Transfers to the Frame Buffer

Compared to the inner workings of the cel engine, the details of transferring an image into the frame buffer with the SPORT bus are starkly simple. In essence, a background image is stored outside of the frame buffer in another section of VRAM. During the vertical interrupt of the NTSC display, the SPORT bus transfers the contents of the background-image bitmap into the frame buffer, effectively erasing everything there and laying out a fresh background for any cel projection or direct drawing to the frame buffer.

## Restrictions

The SPORT bus has the following restrictions imposed by its architecture-one timing restriction and three memory restrictions:

- A SPORT transfer can only take place during a vertical blank interrupt; it cannot take place during a frame scan.

- SPORT is available only in VRAM. It's impossible to use a SPORT transfer between DRAM and VRAM; it works only from VRAM to VRAM.

- SPORT only reads and writes in full memory pages at a time. It does not read or write fractions of pages, so any block transfer carried out by SPORT must be one or more integral pages in size.

- SPORT can transfer pages only within a single bank of VRAM. (Each bank is 1 megabyte in today's hardware.) In a 1 MB VRAM system, this restriction has no effect. In a 2 MB VRAM system, a SPORT transfer must begin and end within the same 1 MB bank, and cannot transfer between banks.

Strategic memory allocation for SPORT transfers is crucial. The frame buffer must be in the same VRAM bank as the background bitmap for a SPORT background refresh to work. SPORT's full-page restriction requires that the frame buffer and bitmap both allocate full pages of VRAM for their operation; if the bitmap or the frame image use less than full pages for their contents, a fraction of a page is left unused, but is still allocated so that the SPORT transfer can write into it without harm to other processes.

As it turns out, there is little or no VRAM waste with full-page allocation because VRAM page sizes are 2 kilobytes in size (depending on available VRAM), and a standard 320-by-240 frame buffer uses exactly 75 2 KB pages of VRAM.

## Clearing the Frame Buffer

Many tasks will want to clear the frame buffer to a single color (black, for example) instead of laying down a background image for each frame. The SPORT bus features FlashWrite. It copies the contents of a single 32-bit register to all the pixels of the frame buffer. This clears the buffer without dedicating an entire page of VRAM to the clearance color. FlashWrite operations are not restricted to occurring during Vblank.