Last active
August 29, 2015 14:27
-
-
Save bashaus/af263b4266ea4094e5e1 to your computer and use it in GitHub Desktop.
Enable, disable and switch between interrupts (LCD, VBLANK) in GBDK (Game Boy C)
This file contains hidden or 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
| void (*VBLANKListener)(); | |
| void noop() { /* Do nothing */ } | |
| void MainVBLANK() { | |
| disable_interrupts(); | |
| (*VBLANKListener)(); | |
| enable_interrupts(); | |
| } | |
| void main() { | |
| VBLANKListener = noop; | |
| add_VBL(MainVBLANK); | |
| } |
This file contains hidden or 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
| disable_interrupts(); | |
| VBLANKListener = noop; | |
| enable_interrupts(); |
This file contains hidden or 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
| void WorldVBLANK() { | |
| /* Interrupt code goes here */ | |
| } | |
| disable_interrupts(); | |
| VBLANKListener = WorldVBLANK; | |
| enable_interrupts(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment