summaryrefslogtreecommitdiff
path: root/src/code_800D090.c
diff options
context:
space:
mode:
authorSeth Barberee <seth.barberee@gmail.com>2020-12-17 13:17:58 -0600
committerGitHub <noreply@github.com>2020-12-17 13:17:58 -0600
commit096de8d9b2ffd90c52e790296bfd7c5436d45ca3 (patch)
tree9c5af2e04dea05221c71946a5dfc06471f77801d /src/code_800D090.c
parentbc504264f1e54b3c1e482710c592e5549828bfe1 (diff)
parentf90f3affeb9b0a66aa7df68f5fdecd692033faf9 (diff)
Merge pull request #12 from SethBarberee/master
Merge work from SethBarberee/pmd-red into pret.
Diffstat (limited to 'src/code_800D090.c')
-rw-r--r--src/code_800D090.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/code_800D090.c b/src/code_800D090.c
new file mode 100644
index 0000000..1031a2d
--- /dev/null
+++ b/src/code_800D090.c
@@ -0,0 +1,65 @@
+#include "global.h"
+
+extern void SoundBiasReset(void);
+extern void SoundBiasSet(void);
+
+void Hang(void)
+{
+ while(1)
+ {
+ asm("swi 0x2");
+ }
+}
+
+
+// Unused
+void sub_800D098(void)
+{
+ u32 dispcnt_save;
+ u32 ie_store;
+
+ while(REG_VCOUNT <= 159)
+ ;
+
+ // Save DISPCNT and set to 0
+ dispcnt_save = REG_DISPCNT;
+ REG_DISPCNT = 0;
+
+ *(u16 *)BG_PLTT = 0xefff;
+
+ while(REG_KEYINPUT != 0x3ff) // 0011 1111 1111 (all buttons)
+ ;
+
+
+ REG_IME = 0;
+
+ // Save IE Register
+ ie_store = REG_IE;
+ REG_IE = INTR_FLAG_KEYPAD | INTR_FLAG_GAMEPAK;
+
+ REG_KEYCNT = 0xC304; // TODO 1100 0011 0000 0100
+ // Select:
+ // * Select button
+ // * L/R Button
+ // Enable IRQ
+ // Logical AND
+ // So do something when all buttons above are pressed
+
+ REG_IME = 1;
+
+ SoundBiasReset();
+ asm("swi 0x3");
+ SoundBiasSet();
+
+ REG_IME = 0;
+
+ REG_IE = ie_store; // restore IE
+ REG_KEYCNT = 0; // reset KEYCNT
+
+ REG_IME = 1;
+
+ // Good after here
+ while(REG_VCOUNT <= 159){}
+ REG_DISPCNT = dispcnt_save; // restore DISPCNT
+ while(REG_KEYINPUT != 0x3ff){} // All buttons
+}