MSX Gradius-2 Enhancement Patch (c) 2009 FRS (sd_snatcher@yahoo.com) *************************************************************************** *** You must read the license and agree with it before running, copying *** *** or distributing this patches. If you don't agree with the terms and *** *** conditions, you must delete all its files. *** *************************************************************************** Background ---------- The MSX version of Gradius-2 (aka Nemesis-2) is a spin-off story of the Gradius series, developed specifically for the MSX and later ported to X68000 and PSP under the title "Nemesis 90 Kai". As many other Konami megarom titles for MSX, it suffered from a bug in the timing routine that made it run at twice its normal speed if the processor is fast enough. And, the game is too CPU intensive for a standard 3.57MHz Z80A to sustain a full frame rate. As a result, the game drops frames constantly, running noticeably slower than its predecessor: Gradius (aka Nemesis). This patch contains many fixes and enhancements for the MSX version of the game Gradius-2: 1) Speed optimizations Many internal routines were optimized. There are also new copy-to-VRAM routines that take advantage of the V9958 high-speed transfer if a MSX2+ or a MSX Turbo-R is detected. 2) For MSX1 and MSX2: Dynamic-Vsync patch The Konami's timing routine is based on static-vsync, so the vertical synchronization is always enabled for their games. Any recent PC gamer knows that vsync takes lot of CPU time, resulting in a lower frames per second rate. Which wasn't known until now was how this could affect a slow CPU like the Z80. And it turned out that the Z80 did had a lot of power being wasted by that routine. This patch replaces the bugged-static-vsync-interrupt-handler from Konami by a new one, featuring dynamic vsync. This is a new method used by modern gaming consoles (like Xbox-360) and 3D graphic cards that enables and disables the vsync on the fly, according to the CPU usage. If the CPU is falling behind the target fps, the vsync gets disabled. Once a less cpu intense area of the game is reached and the CPU usage goes down, the vsync is enabled again. This algorithm releases enough CPU power to run the game at a much better framerate. Combined with the speed optimizations (1), the game now have run much smoother than before. It will also fix the timing bug, so now it is possible to run the game on a turbo MSX at the correct speed. This patch will also automatically enable the turbo on the following Panasonic machines, because those don't have an external switch to enable the turbo while running the game. It was also included to allow people not used to the MSX standard to get the benefits of the patch by just selecting "Turbo-R" on their MSX emulators. - Turbo-Rs - FS-A1ST - FS-A1GT - MSX2+ - FS-A1WSX - FS-A1WX - FS-A1FX As a bonus, this patch will also adjust the palette to CoolColors on a MSX2 or higher. CoolColors is an improved palette specially designed by me to enhance the visual of MSX1 games on a V99x8 VDP. If you ever compared any MSX1 game running on both an MSX1 and on a MSX2 (or higher), probably you have noticed that colors are all wrong. This happens because the MSX BIOS set the palette to values that try to balance everyday use with backwards compatibility. The result was good for using the MSX-DOS and terminal programs, but very poor for running MSX1 games. Back in the 90s I developed CoolColors to solve that. It took about two years of extensive testing and improving to get the final result, published in 1997 and used by many MSX programmers since then. 2) For MSX2+ and MSX Turbo-R: Smooth Scroll and TurboFix The original MSX game featured the "jumpy scroll", which was common on MSX1 games, but always made the NES players to think their versions had superior performance, as it looks like the game is running at a very low framerate. This was never true, and the reason why the scroll is jumpy has nothing to do with the system speed: It was that way just because it was scrolled by moving the tiles that have a 8x8 dimension. This patch implements new smooth scroll routines inside the engine, using the V9958 horizontal scroll feature. It runs quite well even at 3.57MHz. Off course, if you run the game on a turbo MSX2+ or a Turbo-R, the results will be even better 3) Invincible patch This one is not a bugfix, but rather a trainer. It will turn your ship indestructible, even against walls. I used the patch mainly for debugging purposes and included it here as a bonus. This patch is optional. ExecROM will ask you if you want it to be applied. 4) Enable Cartridge combinations As many other Konami megarom games, Gradius-2 feature "cartridge combinations". If you insert some specific Konami game in another slot, you can get some interesting effects: - Penguin adventure Effect: metalion is changed into a penguin, and the power-ups are fishes - Q-Bert Effect: You can enter some passwords, press to pause, enter password and press to resume. - METALION Your ship turns green and you're immortal. it wears of after a while; just re-enter the password. - NEMESIS You go to the next stage. - LARS18TH You get full power up (two options, laser etc.) and no speed ups. - The Maze of Galious Effect: when your ship gets destroyed, you can get your weapons back (backup). However, this does not work after a continue. So, there are one patch to simulate each cartridge combination. As those patches are optional, ExecROM will ask you if you want them to be applied. This archive is composed of the following files: READ-ME.TXT : This file; LEIA-ME.TXT : Readme file in Portuguese; GRADIUS2.XPC : All the patches above listed in XPC format. This is the format used by EXECROM, a tool by Adriano for running ROMs on a real MSX using a MegaRAM. No emulators support the XPC format yet, so you can grab XPCtools from http://execrom.sf.net to apply the patches directly to your rom. If your emulator supports patching ROMs on-the-fly, you should prefer it and preserve your original ROMs untouched. The patches are compatible with both GameMaster 1 and 2. This patch was developed using the original ROM dump, which has the following checksums: SHA1(GRADIUS2.ROM)= ab30cdeaacbdf14e6366d43d881338178fc665cb MD5(GRADIUS2.ROM)= ee3e6a50e3de131d217e5dab55519011 --------------------------------------------------------------------------- Using the Patch --------------- There are two easy ways to use the XPC patch: 1) Easier: ExecROM. Just put the ROM and the XPC patch on the same directory (of a disk containing MSX-DOS, off course) with the same filename (ie: GRADIUS2.ROM and GRADIUS2.XPC). ExecROM will detect this and will autoload the patch. You'll need a MegaRAM. (OpenMSX do emulate the MegaRAM). To run the game just type ExecROM GRADIUS2 on the MSX-DOS prompt. 2) Apply the patch to the ROM. Goto https://sourceforge.net/projects/execrom and download XPCtools. You can apply the patch just as you do with an IPS patcher. The problem is: Most emulators require the game to have an exact size (multiple of the page size of the megarom in question) to execute a ROM. Otherwise it will not run the ROM correctly. You can fool such emulators by attaching an 8KB dummy file to the end of original ROM before patching. So the steps to patch the file for an emulator would be: 1) Google for "dummy file creator", get one tool for that. 2) Create an 8KB filled dummy file filled with FFh 3) Open a shell on Windows, type: copy /b NEMESIS2.ROM + dummy8KB.rom GRAD2ENH.ROM 4) type: xpcapply GRAD2ENH.ROM GRADIUS2.XPC If even this way your emulator still refuses to load the ROM, repeat the process using a 128KB dummy ROM (what a waste of space...). --------------------------------------------------------------------------- Special Thanks to: - openMSX team, for their excellent emulator and openMSX Debugger; - Adriano Rodrigues Camargo da Cunha, for ExecROM and XPCtools. =========================================================================== License Terms of use --------------------------------------------------------------------------- 1) This patches are free (gratis) for non-commercial purposes. You can only run, make backup copies or distribute the patches under this strict condition. 2) You are only allowed distribute the patch files (online or on a removable media) under the following conditions: 2.1) No commercial transaction of any kind is involved 2.2) All readme files (in English and Portuguese) are distributed together with the patches, inside the same compressed file. 3) If you want to use this patches for commercial purposes you MUST contact me first to negotiate the terms and conditions. Use the e-mail supplied at the beginning of this document for contacting me.