@@ -74,15 +74,15 @@ GameBoyAdvanceCPU.prototype.HLEReset = function () {
7474GameBoyAdvanceCPU . prototype . branch = function ( branchTo ) {
7575 branchTo = branchTo | 0 ;
7676 //if ((branchTo | 0) > 0x3FFF || this.IOCore.BIOSFound) {
77- //Branch to new address:
78- this . registers [ 15 ] = branchTo | 0 ;
79- //Mark pipeline as invalid:
80- this . IOCore . flagBubble ( ) ;
81- //Next PC fetch has to update the address bus:
82- this . wait . NonSequentialBroadcastClear ( ) ;
77+ //Branch to new address:
78+ this . registers [ 15 ] = branchTo | 0 ;
79+ //Mark pipeline as invalid:
80+ this . IOCore . flagBubble ( ) ;
81+ //Next PC fetch has to update the address bus:
82+ this . wait . NonSequentialBroadcastClear ( ) ;
8383 /*}
8484 else {
85- //We" re branching into BIOS, handle specially:
85+ //We' re branching into BIOS, handle specially:
8686 if ((branchTo | 0) == 0x130) {
8787 //IRQ mode exit handling:
8888 //ROM IRQ handling returns back from its own subroutine back to BIOS at this address.
@@ -144,8 +144,8 @@ GameBoyAdvanceCPU.prototype.IRQinARM = function () {
144144 //Disable IRQ:
145145 this . modeFlags = this . modeFlags | 0x80 ;
146146 //if (this.IOCore.BIOSFound) {
147- //IRQ exception vector:
148- this . branch ( 0x18 ) ;
147+ //IRQ exception vector:
148+ this . branch ( 0x18 ) ;
149149 /*}
150150 else {
151151 //HLE the IRQ entrance:
@@ -164,8 +164,8 @@ GameBoyAdvanceCPU.prototype.IRQinTHUMB = function () {
164164 //Exception always enter ARM mode:
165165 this . enterARM ( ) ;
166166 //if (this.IOCore.BIOSFound) {
167- //IRQ exception vector:
168- this . branch ( 0x18 ) ;
167+ //IRQ exception vector:
168+ this . branch ( 0x18 ) ;
169169 /*}
170170 else {
171171 //HLE the IRQ entrance:
@@ -181,11 +181,11 @@ GameBoyAdvanceCPU.prototype.HLEIRQEnter = function () {
181181 this . wait . NonSequentialBroadcast ( ) ;
182182 //Push register(s) into memory:
183183 for ( var rListPosition = 0xF ; ( rListPosition | 0 ) > - 1 ; rListPosition = ( ( rListPosition | 0 ) - 1 ) | 0 ) {
184- if ( ( 0x500F & ( 1 << ( rListPosition | 0 ) ) ) != 0 ) {
185- //Push a register into memory:
186- currentAddress = ( ( currentAddress | 0 ) - 4 ) | 0 ;
187- this . memory . memoryWrite32 ( currentAddress | 0 , this . registers [ rListPosition | 0 ] | 0 ) ;
188- }
184+ if ( ( 0x500F & ( 1 << ( rListPosition | 0 ) ) ) != 0 ) {
185+ //Push a register into memory:
186+ currentAddress = ( ( currentAddress | 0 ) - 4 ) | 0 ;
187+ this . memory . memoryWrite32 ( currentAddress | 0 , this . registers [ rListPosition | 0 ] | 0 ) ;
188+ }
189189 }
190190 //Store the updated base address back into register:
191191 this . registers [ 0xD ] = currentAddress | 0 ;
@@ -203,7 +203,7 @@ GameBoyAdvanceCPU.prototype.HLEIRQExit = function () {
203203 //Updating the address bus away from PC fetch:
204204 this . wait . NonSequentialBroadcast ( ) ;
205205 //Load register(s) from memory:
206- for ( var rListPosition = 0 ; ( rListPosition | 0 ) < 0x10 ; rListPosition = ( ( rListPosition | 0 ) + 1 ) | 0 ) {
206+ for ( var rListPosition = 0 ; ( rListPosition | 0 ) < 0x10 ; rListPosition = ( ( rListPosition | 0 ) + 1 ) | 0 ) {
207207 if ( ( 0x500F & ( 1 << ( rListPosition | 0 ) ) ) != 0 ) {
208208 //Load a register from memory:
209209 this . registers [ rListPosition & 0xF ] = this . memory . memoryRead32 ( currentAddress | 0 ) | 0 ;
@@ -223,16 +223,16 @@ GameBoyAdvanceCPU.prototype.HLEIRQExit = function () {
223223}
224224GameBoyAdvanceCPU . prototype . SWI = function ( ) {
225225 //if (this.IOCore.BIOSFound) {
226- //Mode bits are set to SWI:
227- this . switchMode ( 0x13 ) ;
228- //Save link register:
229- this . registers [ 14 ] = this . getLR ( ) | 0 ;
230- //Disable IRQ:
231- this . modeFlags = this . modeFlags | 0x80 ;
232- //Exception always enter ARM mode:
233- this . enterARM ( ) ;
234- //SWI exception vector:
235- this . branch ( 0x8 ) ;
226+ //Mode bits are set to SWI:
227+ this . switchMode ( 0x13 ) ;
228+ //Save link register:
229+ this . registers [ 14 ] = this . getLR ( ) | 0 ;
230+ //Disable IRQ:
231+ this . modeFlags = this . modeFlags | 0x80 ;
232+ //Exception always enter ARM mode:
233+ this . enterARM ( ) ;
234+ //SWI exception vector:
235+ this . branch ( 0x8 ) ;
236236 /*}
237237 else {
238238 if ((this.modeFlags & 0x20) != 0) {
@@ -250,19 +250,19 @@ GameBoyAdvanceCPU.prototype.SWI = function () {
250250GameBoyAdvanceCPU . prototype . UNDEFINED = function ( ) {
251251 //Only process undefined instruction if BIOS loaded:
252252 //if (this.IOCore.BIOSFound) {
253- //Mode bits are set to SWI:
254- this . switchMode ( 0x1B ) ;
255- //Save link register:
256- this . registers [ 14 ] = this . getLR ( ) | 0 ;
257- //Disable IRQ:
258- this . modeFlags = this . modeFlags | 0x80 ;
259- //Exception always enter ARM mode:
260- this . enterARM ( ) ;
261- //Undefined exception vector:
262- this . branch ( 0x4 ) ;
253+ //Mode bits are set to SWI:
254+ this . switchMode ( 0x1B ) ;
255+ //Save link register:
256+ this . registers [ 14 ] = this . getLR ( ) | 0 ;
257+ //Disable IRQ:
258+ this . modeFlags = this . modeFlags | 0x80 ;
259+ //Exception always enter ARM mode:
260+ this . enterARM ( ) ;
261+ //Undefined exception vector:
262+ this . branch ( 0x4 ) ;
263263 /*}
264264 else {
265- //Pretend we didn" t execute the bad instruction then:
265+ //Pretend we didn' t execute the bad instruction then:
266266 if ((this.modeFlags & 0x20) != 0) {
267267 this.THUMB.incrementProgramCounter();
268268 }
0 commit comments