As an offshoot of my Z-Machine idea, I'm writing terminal routines for the NES. From what I gather, I have to wait until VBLANK, turn off the display, update the nametable, and turn the PPU back on. I've noticed that most are using a NMI to update the screen, however, with text, I have the luxury of updating asynchronously.
They way the terminal works is that when a character needs to be printed, it's pushed to the stack and the output routine is called.
Here is how I will get it to work in theory....
In my output routine I'll loop and check bit 7 of PPU status. Once that goes high, I know I'm in vblank and I have to turn off the background and sprites using PPUMASK (bits 3 and 4)
Then I pop my character off the stack, and use PPUDATA to update the nametable and it will automatically advance to the next position
Then I turn on the background and sprites again and it should be good to go for the next frame, right?
They way the terminal works is that when a character needs to be printed, it's pushed to the stack and the output routine is called.
Here is how I will get it to work in theory....
In my output routine I'll loop and check bit 7 of PPU status. Once that goes high, I know I'm in vblank and I have to turn off the background and sprites using PPUMASK (bits 3 and 4)
Then I pop my character off the stack, and use PPUDATA to update the nametable and it will automatically advance to the next position
Then I turn on the background and sprites again and it should be good to go for the next frame, right?