summaryrefslogtreecommitdiff
path: root/src/home/interrupt.asm
diff options
context:
space:
mode:
authorDaniel Harding <33dannye@gmail.com>2021-09-19 00:21:14 -0500
committerGitHub <noreply@github.com>2021-09-19 00:21:14 -0500
commitdf67aac83b466dadf5f74c881bf84dd9ef19bdfc (patch)
tree47501aced2d256052b8f78bc97328d5af5703add /src/home/interrupt.asm
parente4bce9b7ee5e89f8edfd921de2379f0fa06af206 (diff)
parent8dee6b7a11e85d6d4b9f8ec9fb9d53a499fd37dc (diff)
Merge pull request #110 from ElectroDeoxys/master
Split Home bank
Diffstat (limited to 'src/home/interrupt.asm')
-rw-r--r--src/home/interrupt.asm37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/home/interrupt.asm b/src/home/interrupt.asm
new file mode 100644
index 0000000..19709c6
--- /dev/null
+++ b/src/home/interrupt.asm
@@ -0,0 +1,37 @@
+; enable timer interrupt
+EnableInt_Timer:
+ ldh a, [rIE]
+ or 1 << INT_TIMER
+ ldh [rIE], a
+ ret
+
+; enable vblank interrupt
+EnableInt_VBlank:
+ ldh a, [rIE]
+ or 1 << INT_VBLANK
+ ldh [rIE], a
+ ret
+
+; enable lcdc interrupt on hblank mode
+EnableInt_HBlank:
+ ldh a, [rSTAT]
+ or 1 << STAT_MODE_HBLANK
+ ldh [rSTAT], a
+ xor a
+ ldh [rIF], a
+ ldh a, [rIE]
+ or 1 << INT_LCD_STAT
+ ldh [rIE], a
+ ret
+
+; disable lcdc interrupt and the hblank mode trigger
+DisableInt_HBlank:
+ ldh a, [rSTAT]
+ and ~(1 << STAT_MODE_HBLANK)
+ ldh [rSTAT], a
+ xor a
+ ldh [rIF], a
+ ldh a, [rIE]
+ and ~(1 << INT_LCD_STAT)
+ ldh [rIE], a
+ ret