/* exec.library VBlank interrupt handler */ AROS_INTH1(VBlankInt, struct TimerBase *, TimerBase) { AROS_INTFUNC_INIT /* UpdateEClock and process VBlank timer*/ EClockUpdate(TimerBase); handleVBlank(TimerBase, SysBase); /* exec should continue with other servers */ return 0; AROS_INTFUNC_EXIT }
void setLCDStatus(struct gameboy * gameboy) { //it take 456 clock cycles to draw 1 scanline //LCD status is in mode 2 for the first 80 (search sprite attrs) //Mode 3 is set for the next 172 (transfer to LCD driver) //The remaining 204 are for mode 0 (hBlank) //When the status mode is changed to 0, 1 or 2, an interrupt request occurs //Check bit 3, 4, or 5 to see if mode interrupt 0, 1 or 2 is enabled //when the lcd mode is disabled, the status mode must be set to 1 if (!isLCDEnabled(gameboy)){ //starting a new scan line sets the lcd status to 2 //printf("LCD isn't enabled - starting new scanline\n"); startNewScanline(gameboy); } else { // printf("LCD is enabled\n"); if (isInVBlankBounds(gameboy)){ //printf("Handle vblank\n"); handleVBlank(gameboy); } else if (isInSpriteAttributeBounds(gameboy)){ //printf("Handle OAM\n"); handleSpriteSearch(gameboy); } else if (isInDriverTransferBounds(gameboy)){ //printf("handle transfer\n"); handleTransferToLCDDriver(gameboy); } else { //printf("handle hblank\n"); handleHBlank(gameboy); } } }