The SPORT Device


The 3DO hardware includes a minimum of 1 MB of VRAM. VRAM is a special type of memory that offers a very wide interface bus, which allows for efficient implementation of display buffers.

SPORT stands for Serial PORT, and refers specifically to the VRAM's serial port, not to an external RS-232 serial port. VRAM has special hardware that lets you copy pages of memory, clear pages of memory, and replicate pages of memory at an amazing rate. The SPORT device provides access to these capabilities. It is ideal for clearing a display to a specific color, or setting a display to a static background picture.

Working With the SPORT Device

The SPORT device always operates on pages of VRAM. The size of VRAM pages is returned by the GetPageSize(MEMTYPE_VRAM) function call. All operations performed by the SPORT device must start on an even page boundary and be a multiple of the page size length. The current VRAM page size is 2 KB, but you must not rely on this fact. Always use the GetPageSize() function to get the actual page size.

Communicating with the SPORT device is done with the standard Portfolio I/O commands. The SPORT device only has a single unit, unit 0. To send commands to the SPORT device, you must complete the following steps:

  1. Open the SPORT device using the OpenNamedDevice() function.
  2. Create an IOReq structure by calling the CreateIOReq() function.
  3. Initialize an IOInfo structure that specifies the command and parameters of the command.
  4. Send the command to the SPORT device using either DoIO() or SendIO().

Copying VRAM Pages

The
SPORTCMD_COPY command copies pages of VRAM to other pages of VRAM. The copy operation always occurs during vertical blanking because the serial port on the VRAM is always in use when video is displayed. When vertical blanking occurs, the serial port becomes available for other duties such as copying and cloning pages.

To use SPORTCMD_COPY, initialize an IOInfo structure such as:

IOInfo ioInfo;

memset(&ioInfo,0,sizeof(ioInfo));
ioInfo.ioi_Command                        = SPORTCMD_COPY;
ioInfo.ioi_Offset                               = mask;
ioInfo.ioi_Send.iob_Buffer                        = sourceAddress;
ioInfo.ioi_Send.iob_Len                        = numBytes;
ioInfo.ioi_Recv.iob_Buffer                        = destinationAddress;
ioInfo.ioi_Recv.iob_Len                        = numBytes;

The sourceAddress field points to the source data to be copied, while the destinationAddress field points to the address where the data is copied. Both of these addresses must be in VRAM, and both must fall on even VRAM page boundaries. numBytes indicates the number of bytes to copy. This value must be an even multiple of the VRAM page size. Finally, mask is a 32-bit value that determines which bits of each word of data are copied. Every on bit indicates a bit that will be copied to the destination. Every off bit indicates that the corresponding bit in the destination will remain unchanged.

Don't use a mask value other than 0xffffffff because future hardware implementations may impose serious performance penalties for using masks with other values.

Replicating VRAM Pages

The SPORTCMD_CLONE command replicates a page of VRAM to a series of other pages. This is useful when creating wallpaper backgrounds. The cloning operation always occurs during vertical blanking because the serial port on the VRAM is always in use when video is being displayed. When vertical blanking occurs, the serial port becomes available for other duties such as copying and cloning pages.

To use SPORTCMD_CLONE, you must initialize an IOInfo structure such as:

IOInfo ioInfo;

memset(&ioInfo,0,sizeof(ioInfo));
ioInfo.ioi_Command                        = SPORTCMD_CLONE;
ioInfo.ioi_Offset                             = mask;
ioInfo.ioi_Send.iob_Buffer                        = sourcePageAddress;
ioInfo.ioi_Send.iob_Len                        = pageSize;
ioInfo.ioi_Recv.iob_Buffer                        = destinationAddress;

ioInfo.ioi_Recv.iob_Len                        = numBytes;

The sourcePageAddress points to the source page to be replicated, while the destinationAddress field points to the address where the data is copied. Both of these addresses must be in VRAM, and both must fall on even VRAM page boundaries. pageSize is the size of a single VRAM page, as returned by GetPageSize(MEMTYPE_VRAM). numBytes indicates the number of bytes to replicate. This value is typically calculated as (numPages * pageSize). This value must be an even multiple of the VRAM page size. Finally, mask is a 32-bit value that determines which bits of each word of data are put on the destination pages. Every on bit indicates a bit that will be copied to the destination. Every off bit indicates that the corresponding bit in the destination will remain unchanged.

Don't use a mask value other than 0xffffffff because future hardware implementations may impose serious performance penalties for using masks with other values.

Setting VRAM Pages to a Fixed Value

The FLASHWRITE_CMD command sets the value of a range of VRAM pages. Unlike the copy and clone operations described above, this command does not operate in the vertical blank area and occurs immediately.

To use FLASHWRITE_CMD, you must initialize an IOInfo structure such as:

IOInfo ioInfo;

memset(&ioInfo,0,sizeof(ioInfo));
ioInfo.ioi_Command                        = FLASHCMD_WRITE;
ioInfo.ioi_CmdOptions    = mask;
ioInfo.ioi_Offset       = value; 
ioInfo.ioi_Send.iob_Buffer                        = pageAddress;
ioInfo.ioi_Send.iob_Len                        = numBytes;
ioInfo.ioi_Recv.iob_Buffer                        = pageAddress;
ioInfo.ioi_Recv.iob_Len                        = numBytes;

The pageAddress field points to the pages of VRAM to be set to a fixed value. This address must be in VRAM, and must fall on an even VRAM page boundary. The numBytes field indicates the number of bytes to affect. This value must be an even multiple of the VRAM page size. value is the value to which the words of data within the pages should be set. Finally, mask is a 32-bit value that determines which bits of each word of data are affected. Every on bit indicates a bit that will be affected. Every off bit indicates that the corresponding bit will remain unchanged.

Don't use a mask value other than 0xffffffff because future hardware implementations may impose serious performance penalties for using masks with other values.