Browse Source

idle loop elimination

ipatix 7 years ago
parent
commit
bdc9d05d6a
1 changed files with 35 additions and 7 deletions
  1. 35
    7
      patches/hooks.asm

+ 35
- 7
patches/hooks.asm View File

1
 _call_via_r0 equ 0x081E3BA8
1
 _call_via_r0 equ 0x081E3BA8
2
 _call_via_r1 equ 0x081E3BAC
2
 _call_via_r1 equ 0x081E3BAC
3
 
3
 
4
-//Ipatix sound stuff
4
+//----------------------
5
+// ipatix sound stuff
6
+//----------------------
7
+
5
 .org 0x080007B4
8
 .org 0x080007B4
6
     .word  0x0203E000   // new PCM work area
9
     .word  0x0203E000   // new PCM work area
7
 .org 0x081DD0B4
10
 .org 0x081DD0B4
64
     B   0x080159DC
67
     B   0x080159DC
65
     .pool
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
 // disable help menu
74
 // disable help menu
75
 // see: https://www.pokecommunity.com/showthread.php?t=364909
75
 // see: https://www.pokecommunity.com/showthread.php?t=364909
76
 .org 0x0813B8C2
76
 .org 0x0813B8C2
77
     .halfword 0xE01D
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
 // decrease amount of valid file handles from 20 to 12 to free up some IRAM
98
 // decrease amount of valid file handles from 20 to 12 to free up some IRAM
80
 NUM_FILE_HANDLES equ 12
99
 NUM_FILE_HANDLES equ 12
81
 .org 0x081E9948
100
 .org 0x081E9948
99
     cmp r1, #NUM_FILE_HANDLES
118
     cmp r1, #NUM_FILE_HANDLES
100
     bge 0x081E9C94
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
 //flag routine
130
 //flag routine
103
 .org 0x0806E5D6
131
 .org 0x0806E5D6
104
 	ldr r0, =flag_hook|1
132
 	ldr r0, =flag_hook|1