diff options
author | Twinaphex | 2017-01-15 09:16:59 +0100 |
---|---|---|
committer | GitHub | 2017-01-15 09:16:59 +0100 |
commit | 0e8ec6b5f7ab59ad13970536c76e2c8c52a23965 (patch) | |
tree | 87330b0cb53dd4302071999a312c712672466550 | |
parent | a25a25f9a1327a996fe4ff37d3bfb7e3c15d174e (diff) | |
parent | f1ca19db63461fd36a5739b0b7bd172185811d50 (diff) | |
download | snesemu-0e8ec6b5f7ab59ad13970536c76e2c8c52a23965.tar.gz snesemu-0e8ec6b5f7ab59ad13970536c76e2c8c52a23965.tar.bz2 snesemu-0e8ec6b5f7ab59ad13970536c76e2c8c52a23965.zip |
Merge pull request #23 from jamsilva/master
Cleanups, fixes (including one for "Retroarch/RetroPie Super Mario Allstars")
82 files changed, 570 insertions, 9074 deletions
@@ -1,6 +1,6 @@ -CATSFC version 1.36, 2013-06-16
+snes9x2005 libretro core.
-A Super Nintendo emulator for the Supercard DSTWO.
+A Super Nintendo emulator core using the libretro API.
Based on:
* Snes9x 1.43, by the Snes9x team (with research by the ZSNES folks, anomie,
@@ -8,207 +8,3 @@ Based on: * NDSSFC 1.06, by the Supercard team (porting to the MIPS processor)
* BAGSFC, by BassAceGold (improving over NDSSFC)
* CATSFC, by ShadauxCat and Nebuleon (improving over BAGSFC)
-
-Contains:
-* Language files written by the GBAtemp community: Dutch by Aeter, French
- by Nebuleon, German by SignZ, Portuguese (Brazilian) by Diego Liberal,
- Spanish by Boriar
-* Language files written by GitHub users: Italian by alexinfurs
-
-# Installing
-
-(If you got the source code and want to compile it, see the `Compiling` section
- at the end of the file.)
-
-To install the plugin to your storage card, copy `catsfc.plg`, `catsfc.ini` and
-`catsfc.bmp` from the release archive to the card's `_dstwoplug` directory.
-Then, copy the `CATSFC` subdirectory to the root of the card.
-
-# Cheats
-
-The format accepted by the "Load a cheat file" function is equivalent to the
-old format used in Mightymo's BSNES Cheat Code Pack.
-
-1. Download the BSNES Cheat Code Pack at
- <http://www.mightymo.net/downloads.html>. It will be a zip archive.
-2. Open the zip file, with WinZip, WinRAR or the built-in zip extension in
- the operating system on your computer.
-3. In the zip file, open the folder called *BSNES Cheat Code Pack*, then
- the one called *BSNES v0.51-0.74 Cheat Code Pack*.
-4. Open your storage card's CATSFC folder, then descend into gamecht.
-5. Drag the cheat code files from the zip archive to the card's gamecht
- folder.
-
-To add cheats to the menu in a game, first load the game, then use the Cheats
-menu's "Load a cheat file" option.
-
-# Frame skipping
-
-In the Video & audio menu, the **Frame skipping** option allows you to select
-a number of frames to skip between rendered frames.
-
-As of version 1.29, the default is - (Keep up with the game). For most games,
-this setting keeps video and audio fluid, without the sudden slowdowns of
-previous versions when many sprites fill the screen. The DS controller buttons
-are also responsive at this setting.
-
-For some games, you may need to adjust frame skipping.
-* If a game runs at 5 frames per second, like *Yoshi's Island*,
- *Kirby Super Star*, *Star Fox* or *Super Mario RPG*, setting frame skipping
- to 1 will allow you to jump, move or shoot at the right times.
-* If you want to show more frames per second in a game that already shows 20,
- setting frame skipping to 1 or 0 will cause more frames to appear,
- but your DS button input may stop responding for 2 entire seconds every so
- often. The audio may also be stretched. (This is similar to NDSGBA.)
-* Setting this to 10 will skip 10 frames and render one, but this will
- severely desynchronise the audio. You will also find yourself unable to
- perform actions during the correct frame with the DS buttons. It is advised
- to set frame skipping to the lowest value with which you can play a game.
-
-# Fluidity
-
-Fluidity is an option you can find under the Video & audio menu in a game.
-By default, video fluidity is preferred over audio fluidity in games.
-
-* Preferring video fluidity makes audio skip certain notes, up to
- 23 milliseconds, in order to render more video. In many games, this
- difference is not audible, but you may hear certain audio glitches if a game
- depends highly on timing for its audio.
- Use this option if you want to play games that require fluid imagery more
- than precise audio emulation. You can also use this option when watching game
- introductions, endings and cutscenes.
-* Preferring audio fluidity makes video skip certain images, up to
- 46 milliseconds, in order to render audio closer to 32,000 times per second.
- Use this option if you want to play games mainly for their soundtracks, or in
- a game's sound test mode. You can also use this option to experiment with the
- green berry glitch in Super Mario World that makes TIME go over and under 100
- units constantly and makes the music play very fast.
-
-# Hotkeys
-
-You can set buttons to press to perform certain actions. For each action,
-there is a *global hotkey* and a *game-specific override hotkey*. You might,
-for example, want to have the R button bound to Temporary fast-forward, but
-a specific game uses R for something important. In that case, you can set the
-global hotkey to R and make an override with X for that game.
-
-Hotkeys are sent to the current game as well as to their corresponding action.
-The criterion for a hotkey is met when **at least** all of its buttons are
-held. Additional keys are sent to the game and can trigger another hotkey.
-For example, setting a hotkey to L and another to R+X, then pressing L+R+X+Y
-will trigger both and send L+R+X+Y to the game.
-
-Available actions are:
-* Go to main menu. In addition to tapping the Touch Screen to return to
- the main menu, you can set a hotkey to do the same.
-* Temporary fast-forward. While this hotkey is held, the fast-forward option
- will be forced on.
-* Toggle sound. Each time this hotkey is held, the sound will be disabled if
- it's currently enabled, and vice-versa.
-* Save state #1. Each time this hotkey is held, saved state #1 will be written,
- without confirmation if it exists.
-* Load state #1. Each time this hotkey is held, saved state #1 will be loaded.
-* Toggle full-screen. Each time this hotkey is held:
- * If the current display mode *is* a full-screen mode, then the display mode
- is set to 3 (Middle, square pixels) and the top and bottom will be cut off.
- * If the current display mode *is not* a full-screen mode, then the display
- mode is set to 4 (Entire screen, smoothed).
-
-# The font
-
-The font used by CATSFC is similar to the Pictochat font. To modify it,
-see `source/font/README.txt`.
-
-# Translations
-
-Translations for CATSFC may be submitted to the author(s) under many forms,
-one of which is the Github pull request. To complete a translation, you will
-need to do the following:
-
-* Open `CATSFC/system/language.msg`.
-* Copy what's between `STARTENGLISH` and `ENDENGLISH` and paste it at the end
- of the file.
-* Change the tags. For example, if you want to translate to Japanese, the tags
- will become `STARTJAPANESE` and `ENDJAPANESE`.
-* Translate each of the messages, using the lines starting with `#MSG_` as a
- guide to the context in which the messages will be used.
-
-If you are not comfortable editing C code, or cannot compile CATSFC after your
-changes, you may instead test your translation in the English block and submit
-it. That allows you to look for message length issues and to align the option
-names and values to your liking with spaces.
-
-If you wish to also hook your language into the user interface, you will need
-to do the following:
-
-* Edit `source/nds/message.h`. Find `enum LANGUAGE` and add the name of your
- language there. For the example of Japanese, you would add this at the end of
- the list:
- ```
- ,
- JAPANESE
- ```
-* Still in `source/nds/message.h`, just below `enum LANGUAGE`, you will find
- `extern char* lang[` *some number* `]`. Add 1 to that number.
-* Edit `source/nds/gui.c`. Find `char *lang[` *some number* `] =`.
- Add the name of your language, in the language itself. For the example of
- Japanese, you would add this at the end of the list:
- ```
- ,
- "日本語"
- ```
-* Still in `source/nds/gui.c`, find `char* language_options[]`, which is below
- the language names. Add an entry similar to the others, with the last number
- plus 1. For example, if the last entry is `, (char *) &lang[7]`, yours would
- be `, (char *) &lang[8]`.
-* Still in `source/nds/gui.c`, find `case CHINESE_SIMPLIFIED`. Copy the lines
- starting at the `case` and ending with `break`, inclusively. Paste them
- before the `}`. Change the language name and tags. For the example of
- Japanese, you would use:
- ```
- case JAPANESE:
- strcpy(start, "STARTJAPANESE");
- strcpy(end, "ENDJAPANESE");
- break;
- ```
-
-Compile again, copy the plugin and your new `language.msg` to your card
-under `CATSFC/system`, and you can now select your new language in CATSFC!
-
-# Compiling
-
-Compiling CATSFC is best done on Linux. Make sure you have access to a Linux
-system to perform these steps.
-
-## The DS2 SDK
-To compile CATSFC, you need to have the Supercard team's DS2 SDK.
-The Makefile expects it at `/opt/ds2sdk`, but you can move it anywhere,
-provided that you update the Makefile's `DS2SDKPATH` variable to point to it.
-
-For best results, download version 0.13 of the DS2 SDK, which will have the
-MIPS compiler (`gcc`), extract it to `/opt/ds2sdk`, follow the instructions,
-then download version 1.2 of the DS2 SDK and extract its files into
-`opt/ds2sdk`, overwriting version 0.13.
-
-Additionally, you will need to add the updated `zlib`, DMA
-(Direct Memory Access) and filesystem access routines provided by BassAceGold
-and recompile `libds2a.a`. To do this:
-
-> sudo rm -r /opt/ds2sdk/libsrc/{console,core,fs,key,zlib,Makefile} /opt/ds2sdk/include
-> sudo cp -r sdk-modifications/{libsrc,include} /opt/ds2sdk
-> sudo chmod -R 600 /opt/ds2sdk/{libsrc,include}
-> sudo chmod -R a+rX /opt/ds2sdk/{libsrc,include}
-> cd /opt/ds2sdk/libsrc
-> sudo rm libds2a.a ../lib/libds2a.a
-> sudo make
-
-## The MIPS compiler (`gcc`)
-You also need the MIPS compiler from the DS2 SDK.
-The Makefile expects it at `/opt/mipsel-4.1.2-nopic`, but you can move it
-anywhere, provided that you update the Makefile's `CROSS` variable to point to
-it.
-
-## Making the plugin
-To make the plugin, `catsfc.plg`, use the `cd` command to change to the
-directory containing your copy of the CATSFC source, then type
-`make clean; make`. `catsfc.plg` should appear in the same directory.
@@ -1,3 +1,24 @@ +/*
+
+Copyright (C) 2010-2017 The RetroArch team
+
+Permission is hereby granted, free of charge,
+to any person obtaining a copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+- - - Ported from - - -
+
ndssfc
Copyright (C) 2010 dking <dking024@gmail.com>,
GBAtemp users BassAceGold, ShadauxCat and Nebuleon
@@ -21,69 +42,168 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - - Based on - - -
-Snes9x 1.43 (c) contributors; see a list in any source file under source/.
+Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
+
+(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
+ Jerremy Koot (jkoot@snes9x.com)
+
+(c) Copyright 2002 - 2004 Matthew Kendora
+
+(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
+
+(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
+
+(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
+
+(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
+ Kris Bleakley (codeviolation@hotmail.com)
+
+(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
+ Nach (n-a-c-h@users.sourceforge.net),
+ zones (kasumitokoduck@yahoo.com)
+
+(c) Copyright 2006 - 2007 nitsuja
+
+(c) Copyright 2009 - 2010 BearOso,
+ OV2
-Permission to use, copy, modify and distribute Snes9x in both binary and
-source form, for non-commercial purposes, is hereby granted without fee,
-providing that this license information and copyright notice appear with
-all copies and any derived work.
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event shall the authors be held liable for any damages
-arising from the use of this software.
-
-Snes9x is freeware for PERSONAL USE only. Commercial users should
-seek permission of the copyright holders first. Commercial use includes
-charging money for Snes9x or software derived from Snes9x.
-
-The copyright holders request that bug fixes and improvements to the code
-should be forwarded to them so everyone can benefit from the modifications
-in future versions.
-- - - Using icons - - -
+BS-X C emulator code
+(c) Copyright 2005 - 2006 Dreamer Nom,
+ zones
-SNES controller icon from the Gaming Icons Pack by deviantART user deleket.
+C4 x86 assembler and some C emulation code
+(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
+ Nach,
+ zsKnight (zsknight@zsnes.com)
-Some rights reserved. This work is licensed under a Creative Commons
-Attribution-Noncommercial-No Derivative Works 3.0 License.
+C4 C++ code
+(c) Copyright 2003 - 2006 Brad Jorsch,
+ Nach
-See it here: http://deleket.deviantart.com/art/Gaming-Icons-Pack-42723812
+DSP-1 emulator code
+(c) Copyright 1998 - 2006 _Demo_,
+ Andreas Naive (andreasnaive@gmail.com),
+ Gary Henderson,
+ Ivar (ivar@snes9x.com),
+ John Weidman,
+ Kris Bleakley,
+ Matthew Kendora,
+ Nach,
+ neviksti (neviksti@hotmail.com)
-The full text of the license is found here:
-http://creativecommons.org/licenses/by-nc-nd/3.0/
+DSP-2 emulator code
+(c) Copyright 2003 John Weidman,
+ Kris Bleakley,
+ Lord Nightmare (lord_nightmare@users.sourceforge.net),
+ Matthew Kendora,
+ neviksti
-----
+DSP-3 emulator code
+(c) Copyright 2003 - 2006 John Weidman,
+ Kris Bleakley,
+ Lancer,
+ z80 gaiden
-sbutto.svg, smaini.svg, smnsel.svg, smsel.svg, smsgfr.svg, snmaini.svg,
- stitle.svg, subsela.svg:
+DSP-4 emulator code
+(c) Copyright 2004 - 2006 Dreamer Nom,
+ John Weidman,
+ Kris Bleakley,
+ Nach,
+ z80 gaiden
-Created by GBAtemp user Nebuleon.
+OBC1 emulator code
+(c) Copyright 2001 - 2004 zsKnight,
+ pagefault (pagefault@zsnes.com),
+ Kris Bleakley
+ Ported from x86 assembler to C by sanmaiwashi
-Some rights reserved. This work is licensed under a Creative Commons
-Attribution-ShareAlike 3.0 license.
+SPC7110 and RTC C++ emulator code used in 1.39-1.51
+(c) Copyright 2002 Matthew Kendora with research by
+ zsKnight,
+ John Weidman,
+ Dark Force
-The full text of the license is found here:
-http://creativecommons.org/licenses/by-sa/3.0/
+SPC7110 and RTC C++ emulator code used in 1.52+
+(c) Copyright 2009 byuu,
+ neviksti
-----
+S-DD1 C emulator code
+(c) Copyright 2003 Brad Jorsch with research by
+ Andreas Naive,
+ John Weidman
-applications-system.svg, media-flash.svg, system-log-out.svg:
+S-RTC C emulator code
+(c) Copyright 2001 - 2006 byuu,
+ John Weidman
-Created by artists for the Tango Icon Project.
+ST010 C++ emulator code
+(c) Copyright 2003 Feather,
+ John Weidman,
+ Kris Bleakley,
+ Matthew Kendora
+
+Super FX x86 assembler emulator code
+(c) Copyright 1998 - 2003 _Demo_,
+ pagefault,
+ zsKnight
+
+Super FX C emulator code
+(c) Copyright 1997 - 1999 Ivar,
+ Gary Henderson,
+ John Weidman
+
+Sound emulator code used in 1.5-1.51
+(c) Copyright 1998 - 2003 Brad Martin
+(c) Copyright 1998 - 2006 Charles Bilyue'
+
+Sound emulator code used in 1.52+
+(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
+
+(c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE
+WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY)
+
+Snes9x homepage: http://www.snes9x.com/
+
+Permission to use, copy, modify and/or distribute Snes9x in both binary
+and source form, for non-commercial purposes, is hereby granted without
+fee, providing that this license information and copyright notice appear
+with all copies and any derived work.
-This work is in the public domain.
+This software is provided 'as-is', without any express or implied
+warranty. In no event shall the authors be held liable for any damages
+arising from the use of this software or it's derivatives.
+
+Snes9x is freeware for PERSONAL USE only. Commercial users should
+seek permission of the copyright holders first. Commercial use includes,
+but is not limited to, charging money for Snes9x or software derived from
+Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
+using Snes9x as a promotion for your commercial product.
+
+The copyright holders request that bug fixes and improvements to the code
+should be forwarded to them so everyone can benefit from the modifications
+in future versions.
-----
+Super NES and Super Nintendo Entertainment System are trademarks of
+Nintendo Co., Limited and its subsidiary companies.
-key.svg, manage.svg, slide-audio.svg:
+- - - Also includes code by - - -
-Part of the RRZE Icon Set, (c) 2010 Regional Computing Centre of Erlangen
-(RRZE).
+Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
-Get it here: http://rrze-icon-set.berlios.de/download.html
+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.
-Some rights reserved. This work is licensed under a Creative Commons
-Attribution-ShareAlike 3.0 license.
+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., 675 Mass Ave, Cambridge, MA 02139, USA.
-The full text of the license is found here:
-http://creativecommons.org/licenses/by-sa/3.0/
\ No newline at end of file +*/
@@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "copyright" #include <stdio.h> @@ -284,7 +195,10 @@ void _makepath(char* path, const char* drive, const char* dir, } else *path = 0; - strcat(path, fname); + + if (fname) + strcat(path, fname); + if (ext && *ext) { strcat(path, "."); @@ -411,7 +325,6 @@ void retro_init(void) struct retro_log_callback log; enum retro_pixel_format rgb565; static const struct retro_variable vars[] = { - { "catsfc_SwapJoypads", "Swap Joypads; disabled|enabled" }, { "catsfc_VideoMode", "Video Mode; auto|NTSC|PAL" }, { NULL, NULL }, }; @@ -499,11 +412,6 @@ static void check_variables(void) { struct retro_variable var; - var.key = "catsfc_SwapJoypads"; - var.value = NULL; - if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) - Settings.SwapJoypads = strcmp(var.value, "disabled"); - var.key = "catsfc_VideoMode"; var.value = NULL; if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) @@ -804,7 +712,6 @@ bool retro_serialize(void* data, size_t size) memcpy(buffer, &s7r, sizeof(s7r)); buffer += sizeof(s7r); memcpy(buffer, &rtc_f9, sizeof(rtc_f9)); - buffer += sizeof(rtc_f9); return true; } @@ -859,7 +766,6 @@ bool retro_unserialize(const void* data, size_t size) memcpy(&s7r, buffer, sizeof(s7r)); buffer += sizeof(s7r); memcpy(&rtc_f9, buffer, sizeof(rtc_f9)); - buffer += sizeof(rtc_f9); S9xFixSA1AfterSnapshotLoad(); FixROMSpeed(); @@ -1,24 +1,4 @@ -/* Copyright (C) 2010-2014 The RetroArch team - * - * --------------------------------------------------------------------------------------- - * The following license statement only applies to this libretro API header (libretro.h). - * --------------------------------------------------------------------------------------- - * - * Permission is hereby granted, free of charge, - * to any person obtaining a copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +#include "copyright" #ifndef LIBRETRO_H__ #define LIBRETRO_H__ diff --git a/source/65c816.h b/source/65c816.h index be75e3e..5b6184f 100644 --- a/source/65c816.h +++ b/source/65c816.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _65c816_h_ #define _65c816_h_ diff --git a/source/apu.c b/source/apu.c index 81d3688..91453e6 100644 --- a/source/apu.c +++ b/source/apu.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef USE_BLARGG_APU @@ -127,7 +38,6 @@ uint8_t APUROM [64]; void S9xResetAPU() { - int i, j; Settings.APUEnabled = Settings.NextAPUEnabled; @@ -275,7 +185,6 @@ void S9xSetAPUDSP(uint8_t byte) break; case APU_KOFF: - // if (byte) { int c; uint8_t mask = 1; @@ -289,7 +198,6 @@ void S9xSetAPUDSP(uint8_t byte) KeyOnPrev &= ~mask; APU.KeyedChannels &= ~mask; APU.DSP [APU_KON] &= ~mask; - //APU.DSP [APU_KOFF] |= mask; S9xSetSoundKeyOff(c); } } @@ -298,14 +206,12 @@ void S9xSetAPUDSP(uint8_t byte) { KeyOnPrev &= ~mask; APU.KeyedChannels |= mask; - //APU.DSP [APU_KON] |= mask; APU.DSP [APU_KOFF] &= ~mask; APU.DSP [APU_ENDX] &= ~mask; S9xPlaySample(c); } } } - //KeyOnPrev=0; APU.DSP [APU_KOFF] = byte; return; case APU_KON: @@ -323,8 +229,6 @@ void S9xSetAPUDSP(uint8_t byte) { KeyOnPrev &= ~mask; APU.KeyedChannels |= mask; - //APU.DSP [APU_KON] |= mask; - //APU.DSP [APU_KOFF] &= ~mask; APU.DSP [APU_ENDX] &= ~mask; S9xPlaySample(c); } @@ -342,8 +246,6 @@ void S9xSetAPUDSP(uint8_t byte) case APU_VOL_LEFT + 0x50: case APU_VOL_LEFT + 0x60: case APU_VOL_LEFT + 0x70: - // At Shin Megami Tensei suggestion 6/11/00 - // if (byte != APU.DSP [reg]) { S9xSetSoundVolume(reg >> 4, (signed char) byte, (signed char) APU.DSP [reg + 1]); @@ -357,8 +259,6 @@ void S9xSetAPUDSP(uint8_t byte) case APU_VOL_RIGHT + 0x50: case APU_VOL_RIGHT + 0x60: case APU_VOL_RIGHT + 0x70: - // At Shin Megami Tensei suggestion 6/11/00 - // if (byte != APU.DSP [reg]) { S9xSetSoundVolume(reg >> 4, (signed char) APU.DSP [reg - 1], (signed char) byte); @@ -374,7 +274,7 @@ void S9xSetAPUDSP(uint8_t byte) case APU_P_LOW + 0x60: case APU_P_LOW + 0x70: S9xSetSoundHertz(reg >> 4, - ((byte + (APU.DSP [reg + 1] << 8)) & FREQUENCY_MASK) * 8); + (((byte + (APU.DSP [reg + 1] << 8)) & FREQUENCY_MASK) * 32000) >> 12); break; case APU_P_HIGH + 0x00: @@ -397,8 +297,6 @@ void S9xSetAPUDSP(uint8_t byte) case APU_SRCN + 0x50: case APU_SRCN + 0x60: case APU_SRCN + 0x70: - if (byte != APU.DSP [reg]) - S9xSetSoundSample(reg >> 4, byte); break; case APU_ADSR1 + 0x00: @@ -507,8 +405,6 @@ void S9xSetAPUDSP(uint8_t byte) S9xSetFilterCoefficient(reg >> 4, (signed char) byte); break; default: - // XXX - //printf ("Write %02x to unknown APU register %02x\n", byte, reg); break; } @@ -613,8 +509,6 @@ void S9xFixEnvelope(int channel, uint8_t gain, uint8_t adsr1, uint8_t adsr2) void S9xSetAPUControl(uint8_t byte) { - //if (byte & 0x40) - //printf ("*** Special SPC700 timing enabled\n"); if ((byte & 1) != 0 && !APU.TimerEnabled [0]) { APU.Timer [0] = 0; @@ -725,11 +619,9 @@ uint8_t S9xGetAPUDSP() case APU_ENVX + 0x50: case APU_ENVX + 0x60: case APU_ENVX + 0x70: - return ((uint8_t) S9xGetEnvelopeHeight(reg >> 4)); + return 0; case APU_ENDX: - // To fix speech in Magical Drop 2 6/11/00 - // APU.DSP [APU_ENDX] = 0; break; default: break; diff --git a/source/apu.h b/source/apu.h index b09f3c4..d5cdc78 100644 --- a/source/apu.h +++ b/source/apu.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef USE_BLARGG_APU @@ -218,44 +129,5 @@ extern void (*S9xApuOpcodes [256])(void); #define APU_EXECUTE1() do{}while(0) #define APU_EXECUTE() do{}while(0) -//typedef struct -//{ -// uint8_t* PC; -// SAPURegisters Registers; -// uint8_t* RAM; -// uint8_t* DirectPage; -// bool APUExecuting; -// uint8_t Bit; -// uint32_t Address; -// uint8_t* WaitAddress1; -// uint8_t* WaitAddress2; -// uint32_t WaitCounter; -// uint8_t _Carry; -// uint8_t _Zero; -// uint8_t _Overflow; -// uint32_t TimerErrorCounter; -// uint32_t Scanline; -// int32_t OneCycle; -// int32_t TwoCycles; -//} SIAPU; - -//typedef struct -//{ -// int32_t Cycles; -// bool ShowROM; -// uint8_t Flags; -// uint8_t KeyedChannels; -// uint8_t OutPorts [4]; -// uint8_t DSP [0x80]; -// uint8_t ExtraRAM [64]; -// uint16_t Timer [3]; -// uint16_t TimerTarget [3]; -// bool TimerEnabled [3]; -// bool TimerValueWritten [3]; -//} SAPU; - -//SAPU APU; -//SIAPU IAPU; - #endif diff --git a/source/apu_blargg.c b/source/apu_blargg.c index 5c1bc1e..b6188bc 100644 --- a/source/apu_blargg.c +++ b/source/apu_blargg.c @@ -1,181 +1,5 @@ -/*********************************************************************************** - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com), - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2002 - 2004 Matthew Kendora - - (c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org) - - (c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/) - - (c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca), - Kris Bleakley (codeviolation@hotmail.com) - - (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), - Nach (n-a-c-h@users.sourceforge.net), - zones (kasumitokoduck@yahoo.com) - - (c) Copyright 2006 - 2007 nitsuja - - (c) Copyright 2009 - 2010 BearOso, - OV2 - - - BS-X C emulator code - (c) Copyright 2005 - 2006 Dreamer Nom, - zones - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com), - Nach, - zsKnight (zsknight@zsnes.com) - - C4 C++ code - (c) Copyright 2003 - 2006 Brad Jorsch, - Nach - - DSP-1 emulator code - (c) Copyright 1998 - 2006 _Demo_, - Andreas Naive (andreasnaive@gmail.com), - Gary Henderson, - Ivar (ivar@snes9x.com), - John Weidman, - Kris Bleakley, - Matthew Kendora, - Nach, - neviksti (neviksti@hotmail.com) - - DSP-2 emulator code - (c) Copyright 2003 John Weidman, - Kris Bleakley, - Lord Nightmare (lord_nightmare@users.sourceforge.net), - Matthew Kendora, - neviksti - - DSP-3 emulator code - (c) Copyright 2003 - 2006 John Weidman, - Kris Bleakley, - Lancer, - z80 gaiden - - DSP-4 emulator code - (c) Copyright 2004 - 2006 Dreamer Nom, - John Weidman, - Kris Bleakley, - Nach, - z80 gaiden - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, - pagefault (pagefault@zsnes.com), - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code used in 1.39-1.51 - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, - John Weidman, - Dark Force - - SPC7110 and RTC C++ emulator code used in 1.52+ - (c) Copyright 2009 byuu, - neviksti - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive, - John Weidman +#include "../copyright" - S-RTC C emulator code - (c) Copyright 2001 - 2006 byuu, - John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, - John Weidman, - Kris Bleakley, - Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 _Demo_, - pagefault, - zsKnight - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, - Gary Henderson, - John Weidman - - Sound emulator code used in 1.5-1.51 - (c) Copyright 1998 - 2003 Brad Martin - (c) Copyright 1998 - 2006 Charles Bilyue' - - Sound emulator code used in 1.52+ - (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - 2xSaI filter - (c) Copyright 1999 - 2001 Derek Liauw Kie Fa - - HQ2x, HQ3x, HQ4x filters - (c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com) - - NTSC filter - (c) Copyright 2006 - 2007 Shay Green - - GTK+ GUI code - (c) Copyright 2004 - 2010 BearOso - - Win32 GUI code - (c) Copyright 2003 - 2006 blip, - funkyass, - Matthew Kendora, - Nach, - nitsuja - (c) Copyright 2009 - 2010 OV2 - - Mac OS GUI code - (c) Copyright 1998 - 2001 John Stiles - (c) Copyright 2001 - 2010 zones - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - - Specific ports contains the works of other authors. See headers in - individual files. - - - Snes9x homepage: http://www.snes9x.com/ - - Permission to use, copy, modify and/or distribute Snes9x in both binary - and source form, for non-commercial purposes, is hereby granted without - fee, providing that this license information and copyright notice appear - with all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software or it's derivatives. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes, - but is not limited to, charging money for Snes9x or software derived from - Snes9x, including Snes9x or derivatives in commercial game bundles, and/or - using Snes9x as a promotion for your commercial product. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. - ***********************************************************************************/ #ifdef USE_BLARGG_APU #include <math.h> @@ -196,7 +20,6 @@ #include "apu_blargg.h" #include "snes9x.h" -//#include "snapshot.h" #include "display.h" @@ -1461,7 +1284,6 @@ static INLINE void spc_dsp_write( int data, int time ) } break; } - /* dprintf( "SPC wrote to DSP register > $7F\n" ); */ } @@ -1503,8 +1325,6 @@ static void spc_cpu_write_smp_reg_( int data, int time, int addr ) case R_T0OUT: case R_T1OUT: case R_T2OUT: - /* dprintf( "SPC wrote to counter %d\n", (int) addr - R_T0OUT ); */ - if ( data < NO_READ_BEFORE_WRITE_DIVIDED_BY_TWO) { if ( (time - 1) >= m.timers[addr - R_T0OUT].next_time ) @@ -1521,10 +1341,6 @@ static void spc_cpu_write_smp_reg_( int data, int time, int addr ) break; case R_TEST: -#if 0 - if ( (uint8_t) data != 0x0A ) - dprintf( "SPC wrote to test register\n" ); -#endif break; case R_CONTROL: @@ -1863,7 +1679,6 @@ loop: m.smp_regs[0][i] = (uint8_t) data; /* Registers other than $F2 and $F4-$F7 */ - /* if ( i != 2 && i != 4 && i != 5 && i != 6 && i != 7 ) */ if ( ((~0x2F00 << (bits_in_int - 16)) << i) < 0 ) /* 12% */ { if ( i == R_DSPDATA ) /* 99% */ @@ -1992,7 +1807,6 @@ loop: temp = GET_LE16( pc ); pc += 2; READ_TIMER( 0, temp, y = nz ); - /* y = nz = SPC_CPU_READ( 0, temp ); */ goto loop; } @@ -2784,10 +2598,6 @@ out_of_time: stop: /* Uncache registers */ -#if 0 - if ( GET_PC() >= 0x10000 ) - dprintf( "SPC: PC wrapped around\n" ); -#endif m.cpu_regs.pc = (uint16_t) GET_PC(); m.cpu_regs.sp = ( uint8_t) GET_SP(); m.cpu_regs.a = ( uint8_t) a; @@ -3236,8 +3046,6 @@ static INLINE bool resampler_push(int16_t *src, int num_samples) static INLINE void resampler_resize (int num_samples) { - /* int size; */ - /* size = num_samples << 1; */ free(rb_buffer); rb_buffer_size = rb_size; rb_buffer = (unsigned char*)malloc(rb_buffer_size); diff --git a/source/apu_blargg.h b/source/apu_blargg.h index 53aec7b..6c44acc 100644 --- a/source/apu_blargg.h +++ b/source/apu_blargg.h @@ -1,180 +1,4 @@ -/*********************************************************************************** - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com), - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2002 - 2004 Matthew Kendora - - (c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org) - - (c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/) - - (c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca), - Kris Bleakley (codeviolation@hotmail.com) - - (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), - Nach (n-a-c-h@users.sourceforge.net), - zones (kasumitokoduck@yahoo.com) - - (c) Copyright 2006 - 2007 nitsuja - - (c) Copyright 2009 - 2010 BearOso, - OV2 - - - BS-X C emulator code - (c) Copyright 2005 - 2006 Dreamer Nom, - zones - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com), - Nach, - zsKnight (zsknight@zsnes.com) - - C4 C++ code - (c) Copyright 2003 - 2006 Brad Jorsch, - Nach - - DSP-1 emulator code - (c) Copyright 1998 - 2006 _Demo_, - Andreas Naive (andreasnaive@gmail.com), - Gary Henderson, - Ivar (ivar@snes9x.com), - John Weidman, - Kris Bleakley, - Matthew Kendora, - Nach, - neviksti (neviksti@hotmail.com) - - DSP-2 emulator code - (c) Copyright 2003 John Weidman, - Kris Bleakley, - Lord Nightmare (lord_nightmare@users.sourceforge.net), - Matthew Kendora, - neviksti - - DSP-3 emulator code - (c) Copyright 2003 - 2006 John Weidman, - Kris Bleakley, - Lancer, - z80 gaiden - - DSP-4 emulator code - (c) Copyright 2004 - 2006 Dreamer Nom, - John Weidman, - Kris Bleakley, - Nach, - z80 gaiden - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, - pagefault (pagefault@zsnes.com), - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code used in 1.39-1.51 - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, - John Weidman, - Dark Force - - SPC7110 and RTC C++ emulator code used in 1.52+ - (c) Copyright 2009 byuu, - neviksti - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive, - John Weidman - - S-RTC C emulator code - (c) Copyright 2001 - 2006 byuu, - John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, - John Weidman, - Kris Bleakley, - Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 _Demo_, - pagefault, - zsKnight - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, - Gary Henderson, - John Weidman - - Sound emulator code used in 1.5-1.51 - (c) Copyright 1998 - 2003 Brad Martin - (c) Copyright 1998 - 2006 Charles Bilyue' - - Sound emulator code used in 1.52+ - (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - 2xSaI filter - (c) Copyright 1999 - 2001 Derek Liauw Kie Fa - - HQ2x, HQ3x, HQ4x filters - (c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com) - - NTSC filter - (c) Copyright 2006 - 2007 Shay Green - - GTK+ GUI code - (c) Copyright 2004 - 2010 BearOso - - Win32 GUI code - (c) Copyright 2003 - 2006 blip, - funkyass, - Matthew Kendora, - Nach, - nitsuja - (c) Copyright 2009 - 2010 OV2 - - Mac OS GUI code - (c) Copyright 1998 - 2001 John Stiles - (c) Copyright 2001 - 2010 zones - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - - Snes9x homepage: http://www.snes9x.com/ - - Permission to use, copy, modify and/or distribute Snes9x in both binary - and source form, for non-commercial purposes, is hereby granted without - fee, providing that this license information and copyright notice appear - with all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software or it's derivatives. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes, - but is not limited to, charging money for Snes9x or software derived from - Snes9x, including Snes9x or derivatives in commercial game bundles, and/or - using Snes9x as a promotion for your commercial product. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. - ***********************************************************************************/ +#include "../copyright" #ifdef USE_BLARGG_APU diff --git a/source/apumem.h b/source/apumem.h index 459bbf1..c86b8c0 100644 --- a/source/apumem.h +++ b/source/apumem.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _apumemory_h_ #define _apumemory_h_ @@ -210,22 +121,6 @@ INLINE void S9xAPUSetByte(uint8_t byte, uint32_t Address) } else { -#if 0 - if (Address >= 0x2500 && Address <= 0x2504) - printf("%06d %04x <- %02x\n", ICPU.Scanline, Address, byte); - if (Address == 0x26c6) - { - extern FILE* apu_trace; - extern FILE* trace; - APU.Flags |= TRACE_FLAG; - CPU.Flags |= TRACE_FLAG; - if (apu_trace == NULL) - apu_trace = fopen("aputrace.log", "wb"); - if (trace == NULL) - trace = fopen("trace.log", "wb"); - printf("TRACING SWITCHED ON\n"); - } -#endif if (Address < 0xffc0) IAPU.RAM [Address] = byte; else diff --git a/source/blargg_endian.h b/source/blargg_endian.h index 15482b4..80ce61e 100644 --- a/source/blargg_endian.h +++ b/source/blargg_endian.h @@ -1,3 +1,5 @@ +#include "../copyright" + /* CPU Byte Order Utilities */ /* snes_spc 0.9.0 */ diff --git a/source/boolean.h b/source/boolean.h index 4d53907..d5dbdaf 100644 --- a/source/boolean.h +++ b/source/boolean.h @@ -1,24 +1,4 @@ -/* Copyright (C) 2010-2016 The RetroArch team - * - * --------------------------------------------------------------------------------------- - * The following license statement only applies to this file (boolean.h). - * --------------------------------------------------------------------------------------- - * - * Permission is hereby granted, free of charge, - * to any person obtaining a copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +#include "../copyright" #ifndef __LIBRETRO_SDK_BOOLEAN_H #define __LIBRETRO_SDK_BOOLEAN_H diff --git a/source/c4.c b/source/c4.c index 94f5866..163341b 100644 --- a/source/c4.c +++ b/source/c4.c @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #include <math.h> #include <stdlib.h> #include "c4.h" diff --git a/source/c4.h b/source/c4.h index 0320cbe..7834776 100644 --- a/source/c4.h +++ b/source/c4.h @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #ifndef _C4_H_ #define _C4_H_ diff --git a/source/c4emu.c b/source/c4emu.c index a319a98..6fce00f 100644 --- a/source/c4emu.c +++ b/source/c4emu.c @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -100,9 +12,6 @@ void S9xInitC4() { - // Stupid zsnes code, we can't do the logical thing without breaking - // savestates - // Memory.C4RAM = &Memory.FillRAM [0x6000]; memset(Memory.C4RAM, 0, 0x2000); } @@ -278,10 +187,6 @@ static void C4DoScaleRotate(int row_padding) uint8_t w = Memory.C4RAM[0x1f89] & ~7; uint8_t h = Memory.C4RAM[0x1f8c] & ~7; - // printf("%dx%d XScale=%04x YScale=%04x angle=%03x\n", w, h, XScale, YScale, READ_WORD(Memory.C4RAM+0x1f80)&0x1ff); - // printf("Matrix: [%10g %10g] [%04x %04x]\n", A/4096.0, B/4096.0, A&0xffff, B&0xffff); - // printf(" [%10g %10g] [%04x %04x]\n", C/4096.0, D/4096.0, C&0xffff, D&0xffff); - // Clear the output RAM memset(Memory.C4RAM, 0, (w + row_padding / 4)*h / 2); @@ -380,9 +285,8 @@ static void C4DrawLine(int32_t X1, int32_t Y1, int16_t Z1, //.loop if (X1 > 0xff && Y1 > 0xff && X1 < 0x6000 && Y1 < 0x6000) { - uint16_t addr = ((X1 & ~0x7ff) + (Y1 & ~0x7ff) * 12 + (Y1 & 0x700)) >> 7; - addr = (((Y1 >> 8) >> 3) << 8) - (((Y1 >> 8) >> 3) << 6) + ((( - X1 >> 8) >> 3) << 4) + ((Y1 >> 8) & 7) * 2; + uint16_t addr = (((Y1 >> 8) >> 3) << 8) - (((Y1 >> 8) >> 3) << 6) + ((( + X1 >> 8) >> 3) << 4) + ((Y1 >> 8) & 7) * 2; uint8_t bit = 0x80 >> ((X1 >> 8) & 7); Memory.C4RAM[addr + 0x300] &= ~bit; Memory.C4RAM[addr + 0x301] &= ~bit; @@ -787,9 +691,7 @@ void S9xSetC4(uint8_t byte, uint16_t Address) case 0x54: // Square { int64_t a = SAR64((int64_t)READ_3WORD(Memory.C4RAM + 0x1f80) << 40, 40); - // printf("%08X%08X\n", (uint32_t)(a>>32), (uint32_t)(a&0xFFFFFFFF)); a *= a; - // printf("%08X%08X\n", (uint32_t)(a>>32), (uint32_t)(a&0xFFFFFFFF)); WRITE_3WORD(Memory.C4RAM + 0x1f83, a); WRITE_3WORD(Memory.C4RAM + 0x1f86, (a >> 24)); } diff --git a/source/catsfc_griffin.c b/source/catsfc_griffin.c index e94c144..8b4666c 100644 --- a/source/catsfc_griffin.c +++ b/source/catsfc_griffin.c @@ -1,3 +1,5 @@ +#include "../copyright" + #include "apu.c" #include "c4.c" #include "c4emu.c" diff --git a/source/cheats.c b/source/cheats.c index ecec232..c308c93 100644 --- a/source/cheats.c +++ b/source/cheats.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifdef WANT_CHEATS diff --git a/source/cheats.h b/source/cheats.h index a50505f..86d4f96 100644 --- a/source/cheats.h +++ b/source/cheats.h @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) +#include "../copyright" - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #ifndef _CHEATS_H_ #define _CHEATS_H_ diff --git a/source/cheats2.c b/source/cheats2.c index f5fceee..4ca6b1d 100644 --- a/source/cheats2.c +++ b/source/cheats2.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifdef WANT_CHEATS diff --git a/source/clip.c b/source/clip.c index 1fb602f..8993e72 100644 --- a/source/clip.c +++ b/source/clip.c @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #include <stdlib.h> #include "snes9x.h" @@ -187,7 +99,6 @@ void ComputeClipWindows() } } - // if (!Settings.DisableGraphicWindows) { if (w == 5 || pClip->Count [5] || (Memory.FillRAM [0x212c + c] & Memory.FillRAM [0x212e + c] & (1 << w))) @@ -754,8 +665,7 @@ void ComputeClipWindows() // no intersection, nullify it pClip->Left[i][w] = 1; pClip->Right[i][w] = 0; -Clip_ok: - j = 0; // dummy statement +Clip_ok:; } } } diff --git a/source/copyright.h b/source/copyright.h deleted file mode 100644 index 9d62d73..0000000 --- a/source/copyright.h +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ -/* - * Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - * - * (c) Copyright 1996 - 2001 Gary Henderson (gary.henderson@ntlworld.com) and - * Jerremy Koot (jkoot@snes9x.com) - * - * Super FX C emulator code - * (c) Copyright 1997 - 1999 Ivar (ivar@snes9x.com) and - * Gary Henderson. - * Super FX assembler emulator code (c) Copyright 1998 zsKnight and _Demo_. - * - * DSP1 emulator code (c) Copyright 1998 Ivar, _Demo_ and Gary Henderson. - * C4 asm and some C emulation code (c) Copyright 2000 zsKnight and _Demo_. - * C4 C code (c) Copyright 2001 Gary Henderson (gary.henderson@ntlworld.com). - * - * DOS port code contains the works of other authors. See headers in - * individual files. - * - * Snes9x homepage: http://www.snes9x.com - * - * Permission to use, copy, modify and distribute Snes9x in both binary and - * source form, for non-commercial purposes, is hereby granted without fee, - * providing that this license information and copyright notice appear with - * all copies and any derived work. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event shall the authors be held liable for any damages - * arising from the use of this software. - * - * Snes9x is freeware for PERSONAL USE only. Commercial users should - * seek permission of the copyright holders first. Commercial use includes - * charging money for Snes9x or software derived from Snes9x. - * - * The copyright holders request that bug fixes and improvements to the code - * should be forwarded to them so everyone can benefit from the modifications - * in future versions. - * - * Super NES and Super Nintendo Entertainment System are trademarks of - * Nintendo Co., Limited and its subsidiary companies. - */ -/* - * Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - * - * (c) Copyright 1996, 1997, 1998, 1999 Gary Henderson (gary@daniver.demon.co.uk) and - * Jerremy Koot (jkoot@snes9x.com) - * - * Super FX C emulator code (c) Copyright 1997, 1998 Ivar and - * Gary Henderson. - * Super FX assembler emulator code (c) Copyright 1998 zsKnight and _Demo_. - * - * Permission to use, copy, modify and distribute Snes9x in both binary and - * source form, for non-commercial purposes, is hereby granted without fee, - * providing that this license information and copyright notice appear with - * all copies and any derived work. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event shall the authors be held liable for any damages - * arising from the use of this software. - * - * Snes9x is freeware for PERSONAL USE only. Commercial users should - * seek permission of the copyright holders first. Commercial use includes - * charging money for Snes9x or software derived from Snes9x. - * - * The copyright holders request that bug fixes and improvements to the code - * should be forwarded to them so everyone can benefit from the modifications - * in future versions. - * - * Super NES and Super Nintendo Entertainment System are trademarks of - * Nintendo Co., Limited and its subsidiary companies. - */ - diff --git a/source/cpu.c b/source/cpu.c index 573d431..62587de 100644 --- a/source/cpu.c +++ b/source/cpu.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #include "snes9x.h" #include "memmap.h" @@ -110,7 +21,7 @@ extern struct FxInit_s SuperFX; void S9xResetSuperFX() { - SuperFX.vFlags = 0; //FX_FLAG_ROM_BUFFER;// | FX_FLAG_ADDRESS_CHECKING; + SuperFX.vFlags = 0; FxReset(&SuperFX); } @@ -151,9 +62,7 @@ void S9xResetCPU() CPU.FastROMSpeed = SLOW_ONE_CYCLE; CPU.AutoSaveTimer = 0; CPU.SRAMModified = false; - // CPU.NMITriggerPoint = 4; // Set when ROM image loaded CPU.BRKTriggered = false; - //CPU.TriedInterleavedMode2 = false; // Reset when ROM image loaded CPU.NMICycleCount = 0; CPU.IRQCycleCount = 0; S9xSetPCBase(ICPU.Registers.PC); @@ -164,19 +73,17 @@ void S9xResetCPU() S9xUnpackStatus(); } -void S9xReset(void) +static void CommonS9xReset(void) { if (Settings.SuperFX) S9xResetSuperFX(); memset(Memory.FillRAM, 0, 0x8000); memset(Memory.VRAM, 0x00, 0x10000); - memset(Memory.RAM, 0x55, 0x20000); if (Settings.SPC7110) S9xSpc7110Reset(); S9xResetCPU(); - S9xResetPPU(); S9xResetSRTC(); if (Settings.SDD1) S9xResetSDD1(); @@ -184,6 +91,8 @@ void S9xReset(void) S9xResetDMA(); S9xResetAPU(); S9xResetDSP1(); + if (Settings.OBC1) + ResetOBC1(); S9xSA1Init(); if (Settings.C4) S9xInitC4(); @@ -191,39 +100,17 @@ void S9xReset(void) #ifdef WANT_CHEATS S9xInitCheatData(); #endif +} - if (Settings.OBC1) - ResetOBC1(); +void S9xReset(void) +{ + CommonS9xReset(); + S9xResetPPU(); + memset(Memory.RAM, 0x55, 0x20000); } + void S9xSoftReset(void) { - if (Settings.SuperFX) - S9xResetSuperFX(); - - memset(Memory.FillRAM, 0, 0x8000); - memset(Memory.VRAM, 0x00, 0x10000); - // memset (Memory.RAM, 0x55, 0x20000); - - if (Settings.SPC7110) - S9xSpc7110Reset(); - S9xResetCPU(); + CommonS9xReset(); S9xSoftResetPPU(); - S9xResetSRTC(); - if (Settings.SDD1) - S9xResetSDD1(); - - S9xResetDMA(); - S9xResetAPU(); - S9xResetDSP1(); - if (Settings.OBC1) - ResetOBC1(); - S9xSA1Init(); - if (Settings.C4) - S9xInitC4(); - -#ifdef WANT_CHEATS - S9xInitCheatData(); -#endif - } - diff --git a/source/cpuaddr.h b/source/cpuaddr.h index 3bdf18f..21ce254 100644 --- a/source/cpuaddr.h +++ b/source/cpuaddr.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _CPUADDR_H_ #define _CPUADDR_H_ @@ -102,7 +13,6 @@ typedef enum } AccessMode; // The type for a function that can run after the addressing mode is resolved: -// void NAME (long Addr) {...} typedef void (*InternalOp)(long); static void Immediate8(AccessMode a, InternalOp op) @@ -225,7 +135,6 @@ static void Direct(AccessMode a, InternalOp op) { if (a & READ) OpenBus = *CPU.PC; long Addr = (*CPU.PC++ + ICPU.Registers.D.W) & 0xffff; - // if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE; (*op)(Addr); } @@ -238,7 +147,6 @@ static void DirectIndirectIndexed(AccessMode a, InternalOp op) if (a & READ) OpenBus = (uint8_t)(Addr >> 8); Addr += ICPU.ShiftedDB + ICPU.Registers.Y.W; - // if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE; // XXX: always add one if STA // XXX: else Add one cycle if crosses page boundary (*op)(Addr); @@ -254,7 +162,6 @@ static void DirectIndirectIndexedLong(AccessMode a, InternalOp op) ICPU.Registers.Y.W; else Addr = S9xGetWord(Addr) + (S9xGetByte(Addr + 2) << 16) + ICPU.Registers.Y.W; - // if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE; (*op)(Addr); } @@ -346,8 +253,6 @@ static void DirectIndirect(AccessMode a, InternalOp op) Addr = S9xGetWord(Addr); if (a & READ) OpenBus = (uint8_t)(Addr >> 8); Addr += ICPU.ShiftedDB; - - // if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE; (*op)(Addr); } @@ -359,7 +264,6 @@ static void DirectIndirectLong(AccessMode a, InternalOp op) Addr = S9xGetWord(Addr) + ((OpenBus = S9xGetByte(Addr + 2)) << 16); else Addr = S9xGetWord(Addr) + (S9xGetByte(Addr + 2) << 16); - // if (ICPU.Registers.DL != 0) CPU.Cycles += ONE_CYCLE; (*op)(Addr); } diff --git a/source/cpuexec.c b/source/cpuexec.c index 9c50add..6b1896c 100644 --- a/source/cpuexec.c +++ b/source/cpuexec.c @@ -1,96 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ -//#include "ds2_timer.h" -//#include "ds2_cpu.h" -//#include "ds2io.h" +#include "../copyright" #include "snes9x.h" #include "memmap.h" @@ -125,13 +33,13 @@ void S9xMainLoop(void) { if (Settings.SA1) { - if (Settings.SuperFX) S9xMainLoop_SA1_SFX(); - else /* if (!Settings.SuperFX) */ S9xMainLoop_SA1_NoSFX(); + if (Settings.SuperFX) S9xMainLoop_SA1_SFX(); + else S9xMainLoop_SA1_NoSFX(); } - else /* if (!Settings.SA1) */ + else { - if (Settings.SuperFX) S9xMainLoop_NoSA1_SFX(); - else /* if (!Settings.SuperFX) */ S9xMainLoop_NoSA1_NoSFX(); + if (Settings.SuperFX) S9xMainLoop_NoSA1_SFX(); + else S9xMainLoop_NoSA1_NoSFX(); } } @@ -598,10 +506,6 @@ void S9xDoHBlankProcessing_SFX() // once every emulated 63.5 microseconds, which coresponds to // 15.750KHz, but the SPC700 timers need to be updated at multiples // of 8KHz, hence the error correction. - // IAPU.TimerErrorCounter++; - // if (IAPU.TimerErrorCounter >= ) - // IAPU.TimerErrorCounter = 0; - // else { if (APU.TimerEnabled [2]) { @@ -778,10 +682,6 @@ void S9xDoHBlankProcessing_NoSFX() // once every emulated 63.5 microseconds, which coresponds to // 15.750KHz, but the SPC700 timers need to be updated at multiples // of 8KHz, hence the error correction. - // IAPU.TimerErrorCounter++; - // if (IAPU.TimerErrorCounter >= ) - // IAPU.TimerErrorCounter = 0; - // else #ifndef USE_BLARGG_APU { if (APU.TimerEnabled [2]) diff --git a/source/cpuexec.h b/source/cpuexec.h index a88c961..82de07f 100644 --- a/source/cpuexec.h +++ b/source/cpuexec.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _CPUEXEC_H_ #define _CPUEXEC_H_ diff --git a/source/cpumacro.h b/source/cpumacro.h index 3f2d224..5539445 100644 --- a/source/cpumacro.h +++ b/source/cpumacro.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _CPUMACRO_H_ #define _CPUMACRO_H_ @@ -267,7 +178,6 @@ static void ASL16(long Addr) uint16_t Work16 = S9xGetWord(Addr); ICPU._Carry = (Work16 & 0x8000) != 0; Work16 <<= 1; - //S9xSetWord (Work16, Addr); S9xSetByte(Work16 >> 8, Addr + 1); S9xSetByte(Work16 & 0xFF, Addr); SetZN16(Work16); @@ -379,7 +289,6 @@ static void DEC16(long Addr) #endif uint16_t Work16 = S9xGetWord(Addr) - 1; - //S9xSetWord (Work16, Addr); S9xSetByte(Work16 >> 8, Addr + 1); S9xSetByte(Work16 & 0xFF, Addr); SetZN16(Work16); @@ -441,7 +350,6 @@ static void INC16(long Addr) #endif uint16_t Work16 = S9xGetWord(Addr) + 1; - //S9xSetWord (Work16, Addr); S9xSetByte(Work16 >> 8, Addr + 1); S9xSetByte(Work16 & 0xFF, Addr); SetZN16(Work16); @@ -519,7 +427,6 @@ static void LSR16(long Addr) uint16_t Work16 = S9xGetWord(Addr); ICPU._Carry = Work16 & 1; Work16 >>= 1; - //S9xSetWord (Work16, Addr); S9xSetByte(Work16 >> 8, Addr + 1); S9xSetByte(Work16 & 0xFF, Addr); SetZN16(Work16); @@ -576,7 +483,6 @@ static void ROL16(long Addr) Work32 <<= 1; Work32 |= CheckCarry(); ICPU._Carry = Work32 >= 0x10000; - //S9xSetWord ((uint16_t) Work32, Addr); S9xSetByte((Work32 >> 8) & 0xFF, Addr + 1); S9xSetByte(Work32 & 0xFF, Addr); SetZN16((uint16_t) Work32); @@ -623,7 +529,6 @@ static void ROR16(long Addr) Work32 |= (int) CheckCarry() << 16; ICPU._Carry = (uint8_t)(Work32 & 1); Work32 >>= 1; - //S9xSetWord ((uint16_t) Work32, Addr); S9xSetByte((Work32 >> 8) & 0x00FF, Addr + 1); S9xSetByte(Work32 & 0x00FF, Addr); SetZN16((uint16_t) Work32); @@ -803,7 +708,6 @@ static void TSB16(long Addr) uint16_t Work16 = S9xGetWord(Addr); ICPU._Zero = (Work16 & ICPU.Registers.A.W) != 0; Work16 |= ICPU.Registers.A.W; - //S9xSetWord (Work16, Addr); S9xSetByte(Work16 >> 8, Addr + 1); S9xSetByte(Work16 & 0xFF, Addr); } @@ -821,7 +725,6 @@ static void TRB16(long Addr) uint16_t Work16 = S9xGetWord(Addr); ICPU._Zero = (Work16 & ICPU.Registers.A.W) != 0; Work16 &= ~ICPU.Registers.A.W; - //S9xSetWord (Work16, Addr); S9xSetByte(Work16 >> 8, Addr + 1); S9xSetByte(Work16 & 0xFF, Addr); } diff --git a/source/cpuops.c b/source/cpuops.c index d7f90e6..c640763 100644 --- a/source/cpuops.c +++ b/source/cpuops.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" /*****************************************************************************/ /* CPU-S9xOpcodes.CPP */ @@ -147,10 +58,6 @@ static void Op75M1(void) DirectIndexedX(READ, ADC8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -159,10 +66,6 @@ static void Op75M0(void) DirectIndexedX(READ, ADC16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -405,10 +308,6 @@ static void Op35M1(void) DirectIndexedX(READ, AND8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -417,10 +316,6 @@ static void Op35M0(void) DirectIndexedX(READ, AND16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -736,10 +631,6 @@ static void Op34M1(void) DirectIndexedX(READ, BIT8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -748,10 +639,6 @@ static void Op34M0(void) DirectIndexedX(READ, BIT16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -837,10 +724,6 @@ static void OpD5M1(void) DirectIndexedX(READ, CMP8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -849,10 +732,6 @@ static void OpD5M0(void) DirectIndexedX(READ, CMP16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -1206,10 +1085,6 @@ static void OpD6M1(void) DirectIndexedX(MODIFY, DEC8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -1218,10 +1093,6 @@ static void OpD6M0(void) DirectIndexedX(MODIFY, DEC16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -1304,10 +1175,6 @@ static void Op55M1(void) DirectIndexedX(READ, EOR8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -1316,10 +1183,6 @@ static void Op55M0(void) DirectIndexedX(READ, EOR16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -1549,10 +1412,6 @@ static void OpF6M1(void) DirectIndexedX(MODIFY, INC8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -1561,10 +1420,6 @@ static void OpF6M0(void) DirectIndexedX(MODIFY, INC16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -1647,10 +1502,6 @@ static void OpB5M1(void) DirectIndexedX(READ, LDA8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -1659,10 +1510,6 @@ static void OpB5M0(void) DirectIndexedX(READ, LDA16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -1905,10 +1752,6 @@ static void OpB6X1(void) DirectIndexedY(READ, LDX8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -1917,10 +1760,6 @@ static void OpB6X0(void) DirectIndexedY(READ, LDX16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -2003,10 +1842,6 @@ static void OpB4X1(void) DirectIndexedX(READ, LDY8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -2015,10 +1850,6 @@ static void OpB4X0(void) DirectIndexedX(READ, LDY16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -2087,10 +1918,6 @@ static void Op56M1(void) DirectIndexedX(MODIFY, LSR8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -2099,10 +1926,6 @@ static void Op56M0(void) DirectIndexedX(MODIFY, LSR16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -2185,10 +2008,6 @@ static void Op15M1(void) DirectIndexedX(READ, ORA8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -2197,10 +2016,6 @@ static void Op15M0(void) DirectIndexedX(READ, ORA16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -2430,10 +2245,6 @@ static void Op36M1(void) DirectIndexedX(MODIFY, ROL8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -2442,10 +2253,6 @@ static void Op36M0(void) DirectIndexedX(MODIFY, ROL16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -2514,10 +2321,6 @@ static void Op76M1(void) DirectIndexedX(MODIFY, ROR8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -2526,10 +2329,6 @@ static void Op76M0(void) DirectIndexedX(MODIFY, ROR16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE /* memory */ + ONE_CYCLE /* opcode */; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -2598,10 +2397,6 @@ static void OpF5M1(void) DirectIndexedX(READ, SBC8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -2610,10 +2405,6 @@ static void OpF5M0(void) DirectIndexedX(READ, SBC16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -2832,10 +2623,6 @@ static void Op95M1(void) DirectIndexedX(WRITE, STA8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -2844,10 +2631,6 @@ static void Op95M0(void) DirectIndexedX(WRITE, STA16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -3074,10 +2857,6 @@ static void Op96X1(void) DirectIndexedY(WRITE, STX8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -3086,10 +2865,6 @@ static void Op96X0(void) DirectIndexedY(WRITE, STX16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -3132,10 +2907,6 @@ static void Op94X1(void) DirectIndexedX(WRITE, STY8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -3144,10 +2915,6 @@ static void Op94X0(void) DirectIndexedX(WRITE, STY16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -3190,10 +2957,6 @@ static void Op74M1(void) DirectIndexedX(WRITE, STZ8); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -3202,10 +2965,6 @@ static void Op74M0(void) DirectIndexedX(WRITE, STZ16); #ifndef SA1_OPCODES CPU.Cycles += CPU.MemSpeed + ONE_CYCLE; - // if (ICPU.Registers.DL != 0) - // CPU.Cycles += TWO_CYCLES; - // else - // CPU.Cycles += ONE_CYCLE; #endif } @@ -3383,8 +3142,6 @@ static inline void CPUShutdown() !(CPU.Flags & (IRQ_PENDING_FLAG | NMI_FLAG))) { CPU.WaitAddress = NULL; - if (Settings.SA1) - S9xSA1ExecuteDuringSleep(); #ifndef USE_BLARGG_APU CPU.Cycles = CPU.NextEvent; if (IAPU.APUExecuting) @@ -3424,6 +3181,31 @@ static inline void CPUShutdown() #define CPUShutdown() #endif +// From the speed-hacks branch of CatSFC +static inline void ForceShutdown() +{ +#ifdef CPU_SHUTDOWN +#ifndef SA1_OPCODES + CPU.WaitAddress = NULL; +#ifndef USE_BLARGG_APU + CPU.Cycles = CPU.NextEvent; + if (IAPU.APUExecuting) + { + ICPU.CPUExecuting = false; + do + { + APU_EXECUTE1(); + } while (APU.Cycles < CPU.NextEvent); + ICPU.CPUExecuting = true; + } +#endif +#else + SA1.Executing = false; + SA1.CPUExecuting = false; +#endif +#endif +} + /* BCC */ static void Op90(void) { @@ -3747,10 +3529,7 @@ static void OpEA(void) /**********************************************************************************************/ /* PUSH Instructions ************************************************************************* */ -/* #define PushW(w) \ - * S9xSetWord (w, ICPU.Registers.S.W - 1);\ - * ICPU.Registers.S.W -= 2; - */ + #define PushB(b)\ S9xSetByte (b, ICPU.Registers.S.W--); @@ -3983,10 +3762,6 @@ static void Op5AX0(void) w = S9xGetByte (++ICPU.Registers.S.W); \ w |= (S9xGetByte (++ICPU.Registers.S.W)<<8); -/* w = S9xGetWord (ICPU.Registers.S.W + 1); \ - ICPU.Registers.S.W += 2; -*/ - #define PullB(b)\ b = S9xGetByte (++ICPU.Registers.S.W); @@ -4091,7 +3866,6 @@ static void Op28E1(void) ICPU.Registers.YH = 0; } S9xFixCycles(); - /* CHECK_FOR_IRQ();*/ } static void Op28(void) @@ -4108,7 +3882,6 @@ static void Op28(void) ICPU.Registers.YH = 0; } S9xFixCycles(); - /* CHECK_FOR_IRQ();*/ } //PLX @@ -4866,7 +4639,6 @@ static void OpC2(void) ICPU.Registers.YH = 0; } S9xFixCycles(); - /* CHECK_FOR_IRQ(); */ } static void OpE2(void) @@ -4935,7 +4707,6 @@ static void Op40(void) CPU.Cycles += TWO_CYCLES; #endif S9xFixCycles(); - /* CHECK_FOR_IRQ(); */ } /**********************************************************************************************/ @@ -4944,39 +4715,10 @@ static void Op40(void) // WAI static void OpCB(void) { - - // Ok, let's just C-ify the ASM versions separately. #ifdef SA1_OPCODES SA1.WaitingForInterrupt = true; SA1.PC--; -#if 0 - // XXX: FIXME - if (Settings.Shutdown) - { - SA1.Cycles = SA1.NextEvent; - if (IAPU.APUExecuting) - { - SA1.Executing = false; - do - { - APU_EXECUTE1(, - } - while (APU.Cycles < SA1.NextEvent, SA1.Executing = true; - } -} -#endif #else // SA1_OPCODES -#if 0 - - - if (CPU.IRQActive) - { -#ifndef SA1_OPCODES - CPU.Cycles += TWO_CYCLES; -#endif - } - else -#endif { CPU.WaitingForInterrupt = true; CPU.PC--; @@ -5008,16 +4750,194 @@ static void OpCB(void) #endif // SA1_OPCODES } -// STP +// Usually an STP opcode +// SNESAdvance speed hack, not implemented in Snes9xTYL | Snes9x-Euphoria (from the speed-hacks branch of CatSFC) static void OpDB(void) { - CPU.PC--; - CPU.Flags |= DEBUG_MODE_FLAG; +#if !defined NO_SPEEDHACKS && defined CPU_SHUTDOWN + uint8_t NextByte = *CPU.PC++; + + ForceShutdown(); + + int8_t BranchOffset = (NextByte & 0x7F) | ((NextByte & 0x40) << 1); + // ^ -64 .. +63, sign extend bit 6 into 7 for unpacking + long TargetAddress = ((int) (CPU.PC - CPU.PCBase) + BranchOffset) & 0xffff; + + switch (NextByte & 0x80) + { + case 0x00: // BNE + BranchCheck1 (); + if (!CheckZero ()) { + CPU.PC = CPU.PCBase + TargetAddress; +#ifdef VAR_CYCLES + CPU.Cycles += ONE_CYCLE; +#else +#ifndef SA1_OPCODES + CPU.Cycles++; +#endif +#endif + CPUShutdown (); + } + return; + case 0x80: // BEQ + BranchCheck2 (); + if (CheckZero ()) { + CPU.PC = CPU.PCBase + TargetAddress; +#ifdef VAR_CYCLES + CPU.Cycles += ONE_CYCLE; +#else +#ifndef SA1_OPCODES + CPU.Cycles++; +#endif +#endif + CPUShutdown (); + } + return; + } +#else + CPU.PC--; + CPU.Flags |= DEBUG_MODE_FLAG; +#endif } -// Reserved S9xOpcode +// SNESAdvance speed hack, as implemented in Snes9xTYL / Snes9x-Euphoria (from the speed-hacks branch of CatSFC) static void Op42(void) { +#if !defined NO_SPEEDHACKS && defined CPU_SHUTDOWN + uint8_t NextByte = *CPU.PC++; + + ForceShutdown(); + + int8_t BranchOffset = 0xF0 | (NextByte & 0xF); // always negative + long TargetAddress = ((int) (CPU.PC - CPU.PCBase) + BranchOffset) & 0xffff; + + switch (NextByte & 0xF0) + { + case 0x10: // BPL + BranchCheck1 (); + if (!CheckNegative ()) { + CPU.PC = CPU.PCBase + TargetAddress; +#ifdef VAR_CYCLES + CPU.Cycles += ONE_CYCLE; +#else +#ifndef SA1_OPCODES + CPU.Cycles++; +#endif +#endif + CPUShutdown (); + } + return; + case 0x30: // BMI + BranchCheck1 (); + if (CheckNegative ()) { + CPU.PC = CPU.PCBase + TargetAddress; +#ifdef VAR_CYCLES + CPU.Cycles += ONE_CYCLE; +#else +#ifndef SA1_OPCODES + CPU.Cycles++; +#endif +#endif + CPUShutdown (); + } + return; + case 0x50: // BVC + BranchCheck0 (); + if (!CheckOverflow ()) { + CPU.PC = CPU.PCBase + TargetAddress; +#ifdef VAR_CYCLES + CPU.Cycles += ONE_CYCLE; +#else +#ifndef SA1_OPCODES + CPU.Cycles++; +#endif +#endif + CPUShutdown (); + } + return; + case 0x70: // BVS + BranchCheck0 (); + if (CheckOverflow ()) { + CPU.PC = CPU.PCBase + TargetAddress; +#ifdef VAR_CYCLES + CPU.Cycles += ONE_CYCLE; +#else +#ifndef SA1_OPCODES + CPU.Cycles++; +#endif +#endif + CPUShutdown (); + } + return; + case 0x80: // BRA + CPU.PC = CPU.PCBase + TargetAddress; +#ifdef VAR_CYCLES + CPU.Cycles += ONE_CYCLE; +#else +#ifndef SA1_OPCODES + CPU.Cycles++; +#endif +#endif + CPUShutdown (); + return; + case 0x90: // BCC + BranchCheck0 (); + if (!CheckCarry ()) { + CPU.PC = CPU.PCBase + TargetAddress; +#ifdef VAR_CYCLES + CPU.Cycles += ONE_CYCLE; +#else +#ifndef SA1_OPCODES + CPU.Cycles++; +#endif +#endif + CPUShutdown (); + } + return; + case 0xB0: // BCS + BranchCheck0 (); + if (CheckCarry ()) { + CPU.PC = CPU.PCBase + TargetAddress; +#ifdef VAR_CYCLES + CPU.Cycles += ONE_CYCLE; +#else +#ifndef SA1_OPCODES + CPU.Cycles++; +#endif +#endif + CPUShutdown (); + } + return; + case 0xD0: // BNE + BranchCheck1 (); + if (!CheckZero ()) { + CPU.PC = CPU.PCBase + TargetAddress; +#ifdef VAR_CYCLES + CPU.Cycles += ONE_CYCLE; +#else +#ifndef SA1_OPCODES + CPU.Cycles++; +#endif +#endif + CPUShutdown (); + } + return; + case 0xF0: // BEQ + BranchCheck2 (); + if (CheckZero ()) { + CPU.PC = CPU.PCBase + TargetAddress; +#ifdef VAR_CYCLES + CPU.Cycles += ONE_CYCLE; +#else +#ifndef SA1_OPCODES + CPU.Cycles++; +#endif +#endif + CPUShutdown (); + } + return; + } +#endif } /*****************************************************************************/ diff --git a/source/cpuops.h b/source/cpuops.h index 41f293b..7ed310a 100644 --- a/source/cpuops.h +++ b/source/cpuops.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _CPUOPS_H_ #define _CPUOPS_H_ diff --git a/source/data.c b/source/data.c index 4ac246b..e039040 100644 --- a/source/data.c +++ b/source/data.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #include "snes9x.h" diff --git a/source/display.h b/source/display.h index b009c93..8b6e934 100644 --- a/source/display.h +++ b/source/display.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _DISPLAY_H_ #define _DISPLAY_H_ diff --git a/source/dma.c b/source/dma.c index b5478ae..c0956c4 100644 --- a/source/dma.c +++ b/source/dma.c @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -116,8 +28,6 @@ extern int HDMA_ModeByteCounts [8]; extern uint8_t* HDMAMemPointers [8]; extern uint8_t* HDMABasePointers [8]; -// #define SETA010_HDMA_FROM_CART - #ifdef SETA010_HDMA_FROM_CART uint32_t HDMARawPointers[8]; // Cart address space pointer #endif @@ -198,18 +108,17 @@ void S9xDoDMA(uint8_t Channel) #endif if (Settings.SPC7110 && (d->AAddress == 0x4800 || d->ABank == 0x50)) { - uint32_t i, j; + uint32_t i; i = (s7r.reg4805 | (s7r.reg4806 << 8)); i *= s7r.AlignBy; i += s7r.bank50Internal; i %= DECOMP_BUFFER_SIZE; - j = 0; if ((i + d->TransferBytes) < DECOMP_BUFFER_SIZE) spc7110_dma = &s7r.bank50[i]; else { spc7110_dma = (uint8_t*)malloc(d->TransferBytes); - j = DECOMP_BUFFER_SIZE - i; + uint32_t j = DECOMP_BUFFER_SIZE - i; memcpy(spc7110_dma, &s7r.bank50[i], j); memcpy(&spc7110_dma[j], s7r.bank50, d->TransferBytes - j); s7_wrap = true; @@ -243,10 +152,6 @@ void S9xDoDMA(uint8_t Channel) uint32_t char_count = inc / bytes_per_char; in_sa1_dma = true; - - //printf ("%08x,", base); fflush (stdout); - //printf ("depth = %d, count = %d, bytes_per_char = %d, bytes_per_line = %d, num_chars = %d, char_line_bytes = %d\n", - //depth, count, bytes_per_char, bytes_per_line, num_chars, char_line_bytes); int i; switch (depth) @@ -507,7 +412,6 @@ void S9xDoDMA(uint8_t Channel) { Work = *(base + p); REGISTER_2118_linear(Work); - p += inc; } } else @@ -527,7 +431,6 @@ void S9xDoDMA(uint8_t Channel) { Work = *(base + p); REGISTER_2118_tile(Work); - p += inc; } } } @@ -549,7 +452,6 @@ void S9xDoDMA(uint8_t Channel) { Work = *(base + p); S9xSetPPU(Work, 0x2100 + d->BAddress); - p += inc; } } } @@ -866,9 +768,6 @@ uint8_t S9xDoHDMA(uint8_t byte) byte &= ~mask; continue; } - // Uncommenting the following line breaks Punchout - it starts - // H-DMA during the frame. - //p->FirstLine = true; } if (p->Repeat && !p->FirstLine) { diff --git a/source/dma.h b/source/dma.h index 31d06c4..5d4f358 100644 --- a/source/dma.h +++ b/source/dma.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _DMA_H_ #define _DMA_H_ diff --git a/source/dsp1.c b/source/dsp1.c index 9c62f50..cccae23 100644 --- a/source/dsp1.c +++ b/source/dsp1.c @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #include "snes9x.h" #include "dsp1.h" #include "missing.h" @@ -128,22 +40,18 @@ uint8_t S9xGetDSP(uint16_t address) uint8_t t; t = (*GetDSP)(address); - //DSP1GetByte(address); return (t); } void S9xSetDSP(uint8_t byte, uint16_t address) { (*SetDSP)(byte, address); - //DSP1SetByte(byte, address); } void DSP1SetByte(uint8_t byte, uint16_t address) { if ((address & 0xf000) == 0x6000 || (address & 0x7fff) < 0x4000) { - // if ((address & 1) == 0) - // { if ((DSP1.command == 0x0A || DSP1.command == 0x1A) && DSP1.out_count != 0) { DSP1.out_count--; @@ -156,7 +64,6 @@ void DSP1SetByte(uint8_t byte, uint16_t address) DSP1.in_index = 0; DSP1.waiting4command = false; DSP1.first_parameter = true; - // printf("Op%02X\n",byte); // Mario Kart uses 0x00, 0x02, 0x06, 0x0c, 0x28, 0x0a switch (byte) { @@ -288,9 +195,7 @@ void DSP1SetByte(uint8_t byte, uint16_t address) case 0x1f: DSP1.in_count = 1; break; - // case 0x80: DSP1.in_count = 2; break; default: - //printf("Op%02X\n",byte); case 0x80: DSP1.in_count = 0; DSP1.waiting4command = true; @@ -316,14 +221,10 @@ void DSP1SetByte(uint8_t byte, uint16_t address) && DSP1.in_index == 0))) { } - // else if (DSP1.first_parameter) - // { - // } else { if (DSP1.in_count) { - //DSP1.parameters [DSP1.in_index] |= (byte << 8); if (--DSP1.in_count == 0) { // Actually execute the command @@ -413,7 +314,6 @@ void DSP1SetByte(uint8_t byte, uint16_t address) break; case 0x38: // Range - Op38X = (int16_t)(DSP1.parameters [0] | (DSP1.parameters[1] << 8)); Op38Y = (int16_t)(DSP1.parameters [2] | (DSP1.parameters[3] << 8)); Op38Z = (int16_t)(DSP1.parameters [4] | (DSP1.parameters[5] << 8)); @@ -782,16 +682,11 @@ uint8_t DSP1GetByte(uint16_t address) { uint8_t t; if ((address & 0xf000) == 0x6000 || - // (address >= 0x8000 && address < 0xc000)) (address & 0x7fff) < 0x4000) { if (DSP1.out_count) { - //if ((address & 1) == 0) t = (uint8_t) DSP1.output [DSP1.out_index]; - //else - //{ - // t = (uint8_t) (DSP1.output [DSP1.out_index] >> 8); DSP1.out_index++; if (--DSP1.out_count == 0) { @@ -818,15 +713,10 @@ uint8_t DSP1GetByte(uint16_t address) } } DSP1.waiting4command = true; - //} } else { - // Top Gear 3000 requires this value.... - // if(4==Settings.DSPVersion) t = 0xff; - //Ballz3d requires this one: - // else t = 0x00; } } else t = 0x80; @@ -843,8 +733,6 @@ void DSP2SetByte(uint8_t byte, uint16_t address) DSP1.command = byte; DSP1.in_index = 0; DSP1.waiting4command = false; - // DSP1.first_parameter = true; - // printf("Op%02X\n",byte); switch (byte) { case 0x01: @@ -875,13 +763,11 @@ void DSP2SetByte(uint8_t byte, uint16_t address) else { DSP1.parameters [DSP1.in_index] = byte; - // DSP1.first_parameter = false; DSP1.in_index++; } if (DSP1.in_count == DSP1.in_index) { - //DSP1.parameters [DSP1.in_index] |= (byte << 8); // Actually execute the command DSP1.waiting4command = true; DSP1.out_index = 0; @@ -965,7 +851,6 @@ void DSP2SetByte(uint8_t byte, uint16_t address) case 0x03: DSP2Op05Transparent = DSP1.parameters[0]; - //DSP2Op03(); break; case 0x0f: default: @@ -997,7 +882,6 @@ uint8_t DSP2GetByte(uint16_t address) //Disable non-working chips? #ifdef DSP_DUMMY_LOOPS -//static const uint16_t DSP1ROM[1024] from SNES9X v1.53 uint16_t Dsp3Rom[1024] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -1141,8 +1025,6 @@ void DSP3SetByte(uint8_t byte, uint16_t address) DSP1.command = byte; DSP1.in_index = 0; DSP1.waiting4command = false; - // DSP1.first_parameter = true; - // printf("Op%02X\n",byte); switch (byte) { case 0x2F: @@ -1158,20 +1040,17 @@ void DSP3SetByte(uint8_t byte, uint16_t address) DSP1.in_count = 4; break; default: - // printf("Op%02X\n",byte); break; } } else { DSP1.parameters [DSP1.in_index] = byte; - // DSP1.first_parameter = false; DSP1.in_index++; } if (DSP1.in_count == DSP1.in_index) { - //DSP1.parameters [DSP1.in_index] |= (byte << 8); // Actually execute the command DSP1.waiting4command = true; DSP1.out_index = 0; @@ -1221,7 +1100,6 @@ uint8_t DSP3GetByte(uint16_t address) t = (uint8_t)Dsp3Rom[DSP1.out_index >> 1]; else t = Dsp3Rom[DSP1.out_index >> 1] >> 8; - // t=Dsp3Rom[DSP1.out_index]; DSP1.out_index++; } else @@ -1239,18 +1117,6 @@ uint8_t DSP3GetByte(uint16_t address) else { t = 0x80; - /* if(DSP1.command=0x38&&DSP1.out_count==0) - { - t=0xC0; - static int Op38c; - if(Op38c==14) - { - Op38c=0; - t=0x80; - DSP1.in_count=4; - } - Op38c++; - }*/ } return t; } @@ -1301,7 +1167,6 @@ void DSP4SetByte(uint8_t byte, uint16_t address) DSP4.command |= (byte << 8); DSP4.in_index = 0; DSP4.waiting4command = false; - // DSP4.first_parameter = true; DSP4.half_command = 0; DSP4.out_count = 0; DSP4.out_index = 0; @@ -1350,7 +1215,6 @@ void DSP4SetByte(uint8_t byte, uint16_t address) break; default: DSP4.waiting4command = true; - //printf("(line %d) Unknown Op%02X\n",line,DSP4.command); break; } } @@ -1363,13 +1227,11 @@ void DSP4SetByte(uint8_t byte, uint16_t address) else { DSP4.parameters [DSP4.in_index] = byte; - // DSP4.first_parameter = false; DSP4.in_index++; } if (!DSP4.waiting4command && DSP4.in_count == DSP4.in_index) { - //DSP4.parameters [DSP4.in_index] |= (byte << 8); // Actually execute the command DSP4.waiting4command = true; DSP4.out_index = 0; @@ -1476,9 +1338,6 @@ void DSP4SetByte(uint8_t byte, uint16_t address) // unknown case 0x000A: { - int16_t in1a = DSP4_READ_WORD(0); - int16_t in2a = DSP4_READ_WORD(2); - int16_t in3a = DSP4_READ_WORD(4); int16_t out1a, out2a; out1a = (int16_t)0xff40; diff --git a/source/dsp1.h b/source/dsp1.h index 745272b..0c18155 100644 --- a/source/dsp1.h +++ b/source/dsp1.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _DSP1_H_ #define _DSP1_H_ @@ -126,7 +37,5 @@ uint8_t S9xGetDSP(uint16_t Address); void S9xSetDSP(uint8_t Byte, uint16_t Address); extern SDSP1 DSP1; -//extern struct SDSP1 DSP1; - #endif diff --git a/source/dsp1emu.c b/source/dsp1emu.c index 2905b6b..3999d5d 100644 --- a/source/dsp1emu.c +++ b/source/dsp1emu.c @@ -1,19 +1,4 @@ -//Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com ) -// -//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., 675 Mass Ave, Cambridge, MA 02139, USA. +#include "../copyright" #include <stdio.h> #include <stdarg.h> @@ -698,15 +683,12 @@ void DSPOp06() // rotate around Z tanval2 = Angle(-Op02AAS + 32768); - // tanval2 = (-Op02AAS+32768)/(65536/INCR); ObjPX1 = (ObjPX * Cos(tanval2) + ObjPY * -Sin(tanval2)); ObjPY1 = (ObjPX * Sin(tanval2) + ObjPY * Cos(tanval2)); ObjPZ1 = ObjPZ; // rotate around X - // tanval2 = (-Op02AZS/(65536/INCR)) & 1023; tanval2 = Angle(-Op02AZS); - // tanval2 = (-Op02AZS)/256; ObjPX2 = ObjPX1; ObjPY2 = (ObjPY1 * Cos(tanval2) + ObjPZ1 * -Sin(tanval2)); ObjPZ2 = (ObjPY1 * Sin(tanval2) + ObjPZ1 * Cos(tanval2)); @@ -716,8 +698,8 @@ void DSPOp06() if (ObjPZ2 < 0) { double d; - Op06H = (int16_t)(-ObjPX2 * Op02LES / -(ObjPZ2)); //-ObjPX2*256/-ObjPZ2; - Op06V = (int16_t)(-ObjPY2 * Op02LES / -(ObjPZ2)); //-ObjPY2*256/-ObjPZ2; + Op06H = (int16_t)(-ObjPX2 * Op02LES / -(ObjPZ2)); + Op06V = (int16_t)(-ObjPY2 * Op02LES / -(ObjPZ2)); d = (double)Op02LES; d *= 256.0; d /= (-ObjPZ2); @@ -726,8 +708,6 @@ void DSPOp06() else if (d < 0.0) d = 0.0; Op06S = (uint16_t)d; - //Op06S=(uint16_t)(256*(double)Op02LES/-ObjPZ2); - //Op06S=(uint16_t)((double)(256.0*((double)Op02LES)/(-ObjPZ2))); } else { @@ -762,8 +742,8 @@ void DSPOp06() if (ObjPZ2 < 0) { - Op06H = (int16_t)(-ObjPX2 * Op02LES / -(ObjPZ2)); //-ObjPX2*256/-ObjPZ2; - Op06V = (int16_t)(-ObjPY2 * Op02LES / -(ObjPZ2)); //-ObjPY2*256/-ObjPZ2; + Op06H = (int16_t)(-ObjPX2 * Op02LES / -(ObjPZ2)); + Op06V = (int16_t)(-ObjPY2 * Op02LES / -(ObjPZ2)); double d = (double)Op02LES; d *= 256.0; d /= (-ObjPZ2); @@ -772,7 +752,6 @@ void DSPOp06() else if (d < 0.0) d = 0.0; Op06S = (uint16_t)d; - // Op06S=(uint16_t)(256*(double)Op02LES/-ObjPZ2); } else { diff --git a/source/dsp2emu.c b/source/dsp2emu.c index 43bfb45..1ec79bc 100644 --- a/source/dsp2emu.c +++ b/source/dsp2emu.c @@ -1,94 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ - +#include "../copyright" uint16_t DSP2Op09Word1 = 0; uint16_t DSP2Op09Word2 = 0; @@ -226,29 +136,19 @@ int DSP2Op0DInLen = 0; void DSP2_Op0D() { - // Overload's algorithm - use this unless doing hardware testing - - // One note: the HW can do odd byte scaling but since we divide - // by two to get the count of bytes this won't work well for - // odd byte scaling (in any of the current algorithm implementations). - // So far I haven't seen Dungeon Master use it. - // If it does we can adjust the parameters and code to work with it + // (Modified) Overload's algorithm - use this unless doing hardware testing int i; - int pixel_offset; - uint8_t pixelarray[512]; - for (i = 0; i < DSP2Op0DOutLen * 2; i++) + for(i = 0 ; i < DSP2Op0DOutLen ; i++) { - pixel_offset = (i * DSP2Op0DInLen) / DSP2Op0DOutLen; - if ((pixel_offset & 1) == 0) - pixelarray[i] = DSP1.parameters[pixel_offset >> 1] >> 4; - else - pixelarray[i] = DSP1.parameters[pixel_offset >> 1] & 0x0f; + int j = i << 1; + int pixel_offset_low = ((j * DSP2Op0DInLen) / DSP2Op0DOutLen) >> 1; + int pixel_offset_high = (((j + 1) * DSP2Op0DInLen) / DSP2Op0DOutLen) >> 1; + uint8_t pixel_low = DSP1.parameters[pixel_offset_low] >> 4; + uint8_t pixel_high = DSP1.parameters[pixel_offset_high] & 0x0f; + DSP1.output[i] = (pixel_low << 4) | pixel_high; } - - for (i = 0; i < DSP2Op0DOutLen; i++) - DSP1.output[i] = (pixelarray[i << 1] << 4) | pixelarray[(i << 1) + 1]; } #else @@ -298,45 +198,3 @@ void DSP2_Op0D() } #endif - -#if 0 // Probably no reason to use this code - it's not quite bit accurate and it doesn't look as good as Overload's algorithm - -void DSP2_Op0D() -{ - // Float implementation of Neviksti's algorithm - // This is the right algorithm to match the DSP2 bits but the precision - // of the PC float does not match the precision of the fixed point math - // on the DSP2 causing occasional one off data mismatches (which should - // be no problem because its just a one pixel difference in a scaled image - // to be displayed). - - float multiplier; - float pixloc; - int i, j; - uint8_t pixelarray[512]; - - if (DSP2Op0DInLen <= DSP2Op0DOutLen) - multiplier = (float) 1.0; - else - multiplier = (float)((DSP2Op0DInLen * 2.0) / (DSP2Op0DOutLen * 2.0 + 1.0)); - - pixloc = 0.0; - for (i = 0; i < DSP2Op0DOutLen * 2; i++) - { - // j = (int)(i * multiplier); - j = (int) pixloc; - - if (j & 1) - pixelarray[i] = DSP1.parameters[j >> 1] & 0x0f; - else - pixelarray[i] = (DSP1.parameters[j >> 1] & 0xf0) >> 4; - - pixloc += multiplier; // use an add in the loop instead of multiply to increase loop speed - } - - for (i = 0; i < DSP2Op0DOutLen; i++) - DSP1.output[i] = (pixelarray[i << 1] << 4) | pixelarray[(i << 1) + 1]; -} - -#endif - diff --git a/source/dsp4.h b/source/dsp4.h index 6aeee61..488b5f6 100644 --- a/source/dsp4.h +++ b/source/dsp4.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _DSP4_H_ #define _DSP4_H_ diff --git a/source/dsp4emu.c b/source/dsp4emu.c index a2ef53d..4ea8fcb 100644 --- a/source/dsp4emu.c +++ b/source/dsp4emu.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #include "dsp4.h" #include "memmap.h" @@ -134,10 +45,6 @@ void DSP4_Op06(bool size, bool msb) } } -#if OP==0x0001 -#define PRINT -#endif - void DSP4_Op01() { uint16_t command; @@ -159,7 +66,6 @@ void DSP4_Op01() // process initial inputs // sort inputs - // 0x00 = DSP4_READ_WORD(0x00); project_focaly = DSP4_READ_WORD(0x02); raster = DSP4_READ_WORD(0x04); viewport_top = DSP4_READ_WORD(0x06); @@ -169,13 +75,11 @@ void DSP4_Op01() project_focalx = DSP4_READ_WORD(0x0e); project_centerx = DSP4_READ_WORD(0x10); project_ptr = DSP4_READ_WORD(0x12); - // (envelope?) 0xc0 = DSP4_READ_WORD(0x14); project_pitchylow = DSP4_READ_WORD(0x16); project_pitchy = DSP4_READ_WORD(0x18); project_pitchxlow = DSP4_READ_WORD(0x1a); project_pitchx = DSP4_READ_WORD(0x1c); far_plane = DSP4_READ_WORD(0x1e); - // ? = DSP4_READ_WORD(0x20); project_y1low = DSP4_READ_WORD(0x22); // pre-compute @@ -227,7 +131,6 @@ DSP4_WAIT(1) resume1: resume2: plane = DSP4_READ_WORD(0); - py_dy = 0; px_dx = 0; // ignore invalid data @@ -275,10 +178,6 @@ resume2: // debug ++block; -#ifdef PRINT - printf("(line %d) Op01 check %02X, plane %04X, focal_y %04X, y2 %04X\n", c, - (uint16_t)segments, (uint16_t)(plane), (uint16_t)project_focaly, (uint16_t)project_y2); -#endif // prepare output DSP4.out_count = 8 + 2 + 6 * segments; @@ -290,14 +189,6 @@ resume2: DSP4_WRITE_WORD(6, project_y2); DSP4_WRITE_WORD(8, segments); -#if 0 - DSP4_WRITE_WORD(0, -1); - DSP4_WRITE_WORD(2, -1); - DSP4_WRITE_WORD(4, -1); - DSP4_WRITE_WORD(6, -1); - DSP4_WRITE_WORD(8, -1); -#endif - index = 10; // iterate through each point @@ -307,12 +198,6 @@ resume2: y_out = project_y + ((py_dy * lcv) >> 8); x_out = project_x + ((px_dx * lcv) >> 8); -#if 0 - project_ptr = -1; - y_out = -1; - x_out = -1; -#endif - // data DSP4_WRITE_WORD(index + 0, project_ptr); DSP4_WRITE_WORD(index + 2, y_out); @@ -353,12 +238,6 @@ resume2: DSP4.out_count = 0; } -#undef PRINT - -#if OP==0x0007 -#define PRINT -#endif - void DSP4_Op07() { uint16_t command; @@ -405,10 +284,6 @@ void DSP4_Op07() // debug block = 0; -#ifdef PRINT - printf("(line %d) Op07 data %04X\n", c, (uint16_t)project_y1); -#endif - //////////////////////////////////////////////////// // command check @@ -440,7 +315,6 @@ DSP4_WAIT(1) resume1: int16_t py_dy, px_dx; resume2: - py_dy = 0; px_dx = 0; // debug @@ -483,11 +357,6 @@ resume2: px_dx = ((project_x2 - project_x1) << 8) / segments; } -#ifdef PRINT - printf("(line %d) Op07 block %d, loc %04X, out %02X, project_x2 %04X\n", c, - block, plane, segments, (uint16_t)project_x2); -#endif - // prepare pre-output DSP4.out_count = 4 + 2 + 6 * segments; @@ -495,12 +364,6 @@ resume2: DSP4_WRITE_WORD(2, project_y2); DSP4_WRITE_WORD(4, segments); -#if 0 - DSP4_WRITE_WORD(0, -1); - DSP4_WRITE_WORD(2, -1); - DSP4_WRITE_WORD(4, -1); -#endif - index = 6; for (lcv = 0; lcv < segments; lcv++) { @@ -508,12 +371,6 @@ resume2: y_out = project_y + ((py_dy * lcv) >> 8); x_out = project_x + ((px_dx * lcv) >> 8); -#if 0 - project_ptr = -1; - //y_out = -1; - x_out = -1; -#endif - // data DSP4_WRITE_WORD(index + 0, project_ptr); DSP4_WRITE_WORD(index + 2, y_out); @@ -544,12 +401,6 @@ resume2: DSP4.out_count = 0; } -#undef PRINT - -#if OP==0x0008 -#define PRINT -#endif - void DSP4_Op08() { uint16_t command; @@ -688,11 +539,6 @@ DSP4_WAIT(2) resume2: if (pos2 < path_clipLeft[1]) pos2 = path_clipLeft[1]; if (pos2 > path_clipRight[1]) pos2 = path_clipRight[1]; -#if 0 - pos1 = -1; - //pos2=-1; -#endif - path_plane[0] = plane; path_plane[1] = plane; @@ -700,10 +546,6 @@ DSP4_WAIT(2) resume2: DSP4.out_count = 2; DSP4.output[0] = pos1 & 0xFF; DSP4.output[1] = pos2 & 0xFF; - -#ifdef PRINT - printf("(line %d) Op08 x_left %04X\n", c, (uint16_t)x_left); -#endif } // proceed with projection else @@ -750,11 +592,6 @@ DSP4_WAIT(2) resume2: path_plane[0] = plane; } -#ifdef PRINT - printf("(line %d) Op08 block %d, out %02X, raster %02X\n", c, block, segments, - (uint16_t)y_left); -#endif - // zone 1 DSP4.out_count = (2 + 4 * segments); DSP4_WRITE_WORD(index, segments); @@ -774,14 +611,6 @@ DSP4_WAIT(2) resume2: if (pos2 < path_clipLeft[1]) pos2 = path_clipLeft[1]; if (pos2 > path_clipRight[1]) pos2 = path_clipRight[1]; -#if 0 - if (pos1 == 0x00ff) pos1 = 0; - if (pos2 == 0x00ff) pos2 = 0; - path_ptr[0] = -1; - pos1 = -1; - pos2 = -1; -#endif - // data DSP4_WRITE_WORD(index, path_ptr[0]); index += 2; @@ -865,14 +694,6 @@ DSP4_WAIT(2) resume2: if (pos2 < path_clipLeft[3]) pos2 = path_clipLeft[3]; if (pos2 > path_clipRight[3]) pos2 = path_clipRight[3]; -#if 0 - if (pos1 == 0x00ff) pos1 = 0; - if (pos2 == 0x00ff) pos2 = 0; - path_ptr[2] = -1; - //pos1 = -1; - pos2 = -1; -#endif - // data DSP4_WRITE_WORD(index, path_ptr[2]); index += 2; @@ -906,12 +727,6 @@ DSP4_WAIT(2) resume2: DSP4_WRITE_WORD(0, 0); } -#undef PRINT - -#if OP==0x000D -#define PRINT -#endif - void DSP4_Op0D() { uint16_t command; @@ -933,7 +748,6 @@ void DSP4_Op0D() // process initial inputs // sort inputs - // 0x00 = DSP4_READ_WORD(0x00); project_focaly = DSP4_READ_WORD(0x02); raster = DSP4_READ_WORD(0x04); viewport_top = DSP4_READ_WORD(0x06); @@ -944,13 +758,11 @@ void DSP4_Op0D() project_focalx = DSP4_READ_WORD(0x0e); project_centerx = DSP4_READ_WORD(0x10); project_ptr = DSP4_READ_WORD(0x12); - // 0xc0 = DSP4_READ_WORD(0x14); project_pitchylow = DSP4_READ_WORD(0x16); project_pitchy = DSP4_READ_WORD(0x18); project_pitchxlow = DSP4_READ_WORD(0x1a); project_pitchx = DSP4_READ_WORD(0x1c); far_plane = DSP4_READ_WORD(0x1e); - // ? = DSP4_READ_WORD(0x20); // multi-op storage multi_index1++; @@ -1021,7 +833,6 @@ DSP4_WAIT(1) resume1: resume2: plane = DSP4_READ_WORD(0); - py_dy = 0; px_dx = 0; @@ -1071,11 +882,6 @@ resume2: // debug ++block; -#ifdef PRINT - printf("(line %d) Op0D check %02X, plane %04X\n", c, (uint16_t)segments, - (uint16_t)(plane)); -#endif - // prepare output DSP4.out_count = 8 + 2 + 6 * segments; @@ -1084,13 +890,6 @@ resume2: DSP4_WRITE_WORD(4, project_focaly); DSP4_WRITE_WORD(6, project_y2); DSP4_WRITE_WORD(8, segments); -#if 0 - DSP4_WRITE_WORD(0, -1); - DSP4_WRITE_WORD(2, -1); - DSP4_WRITE_WORD(4, -1); - DSP4_WRITE_WORD(6, -1); - DSP4_WRITE_WORD(8, -1); -#endif index = 10; @@ -1101,12 +900,6 @@ resume2: y_out = project_y + ((py_dy * lcv) >> 8); x_out = project_x + ((px_dx * lcv) >> 8); -#if 0 - project_ptr = -1; - //y_out=-1; - x_out = -1; -#endif - // data DSP4_WRITE_WORD(index + 0, project_ptr); DSP4_WRITE_WORD(index + 2, y_out); @@ -1144,16 +937,6 @@ resume2: DSP4.out_count = 0; } -#undef PRINT - -#if OP==0x0009 -#define PRINT -#endif - -#if OP==0x0006 -#define PRINT -#endif - void DSP4_Op09() { uint16_t command; @@ -1196,17 +979,11 @@ void DSP4_Op09() view_plane = PLANE_START; center_x = DSP4_READ_WORD(0x00); center_y = DSP4_READ_WORD(0x02); - // 0x00 = DSP4_READ_WORD(0x04); viewport_left = DSP4_READ_WORD(0x06); viewport_right = DSP4_READ_WORD(0x08); viewport_top = DSP4_READ_WORD(0x0a); viewport_bottom = DSP4_READ_WORD(0x0c); -#ifdef PRINT2 - printf("Window: (%04X,%04X) (%04X,%04X)\n", - viewport_left, viewport_right, viewport_top, viewport_bottom); -#endif - // expand viewport dimensions viewport_left -= 8; @@ -1214,12 +991,10 @@ void DSP4_Op09() multi_index1++; multi_index1 %= 4; -#if 1 // convert track line to the window region project_y2 = center_y + multi_raster[multi_index1] * (viewport_bottom - center_y) / (0x33 - 0); if (op09_mode == 0) project_y2 -= 2; -#endif goto no_sprite; @@ -1278,9 +1053,7 @@ sprite_found: { int16_t plane; int16_t car_left, car_right; - // int16_t car_left_a; int16_t focal_back; -// int16_t focal_front; // we already have 4 bytes we want DSP4.in_count = 6 + 12; @@ -1291,8 +1064,6 @@ DSP4_WAIT(3) resume3: // filter inputs project_y1 = DSP4_READ_WORD(0x00); focal_back = DSP4_READ_WORD(0x06); - // focal_front = DSP4_READ_WORD(0x08); - // car_left_a = DSP4_READ_WORD(0x0a); car_left = DSP4_READ_WORD(0x0c); plane = DSP4_READ_WORD(0x0e); car_right = DSP4_READ_WORD(0x10); @@ -1348,7 +1119,6 @@ DSP4_WAIT(5) resume5: project_y1 = DSP4_READ_WORD(0x00); plane = DSP4_READ_WORD(0x02); project_centerx = DSP4_READ_WORD(0x04); - //project_y1 = DSP4_READ_WORD(0x06); project_focalx = DSP4_READ_WORD(0x08); project_focaly = DSP4_READ_WORD(0x0a); sprite_offset = DSP4_READ_WORD(0x0c); @@ -1387,9 +1157,6 @@ DSP4_WAIT(6) resume6: if (command == 0x0000) { sprite_size = !sprite_size; -#ifdef PRINT - printf("TOGGLE=%02X\n", (uint8_t)sprite_size); -#endif continue; } @@ -1431,12 +1198,6 @@ resume7: if (far_plane <= multi_farplane[multi_index1] && sp_y >= project_y2) clip = true; -#ifdef PRINT2 - printf("(line %d) %04X, %04X, %04X / %04X %04X\n", line, - (uint16_t)sp_x, (uint16_t)sp_y, (uint16_t)far_plane, - (uint16_t)multi_farplane[multi_index1], (uint16_t)project_y2); -#endif - // don't draw offscreen coordinates DSP4.out_count = 0; if (!clip) @@ -1448,12 +1209,6 @@ resume7: sp_oam = sprite_offset + offset; sp_msb = (sp_x < 0 || sp_x > 255); -#ifdef PRINT - printf("(line %d) %04X, %04X, %04X, %04X, %04X\n", line, - (uint16_t)sp_oam, (uint16_t)sprite_offset, (uint16_t)offset, - (uint16_t)sp_x, (uint16_t)sp_y); -#endif - // emit transparency information if ( (sprite_offset & 0x08) && @@ -1493,16 +1248,6 @@ resume7: // OAM: size,msb data DSP4_Op06(sprite_size, (char) sp_msb); - -#if 0 - DSP4_WRITE_WORD(0, -1); - DSP4_WRITE_WORD(2, -1); - DSP4_WRITE_WORD(4, -1); - DSP4_WRITE_WORD(6, -1); - DSP4_WRITE_WORD(8, -1); - DSP4_WRITE_WORD(10, -1); - DSP4_WRITE_WORD(12, -1); -#endif } // no sprite information @@ -1550,6 +1295,3 @@ terminate: DSP4.waiting4command = true; DSP4.out_count = 0; } - -#undef PRINT - diff --git a/source/font.h b/source/font.h index d61fc82..8a4908f 100644 --- a/source/font.h +++ b/source/font.h @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ static const char* font[] = { " . . . . .. . . ", diff --git a/source/fxdbg.c b/source/fxdbg.c index fcff834..1988cff 100644 --- a/source/fxdbg.c +++ b/source/fxdbg.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #include "fxemu.h" #include "fxinst.h" diff --git a/source/fxemu.c b/source/fxemu.c index ecef971..c16ee58 100644 --- a/source/fxemu.c +++ b/source/fxemu.c @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #include "fxemu.h" #include "fxinst.h" #include <stdlib.h> @@ -101,133 +13,21 @@ uint32_t(**fx_ppfFunctionTable)(uint32_t) = 0; void (**fx_ppfPlotTable)() = 0; void (**fx_ppfOpcodeTable)() = 0; -#if 0 -void fx_setCache() -{ - uint32_t c; - GSU.bCacheActive = true; - GSU.pvRegisters[0x3e] &= 0xf0; - c = (uint32_t)GSU.pvRegisters[0x3e]; - c |= ((uint32_t)GSU.pvRegisters[0x3f]) << 8; - if (c == GSU.vCacheBaseReg) - return; - GSU.vCacheBaseReg = c; - GSU.vCacheFlags = 0; - if (c < (0x10000 - 512)) - { - uint8_t const* t = &ROM(c); - memcpy(GSU.pvCache, t, 512); - } - else - { - uint8_t const* t1; - uint8_t const* t2; - uint32_t i = 0x10000 - c; - t1 = &ROM(c); - t2 = &ROM(0); - memcpy(GSU.pvCache, t1, i); - memcpy(&GSU.pvCache[i], t2, 512 - i); - } -} -#endif - void FxCacheWriteAccess(uint16_t vAddress) { -#if 0 - if (!GSU.bCacheActive) - { - uint8_t v = GSU.pvCache[GSU.pvCache[vAddress & 0x1ff]; - fx_setCache(); - GSU.pvCache[GSU.pvCache[vAddress & 0x1ff] = v; - } -#endif - if ((vAddress & 0x00f) == 0x00f) - GSU.vCacheFlags |= 1 << ((vAddress & 0x1f0) >> 4); + if ((vAddress & 0x00f) == 0x00f) + GSU.vCacheFlags |= 1 << ((vAddress & 0x1f0) >> 4); } - void FxFlushCache() +void FxFlushCache() { GSU.vCacheFlags = 0; GSU.vCacheBaseReg = 0; GSU.bCacheActive = false; - // GSU.vPipe = 0x1; -} - -static void fx_backupCache() -{ -#if 0 - uint32_t i; - uint32_t v = GSU.vCacheFlags; - uint32_t c = USEX16(GSU.vCacheBaseReg); - if (v) - for (i = 0; i < 32; i++) - { - if (v & 1) - { - if (c < (0x10000 - 16)) - { - uint8_t* t = &GSU.pvPrgBank[c]; - memcpy(&GSU.avCacheBackup[i << 4], t, 16); - memcpy(t, &GSU.pvCache[i << 4], 16); - } - else - { - uint8_t* t1; - uint8_t* t2; - uint32_t a = 0x10000 - c; - t1 = &GSU.pvPrgBank[c]; - t2 = &GSU.pvPrgBank[0]; - memcpy(&GSU.avCacheBackup[i << 4], t1, a); - memcpy(t1, &GSU.pvCache[i << 4], a); - memcpy(&GSU.avCacheBackup[(i << 4) + a], t2, 16 - a); - memcpy(t2, &GSU.pvCache[(i << 4) + a], 16 - a); - } - } - c = USEX16(c + 16); - v >>= 1; - } -#endif -} - -static void fx_restoreCache() -{ -#if 0 - uint32_t i; - uint32_t v = GSU.vCacheFlags; - uint32_t c = USEX16(GSU.vCacheBaseReg); - if (v) - for (i = 0; i < 32; i++) - { - if (v & 1) - { - if (c < (0x10000 - 16)) - { - uint8_t* t = &GSU.pvPrgBank[c]; - memcpy(t, &GSU.avCacheBackup[i << 4], 16); - memcpy(&GSU.pvCache[i << 4], t, 16); - } - else - { - uint8_t* t1; - uint8_t* t2; - uint32_t a = 0x10000 - c; - t1 = &GSU.pvPrgBank[c]; - t2 = &GSU.pvPrgBank[0]; - memcpy(t1, &GSU.avCacheBackup[i << 4], a); - memcpy(&GSU.pvCache[i << 4], t1, a); - memcpy(t2, &GSU.avCacheBackup[(i << 4) + a], 16 - a); - memcpy(&GSU.pvCache[(i << 4) + a], t2, 16 - a); - } - } - c = USEX16(c + 16); - v >>= 1; - } -#endif } void fx_flushCache() { - fx_restoreCache(); GSU.vCacheFlags = 0; GSU.bCacheActive = false; } @@ -285,10 +85,6 @@ static void fx_readRegisterSpace() i |= ((int)(!!(p[GSU_SCMR] & 0x20))) << 1; GSU.vScreenHeight = GSU.vScreenRealHeight = avHeight[i]; GSU.vMode = p[GSU_SCMR] & 0x03; -#if 0 - if (GSU.vMode == 2) - error illegal color depth GSU.vMode; -#endif if (i == 3) GSU.vScreenSize = (256 / 8) * (256 / 8) * 32; else @@ -298,14 +94,9 @@ static void fx_readRegisterSpace() /* OBJ Mode (for drawing into sprites) */ GSU.vScreenHeight = 256; } -#if 0 - if (GSU.pvScreenBase + GSU.vScreenSize > GSU.pvRam + (GSU.nRamBanks * 65536)) - error illegal address for screen base register -#else if (GSU.pvScreenBase + GSU.vScreenSize > GSU.pvRam + (GSU.nRamBanks * 65536)) GSU.pvScreenBase = GSU.pvRam + (GSU.nRamBanks * 65536) - GSU.vScreenSize; -#endif - GSU.pfPlot = fx_apfPlotTable[GSU.vMode]; + GSU.pfPlot = fx_apfPlotTable[GSU.vMode]; GSU.pfRpix = fx_apfPlotTable[GSU.vMode + 5]; fx_ppfOpcodeTable[0x04c] = GSU.pfPlot; @@ -314,8 +105,6 @@ static void fx_readRegisterSpace() fx_ppfOpcodeTable[0x34c] = GSU.pfRpix; fx_computeScreenPointers(); - - fx_backupCache(); } void fx_dirtySCBR() @@ -483,8 +272,6 @@ static void fx_writeRegisterSpace() p[GSU_RAMBR] = (uint8_t)GSU.vRamBankReg; p[GSU_CBR] = (uint8_t)GSU.vCacheBaseReg; p[GSU_CBR + 1] = (uint8_t)(GSU.vCacheBaseReg >> 8); - - fx_restoreCache(); } /* Reset the FxChip */ @@ -493,30 +280,15 @@ void FxReset(struct FxInit_s* psFxInfo) int i; static uint32_t(**appfFunction[])(uint32_t) = { - &fx_apfFunctionTable[0], -#if 0 - &fx_a_apfFunctionTable[0], - &fx_r_apfFunctionTable[0], - &fx_ar_apfFunctionTable[0], -#endif + &fx_apfFunctionTable[0] }; static void (**appfPlot[])() = { - &fx_apfPlotTable[0], -#if 0 - &fx_a_apfPlotTable[0], - &fx_r_apfPlotTable[0], - &fx_ar_apfPlotTable[0], -#endif + &fx_apfPlotTable[0] }; static void (**appfOpcode[])() = { - &fx_apfOpcodeTable[0], -#if 0 - &fx_a_apfOpcodeTable[0], - &fx_r_apfOpcodeTable[0], - &fx_ar_apfOpcodeTable[0], -#endif + &fx_apfOpcodeTable[0] }; /* Get function pointers for the current emulation mode */ @@ -624,22 +396,12 @@ int FxEmulate(uint32_t nInstructions) { CF(G); fx_writeRegisterSpace(); -#if 0 - GSU.vIllegalAddress = (GSU.vPrgBankReg << 24) | R15; - return FX_ERROR_ILLEGAL_ADDRESS; -#else return 0; -#endif } /* Execute GSU session */ CF(IRQ); - /* - if (GSU.bBreakPoint) - vCount = fx_ppfFunctionTable[FX_FUNCTION_RUN_TO_BREAKPOINT](nInstructions); - else - */ vCount = fx_ppfFunctionTable[FX_FUNCTION_RUN](nInstructions); /* Store GSU registers */ @@ -652,18 +414,6 @@ int FxEmulate(uint32_t nInstructions) return vCount; } -/* Breakpoints */ -/* -void FxBreakPointSet(uint32_t vAddress) -{ - GSU.bBreakPoint = true; - GSU.vBreakPoint = USEX16(vAddress); -} -void FxBreakPointClear() -{ - GSU.bBreakPoint = false; -}*/ - /* Step by step execution */ int FxStepOver(uint32_t nInstructions) { @@ -674,12 +424,7 @@ int FxStepOver(uint32_t nInstructions) if (!fx_checkStartAddress()) { CF(G); -#if 0 - GSU.vIllegalAddress = (GSU.vPrgBankReg << 24) | R15; - return FX_ERROR_ILLEGAL_ADDRESS; -#else return 0; -#endif } if (PIPE >= 0xf0) diff --git a/source/fxemu.h b/source/fxemu.h index fcc1ee0..5b1efac 100644 --- a/source/fxemu.h +++ b/source/fxemu.h @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #ifndef _FXEMU_H_ #define _FXEMU_H_ 1 @@ -114,10 +26,6 @@ extern int FxEmulate(uint32_t nInstructions); extern void FxCacheWriteAccess(uint16_t vAddress); extern void FxFlushCache(); /* Callled when the G flag in SFR is set to zero */ -/* Breakpoint */ -//extern void FxBreakPointSet(uint32_t vAddress); -//extern void FxBreakPointClear(); - /* Step by step execution */ extern int FxStepOver(uint32_t nInstructions); diff --git a/source/fxinst.c b/source/fxinst.c index ee16a54..05ebba2 100644 --- a/source/fxinst.c +++ b/source/fxinst.c @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #define FX_DO_ROMBUFFER #include "fxemu.h" @@ -148,23 +60,6 @@ static void fx_cache() fx_flushCache(); GSU.vCacheBaseReg = c; GSU.bCacheActive = true; -#if 0 - if (c < (0x10000 - 512)) - { - uint8_t const* t = &ROM(c); - memcpy(GSU.pvCache, t, 512); - } - else - { - uint8_t const* t1; - uint8_t const* t2; - uint32_t i = 0x10000 - c; - t1 = &ROM(c); - t2 = &ROM(0); - memcpy(GSU.pvCache, t1, i); - memcpy(&GSU.pvCache[i], t2, 512 - i); - } -#endif } R15++; CLRFLAGS; @@ -3349,11 +3244,6 @@ static uint32_t fx_run(uint32_t nInstructions) READR14; while (TF(G) && (GSU.vCounter-- > 0)) FX_STEP; - /* - #ifndef FX_ADDRESS_CHECK - GSU.vPipeAdr = USEX16(R15-1) | (USEX8(GSU.vPrgBankReg)<<16); - #endif - */ return (nInstructions - GSU.vInstCount); } @@ -3370,11 +3260,6 @@ static uint32_t fx_run_to_breakpoint(uint32_t nInstructions) break; } } - /* - #ifndef FX_ADDRESS_CHECK - GSU.vPipeAdr = USEX16(R15-1) | (USEX8(GSU.vPrgBankReg)<<16); - #endif - */ return vCounter; } @@ -3393,11 +3278,6 @@ static uint32_t fx_step_over(uint32_t nInstructions) if (USEX16(R15) == GSU.vStepPoint) break; } - /* - #ifndef FX_ADDRESS_CHECK - GSU.vPipeAdr = USEX16(R15-1) | (USEX8(GSU.vPrgBankReg)<<16); - #endif - */ return vCounter; } @@ -3643,4 +3523,3 @@ void (*fx_apfOpcodeTable[])() = &fx_lm_r0, &fx_lm_r1, &fx_lm_r2, &fx_lm_r3, &fx_lm_r4, &fx_lm_r5, &fx_lm_r6, &fx_lm_r7, &fx_lm_r8, &fx_lm_r9, &fx_lm_r10, &fx_lm_r11, &fx_lm_r12, &fx_lm_r13, &fx_lm_r14, &fx_lm_r15, }; - diff --git a/source/fxinst.h b/source/fxinst.h index cabf7ac..4e66a54 100644 --- a/source/fxinst.h +++ b/source/fxinst.h @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #ifndef _FXINST_H_ #define _FXINST_H_ 1 diff --git a/source/getset.h b/source/getset.h index 78e4cfe..8939e76 100644 --- a/source/getset.h +++ b/source/getset.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _GETSET_H_ #define _GETSET_H_ @@ -139,7 +50,6 @@ INLINE uint8_t S9xGetByte(uint32_t Address) //unbound & SRAMMask = Sram offset return (*(Memory.SRAM + ((((Address & 0xFF0000) >> 1) | (Address & 0x7FFF)) &Memory.SRAMMask))); - // return (*(Memory.SRAM + ((Address & Memory.SRAMMask)))); case MAP_RONLY_SRAM: case MAP_HIROM_SRAM: @@ -242,9 +152,6 @@ INLINE uint16_t S9xGetWord(uint32_t Address) ((*(Memory.SRAM + (((((Address + 1) & 0xFF0000) >> 1) | (( Address + 1) & 0x7FFF)) &Memory.SRAMMask))) << 8); - //return (*(uint16_t*)(Memory.SRAM + ((((Address&0xFF0000)>>1)|(Address&0x7FFF)) & Memory.SRAMMask));// | - // (*(Memory.SRAM + ((Address + 1) & Memory.SRAMMask)) << 8)); - case MAP_RONLY_SRAM: case MAP_HIROM_SRAM: /* BJ: no FAST_LSB_WORD_ACCESS here, since if Memory.SRAMMask=0x7ff @@ -350,7 +257,6 @@ INLINE void S9xSetByte(uint8_t Byte, uint32_t Address) { *(Memory.SRAM + ((((Address & 0xFF0000) >> 1) | (Address & 0x7FFF))& Memory.SRAMMask)) = Byte; - // *(Memory.SRAM + (Address & Memory.SRAMMask)) = Byte; CPU.SRAMModified = true; } return; @@ -484,8 +390,6 @@ INLINE void S9xSetWord(uint16_t Word, uint32_t Address) *(Memory.SRAM + (((((Address + 1) & 0xFF0000) >> 1) | (( Address + 1) & 0x7FFF))& Memory.SRAMMask)) = Word >> 8; - // *(Memory.SRAM + (Address & Memory.SRAMMask)) = (uint8_t) Word; - // *(Memory.SRAM + ((Address + 1) & Memory.SRAMMask)) = Word >> 8; CPU.SRAMModified = true; } return; @@ -577,11 +481,9 @@ INLINE uint8_t* GetBasePointer(uint32_t Address) case MAP_PPU: //just a guess, but it looks like this should match the CPU as a source. return (Memory.FillRAM); - // return (Memory.FillRAM - 0x2000); case MAP_CPU: //fixes Ogre Battle's green lines return (Memory.FillRAM); - // return (Memory.FillRAM - 0x4000); case MAP_DSP: return (Memory.FillRAM - 0x6000); case MAP_SA1RAM: diff --git a/source/gfx.c b/source/gfx.c index d61bb09..5613c49 100644 --- a/source/gfx.c +++ b/source/gfx.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #include "snes9x.h" @@ -355,8 +266,6 @@ bool S9xInitGFX() GFX.ZPitch >>= 1; GFX.Delta = (GFX.SubScreen - GFX.Screen) >> 1; GFX.DepthDelta = GFX.SubZBuffer - GFX.ZBuffer; - //GFX.InfoStringTimeout = 0; - //GFX.InfoString = NULL; PPU.BG_Forced = 0; IPPU.OBJChanged = true; @@ -943,13 +852,11 @@ void S9xSetupOBJ() /* First, find out which sprites are on which lines */ uint8_t OBJOnLine[SNES_HEIGHT_EXTENDED][128]; - // memset(OBJOnLine, 0, sizeof(OBJOnLine)); - /* Hold on here, that's a lot of bytes to initialise at once! - * So we only initialise them per line, as needed. [Neb] + /* We only initialise this per line, as needed. [Neb] * Bonus: We can quickly avoid looping if a line has no OBJs. */ bool AnyOBJOnLine[SNES_HEIGHT_EXTENDED]; - memset(AnyOBJOnLine, false, sizeof(AnyOBJOnLine)); // better + memset(AnyOBJOnLine, false, sizeof(AnyOBJOnLine)); for (S = 0; S < 128; S++) { @@ -998,7 +905,7 @@ void S9xSetupOBJ() int j, Y; for (Y = 0; Y < SNES_HEIGHT_EXTENDED; Y++) { - GFX.OBJLines[Y].RTOFlags = Y ? 0 : GFX.OBJLines[Y - 1].RTOFlags; + GFX.OBJLines[Y].RTOFlags = Y ? GFX.OBJLines[Y - 1].RTOFlags : 0; GFX.OBJLines[Y].Tiles = 34; j = 0; @@ -1604,7 +1511,6 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8 for (Y = GFX.StartY; Y <= GFX.EndY; Y++) { uint32_t VOff = LineData [Y].BG[2].VOffset - 1; - // uint32_t VOff = LineData [Y].BG[2].VOffset; uint32_t HOff = LineData [Y].BG[2].HOffset; int VirtAlign; @@ -1662,7 +1568,6 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8 uint32_t VOffset; uint32_t HOffset; - //added: uint32_t LineHOffset = LineData [Y].BG[bg].HOffset; uint32_t Offset; @@ -1695,8 +1600,6 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8 VOffset = LineData [Y].BG[bg].VOffset; //MKendora; use temp var to reduce memory accesses - //HOffset = LineData [Y].BG[bg].HOffset; - HOffset = LineHOffset; //End MK @@ -1721,8 +1624,7 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8 { VOffset = LineData [Y].BG[bg].VOffset; - //MKendora another mem access hack - //HOffset = LineData [Y].BG[bg].HOffset; + //MKendora; use temp var to reduce memory accesses HOffset = LineHOffset; //end MK @@ -1744,17 +1646,9 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8 //MKendora Strike Gunner fix if ((HCellOffset & OffsetEnableMask)) - { - //HOffset= HCellOffset; - HOffset = (HCellOffset & ~7) | (LineHOffset & 7); - //HOffset |= LineData [Y].BG[bg].HOffset&7; - } else HOffset = LineHOffset; - //HOffset = LineData [Y].BG[bg].HOffset - - //Settings.StrikeGunnerOffsetHack; - //HOffset &= (~7); //end MK } } @@ -1804,7 +1698,6 @@ static void DrawBackgroundOffset(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8 Offset = HPos & 7; - //Count =1; Count = 8 - Offset; if (Count > MaxCount) Count = MaxCount; @@ -1905,19 +1798,12 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2) int Lines; -// int VOffsetMask; int VOffsetShift; if (BG.TileSize == 16) - { -// VOffsetMask = 0x3ff; VOffsetShift = 4; - } else - { -// VOffsetMask = 0x1ff; VOffsetShift = 3; - } int endy = IPPU.Interlace ? 1 + (GFX.EndY << 1) : GFX.EndY; int Y; @@ -2184,7 +2070,6 @@ static void DrawBackgroundMode5(uint32_t bg, uint8_t Z1, uint8_t Z2) } GFX.Pitch = IPPU.DoubleHeightPixels ? GFX.RealPitch * 2 : GFX.RealPitch; GFX.PPL = IPPU.DoubleHeightPixels ? GFX.PPLx2 : (GFX.PPLx2 >> 1); - } static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2) @@ -2218,14 +2103,10 @@ static void DrawBackground(uint32_t BGMode, uint32_t bg, uint8_t Z1, uint8_t Z2) case 5: case 6: // XXX: is also offset per tile. - // if (Settings.SupportHiRes) - // { if (!Settings.SupportHiRes) SelectTileRenderer(true /* normal */); DrawBackgroundMode5(bg, Z1, Z2); return; - // } - break; } uint32_t Tile; @@ -3386,20 +3267,7 @@ void DisplayChar(uint8_t* Screen, uint8_t c) uint8_t p = font [line][offset + w]; if (p == '#') - { - /* - if(Memory.Hacked) - *s= BUILD_PIXEL(31,0,0); - else if(Memory.Iffy) - *s= BUILD_PIXEL(31,31,0); - else if(Memory.Iformat==1) - *s= BUILD_PIXEL(0,31,0); - else if(Memory.Iformat==2) - *s= BUILD_PIXEL(0,31,31); - else *s = 0xffff; - */ *s = Settings.DisplayColor; - } else if (p == '.') *s = BLACK; } @@ -3974,5 +3842,3 @@ void S9xUpdateScreen(void) IPPU.PreviousLine = IPPU.CurrentLine; } - - diff --git a/source/gfx.h b/source/gfx.h index ccaefcf..663a4c3 100644 --- a/source/gfx.h +++ b/source/gfx.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _GFX_H_ #define _GFX_H_ @@ -110,11 +21,7 @@ extern struct SGFX GFX; bool S9xInitGFX(); void S9xDeinitGFX(); bool S9xInitUpdate(void); -#if 0 -void S9xSyncSpeed(); -#else #define S9xSyncSpeed() -#endif struct SGFX diff --git a/source/globals.c b/source/globals.c index 3381046..07df507 100644 --- a/source/globals.c +++ b/source/globals.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #include "snes9x.h" #include "memmap.h" diff --git a/source/memmap.c b/source/memmap.c index 1eb9ff9..a91f68e 100644 --- a/source/memmap.c +++ b/source/memmap.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #include <string.h> #ifdef HAVE_STRINGS_H @@ -113,12 +24,6 @@ #include "spc7110.h" #include "seta.h" -#ifdef DS2_DMA -//#include "ds2_cpu.h" -//#include "ds2_dma.h" -//#include "dma_adj.h" -#endif - #ifdef __W32_HEAP #include <malloc.h> #endif @@ -436,9 +341,7 @@ bool S9xInitMemory() memset(Memory.RAM, 0, 0x20000); memset(Memory.SRAM, 0, 0x20000); memset(Memory.VRAM, 0, 0x10000); - // This needs to be initialised with a ROM first anyway, so don't - // bother memsetting. [Neb] - // memset (ROM, 0, MAX_ROM_SIZE + 0x200 + 0x8000); + // Don't bother memsetting ROM, we will load a game anyway. [Neb] Memory.BSRAM = (uint8_t*) malloc(0x80000); memset(Memory.BSRAM, 0, 0x80000); @@ -922,6 +825,39 @@ again: S9xMessage(S9X_ERROR, S9X_ROM_CONFUSING_FORMAT_INFO, "Warning! Hacked Dump!"); } +#ifndef NO_SPEEDHACKS + // SNESAdvance speed hacks (from the speed-hacks branch of CatSFC) + if (strncmp("YOSHI'S ISLAND", (char *) &Memory.ROM[0x7FC0], 14) == 0) + { + Memory.ROM[0x0000F4] = 0x42; Memory.ROM[0x0000F5] = 0x3B; + } + else if (strncmp("SUPER MARIOWORLD", (char *) &Memory.ROM[0x7FC0], 16) == 0) + { + Memory.ROM[0x00006D] = 0x42; + } + else if (strncmp("ALL_STARS + WORLD", (char *) &Memory.ROM[0x7FC0], 17) == 0) + { + Memory.ROM[0x0003D0] = 0x42; Memory.ROM[0x0003D1] = 0x5B; + Memory.ROM[0x018522] = 0x42; Memory.ROM[0x018523] = 0x5B; + Memory.ROM[0x02C804] = 0x42; Memory.ROM[0x02C805] = 0xBA; + Memory.ROM[0x0683B5] = 0x42; Memory.ROM[0x0683B6] = 0x5B; + Memory.ROM[0x0696AC] = 0x42; Memory.ROM[0x0696AD] = 0xBA; + Memory.ROM[0x089233] = 0xDB; Memory.ROM[0x089234] = 0x61; + Memory.ROM[0x0895DF] = 0x42; Memory.ROM[0x0895E0] = 0x5B; + Memory.ROM[0x0A7A9D] = 0x42; Memory.ROM[0x0A7A9E] = 0xBA; + Memory.ROM[0x1072E7] = 0x42; Memory.ROM[0x1072E8] = 0xD9; + Memory.ROM[0x107355] = 0x42; Memory.ROM[0x107356] = 0x5B; + Memory.ROM[0x1073CF] = 0x42; Memory.ROM[0x1073D0] = 0x5B; + Memory.ROM[0x107443] = 0x42; Memory.ROM[0x107444] = 0x5B; + Memory.ROM[0x107498] = 0x42; Memory.ROM[0x107499] = 0x5B; + Memory.ROM[0x107505] = 0x42; Memory.ROM[0x107506] = 0x5B; + Memory.ROM[0x107539] = 0x42; Memory.ROM[0x10753A] = 0x5B; + Memory.ROM[0x107563] = 0x42; Memory.ROM[0x107564] = 0x5B; + Memory.ROM[0x1801D4] = 0x42; Memory.ROM[0x1801D5] = 0x10; + Memory.ROM[0x18041D] = 0x42; Memory.ROM[0x18041E] = 0x79; + } +#endif + int hi_score=ScoreHiROM(true, 0); int lo_score=ScoreLoROM(true, 0); @@ -948,9 +884,6 @@ again: TotalFileSize -= 512; S9xMessage(S9X_INFO, S9X_HEADER_WARNING, "Try specifying the -nhd command line option if the game doesn't work\n"); - //modifying ROM, so we need to rescore - hi_score = ScoreHiROM(false, 0); - lo_score = ScoreLoROM(false, 0); } Memory.CalculatedSize = TotalFileSize & ~0x1FFF; // round down to lower 0x2000 @@ -1010,8 +943,6 @@ again: hi_score = hiromscore; RomHeader = Memory.ROM; } - - } Interleaved = Settings.ForceInterleaved || Settings.ForceInterleaved2; @@ -1328,7 +1259,6 @@ void InitROM(bool Interleaved) memset(Memory.BlockIsRAM, 0, MEMMAP_NUM_BLOCKS); memset(Memory.BlockIsROM, 0, MEMMAP_NUM_BLOCKS); - Memory.SRAM = Memory.SRAM; memset(Memory.ROMId, 0, 5); memset(Memory.CompanyId, 0, 3); @@ -1412,11 +1342,8 @@ void InitROM(bool Interleaved) SetaDSPMap(); else if (Settings.SuperFX) { - //::SRAM = ROM + 1024 * 1024 * 4; SuperFXROMMap(); Settings.MultiPlayer5Master = false; - //Settings.MouseMaster = false; - //Settings.SuperScopeMaster = false; Settings.DSP1Master = false; Settings.SA1 = false; Settings.C4 = false; @@ -1427,9 +1354,6 @@ void InitROM(bool Interleaved) (Memory.ROMType & 0xf) > 3 && (Memory.ROMType & 0xf0) == 0x30)) { Settings.SA1 = true; - // Settings.MultiPlayer5Master = false; - //Settings.MouseMaster = false; - //Settings.SuperScopeMaster = false; Settings.DSP1Master = false; Settings.C4 = false; Settings.SDD1 = false; @@ -2053,16 +1977,11 @@ void BSLoROMMap() Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU; Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU; Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) Memory.RAM; - // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) Memory.SRAM; Memory.BlockIsRAM [c + 5] = Memory.BlockIsRAM [c + 0x805] = true; - // Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t *)MAP_NONE; - // Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t *)MAP_NONE; Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) Memory.RAM; - // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) SRAM; Memory.BlockIsRAM [c + 6] = Memory.BlockIsRAM [c + 0x806] = true; Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) Memory.RAM; - // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) Memory.SRAM; Memory.BlockIsRAM [c + 7] = Memory.BlockIsRAM [c + 0x807] = true; for (i = c + 8; i < c + 16; i++) { @@ -2079,22 +1998,6 @@ void BSLoROMMap() Memory.BlockIsRAM [(c << 4) + 0x105] = true; } - - /* // Banks 40->7f and c0->ff - for (c = 0; c < 0x400; c += 16) - { - for (i = c; i < c + 8; i++) - Map [i + 0x400] = Map [i + 0xc00] = &ROM [(c << 11) % CalculatedSize]; - - for (i = c + 8; i < c + 16; i++) - Map [i + 0x400] = Map [i + 0xc00] = &ROM [((c << 11) + 0x200000) % CalculatedSize - 0x8000]; - - for (i = c; i < c + 16; i++) - { - BlockIsROM [i + 0x400] = BlockIsROM [i + 0xc00] = true; - } - } - */ for (c = 1; c <= 4; c++) { for (i = 0; i < 16; i++) @@ -2130,8 +2033,6 @@ void BSLoROMMap() } MapRAM(); WriteProtectROM(); - - } void HiROMMap() @@ -2746,407 +2647,6 @@ void SufamiTurboLoROMMap() WriteProtectROM(); } -#if 0 - -//untested!! -void SameGameMap() -{ - int i; - int c; - int j; - - int mask[4]; - int mask2[4]; - for (j = 0; j < 4; j++) - mask[j] = mask2[j] = 0x00ff; - - mask[0] = (CalculatedSize / 0x10000) - 1; - mask2[0] = (Slot1Size / 0x10000) - 1; - - int x; - bool foundZeros; - bool pastZeros; - - for (j = 0; j < 3; j++) - { - x = 1; - foundZeros = false; - pastZeros = false; - - mask[j + 1] = mask[j]; - - while (x > 0x100 && !pastZeros) - { - if (mask[j]&x) - { - x <<= 1; - if (foundZeros) - pastZeros = true; - } - else - { - foundZeros = true; - pastZeros = false; - mask[j + 1] |= x; - x <<= 1; - } - } - } - - for (j = 0; j < 3; j++) - { - x = 1; - foundZeros = false; - pastZeros = false; - - mask2[j + 1] = mask2[j]; - - while (x > 0x100 && !pastZeros) - { - if (mask2[j]&x) - { - x <<= 1; - if (foundZeros) - pastZeros = true; - } - else - { - foundZeros = true; - pastZeros = false; - mask2[j + 1] |= x; - x <<= 1; - } - } - } - - - // Banks 00->3f and 80->bf - for (c = 0; c < 0x400; c += 16) - { - Memory.Map [c + 0] = Memory.Map [c + 0x800] = RAM; - Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true; - Memory.Map [c + 1] = Memory.Map [c + 0x801] = RAM; - Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true; - - Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU; - Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU; - Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU; - Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU; - - Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_NONE; - Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE; - } - - // Banks 30->3f and b0->bf, address ranges 6000->7fff is S-RAM. - for (c = 0; c < 16; c++) - { - Memory.Map [0x306 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM; - Memory.Map [0x307 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM; - Memory.Map [0xb06 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM; - Memory.Map [0xb07 + (c << 4)] = (uint8_t*) MAP_HIROM_SRAM; - Memory.BlockIsRAM [0x306 + (c << 4)] = true; - Memory.BlockIsRAM [0x307 + (c << 4)] = true; - Memory.BlockIsRAM [0xb06 + (c << 4)] = true; - Memory.BlockIsRAM [0xb07 + (c << 4)] = true; - } - - for c = 0; -c < 0x200; -c += 16) -{ - for (i = 0; i < 8; i++) - { - int e = 3; - int d = c >> 4; - while (d > mask[0]) - { - d &= mask[e]; - e--; - } - - int f = 3; - int g = c >> 4; - while (g > mask2[0]) - { - g &= mask2[f]; - f--; - } - - //stuff in HiROM areas - Memory.Map[c + 0x400 + i] = &ROM[d * 0x10000]; - Memory.Map[c + 0xC00 + i] = &ROM[d * 0x10000]; - //MINI - Memory.Map[c + 0x600 + i] = &ROMOffset1[g * 0x10000]; - Memory.Map[c + 0xE00 + i] = &ROMOffset1[g * 0x10000]; - - } - for (i = 8; i < 16; i++) - { - int e = 3; - int d = c >> 4; - while (d > mask[0]) - { - d &= mask[e]; - e--; - } - - int f = 3; - int g = c >> 4; - while (g > mask2[0]) - { - g &= mask2[f]; - f--; - } - - - //all stuff - //BASE - Memory.Map[c + i] = &ROM[d * 0x10000]; - Memory.Map[c + 0x800 + i] = &ROM[d * 0x10000]; - Memory.Map[c + 0x400 + i] = &ROM[d * 0x10000]; - Memory.Map[c + 0xC00 + i] = &ROM[d * 0x10000]; - //MINI - Memory.Map[c + 0x200 + i] = &ROMOffset1[g * 0x10000]; - Memory.Map[c + 0xA00 + i] = &ROMOffset1[g * 0x10000]; - Memory.Map[c + 0x600 + i] = &ROMOffset1[g * 0x10000]; - Memory.Map[c + 0xE00 + i] = &ROMOffset1[g * 0x10000]; - } - - } - - int bankmax = 0x40 + (1 << (ROMSize - 6)); - //safety for corrupt headers - if (bankmax > 128) - bankmax = 0x80; - int sum = 0; - for (i = 0x40; i < bankmax; i++) -{ - uint8_t* bank_low = (uint8_t*)Memory.Map[i << 4]; - for (c = 0; c < 0x10000; c++) - sum += bank_low[c]; - } - CalculatedChecksum = sum & 0xFFFF; - - MapRAM(); - WriteProtectROM(); -} - - -//Untested!! -void GNextROMMap() -{ - int c; - int i; - - // Banks 00->3f and 80->bf - for (c = 0; c < 0x400; c += 16) - { - Memory.Map [c + 0] = Memory.Map [c + 0x800] = RAM; - Memory.Map [c + 1] = Memory.Map [c + 0x801] = RAM; - Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true; - Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true; - - Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU; - Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) &Memory.FillRAM [0x3000] - - 0x3000; - Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU; - Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU; - Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_BWRAM; - Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_BWRAM; - for (i = c + 8; i < c + 16; i++) - { - Memory.Map [i] = Memory.Map [i + 0x800] = &ROM [c << 11] - 0x8000; - BlockIsROM [i] = BlockIsROM [i + 0x800] = true; - } - } - - - // Banks 40->4f (was 7f, but SNES docs and GNext overdumping shows nothing here.) - for (c = 0; c < 0x100; c += 16) - { - for (i = c; i < c + 16; i++) - Memory.Map [i + 0x400] = (uint8_t*) &SRAM [(c << 12) & 0x1ffff]; - - for (i = c; i < c + 16; i++) - BlockIsROM [i + 0x400] = false; - } - - for (c = 0; c < 0x100; c += 16) - { - for (i = c; i < c + 16; i++) - Memory.Map [i + 0x700] = (uint8_t*) &ROMOffset1 [(c << 12) & (Slot1Size - 1)]; - } - - // c0->ff - for (c = 0; c < 0x400; c += 16) - { - for (i = c; i < c + 16; i++) - { - Memory.Map [i + 0xc00] = &ROM [(c << 12) % CalculatedSize]; - BlockIsROM [i + 0xc00] = true; - } - } - - for (c = 0; c < 16; c++) - { - Memory.Map [c + 0x7e0] = RAM; - Memory.Map [c + 0x7f0] = RAM + 0x10000; - Memory.BlockIsRAM [c + 0x7e0] = true; - Memory.BlockIsRAM [c + 0x7f0] = true; - BlockIsROM [c + 0x7e0] = false; - BlockIsROM [c + 0x7f0] = false; - } - WriteProtectROM(); - - // Now copy the map and correct it for the SA1 CPU. - // memmove converted: Different mallocs [Neb] - memcpy((void*) SA1.WriteMap, (void*) WriteMap, sizeof(WriteMap)); - // memmove converted: Different mallocs [Neb] - memcpy((void*) SA1.Map, (void*) Memory.Map, sizeof(Memory.Map)); - - // Banks 00->3f and 80->bf - for (c = 0; c < 0x400; c += 16) - { - SA1.Map [c + 0] = SA1.Map [c + 0x800] = &Memory.FillRAM [0x3000]; - SA1.Map [c + 1] = SA1.Map [c + 0x801] = (uint8_t*) MAP_NONE; - SA1.WriteMap [c + 0] = SA1.WriteMap [c + 0x800] = &Memory.FillRAM [0x3000]; - SA1.WriteMap [c + 1] = SA1.WriteMap [c + 0x801] = (uint8_t*) MAP_NONE; - } - - // Banks 60->6f - for (c = 0; c < 0x100; c++) - SA1.Map [c + 0x600] = SA1.WriteMap [c + 0x600] = (uint8_t*) MAP_BWRAM_BITMAP; - - BWRAM = SRAM; -} - -void SufamiTurboAltROMMap() -{ - int c; - int i; - - if (Slot1Size != 0) - Slot1SRAMSize = (1 << ((uint8_t)ROMOffset1[0x32])) * 1024; - else Slot1Size = 0x8000; - if (Slot2Size != 0) - Slot2SRAMSize = (1 << ((uint8_t)ROMOffset2[0x32])) * 1024; - else Slot2Size = 0x8000; - - // Banks 00->3f and 80->bf - for (c = 0; c < 0x400; c += 16) - { - Memory.Map [c + 0] = Memory.Map [c + 0x800] = RAM; - Memory.Map [c + 1] = Memory.Map [c + 0x801] = RAM; - Memory.BlockIsRAM [c + 0] = Memory.BlockIsRAM [c + 0x800] = true; - Memory.BlockIsRAM [c + 1] = Memory.BlockIsRAM [c + 0x801] = true; - - Memory.Map [c + 2] = Memory.Map [c + 0x802] = (uint8_t*) MAP_PPU; - Memory.Map [c + 3] = Memory.Map [c + 0x803] = (uint8_t*) MAP_PPU; - Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU; - Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU; - Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) MAP_NONE; - Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE; - - // for (i = c + 8; i < c + 16; i++) - // { - // Memory.Map [i] = Memory.Map [i + 0x800] = &ROM [c << 11] - 0x8000; - // BlockIsROM [i] = BlockIsROM [i + 0x800] = true; - // } - - } - - //Map Bios - - for (c = 0; c < 0x200; c += 16) - { - for (i = c + 8; i < c + 16; i++) - { - Memory.Map [i] = Memory.Map [i + 0x800] = &ROM [((c >> 4) * 0x8000) % - CalculatedSize] - 0x8000; - BlockIsROM [i] = BlockIsROM [i + 0x800] = true; - } - - } - - - for (c = 0x200; c < 0x400; c += 16) - { - for (i = c + 8; i < c + 16; i++) - { - if (Slot1Size != 0) - { - Memory.Map [i] = Memory.Map [i + 0x800] = &ROMOffset1 [((( - c >> 4) * 0x8000) % Slot1Size)] - 0x8000; - BlockIsROM [i] = BlockIsROM [i + 0x800] = true; - } - else Memory.Map [i] = Memory.Map [i + 0x800] = (uint8_t*)MAP_NONE; - } - - } - - for (c = 0x400; c < 0x600; c += 16) - { - for (i = c; i < c + 8; i++) - { - if (Slot2Size != 0) - { - Memory.Map [i] = Memory.Map [i + 0x800] = &ROMOffset2[((( - c >> 4) * 0x8000) % Slot2Size)]; - BlockIsROM [i] = BlockIsROM [i + 0x800] = true; - } - else Memory.Map [i] = Memory.Map [i + 0x800] = (uint8_t*)MAP_NONE; - - } - for (i = c + 8; i < c + 16; i++) - { - if (Slot2Size != 0) - { - Memory.Map [i] = Memory.Map [i + 0x800] = &ROMOffset2[((( - c >> 4) * 0x8000) % Slot2Size)] - 0x8000; - BlockIsROM [i] = BlockIsROM [i + 0x800] = true; - } - else Memory.Map [i] = Memory.Map [i + 0x800] = (uint8_t*)MAP_NONE; - - } - - } - - // Banks 60->67 (7F?), S-RAM - if (Slot1SRAMSize != 0) - { - for (c = 0; c < 0x100; c++) - { - Memory.Map [c + 0xE00] = Memory.Map [c + 0x600] = (uint8_t*) MAP_LOROM_SRAM; - Memory.BlockIsRAM [c + 0xE00] = Memory.BlockIsRAM [c + 0x600] = true; - BlockIsROM [c + 0xE00] = BlockIsROM [c + 0x600] = false; - } - } - if (Slot2SRAMSize != 0) - { - for (c = 0; c < 0x100; c++) - { - Memory.Map [c + 0xF00] = Memory.Map [c + 0x700] = (uint8_t*) MAP_LOROM_SRAM; - Memory.BlockIsRAM [c + 0xF00] = Memory.BlockIsRAM [c + 0x700] = true; - BlockIsROM [c + 0xF00] = BlockIsROM [c + 0x700] = false; - } - } - - // Banks 7e->7f, RAM - for (c = 0; c < 16; c++) - { - Memory.Map [c + 0x7e0] = RAM; - Memory.Map [c + 0x7f0] = RAM + 0x10000; - Memory.BlockIsRAM [c + 0x7e0] = true; - Memory.BlockIsRAM [c + 0x7f0] = true; - BlockIsROM [c + 0x7e0] = false; - BlockIsROM [c + 0x7f0] = false; - } - - WriteProtectROM(); -} -#endif - - void SRAM512KLoROMMap() { int c; @@ -3213,16 +2713,11 @@ void BSHiROMMap() Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU; // XXX: How large is SRAM?? Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) Memory.RAM; - // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) SRAM; Memory.BlockIsRAM [c + 5] = Memory.BlockIsRAM [c + 0x805] = true; - // Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t *) MAP_NONE; - // Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t *) MAP_NONE; Memory.Map [c + 6] = Memory.Map [c + 0x806] = (uint8_t*) Memory.RAM; - // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) SRAM; Memory.BlockIsRAM [c + 6] = Memory.BlockIsRAM [c + 0x806] = true; Memory.Map [c + 7] = Memory.Map [c + 0x807] = (uint8_t*) Memory.RAM; - // Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t *) Memory.SRAM; Memory.BlockIsRAM [c + 7] = Memory.BlockIsRAM [c + 0x807] = true; for (i = c + 8; i < c + 16; i++) @@ -3289,13 +2784,11 @@ void JumboLoROMMap(bool Interleaved) int i; uint32_t OFFSET0 = 0x400000; -// uint32_t OFFSET1 = 0x400000; uint32_t OFFSET2 = 0x000000; if (Interleaved) { OFFSET0 = 0x000000; -// OFFSET1 = 0x000000; OFFSET2 = Memory.CalculatedSize - 0x400000; //changed to work with interleaved DKJM2. } @@ -3406,8 +2899,8 @@ void SPC7110HiROMMap() Memory.Map [c + 4] = Memory.Map [c + 0x804] = (uint8_t*) MAP_CPU; Memory.Map [c + 5] = Memory.Map [c + 0x805] = (uint8_t*) MAP_CPU; - Memory.Map [c + 6] /*= Memory.Map [c + 0x806]*/ = (uint8_t*) MAP_HIROM_SRAM; - Memory.Map [c + 7] /*= Memory.Map [c + 0x807]*/ = (uint8_t*) MAP_HIROM_SRAM; + Memory.Map [c + 6] = (uint8_t*) MAP_HIROM_SRAM; + Memory.Map [c + 7] = (uint8_t*) MAP_HIROM_SRAM; Memory.Map [c + 0x806] = Memory.Map [c + 0x807] = (uint8_t*) MAP_NONE; for (i = c + 8; i < c + 16; i++) @@ -3427,8 +2920,6 @@ void SPC7110HiROMMap() Memory.Map [0xb07 + (c << 4)] = (uint8_t*) MAP_NONE; Memory.BlockIsRAM [0x306 + (c << 4)] = true; Memory.BlockIsRAM [0x307 + (c << 4)] = true; - // Memory.BlockIsRAM [0xb06 + (c << 4)] = true; - // Memory.BlockIsRAM [0xb07 + (c << 4)] = true; } // Banks 40->7f and c0->ff @@ -3478,8 +2969,6 @@ void SPC7110Sram(uint8_t newstate) Memory.Map[7] = (uint8_t*)MAP_HIROM_SRAM; Memory.Map[0x306] = (uint8_t*)MAP_HIROM_SRAM; Memory.Map[0x307] = (uint8_t*)MAP_HIROM_SRAM; - - } else { @@ -3852,9 +3341,6 @@ void ApplyROMFixes() Settings.H_Max = (SNES_CYCLES_PER_SCANLINE * Settings.CyclesPercentage) / 100; - //no need to ifdef for right now... - //#ifdef HDMA_HACKS - // A Couple of HDMA related hacks - Lantus if ((strcmp(Memory.ROMName, "SFX SUPERBUTOUDEN2") == 0) || (strcmp(Memory.ROMName, "ALIEN vs. PREDATOR") == 0) || @@ -3865,10 +3351,6 @@ void ApplyROMFixes() if (strcmp(Memory.ROMName, "HOME IMPROVEMENT") == 0) Settings.H_Max = (SNES_CYCLES_PER_SCANLINE * 200) / 100; - // End HDMA hacks - //#endif - - if (strcmp(Memory.ROMId, "ASRJ") == 0 && Settings.CyclesPercentage == 100) // Street Racer Settings.H_Max = (SNES_CYCLES_PER_SCANLINE * 95) / 100; @@ -4104,27 +3586,10 @@ void ApplyROMFixes() strcmp(Memory.ROMName, "goemon 4") == 0) SNESGameFixes.SRAMInitialValue = 0x00; -#if 0 - if (strcmp(Memory.ROMName, "XBAND JAPANESE MODEM") == 0) - { - for (c = 0x200; c < 0x400; c += 16) - { - for (int i = c; i < c + 16; i++) - { - Memory.Map [i + 0x400] = Memory.Map [i + 0xc00] = &ROM[c * 0x1000]; - Memory.BlockIsRAM [i + 0x400] = Memory.BlockIsRAM [i + 0xc00] = true; - BlockIsROM [i + 0x400] = BlockIsROM [i + 0xc00] = false; - } - } - WriteProtectROM(); - } -#endif - #define RomPatch(adr,ov,nv) \ if (Memory.ROM [adr] == ov) \ Memory.ROM [adr] = nv - // Love Quest if (strcmp(Memory.ROMName, "LOVE QUEST") == 0) { @@ -4252,4 +3717,3 @@ void ParseSNESHeader(uint8_t* RomHeader) #undef INLINE #define INLINE #include "getset.h" - diff --git a/source/memmap.h b/source/memmap.h index 22122cf..788c30a 100644 --- a/source/memmap.h +++ b/source/memmap.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _memmap_h_ #define _memmap_h_ @@ -159,7 +70,6 @@ void JumboLoROMMap(bool); void LoROMMap(); void LoROM24MBSMap(); void SRAM512KLoROMMap(); -// void SRAM1024KLoROMMap (); void SufamiTurboLoROMMap(); void HiROMMap(); void SuperFXROMMap(); @@ -233,9 +143,6 @@ typedef struct uint32_t ROMCRC32; uint8_t ExtendedFormat; uint8_t* BSRAM; -#if 0 - bool LoadMulti(const char*, const char*, const char*); -#endif } CMemory; void ResetSpeedMap(); @@ -262,4 +169,3 @@ extern uint8_t OpenBus; #endif // NO_INLINE_SET_GET #endif // _memmap_h_ - diff --git a/source/messages.h b/source/messages.h index 369b060..00776ca 100644 --- a/source/messages.h +++ b/source/messages.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _messages_h_ #define _messages_h_ @@ -138,4 +49,3 @@ enum }; #endif - diff --git a/source/missing.h b/source/missing.h index 012ce18..9a8b711 100644 --- a/source/missing.h +++ b/source/missing.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _MISSING_H_ #define _MISSING_H_ diff --git a/source/obc1.c b/source/obc1.c index d2de3f0..0013e33 100644 --- a/source/obc1.c +++ b/source/obc1.c @@ -1,93 +1,5 @@ -/**************************************************** - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #include <string.h> #include "memmap.h" #include "obc1.h" diff --git a/source/obc1.h b/source/obc1.h index 30cb012..7d478f0 100644 --- a/source/obc1.h +++ b/source/obc1.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _OBC1_H_ #define _OBC1_H_ @@ -96,7 +7,7 @@ uint8_t GetOBC1(uint16_t Address); void SetOBC1(uint8_t Byte, uint16_t Address); uint8_t* GetBasePointerOBC1(uint32_t Address); uint8_t* GetMemPointerOBC1(uint32_t Address); -void ResetOBC1();//bool full); +void ResetOBC1(); #endif diff --git a/source/pixform.h b/source/pixform.h index 9a5ac48..1e4b95f 100644 --- a/source/pixform.h +++ b/source/pixform.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _PIXFORM_H_ #define _PIXFORM_H_ diff --git a/source/port.h b/source/port.h index 9fb8b42..125d656 100644 --- a/source/port.h +++ b/source/port.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _PORT_H_ #define _PORT_H_ @@ -141,9 +52,6 @@ void S9xGenerateSound(void); // On little-endian MIPS, a 16-bit word can be read directly from an address // only if it's aligned. #define FAST_ALIGNED_LSB_WORD_ACCESS -#else -//#define MSB_FIRST -//#define FAST_LSB_WORD_ACCESS #endif #include <libretro.h> diff --git a/source/ppu.c b/source/ppu.c index 379198a..bc94e6e 100644 --- a/source/ppu.c +++ b/source/ppu.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #include "snes9x.h" #include "memmap.h" @@ -116,19 +27,11 @@ void S9xLatchCounters(bool force) { if (!force && !(Memory.FillRAM[0x4213] & 0x80)) return; -#if 0 -# ifdef CPU_SHUTDOWN - CPU.WaitAddress = CPU.PCAtOpcodeStart; -# endif -#endif PPU.HVBeamCounterLatched = 1; PPU.VBeamPosLatched = (uint16_t) CPU.V_Counter; PPU.HBeamPosLatched = (uint16_t)((CPU.Cycles * SNES_HCOUNTER_MAX) / Settings.H_Max); - // Causes screen flicker for Yoshi's Island if uncommented - //CLEAR_IRQ_SOURCE (PPU_V_BEAM_IRQ_SOURCE | PPU_H_BEAM_IRQ_SOURCE); - Memory.FillRAM [0x213F] |= 0x40; } @@ -262,7 +165,6 @@ static void S9xSetSuperFX(uint8_t Byte, uint16_t Address) /******************************************************************************/ void S9xSetPPU(uint8_t Byte, uint16_t Address) { - // fprintf(stderr, "%03d: %02x to %04x\n", CPU.V_Counter, Byte, Address); if (Address <= 0x2183) { switch (Address) @@ -411,52 +313,43 @@ void S9xSetPPU(uint8_t Byte, uint16_t Address) //share a previous byte value for setting them. case 0x210D: - //TEST9 if(last_written != 0x210d) PPU.BGnxOFSbyte = 0; PPU.BG[0].HOffset = (Byte << 8) | PPU.BGnxOFSbyte; PPU.BGnxOFSbyte = Byte; - // fprintf(stderr, "%02x to %04x (PPU.BG[0].HOffset = %04x %d)\n", Byte, Address, PPU.BG[0].HOffset, CPU.V_Counter); break; case 0x210E: PPU.BG[0].VOffset = (Byte << 8) | PPU.BGnxOFSbyte; PPU.BGnxOFSbyte = Byte; - // fprintf(stderr, "%02x to %04x (PPU.BG[0].VOffset = %04x %d)\n", Byte, Address, PPU.BG[0].VOffset, CPU.V_Counter); break; case 0x210F: PPU.BG[1].HOffset = (Byte << 8) | PPU.BGnxOFSbyte; PPU.BGnxOFSbyte = Byte; - // fprintf(stderr, "%02x to %04x (PPU.BG[1].HOffset = %04x %d)\n", Byte, Address, PPU.BG[1].HOffset, CPU.V_Counter); break; case 0x2110: PPU.BG[1].VOffset = (Byte << 8) | PPU.BGnxOFSbyte; PPU.BGnxOFSbyte = Byte; - // fprintf(stderr, "%02x to %04x (PPU.BG[1].VOffset = %04x %d)\n", Byte, Address, PPU.BG[1].VOffset, CPU.V_Counter); break; case 0x2111: PPU.BG[2].HOffset = (Byte << 8) | PPU.BGnxOFSbyte; PPU.BGnxOFSbyte = Byte; - // fprintf(stderr, "%02x to %04x (PPU.BG[2].HOffset = %04x %d)\n", Byte, Address, PPU.BG[2].HOffset, CPU.V_Counter); break; case 0x2112: PPU.BG[2].VOffset = (Byte << 8) | PPU.BGnxOFSbyte; PPU.BGnxOFSbyte = Byte; - // fprintf(stderr, "%02x to %04x (PPU.BG[2].VOffset = %04x %d)\n", Byte, Address, PPU.BG[2].VOffset, CPU.V_Counter); break; case 0x2113: PPU.BG[3].HOffset = (Byte << 8) | PPU.BGnxOFSbyte; PPU.BGnxOFSbyte = Byte; - // fprintf(stderr, "%02x to %04x (PPU.BG[3].HOffset = %04x %d)\n", Byte, Address, PPU.BG[3].HOffset, CPU.V_Counter); break; case 0x2114: PPU.BG[3].VOffset = (Byte << 8) | PPU.BGnxOFSbyte; PPU.BGnxOFSbyte = Byte; - // fprintf(stderr, "%02x to %04x (PPU.BG[3].VOffset = %04x %d)\n", Byte, Address, PPU.BG[3].VOffset, CPU.V_Counter); break; //end Theme Park @@ -481,7 +374,6 @@ void S9xSetPPU(uint8_t Byte, uint16_t Address) { static uint16_t IncCount [4] = { 0, 32, 64, 128 }; static uint16_t Shift [4] = { 0, 5, 6, 7 }; - // PPU.VMA.Increment = 1; uint8_t i = (Byte & 0x0c) >> 2; PPU.VMA.FullGraphicCount = IncCount [i]; PPU.VMA.Mask1 = IncCount [i] * 8 - 1; @@ -781,8 +673,6 @@ void S9xSetPPU(uint8_t Byte, uint16_t Address) } else PPU.ScreenHeight = SNES_HEIGHT; - //if((Byte & 1)&&(PPU.BGMode==5||PPU.BGMode==6)) - //IPPU.Interlace=1; if ((Memory.FillRAM [0x2133] ^ Byte) & 3) { FLUSH_REDRAW(); @@ -791,7 +681,6 @@ void S9xSetPPU(uint8_t Byte, uint16_t Address) if (PPU.BGMode == 5 || PPU.BGMode == 6) IPPU.Interlace = Byte & 1; IPPU.InterlaceSprites = 0; - // IPPU.InterlaceSprites = (Byte&2)>>1; } } @@ -892,7 +781,6 @@ void S9xSetPPU(uint8_t Byte, uint16_t Address) #ifdef SPCTOOL _SPCInPB(Address & 3, Byte); #else - // CPU.Flags |= DEBUG_MODE_FLAG; Memory.FillRAM [Address] = Byte; IAPU.RAM [(Address & 3) + 0xf4] = Byte; #ifdef SPC700_SHUTDOWN @@ -954,7 +842,7 @@ void S9xSetPPU(uint8_t Byte, uint16_t Address) /******************************************************************************/ uint8_t S9xGetPPU(uint16_t Address) { - uint8_t byte = OpenBus; + uint8_t byte; if (Address < 0x2100) //not a real PPU reg return OpenBus; //treat as unmapped memory returning last byte on the bus if (Address <= 0x2190) @@ -1279,16 +1167,12 @@ uint8_t S9xGetPPU(uint16_t Address) #ifdef SPCTOOL return ((uint8_t) _SPCOutP [Address & 3]); #else - // CPU.Flags |= DEBUG_MODE_FLAG; #ifdef SPC700_SHUTDOWN IAPU.APUExecuting = Settings.APUEnabled; IAPU.WaitCounter++; #endif if (Settings.APUEnabled) { -#ifdef CPU_SHUTDOWN - // CPU.WaitAddress = CPU.PCAtOpcodeStart; -#endif if (SNESGameFixes.APU_OutPorts_ReturnValueFix && Address >= 0x2140 && Address <= 0x2143 && !CPU.V_Counter) { @@ -1356,13 +1240,10 @@ uint8_t S9xGetPPU(uint16_t Address) case 0x21c2: if (Model->_5C77 == 2) return (0x20); - - // fprintf(stderr, "Read from $21c2!\n"); return OpenBus; case 0x21c3: if (Model->_5C77 == 2) return (0); - // fprintf(stderr, "Read from $21c3!\n"); return OpenBus; case 0x2800: // For Dai Kaijyu Monogatari II @@ -1380,8 +1261,6 @@ uint8_t S9xGetPPU(uint16_t Address) byte = Memory.FillRAM [Address]; - //if (Address != 0x3030 && Address != 0x3031) - //printf ("%04x\n", Address); #ifdef CPU_SHUTDOWN if (Address == 0x3030) CPU.WaitAddress = CPU.PCAtOpcodeStart; @@ -1394,7 +1273,6 @@ uint8_t S9xGetPPU(uint16_t Address) } return (byte); } - // fprintf(stderr, "%03d: %02x from %04x\n", CPU.V_Counter, byte, Address); return (byte); } @@ -1405,7 +1283,6 @@ uint8_t S9xGetPPU(uint16_t Address) void S9xSetCPU(uint8_t byte, uint16_t Address) { int d; - // fprintf(stderr, "%03d: %02x to %04x\n", CPU.V_Counter, byte, Address); if (Address < 0x4200) { @@ -1422,7 +1299,7 @@ void S9xSetCPU(uint8_t byte, uint16_t Address) } break; case 0x4017: - break; + return; default: break; } @@ -1434,7 +1311,6 @@ void S9xSetCPU(uint8_t byte, uint16_t Address) // NMI, V & H IRQ and joypad reading enable flags if (byte & 0x20) { - //if(!SNESGameFixes.umiharakawaseFix && PPU.IRQVBeamPos==262) fprintf(stderr, "PPU.IRQVBeamPos = %d, CPU.V_Counter = %d\n", PPU.IRQVBeamPos, CPU.V_Counter); if (!PPU.VTimerEnabled) { PPU.VTimerEnabled = true; @@ -1447,8 +1323,6 @@ void S9xSetCPU(uint8_t byte, uint16_t Address) else { PPU.VTimerEnabled = false; - // if (SNESGameFixes.umiharakawaseFix) - // byte &= ~0x20; } if (byte & 0x10) @@ -1825,11 +1699,7 @@ void S9xSetCPU(uint8_t byte, uint16_t Address) case 0x435B: case 0x436B: case 0x437B: - // Unknown, but they seem to be RAM-ish -#if 0 - fprintf(stderr, "Write %02x to %04x!\n", byte, Address); -#endif break; //These registers are used by both the S-DD1 and the SPC7110 @@ -1839,14 +1709,12 @@ void S9xSetCPU(uint8_t byte, uint16_t Address) case 0x4803: if (Settings.SPC7110) S9xSetSPC7110(byte, Address); - //printf ("%02x->%04x\n", byte, Address); break; case 0x4804: case 0x4805: case 0x4806: case 0x4807: - //printf ("%02x->%04x\n", byte, Address); if (Settings.SPC7110) S9xSetSPC7110(byte, Address); else S9xSetSDD1MemoryMap(Address - 0x4804, byte & 7); @@ -1911,7 +1779,6 @@ void S9xSetCPU(uint8_t byte, uint16_t Address) uint8_t S9xGetCPU(uint16_t Address) { uint8_t byte; - // fprintf(stderr, "read from %04x\n", Address); if (Address < 0x4200) { @@ -1921,22 +1788,12 @@ uint8_t S9xGetCPU(uint16_t Address) case 0x4016: { if (Memory.FillRAM [0x4016] & 1) - { - if ((!Settings.SwapJoypads && - IPPU.Controller == SNES_MOUSE_SWAPPED) || - (Settings.SwapJoypads && - IPPU.Controller == SNES_MOUSE)) - { - if (++PPU.MouseSpeed [0] > 2) - PPU.MouseSpeed [0] = 0; - } - return (0); - } + return 0; + + if (PPU.Joypad1ButtonReadPos >= 16) // Joypad 1 is enabled + return 1; - int ind = Settings.SwapJoypads ? 1 : 0; - byte = IPPU.Joypads[ind] >> (PPU.Joypad1ButtonReadPos ^ 15); - PPU.Joypad1ButtonReadPos++; - return (byte & 1); + return (IPPU.Joypads[0] >> (PPU.Joypad1ButtonReadPos++ ^ 15)) & 1; } case 0x4017: { @@ -1947,26 +1804,18 @@ uint8_t S9xGetCPU(uint16_t Address) { case SNES_MULTIPLAYER5: return (2); - case SNES_MOUSE_SWAPPED: - if (Settings.SwapJoypads && ++PPU.MouseSpeed [0] > 2) - PPU.MouseSpeed [0] = 0; - break; - case SNES_MOUSE: - if (!Settings.SwapJoypads && ++PPU.MouseSpeed [0] > 2) - PPU.MouseSpeed [0] = 0; break; } - return (0x00); - } - int ind = Settings.SwapJoypads ? 0 : 1; + return 0; + } if (IPPU.Controller == SNES_MULTIPLAYER5) { if (Memory.FillRAM [0x4201] & 0x80) { - byte = ((IPPU.Joypads[ind] >> (PPU.Joypad2ButtonReadPos ^ 15)) & 1) | + byte = ((IPPU.Joypads[1] >> (PPU.Joypad2ButtonReadPos ^ 15)) & 1) | (((IPPU.Joypads[2] >> (PPU.Joypad2ButtonReadPos ^ 15)) & 1) << 1); PPU.Joypad2ButtonReadPos++; return (byte); @@ -1979,8 +1828,7 @@ uint8_t S9xGetCPU(uint16_t Address) return (byte); } } - else if (IPPU.Controller == SNES_JUSTIFIER - || IPPU.Controller == SNES_JUSTIFIER_2) + else if (IPPU.Controller == SNES_JUSTIFIER || IPPU.Controller == SNES_JUSTIFIER_2) { uint8_t rv; rv = (1 & (justifiers >> in_bit)); @@ -1988,12 +1836,15 @@ uint8_t S9xGetCPU(uint16_t Address) in_bit %= 32; return rv; } - return ((IPPU.Joypads[ind] >> (PPU.Joypad2ButtonReadPos++ ^ 15)) & 1); + + if (PPU.Joypad2ButtonReadPos >= 16) // Joypad 2 is enabled + return 1; + + return (IPPU.Joypads[1] >> (PPU.Joypad2ButtonReadPos++ ^ 15)) & 1; } default: return OpenBus; } - // return (Memory.FillRAM [Address]); } else switch (Address) @@ -2196,7 +2047,6 @@ uint8_t S9xGetCPU(uint16_t Address) case 0x435B: case 0x436B: case 0x437B: - // Unknown, but they seem to be RAM-ish return (Memory.FillRAM[Address]); @@ -2209,7 +2059,6 @@ uint8_t S9xGetCPU(uint16_t Address) return OpenBus; } - // return (Memory.FillRAM[Address]); } static void CommonPPUReset() @@ -2419,16 +2268,6 @@ void S9xResetPPU() void S9xSoftResetPPU() { CommonPPUReset(); - // PPU.Joypad1ButtonReadPos = 0; - // PPU.Joypad2ButtonReadPos = 0; - // PPU.Joypad3ButtonReadPos = 0; - - // IPPU.Joypads[0] = IPPU.Joypads[1] = IPPU.Joypads[2] = 0; - // IPPU.Joypads[3] = IPPU.Joypads[4] = 0; - // IPPU.SuperScope = 0; - // IPPU.Mouse[0] = IPPU.Mouse[1] = 0; - // IPPU.PrevMouseX[0] = IPPU.PrevMouseX[1] = 256 / 2; - // IPPU.PrevMouseY[0] = IPPU.PrevMouseY[1] = 224 / 2; int c; for (c = 0; c < 0x8000; c += 0x100) @@ -2448,8 +2287,7 @@ void S9xProcessMouse(int which1) int x, y; uint32_t buttons; - if ((IPPU.Controller == SNES_MOUSE || IPPU.Controller == SNES_MOUSE_SWAPPED) - && S9xReadMousePosition(which1, &x, &y, &buttons)) + if (IPPU.Controller == SNES_MOUSE && S9xReadMousePosition(which1, &x, &y, &buttons)) { int delta_x, delta_y; #define MOUSE_SIGNATURE 0x1 @@ -2502,10 +2340,7 @@ void S9xProcessMouse(int which1) else IPPU.Mouse [which1] |= delta_y << 24; - if (IPPU.Controller == SNES_MOUSE_SWAPPED) - IPPU.Joypads [0] = IPPU.Mouse [which1]; - else - IPPU.Joypads [1] = IPPU.Mouse [which1]; + IPPU.Joypads [1] = IPPU.Mouse [which1]; } } @@ -2554,12 +2389,6 @@ void S9xNextController() case SNES_JOYPAD: if (Settings.MouseMaster) { - IPPU.Controller = SNES_MOUSE_SWAPPED; - break; - } - case SNES_MOUSE_SWAPPED: - if (Settings.MouseMaster) - { IPPU.Controller = SNES_MOUSE; break; } @@ -2597,18 +2426,12 @@ void S9xUpdateJustifiers() { static bool last_p1; in_bit = 0; - // static int p1count; justifiers = 0xFFFF00AA; bool offscreen = JustifierOffscreen(); JustifierButtons(&justifiers); - // if(p1count==32) - // { last_p1 = !last_p1; - // p1count=0; - // } - // p1count++; if (!last_p1) justifiers |= 0x1000; @@ -2706,8 +2529,6 @@ void S9xUpdateJoypads() for (i = 0; i < 5; i++) IPPU.Joypads [i] = S9xReadJoypad(i); - // S9xMovieUpdate(); - for (i = 0; i < 5; i++) { if ((IPPU.Joypads [i] & (SNES_LEFT_MASK | SNES_RIGHT_MASK)) == @@ -2752,16 +2573,15 @@ void S9xUpdateJoypads() PPU.Joypad2ButtonReadPos = 0; PPU.Joypad3ButtonReadPos = 16; } - int ind = Settings.SwapJoypads ? 1 : 0; - Memory.FillRAM [0x4218] = (uint8_t) IPPU.Joypads [ind]; - Memory.FillRAM [0x4219] = (uint8_t)(IPPU.Joypads [ind] >> 8); - Memory.FillRAM [0x421a] = (uint8_t) IPPU.Joypads [ind ^ 1]; - Memory.FillRAM [0x421b] = (uint8_t)(IPPU.Joypads [ind ^ 1] >> 8); + Memory.FillRAM [0x4218] = (uint8_t) IPPU.Joypads [0]; + Memory.FillRAM [0x4219] = (uint8_t)(IPPU.Joypads [0] >> 8); + Memory.FillRAM [0x421a] = (uint8_t) IPPU.Joypads [1]; + Memory.FillRAM [0x421b] = (uint8_t)(IPPU.Joypads [1] >> 8); if (Memory.FillRAM [0x4201] & 0x80) { - Memory.FillRAM [0x421c] = (uint8_t) IPPU.Joypads [ind]; - Memory.FillRAM [0x421d] = (uint8_t)(IPPU.Joypads [ind] >> 8); + Memory.FillRAM [0x421c] = (uint8_t) IPPU.Joypads [0]; + Memory.FillRAM [0x421d] = (uint8_t)(IPPU.Joypads [0] >> 8); Memory.FillRAM [0x421e] = (uint8_t) IPPU.Joypads [2]; Memory.FillRAM [0x421f] = (uint8_t)(IPPU.Joypads [2] >> 8); } @@ -2940,7 +2760,6 @@ void REGISTER_2118(uint8_t Byte) IPPU.TileCached [TILE_8BIT][address >> 6] = false; if (!PPU.VMA.High) PPU.VMA.Address += PPU.VMA.Increment; - // Memory.FillRAM [0x2118] = Byte; } void REGISTER_2118_tile(uint8_t Byte) @@ -2956,7 +2775,6 @@ void REGISTER_2118_tile(uint8_t Byte) IPPU.TileCached [TILE_8BIT][address >> 6] = false; if (!PPU.VMA.High) PPU.VMA.Address += PPU.VMA.Increment; - // Memory.FillRAM [0x2118] = Byte; } void REGISTER_2118_linear(uint8_t Byte) @@ -2968,7 +2786,6 @@ void REGISTER_2118_linear(uint8_t Byte) IPPU.TileCached [TILE_8BIT][address >> 6] = false; if (!PPU.VMA.High) PPU.VMA.Address += PPU.VMA.Increment; - // Memory.FillRAM [0x2118] = Byte; } void REGISTER_2119(uint8_t Byte) @@ -2989,7 +2806,6 @@ void REGISTER_2119(uint8_t Byte) IPPU.TileCached [TILE_8BIT][address >> 6] = false; if (PPU.VMA.High) PPU.VMA.Address += PPU.VMA.Increment; - // Memory.FillRAM [0x2119] = Byte; } void REGISTER_2119_tile(uint8_t Byte) @@ -3004,7 +2820,6 @@ void REGISTER_2119_tile(uint8_t Byte) IPPU.TileCached [TILE_8BIT][address >> 6] = false; if (PPU.VMA.High) PPU.VMA.Address += PPU.VMA.Increment; - // Memory.FillRAM [0x2119] = Byte; } void REGISTER_2119_linear(uint8_t Byte) @@ -3016,7 +2831,6 @@ void REGISTER_2119_linear(uint8_t Byte) IPPU.TileCached [TILE_8BIT][address >> 6] = false; if (PPU.VMA.High) PPU.VMA.Address += PPU.VMA.Increment; - // Memory.FillRAM [0x2119] = Byte; } void REGISTER_2122(uint8_t Byte) @@ -3055,7 +2869,6 @@ void REGISTER_2122(uint8_t Byte) } } PPU.CGFLIP ^= 1; - // Memory.FillRAM [0x2122] = Byte; } void REGISTER_2180(uint8_t Byte) diff --git a/source/ppu.h b/source/ppu.h index d04301a..22d225a 100644 --- a/source/ppu.h +++ b/source/ppu.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _PPU_H_ #define _PPU_H_ diff --git a/source/sa1.c b/source/sa1.c index 5a95862..18540fb 100644 --- a/source/sa1.c +++ b/source/sa1.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #include "snes9x.h" #include "ppu.h" @@ -351,20 +262,6 @@ void S9xSA1SetPCBase(uint32_t address) } } -void S9xSA1ExecuteDuringSleep() -{ -#if 0 - if (SA1.Executing) - { - while (CPU.Cycles < CPU.NextEvent) - { - S9xSA1MainLoop(); - CPU.Cycles += TWO_CYCLES * 2; - } - } -#endif -} - void S9xSetSA1MemMap(uint32_t which1, uint8_t map) { int c; @@ -395,7 +292,6 @@ void S9xSetSA1MemMap(uint32_t which1, uint8_t map) uint8_t S9xGetSA1(uint32_t address) { - // printf ("R: %04x\n", address); switch (address) { case 0x2300: @@ -433,12 +329,10 @@ uint8_t S9xGetSA1(uint32_t address) void S9xSetSA1(uint8_t byte, uint32_t address) { - //printf ("W: %02x -> %04x\n", byte, address); switch (address) { case 0x2200: SA1.Waiting = (byte & 0x60) != 0; - // SA1.Executing = !SA1.Waiting && SA1.S9xOpcodes; if (!(byte & 0x20) && (Memory.FillRAM [0x2200] & 0x20)) S9xSA1Reset(); @@ -455,9 +349,6 @@ void S9xSetSA1(uint8_t byte, uint32_t address) if (byte & 0x10) { Memory.FillRAM [0x2301] |= 0x10; - if (Memory.FillRAM [0x220a] & 0x10) - { - } } break; @@ -481,25 +372,13 @@ void S9xSetSA1(uint8_t byte, uint32_t address) S9xClearIRQ(SA1_DMA_IRQ_SOURCE); } break; + case 0x2203: - // printf ("SA1 reset vector: %04x\n", byte | (Memory.FillRAM [0x2204] << 8)); - break; case 0x2204: - // printf ("SA1 reset vector: %04x\n", (byte << 8) | Memory.FillRAM [0x2203]); - break; - case 0x2205: - // printf ("SA1 NMI vector: %04x\n", byte | (Memory.FillRAM [0x2206] << 8)); - break; case 0x2206: - // printf ("SA1 NMI vector: %04x\n", (byte << 8) | Memory.FillRAM [0x2205]); - break; - case 0x2207: - // printf ("SA1 IRQ vector: %04x\n", byte | (Memory.FillRAM [0x2208] << 8)); - break; case 0x2208: - // printf ("SA1 IRQ vector: %04x\n", (byte << 8) | Memory.FillRAM [0x2207]); break; case 0x2209: @@ -516,28 +395,18 @@ void S9xSetSA1(uint8_t byte, uint32_t address) { SA1.Flags |= IRQ_PENDING_FLAG; SA1.IRQActive |= SNES_IRQ_SOURCE; - // SA1.Executing = !SA1.Waiting; } if (((byte ^ Memory.FillRAM [0x220a]) & 0x40) && (Memory.FillRAM [0x2301] & byte & 0x40)) { SA1.Flags |= IRQ_PENDING_FLAG; SA1.IRQActive |= TIMER_IRQ_SOURCE; - // SA1.Executing = !SA1.Waiting; } if (((byte ^ Memory.FillRAM [0x220a]) & 0x20) && (Memory.FillRAM [0x2301] & byte & 0x20)) { SA1.Flags |= IRQ_PENDING_FLAG; SA1.IRQActive |= DMA_IRQ_SOURCE; - // SA1.Executing = !SA1.Waiting; - } - if (((byte ^ Memory.FillRAM [0x220a]) & 0x10) && - (Memory.FillRAM [0x2301] & byte & 0x10)) - { -#if 0 - printf("###SA1 NMI\n"); -#endif } break; case 0x220b: @@ -565,26 +434,12 @@ void S9xSetSA1(uint8_t byte, uint32_t address) SA1.Flags &= ~IRQ_PENDING_FLAG; break; case 0x220c: - // printf ("SNES NMI vector: %04x\n", byte | (Memory.FillRAM [0x220d] << 8)); - break; case 0x220d: - // printf ("SNES NMI vector: %04x\n", (byte << 8) | Memory.FillRAM [0x220c]); - break; - case 0x220e: - // printf ("SNES IRQ vector: %04x\n", byte | (Memory.FillRAM [0x220f] << 8)); - break; case 0x220f: - // printf ("SNES IRQ vector: %04x\n", (byte << 8) | Memory.FillRAM [0x220e]); - break; - case 0x2210: -#if 0 - printf("Timer %s\n", (byte & 0x80) ? "linear" : "HV"); - printf("Timer H-IRQ %s\n", (byte & 1) ? "enabled" : "disabled"); - printf("Timer V-IRQ %s\n", (byte & 2) ? "enabled" : "disabled"); -#endif break; + case 0x2211: printf("Timer reset\n"); break; @@ -605,62 +460,28 @@ void S9xSetSA1(uint8_t byte, uint32_t address) case 0x2222: case 0x2223: S9xSetSA1MemMap(address - 0x2220, byte); - // printf ("MMC: %02x\n", byte); break; case 0x2224: - // printf ("BWRAM image SNES %02x -> 0x6000\n", byte); Memory.BWRAM = Memory.SRAM + (byte & 7) * 0x2000; break; case 0x2225: - // printf ("BWRAM image SA1 %02x -> 0x6000 (%02x)\n", byte, Memory.FillRAM [address]); if (byte != Memory.FillRAM [address]) S9xSA1SetBWRAMMemMap(byte); break; case 0x2226: - // printf ("BW-RAM SNES write %s\n", (byte & 0x80) ? "enabled" : "disabled"); - break; case 0x2227: - // printf ("BW-RAM SA1 write %s\n", (byte & 0x80) ? "enabled" : "disabled"); - break; - case 0x2228: - // printf ("BW-RAM write protect area %02x\n", byte); - break; case 0x2229: - // printf ("I-RAM SNES write protect area %02x\n", byte); - break; case 0x222a: - // printf ("I-RAM SA1 write protect area %02x\n", byte); - break; case 0x2230: -#if 0 - printf("SA1 DMA %s\n", (byte & 0x80) ? "enabled" : "disabled"); - printf("DMA priority %s\n", (byte & 0x40) ? "DMA" : "SA1"); - printf("DMA %s\n", (byte & 0x20) ? "char conv" : "normal"); - printf("DMA type %s\n", (byte & 0x10) ? "BW-RAM -> I-RAM" : "SA1 -> I-RAM"); - printf("DMA distination %s\n", (byte & 4) ? "BW-RAM" : "I-RAM"); - printf("DMA source %s\n", DMAsource [byte & 3]); -#endif break; case 0x2231: if (byte & 0x80) SA1.in_char_dma = false; -#if 0 - printf("CHDEND %s\n", (byte & 0x80) ? "complete" : "incomplete"); - printf("DMA colour mode %d\n", byte & 3); - printf("virtual VRAM width %d\n", (byte >> 2) & 7); -#endif break; case 0x2232: case 0x2233: case 0x2234: - Memory.FillRAM [address] = byte; -#if 0 - printf("DMA source start %06x\n", - Memory.FillRAM [0x2232] | (Memory.FillRAM [0x2233] << 8) | - (Memory.FillRAM [0x2234] << 16)); -#endif - break; case 0x2235: Memory.FillRAM [address] = byte; break; @@ -686,23 +507,13 @@ void S9xSetSA1(uint8_t byte, uint32_t address) // Normal DMA to BW-RAM S9xSA1DMA(); } -#if 0 - printf("DMA dest address %06x\n", - Memory.FillRAM [0x2235] | (Memory.FillRAM [0x2236] << 8) | - (Memory.FillRAM [0x2237] << 16)); -#endif break; case 0x2238: case 0x2239: Memory.FillRAM [address] = byte; -#if 0 - printf("DMA length %04x\n", - Memory.FillRAM [0x2238] | (Memory.FillRAM [0x2239] << 8)); -#endif break; case 0x223f: SA1.VirtualBitmapFormat = (byte & 0x80) ? 2 : 4; - //printf ("virtual VRAM depth %d\n", (byte & 0x80) ? 2 : 4); break; case 0x2240: @@ -720,13 +531,6 @@ void S9xSetSA1(uint8_t byte, uint32_t address) case 0x224c: case 0x224d: case 0x224e: -#if 0 - if (!(SA1.Flags & TRACE_FLAG)) - { - TraceSA1(); - Trace(); - } -#endif Memory.FillRAM [address] = byte; break; @@ -795,7 +599,6 @@ void S9xSetSA1(uint8_t byte, uint32_t address) S9xSA1ReadVariableLengthData(false, true); return; default: - // printf ("W: %02x->%04x\n", byte, address); break; } if (address >= 0x2200 && address <= 0x22ff) @@ -896,7 +699,6 @@ static void S9xSA1DMA() { SA1.Flags |= IRQ_PENDING_FLAG; SA1.IRQActive |= DMA_IRQ_SOURCE; - // SA1.Executing = !SA1.Waiting; } } diff --git a/source/sa1.h b/source/sa1.h index 6946ca0..84ec94a 100644 --- a/source/sa1.h +++ b/source/sa1.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _sa1_h_ #define _sa1_h_ @@ -124,7 +35,6 @@ typedef struct uint8_t IRQActive; bool WaitingForInterrupt; bool Waiting; - // uint8_t WhichEvent; uint8_t* PC; uint8_t* PCBase; uint8_t* BWRAM; @@ -133,9 +43,6 @@ typedef struct uint32_t WaitCounter; uint8_t* WaitByteAddress1; uint8_t* WaitByteAddress2; - // long Cycles; - // long NextEvent; - // long V_Counter; uint8_t* Map [MEMMAP_NUM_BLOCKS]; uint8_t* WriteMap [MEMMAP_NUM_BLOCKS]; int16_t op1; @@ -181,7 +88,6 @@ extern SSA1 SA1; void S9xSA1MainLoop(); void S9xSA1Init(); void S9xFixSA1AfterSnapshotLoad(); -void S9xSA1ExecuteDuringSleep(); #define SNES_IRQ_SOURCE (1 << 7) #define TIMER_IRQ_SOURCE (1 << 6) diff --git a/source/sa1cpu.c b/source/sa1cpu.c index 0c8ea8d..40cbd0e 100644 --- a/source/sa1cpu.c +++ b/source/sa1cpu.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #include "snes9x.h" #include "memmap.h" @@ -198,7 +109,6 @@ #define TRB16 SA1TRB16 #define TRB8 SA1TRB8 -//#undef CPU_SHUTDOWN #undef VAR_CYCLES #define SA1_OPCODES @@ -208,18 +118,6 @@ void S9xSA1MainLoop() { int i; -#if 0 - if (SA1.Flags & NMI_FLAG) - { - SA1.Flags &= ~NMI_FLAG; - if (SA1.WaitingForInterrupt) - { - SA1.WaitingForInterrupt = false; - SA1.PC++; - } - S9xSA1Opcode_NMI(); - } -#endif if (SA1.Flags & IRQ_PENDING_FLAG) { if (SA1.IRQActive) diff --git a/source/sar.h b/source/sar.h index 8d28851..82722a4 100644 --- a/source/sar.h +++ b/source/sar.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _SAR_H_ #define _SAR_H_ diff --git a/source/sdd1.c b/source/sdd1.c index 78380a5..93e3a7e 100644 --- a/source/sdd1.c +++ b/source/sdd1.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #include "snes9x.h" #include "memmap.h" diff --git a/source/sdd1.h b/source/sdd1.h index 65662a8..6a8c251 100644 --- a/source/sdd1.h +++ b/source/sdd1.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef _SDD1_H_ #define _SDD1_H_ diff --git a/source/sdd1emu.c b/source/sdd1emu.c index 1e84cce..c788b49 100644 --- a/source/sdd1emu.c +++ b/source/sdd1emu.c @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ /* S-DD1 decompressor * * Based on code and documentation by Andreas Naive, who deserves a great deal diff --git a/source/sdd1emu.h b/source/sdd1emu.h index 8123712..a968f7d 100644 --- a/source/sdd1emu.h +++ b/source/sdd1emu.h @@ -1,98 +1,8 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #ifndef SDD1EMU_H #define SDD1EMU_H -//#include "port.h" - void SDD1_decompress(uint8_t* out, uint8_t* in, int output_length); #endif diff --git a/source/seta.c b/source/seta.c index 0dcf90b..c9ca72f 100644 --- a/source/seta.c +++ b/source/seta.c @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #include "seta.h" void (*SetSETA)(uint32_t, uint8_t) = &S9xSetST010; diff --git a/source/seta.h b/source/seta.h index 126abcd..ffdecab 100644 --- a/source/seta.h +++ b/source/seta.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef NO_SETA #ifndef _seta_h diff --git a/source/seta010.c b/source/seta010.c index 9c7a122..856e700 100644 --- a/source/seta010.c +++ b/source/seta010.c @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #include "seta.h" #include "memmap.h" @@ -379,7 +291,6 @@ void ST010_Rotate(int16_t Theta, int16_t X0, int16_t Y0, int16_t* X1, int16_t* Y void SETA_Distance(int16_t Y0, int16_t X0, int16_t* Distance) { if (X0 < 0) X0 = -X0; - if (Y0 < 0) Y0 = -Y0; *Distance = ((X0 * 0x7af0) + 0x4000) >> 15; } @@ -725,17 +636,12 @@ void S9xSetST010(uint32_t Address, uint8_t Byte) ST010_OP01(dy, dx, &a1, &b1, &c1, (int16_t*)&o1); // check for wrapping - //if((o1<0x6000 && rot>0xA000) || - // (rot<0x6000 && o1>0xA000)) - //if(o1<rot) if (abs(o1 - rot) > 0x8000) { o1 += 0x8000; rot += 0x8000; wrap = true; } - //o1=0x0000; - //rot=0xFF00; uint16_t old_speed; diff --git a/source/seta011.c b/source/seta011.c index 09b820d..ef49c21 100644 --- a/source/seta011.c +++ b/source/seta011.c @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #include <stdio.h> #include "seta.h" #include "memmap.h" @@ -115,10 +27,6 @@ uint8_t S9xGetST011(uint32_t Address) else t = Memory.SRAM[address]; - // debug - // if(address<0x150) - // printf( "ST011 R: %06X %02X\n", Address, t); - return t; } @@ -137,10 +45,6 @@ void S9xSetST011(uint32_t Address, uint8_t Byte) reset = true; } - // debug - // if(address<0x150) - // printf( "ST011 W: %06X %02X\n", Address, Byte ); - Memory.SRAM[address] = Byte; // op commands/data goes through this address @@ -212,27 +116,16 @@ void S9xSetST011(uint32_t Address, uint8_t Byte) // unknown case 0x04: - { - // outputs - Memory.SRAM[0x12C] = 0x00; - //Memory.SRAM[0x12D] = 0x00; - Memory.SRAM[0x12E] = 0x00; - } - break; - - // unknown case 0x05: { // outputs Memory.SRAM[0x12C] = 0x00; - //Memory.SRAM[0x12D] = 0x00; Memory.SRAM[0x12E] = 0x00; } break; // unknown case 0x06: - break; case 0x07: break; diff --git a/source/seta018.c b/source/seta018.c index 674a0df..2ae40c0 100644 --- a/source/seta018.c +++ b/source/seta018.c @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #include "seta.h" #include "memmap.h" @@ -198,35 +110,6 @@ void S9xSetST018(uint8_t Byte, uint32_t Address) { // hardware check? case 0x0100: - ST018.waiting4command = false; - ST018.pass++; - if (ST018.pass == 1) - { - ST018.in_count = 1; - ST018.out_count = 2; - - // Overload's research - ST018.output[0x00] = 0x81; - ST018.output[0x01] = 0x81; - } - else - { - //ST018.in_count = 1; - ST018.out_count = 3; - - // no reason to change this - //ST018.output[0x00] = 0x81; - //ST018.output[0x01] = 0x81; - ST018.output[0x02] = 0x81; - - // done processing requests - if (ST018.pass == 3) - ST018.waiting4command = true; - } - break; - - // unknown: feels like a security detection - // format identical to 0x0100 case 0xFF00: ST018.waiting4command = false; ST018.pass++; @@ -241,12 +124,7 @@ void S9xSetST018(uint8_t Byte, uint32_t Address) } else { - //ST018.in_count = 1; ST018.out_count = 3; - - // no reason to change this - //ST018.output[0x00] = 0x81; - //ST018.output[0x01] = 0x81; ST018.output[0x02] = 0x81; // done processing requests diff --git a/source/snes9x.h b/source/snes9x.h index e2d4f8f..4da02bc 100644 --- a/source/snes9x.h +++ b/source/snes9x.h @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #ifndef _SNES9X_H_ #define _SNES9X_H_ @@ -169,7 +81,6 @@ enum { SNES_MULTIPLAYER5, SNES_JOYPAD, - SNES_MOUSE_SWAPPED, SNES_MOUSE, SNES_SUPERSCOPE, SNES_JUSTIFIER, @@ -248,7 +159,6 @@ typedef struct bool TraceDSP; /* Joystick options */ - bool SwapJoypads; bool JoystickEnabled; /* ROM timing options (see also H_Max above) */ diff --git a/source/soundux.c b/source/soundux.c index c122859..9a6c304 100644 --- a/source/soundux.c +++ b/source/soundux.c @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #ifndef USE_BLARGG_APU #include <stdlib.h> @@ -162,7 +74,6 @@ void DecodeBlockAsm2(int8_t*, int16_t*, int32_t*, int32_t*); // F is channel's current frequency and M is the 16-bit modulation waveform // from the previous channel multiplied by the current envelope volume level. #define PITCH_MOD(F,M) ((F) * ((((uint32_t) (M)) + 0x800000) >> 16) >> 7) -//#define PITCH_MOD(F,M) ((F) * ((((M) & 0x7fffff) >> 14) + 1) >> 8) #define LAST_SAMPLE 0xffffff #define JUST_PLAYED_LAST_SAMPLE(c) ((c)->sample_pointer >= LAST_SAMPLE) @@ -505,7 +416,6 @@ void DecodeBlock(Channel* ch) uint8_t interim_byte = 0; compressed++; - int16_t* raw = ch->block = ch->decoded; // Seperate out the header parts used for decoding @@ -1076,8 +986,6 @@ void S9xMixSamples(uint8_t* buffer, int sample_count) MixStereo(sample_count); /* Mix and convert waveforms */ - int byte_count = sample_count << 1; - if (SoundData.echo_enable && SoundData.echo_buffer_size) { // 16-bit stereo sound with echo enabled ... diff --git a/source/soundux.h b/source/soundux.h index de08db0..45c177e 100644 --- a/source/soundux.h +++ b/source/soundux.h @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef USE_BLARGG_APU @@ -189,7 +100,6 @@ typedef struct // Just incase they are needed in the future, for snapshot compatibility. uint32_t dummy [3]; Channel channels [NUM_CHANNELS]; - // bool no_filter; int16_t master_volume [2]; /* range is -128 .. 127 */ int16_t echo_volume [2]; /* range is -128 .. 127 */ int noise_hertz; diff --git a/source/spc700.c b/source/spc700.c index 97ab940..d152bd1 100644 --- a/source/spc700.c +++ b/source/spc700.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #ifndef USE_BLARGG_APU @@ -1112,7 +1023,6 @@ void Apu7A() // XXX: BJ: i think the old HalfCarry behavior was wrong... // XXX: Or is it between bits 7 and 8 for ADDW/SUBW? -// XXX: Used Work32 instead of Int32 before. Fixed? [Neb] void Apu9A() { // SUBW YA,dp @@ -1125,9 +1035,6 @@ void Apu9A() APUSetOverflow(); else APUClearOverflow(); - if (((IAPU.Registers.YA.W ^ Work16) & 0x0080) && - ((IAPU.Registers.YA.W ^ (uint16_t) Int32) & 0x0080)) - APUSetHalfCarry(); APUSetHalfCarry(); if ((IAPU.Registers.YA.W ^ Work16 ^ (uint16_t) Int32) & 0x10) APUClearHalfCarry(); diff --git a/source/spc700.h b/source/spc700.h index 3738d0d..1012f2d 100644 --- a/source/spc700.h +++ b/source/spc700.h @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #ifndef USE_BLARGG_APU #ifndef _SPC700_H_ @@ -161,11 +73,9 @@ typedef struct } SAPURegisters; // Needed by ILLUSION OF GAIA -//#define ONE_APU_CYCLE 14 #define ONE_APU_CYCLE 21 // Needed by all games written by the software company called Human -//#define ONE_APU_CYCLE_HUMAN 17 #define ONE_APU_CYCLE_HUMAN 21 // 1.953us := 1.024065.54MHz diff --git a/source/spc7110.c b/source/spc7110.c index 49b8967..acc4666 100644 --- a/source/spc7110.c +++ b/source/spc7110.c @@ -1,93 +1,4 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ +#include "../copyright" #include "spc7110.h" #include "memmap.h" @@ -297,7 +208,6 @@ void MovePackData() FILE* fp = fopen("sp7err.out", "a"); #endif - // fprintf(fp, "Table Entry %06X:%02X not found\n", table, s7r.reg4804); fclose(fp); return; } @@ -383,7 +293,6 @@ void ReadPackData() if (i == MAX_TABLES) { FILE* fp = fopen("sp7err.out", "a"); - // fprintf(fp, "Table Entry %06X:%02X not found\n", table, s7r.reg4804); fclose(fp); return; } @@ -408,7 +317,6 @@ void ReadPackData() splitpath(Memory.ROMFilename, drive, dir, fname, ext); strcpy(name, drive); - //strcat(filename, "\\"); strcat(name, dir); strcat(name, pfold); @@ -509,7 +417,6 @@ void GetPackData() if (i == MAX_TABLES) { FILE* fp = fopen("sp7err.out", "a"); - // fprintf(fp, "Table Entry %06X:%02X not found\n", table, s7r.reg4804); fclose(fp); return; } @@ -792,7 +699,6 @@ uint8_t S9xGetSPC7110(uint16_t Address) i %= s7r.DataRomSize; i += s7r.DataRomOffset; uint8_t tmp = Memory.ROM[i]; - i = ((s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811); if (0x60 == (s7r.reg4818 & 0x60)) { i = ((s7r.reg4813 << 16) | (s7r.reg4812 << 8) | s7r.reg4811); @@ -1024,7 +930,6 @@ void S9xSetSPC7110(uint8_t data, uint16_t Address) break; } } - // s7r.decomp_set=true; } break; //$4810 is probably read only. @@ -1332,13 +1237,10 @@ void S9xSetSPC7110(uint8_t data, uint16_t Address) if (0 == data) { S9xUpdateRTC(); - // rtc_f9.init=false; - // rtc_f9.index=-1; } if (data & 0x01) { s7r.reg4842 = 0x80; - //rtc_f9.last_used=time(NULL);//???? rtc_f9.init = false; rtc_f9.index = -1; } @@ -1427,7 +1329,6 @@ void S9xSetSPC7110(uint8_t data, uint16_t Address) break; //writes to RTC status register aren't expected to be meaningful default: - Address -= 0x4800; break; //16 BIT MULTIPLIER: ($FF00) high byte, defval:00 } @@ -1666,7 +1567,6 @@ bool Load7110Index(char* filename) return false; int f_len; - //do while (1) { i = 0; @@ -1691,7 +1591,6 @@ bool Load7110Index(char* filename) decompack->tableEnts[i].location[index].used_offset = 0; } - //while(!feof(fp)); fclose(fp); return true; } @@ -2073,7 +1972,6 @@ void Do7110Logging() fseek(flog, 35, 0); int f_len; - //do while (1) { int i = 0; @@ -2098,7 +1996,6 @@ void Do7110Logging() i++; } } - //while(!feof(flog)); fclose(flog); } diff --git a/source/spc7110.h b/source/spc7110.h index 0186fc2..0069c54 100644 --- a/source/spc7110.h +++ b/source/spc7110.h @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #ifndef _spc7110_h #define _spc7110_h #include "port.h" diff --git a/source/srtc.c b/source/srtc.c index 28c5463..94ad27f 100644 --- a/source/srtc.c +++ b/source/srtc.c @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #include <string.h> #include "snes9x.h" #include "srtc.h" diff --git a/source/srtc.h b/source/srtc.h index 894974b..00624cc 100644 --- a/source/srtc.h +++ b/source/srtc.h @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #ifndef _srtc_h_ #define _srtc_h_ diff --git a/source/tile.c b/source/tile.c index 9ffff98..72570cf 100644 --- a/source/tile.c +++ b/source/tile.c @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #include "snes9x.h" #include "memmap.h" diff --git a/source/tile.h b/source/tile.h index 984c019..7950546 100644 --- a/source/tile.h +++ b/source/tile.h @@ -1,93 +1,5 @@ -/******************************************************************************* - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. +#include "../copyright" - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Joel Yliluoma (http://iki.fi/bisqwit/) - Kris Bleakley (codeviolation@hotmail.com), - Matthew Kendora, - Nach (n-a-c-h@users.sourceforge.net), - Peter Bortas (peter@bortas.org) and - zones (kasumitokoduck@yahoo.com) - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), - _Demo_ (_demo_@zsnes.com), and Nach - - C4 C++ code - (c) Copyright 2003 Brad Jorsch - - DSP-1 emulator code - (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, - John Weidman, neviksti (neviksti@hotmail.com), - Kris Bleakley, Andreas Naive - - DSP-2 emulator code - (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and - Lord Nightmare (lord_nightmare@users.sourceforge.net - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and - Kris Bleakley - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, John Weidman, and Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive and John Weidman - - S-RTC C emulator code - (c) Copyright 2001 John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman - - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - (c) Copyright 2014 - 2016 Daniel De Matteis. (UNDER NO CIRCUMSTANCE - WILL COMMERCIAL RIGHTS EVER BE APPROPRIATED TO ANY PARTY) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and distribute Snes9x in both binary and - source form, for non-commercial purposes, is hereby granted without fee, - providing that this license information and copyright notice appear with - all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes - charging money for Snes9x or software derived from Snes9x. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*******************************************************************************/ #ifndef _TILE_H_ #define _TILE_H_ |