X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=source%2Fmupen64plus-core%2Fsrc%2Fr4300%2Freset.c;fp=source%2Fmupen64plus-core%2Fsrc%2Fr4300%2Freset.c;h=9192d9e9d9befdf136096c770ee56a94e07e9d91;hb=451ab91e3827a6384981b3300e2a7000d2eaba58;hp=0000000000000000000000000000000000000000;hpb=a2ab25365b5b0dddbee476d695d8a31151407581;p=mupen64plus-pandora.git diff --git a/source/mupen64plus-core/src/r4300/reset.c b/source/mupen64plus-core/src/r4300/reset.c new file mode 100644 index 0000000..9192d9e --- /dev/null +++ b/source/mupen64plus-core/src/r4300/reset.c @@ -0,0 +1,59 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Mupen64plus - reset.c * + * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * + * Copyright (C) 2011 CasualJames * + * Copyright (C) 2008-2009 Richard Goedeken * + * Copyright (C) 2008 Ebenblues Nmn Okaygo Tillin9 * + * Hard reset based on code by 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/reset.h" +#include "r4300/r4300.h" +#include "r4300/interupt.h" +#include "memory/memory.h" + +int reset_hard_job = 0; + +void reset_hard(void) +{ + init_memory(0); + r4300_reset_hard(); + r4300_reset_soft(); + last_addr = 0xa4000040; + next_interupt = 624999; + init_interupt(); + if(r4300emu != CORE_PURE_INTERPRETER) + { + /* TODO + * The following code *should* work and avoid free_blocks() and init_blocks(), + * but it doesn't unless the last line is added (which causes a memory leak). + int i; + for (i=0; i<0x100000; i++) + invalid_code[i] = 1; + blocks[0xa4000000>>12]->block = NULL; */ + free_blocks(); + init_blocks(); + } + generic_jump_to(last_addr); +} + +void reset_soft(void) +{ + add_interupt_event(HW2_INT, 0); /* Hardware 2 Interrupt immediately */ + add_interupt_event(NMI_INT, 50000000); /* Non maskable Interrupt after 1/2 second */ +}