Function


nuPiReadRomOverlay


Format:

void nuPiReadRomOverlay(NUPiOverlaySegment* segment)

Argument:

segment Pointer of segment structure 

Return value:

None

Description:

Reads Overlay segment from ROM

DMA transfers segment data, which includes command codes in the Game Pak, to RDRAM using PI and overlays it. The segment to be read is specified by the PiOverlaySegment type structure which is specified by segment. NUPiOverlaySegment type structure is defined as follows:

typedef struct st_PiOverlaySegment {
    u8* romStart;    /* Starting offset of segment ROM      */
    u8* romEnd;      /* Ending offset of segment ROM      */
    u8* ramStart;    /* Starting address of segment CPU        */
    u8* textStart;   /* Starting address of DRAM of text attribute          */
    u8* textEnd;     /* Ending address of DRAM of text attribute          */
    u8* dataStart;   /* Starting address of DRAM of data attribute           */
    u8* dataEnd;     /* Ending address of DRAM of data attribute       */
    u8* bssStart;    /* Starting address of DRAM of bss attribute            */
    u8* bssEnd;      /* Ending address of DRAM of bss attribute            */
} NUPiOverlaySegment;

This function processes the following, which are necessary for overlay.

Please be aware of the following cautions when DMA transferring overlay segment.

  1. Be sure to overlay after the instruction cache for the area to be overlayed is completely finished. Do not execute a code immediately prior to, during or after the overlay.
  2. Because of the size of the cache line for instruction cache, 32 byte alignment is recommended for the segment to be overlayed.

When data of a large size is transferred using PI-DMA, necessary data for audio replay cannot be transferred during that time, and noise could occur in the audio. Therefore, when the size of data to be transferred at a time is more than 16384 bytes, it is processed so as to transfer the data in 16384 byte units within the function.


Reference:  nuPiInit