Bläddra i källkod

idle loop elimination

ipatix 7 år sedan
förälder
incheckning
bdc9d05d6a
1 ändrade filer med 35 tillägg och 7 borttagningar
  1. 35
    7
      patches/hooks.asm

+ 35
- 7
patches/hooks.asm Visa fil

@@ -1,7 +1,10 @@
1 1
 _call_via_r0 equ 0x081E3BA8
2 2
 _call_via_r1 equ 0x081E3BAC
3 3
 
4
-//Ipatix sound stuff
4
+//----------------------
5
+// ipatix sound stuff
6
+//----------------------
7
+
5 8
 .org 0x080007B4
6 9
     .word  0x0203E000   // new PCM work area
7 10
 .org 0x081DD0B4
@@ -64,18 +67,34 @@ _call_via_r1 equ 0x081E3BAC
64 67
     B   0x080159DC
65 68
     .pool
66 69
 
67
-
68
-//End of sound stuff
69
-
70
-//Don't know what thats all about... leaving it commented for now
71
-//.org 0x0800f268
72
-//    .halfword 0xE000
70
+//---------------------
71
+// ipatix misc stuff
72
+//---------------------
73 73
 
74 74
 // disable help menu
75 75
 // see: https://www.pokecommunity.com/showthread.php?t=364909
76 76
 .org 0x0813B8C2
77 77
     .halfword 0xE01D
78 78
 
79
+// idle loop eliminiation
80
+.org 0x080008A4
81
+    cmp r0, #0
82
+    bne ile_end_wait
83
+    mov r3, #1
84
+ile_idle_loop:
85
+    swi #2
86
+    ldrh r1, [r2, #0x1c]
87
+    mov r0, r3
88
+    and r0, r1
89
+    beq ile_idle_loop
90
+ile_end_wait:
91
+    pop {r0}
92
+    bx r0
93
+
94
+//--------------
95
+// IRAM hacks
96
+//--------------
97
+
79 98
 // decrease amount of valid file handles from 20 to 12 to free up some IRAM
80 99
 NUM_FILE_HANDLES equ 12
81 100
 .org 0x081E9948
@@ -99,6 +118,15 @@ NUM_FILE_HANDLES equ 12
99 118
     cmp r1, #NUM_FILE_HANDLES
100 119
     bge 0x081E9C94
101 120
 
121
+//----------------
122
+// S-Bird stuff
123
+//----------------
124
+
125
+//Don't know what thats all about... leaving it commented for now
126
+//.org 0x0800f268
127
+//    .halfword 0xE000
128
+
129
+
102 130
 //flag routine
103 131
 .org 0x0806E5D6
104 132
 	ldr r0, =flag_hook|1