You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think we can make the page flipping explanation a little clearer. Tonc shows you this snippet but doesn't define most of the symbols used.
u16*vid_flip()
{
// toggle the write_buffer's pagevid_page= (u16*)((u32)vid_page ^ VID_FLIP);
REG_DISPCNT ^= DCNT_PAGE; // update control registerreturnvid_page;
}
The easy part is the register update, although Cearn doesn't waste time explaining that you can just xor the contents of DISPCNT with the offset of the page bit, and you get a nice toggle.
Now for the "hard" part. You are told that vid_page is your write buffer pointer, but we should probably mention that while it is declared by libtonc, you have to initialize it yourself (e.g. to vid_mem). I suppose it'd be more obvious if the following example used vid_page, but it doesn't.
More importantly, VID_FLIP is never defined. It's not a libtonc symbol and without further details, it's hard to tell what this line is actually doing. I think we can safely replace it with VRAM_PAGE_SIZE, and point out that the XOR lets you add or remove the page size offset.
What do you think?
The text was updated successfully, but these errors were encountered:
Suggested by @Kyrio on Discord:
The text was updated successfully, but these errors were encountered: