Last active
March 25, 2020 20:05
-
-
Save drhelius/33678a2389a5fd0fcaea71eb106dd16c to your computer and use it in GitHub Desktop.
Interrupt INT 48h - LCD STAT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Interrupt INT 48h - LCD STAT | |
---------------------------- | |
The STAT register (FF41) selects the conditions that will generate this | |
interrupt (expecting that interrupts are enabled via EI or RETI and that | |
IE.1 (FFFF.1) is set). | |
STAT.3 HBLANK (start of mode 0) | |
STAT.4 VBLANK (start of mode 1) (additional to INT 40) | |
STAT.5 OAM (start of mode 2 and mode 1) | |
STAT.6 LY=LYC (see info about LY=00) | |
If two STAT-condiditions come true at the same time only one INT 48 is | |
generated. This happens in combinations | |
LYC=01..90 and OAM at the same time (see info about LY=00) | |
LYC=90 and VBLANK at the same time | |
OAM and VBLANK at the same time | |
HBLANK and LYC=00 and LYC=91..99 are off-grid and cannot hit others. | |
Some STAT-conditions cause the following STAT-condition to be ignored: | |
Past VBLANK following LYC=91..99,00 is ignored | |
Past VBLANK following OAM (at 00) is ignored | |
Past LYC=00 at 99.2 following OAMs (at 00 and 01) are ignored | |
Past LYC=01..8F following OAM (at 02..90) is ignored | |
Past LYC=00..8F following HBLANK (at 00..8F) is ignored | |
Past LYC=8F following VBLANK is ignored | |
Past HBLANK following OAM is ignored | |
Past HBLANK at 8F following VBLANK is ignored | |
If the OAM condition occurs, everything following -is- recognized. | |
An ignored VBLANK condition means that INT 48h does not produce a V-Blank | |
interrupt, INT 40h is not affected and still produces V-Blank interrupts. | |
The last LY period (LY=99) is a shorter than normal LY periodes. It is followed | |
by the first LY period (LY=00) this period is longer than normal periodes. | |
LY value clks description | |
------------------------------- | |
LY=01..8F 456 at the same moment than OAM | |
LY=90 456 at the same moment than pseudo-OAM and VBLANK | |
LY=91..98 456 during vblank (similiar to LY=01..8F) | |
LY=99 ca.56 similiar to LY=91..98, but shorter | |
LY=00 ca.856 starts during vblank, then present until second OAM | |
Because of the pre-started long LY=00 period, LYC=00 occurs within vblank | |
period and before first OAM (where we would have expected it) | |
*EOF* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment