3.5 Minor Note

The ClearBackground function is designed so you can specify the background color with the three arguments r, g and b at execution time. Assume the background will be fixed to a specific color. In this case, it might seem unnecessary to do a dynamic display list, and that the load at execution time could be reduced by defining this as a static display list. However, there is a reason why this display list is defined dynamically. In fact, it is impossible to substitute a static display list.

List 3-4 See basic3 "graphic.c"

void  ClearBackground(u8 r, u8 g, u8 b)
{
  gDPPipeSync(glistp++);
  /* Set to fill mode (G_CYC_FILL) */
  gDPSetCycleType(glistp++, G_CYC_FILL);
  /* Specify the subject to fill (the next displayed framebuffer) */
  gDPSetColorImage(glistp++, G_IM_FMT_RGBA,
                   G_IM_SIZ_16b, SCREEN_WD,
                   osVirtualToPhysical(nuGfxCfb_ptr));
(The rest  is omitted)

If you look carefully at the contents of ClearBackground, you will see that the symbol nuGfxCfb_ptr is referenced. nuGfxCfb_ptr is a pointer managed by NuSystem that is always set to point to the next framebuffer for rendering. Since this pointer points to a different framebuffer in every rendering frame, it cannot be determined at compile time. Consequently, it is impossible to implement ClearBackground as a static display list.