Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

System

AddressstdgbaAccessTypetonclib
0x4000204reg_waitcntRWwaitcntREG_WAITCNT

waitcnt

waitcnt is the GBA wait-control register (WAITCNT), also referred to as waitctl in some documentation.

struct waitcnt {
    unsigned short sram : 2{3};
    unsigned short ws0_first : 2{1};
    unsigned short ws0_second : 1{1};
    unsigned short ws1_first : 2{};
    unsigned short ws1_second : 1{};
    unsigned short ws2_first : 2{3};
    unsigned short ws2_second : 1{};
    unsigned short phi : 2{};
    short : 1;
    bool prefetch : 1{true};
    const bool is_cgb : 1{};
};

Default-initializing with {} sets optimal ROM access timings and enables the prefetch buffer:

gba::reg_waitcnt = {};