mirror of
https://github.com/mupen64plus/mupen64plus-oldsvn.git
synced 2025-04-02 10:52:35 -04:00
440 lines
8.9 KiB
C
440 lines
8.9 KiB
C
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
* Mupen64plus - regimm.h *
|
|
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
|
|
* Copyright (C) 2002 Hacktarux *
|
|
* *
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License as published by *
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
* (at your option) any later version. *
|
|
* *
|
|
* This program is distributed in the hope that it will be useful, *
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
* GNU General Public License for more details. *
|
|
* *
|
|
* You should have received a copy of the GNU General Public License *
|
|
* along with this program; if not, write to the *
|
|
* Free Software Foundation, Inc., *
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
#include "r4300.h"
|
|
#include "interupt.h"
|
|
#include "ops.h"
|
|
#include "macros.h"
|
|
|
|
#include "../memory/memory.h"
|
|
|
|
void BLTZ()
|
|
{
|
|
local_rs = irs;
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if (local_rs < 0 && !skip_jump)
|
|
PC += (PC-2)->f.i.immediate-1;
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BLTZ_OUT()
|
|
{
|
|
local_rs = irs;
|
|
jump_target = (int)PC->f.i.immediate;
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if (!skip_jump && local_rs < 0)
|
|
jump_to(PC->addr + ((jump_target-1)<<2));
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BLTZ_IDLE()
|
|
{
|
|
int skip;
|
|
if (irs < 0)
|
|
{
|
|
update_count();
|
|
skip = next_interupt - Count;
|
|
if (skip > 3) Count += (skip & 0xFFFFFFFC);
|
|
else BLTZ();
|
|
}
|
|
else BLTZ();
|
|
}
|
|
|
|
void BGEZ()
|
|
{
|
|
local_rs = irs;
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if (local_rs >= 0 && !skip_jump)
|
|
PC += (PC-2)->f.i.immediate - 1;
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BGEZ_OUT()
|
|
{
|
|
local_rs = irs;
|
|
jump_target = (int)PC->f.i.immediate;
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if (!skip_jump && local_rs >= 0)
|
|
jump_to(PC->addr + ((jump_target-1)<<2));
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BGEZ_IDLE()
|
|
{
|
|
int skip;
|
|
if (irs >= 0)
|
|
{
|
|
update_count();
|
|
skip = next_interupt - Count;
|
|
if (skip > 3) Count += (skip & 0xFFFFFFFC);
|
|
else BGEZ();
|
|
}
|
|
else BGEZ();
|
|
}
|
|
|
|
void BLTZL()
|
|
{
|
|
if (irs < 0)
|
|
{
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if(!skip_jump)
|
|
PC += (PC-2)->f.i.immediate-1;
|
|
}
|
|
else
|
|
PC+=2;
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BLTZL_OUT()
|
|
{
|
|
if (irs < 0)
|
|
{
|
|
jump_target = (int)PC->f.i.immediate;
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if (!skip_jump)
|
|
jump_to(PC->addr + ((jump_target-1)<<2));
|
|
}
|
|
else
|
|
PC+=2;
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BLTZL_IDLE()
|
|
{
|
|
int skip;
|
|
if (irs < 0)
|
|
{
|
|
update_count();
|
|
skip = next_interupt - Count;
|
|
if (skip > 3) Count += (skip & 0xFFFFFFFC);
|
|
else BLTZL();
|
|
}
|
|
else BLTZL();
|
|
}
|
|
|
|
void BGEZL()
|
|
{
|
|
if (irs >= 0)
|
|
{
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if(!skip_jump)
|
|
PC += (PC-2)->f.i.immediate-1;
|
|
}
|
|
else
|
|
PC+=2;
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BGEZL_OUT()
|
|
{
|
|
if (irs >= 0)
|
|
{
|
|
jump_target = (int)PC->f.i.immediate;
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if (!skip_jump)
|
|
jump_to(PC->addr + ((jump_target-1)<<2));
|
|
}
|
|
else
|
|
PC+=2;
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BGEZL_IDLE()
|
|
{
|
|
int skip;
|
|
if (irs >= 0)
|
|
{
|
|
update_count();
|
|
skip = next_interupt - Count;
|
|
if (skip > 3) Count += (skip & 0xFFFFFFFC);
|
|
else BGEZL();
|
|
}
|
|
else BGEZL();
|
|
}
|
|
|
|
void BLTZAL()
|
|
{
|
|
local_rs = irs;
|
|
reg[31]=PC->addr+8;
|
|
if((&irs)!=(reg+31))
|
|
{
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if(local_rs < 0 && !skip_jump)
|
|
PC += (PC-2)->f.i.immediate-1;
|
|
}
|
|
else printf("erreur dans bltzal\n");
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BLTZAL_OUT()
|
|
{
|
|
local_rs = irs;
|
|
reg[31]=PC->addr+8;
|
|
if((&irs)!=(reg+31))
|
|
{
|
|
jump_target = (int)PC->f.i.immediate;
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if(!skip_jump && local_rs < 0)
|
|
jump_to(PC->addr + ((jump_target-1)<<2));
|
|
}
|
|
else printf("erreur dans bltzal\n");
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BLTZAL_IDLE()
|
|
{
|
|
int skip;
|
|
if (irs < 0)
|
|
{
|
|
update_count();
|
|
skip = next_interupt - Count;
|
|
if (skip > 3) Count += (skip & 0xFFFFFFFC);
|
|
else BLTZAL();
|
|
}
|
|
else BLTZAL();
|
|
}
|
|
|
|
void BGEZAL()
|
|
{
|
|
local_rs = irs;
|
|
reg[31]=PC->addr+8;
|
|
if((&irs)!=(reg+31))
|
|
{
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if(local_rs >= 0 && !skip_jump)
|
|
PC += (PC-2)->f.i.immediate-1;
|
|
}
|
|
else printf("erreur dans bgezal\n");
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BGEZAL_OUT()
|
|
{
|
|
local_rs = irs;
|
|
reg[31]=PC->addr+8;
|
|
if((&irs)!=(reg+31))
|
|
{
|
|
jump_target = (int)PC->f.i.immediate;
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if(!skip_jump && local_rs >= 0)
|
|
jump_to(PC->addr + ((jump_target-1)<<2));
|
|
}
|
|
else printf("erreur dans bgezal\n");
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BGEZAL_IDLE()
|
|
{
|
|
int skip;
|
|
if (irs >=0)
|
|
{
|
|
update_count();
|
|
skip = next_interupt - Count;
|
|
if (skip > 3) Count += (skip & 0xFFFFFFFC);
|
|
else BGEZAL();
|
|
}
|
|
else BGEZAL();
|
|
}
|
|
|
|
void BLTZALL()
|
|
{
|
|
local_rs = irs;
|
|
reg[31]=PC->addr+8;
|
|
if((&irs)!=(reg+31))
|
|
{
|
|
if (local_rs < 0)
|
|
{
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if(!skip_jump)
|
|
PC += (PC-2)->f.i.immediate-1;
|
|
}
|
|
else
|
|
PC+=2;
|
|
}
|
|
else printf("erreur dans bltzall\n");
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BLTZALL_OUT()
|
|
{
|
|
local_rs = irs;
|
|
reg[31]=PC->addr+8;
|
|
if((&irs)!=(reg+31))
|
|
{
|
|
if (local_rs < 0)
|
|
{
|
|
jump_target = (int)PC->f.i.immediate;
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if (!skip_jump)
|
|
jump_to(PC->addr + ((jump_target-1)<<2));
|
|
}
|
|
else
|
|
PC+=2;
|
|
}
|
|
else printf("erreur dans bltzall\n");
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BLTZALL_IDLE()
|
|
{
|
|
int skip;
|
|
if (irs < 0)
|
|
{
|
|
update_count();
|
|
skip = next_interupt - Count;
|
|
if (skip > 3) Count += (skip & 0xFFFFFFFC);
|
|
else BLTZALL();
|
|
}
|
|
else BLTZALL();
|
|
}
|
|
|
|
void BGEZALL()
|
|
{
|
|
local_rs = irs;
|
|
reg[31]=PC->addr+8;
|
|
if((&irs)!=(reg+31))
|
|
{
|
|
if (local_rs >= 0)
|
|
{
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if(!skip_jump)
|
|
PC += (PC-2)->f.i.immediate-1;
|
|
}
|
|
else
|
|
PC+=2;
|
|
}
|
|
else printf("erreur dans bgezall\n");
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BGEZALL_OUT()
|
|
{
|
|
local_rs = irs;
|
|
reg[31]=PC->addr+8;
|
|
if((&irs)!=(reg+31))
|
|
{
|
|
if (local_rs >= 0)
|
|
{
|
|
jump_target = (int)PC->f.i.immediate;
|
|
PC++;
|
|
delay_slot=1;
|
|
PC->ops();
|
|
update_count();
|
|
delay_slot=0;
|
|
if (!skip_jump)
|
|
jump_to(PC->addr + ((jump_target-1)<<2));
|
|
}
|
|
else
|
|
PC+=2;
|
|
}
|
|
else printf("erreur dans bgezall\n");
|
|
last_addr = PC->addr;
|
|
if (next_interupt <= Count) gen_interupt();
|
|
}
|
|
|
|
void BGEZALL_IDLE()
|
|
{
|
|
int skip;
|
|
if (irs >= 0)
|
|
{
|
|
update_count();
|
|
skip = next_interupt - Count;
|
|
if (skip > 3) Count += (skip & 0xFFFFFFFC);
|
|
else BGEZALL();
|
|
}
|
|
else BGEZALL();
|
|
}
|
|
|