;from caker137 ;Discs of Tron 2-player Environmental Hack ;This hack is designed to work on the first UPRIGHT romset ;released for DOT. There is another later UPRIGHT romset ;that among other things lists scoring for derezz a disc ;in attract mode. For that version see my other hack. ;The "Environmental" ROMs have a bug which prevents starting a 1 ;player game in "Upright" mode. Therefore the "Upright" ROMs are ;the ones to hack, as they are a later, working revision. This ;bug can be seen in the code snippet responsible for starting a ;one or two player game here from the ENV CPU ROMs: 0579: DB 00 in a,($00) ;reads the start buttons 057B: 2F cpl ;invert (low-active buttons) 057C: E6 0C and $0C ;mask off the 1 and 2 player start in "a" 057E: C8 ret z ;if neither pressed, exit 057F: CD 5F 7C call $7C5F ;check for environmental mode jumper (corrupts "a"!!) 0582: 28 04 jr z,$0588 ;if env, start 1 player game 0584: E6 08 and $08 ;check "a" if the pressed key is 2p start (BUG, a is gone!) 0586: 20 14 jr nz,$059C ;jump to start a 2 player game ;"a" holds the input from the player start keys. The call to 7C5F ;checks what the Environmental/Upright jumper is set to. It is ;a routine that uses the "a" register. Then the line at 0x584 ;tries to perform an "and" on "a", but the contents are no longer ;the state of the player start inputs. This test always comes ;out the same and causes a 2 player game to be started, if there ;are enough credits, and it just ignores you if there is only 1 ;credit. The corresponding code snippet in the UPR roms fixed this ;by making a backup of "a" in "b" before calling the mode check ;routine, and later restores "a" from the backup. ;NOW FOR THE WORKING, UPRIGHT ROMs ;testing of ENV/UPR mode jumper is performed ;at address 0x20 for almost all game operations. ;this routine is called often, whenever a cabinet ;specific function is performed during gameplay, ;such as stalling the game to allow speech to continue ;or panning the sound effects for the ENV cab, and ;allowing a 2 player game in the UPR cab. ;the routine result is in Z flag, where Zero=False means that ;the game is an Upright. Here are all the addresses ;that potentially call the mode checking routine ;List of calls to Mode Jumper routine ;From Address Function Hack To 0308: End of Player game check other Upright 0502: Display Start Options Upright 05DD: Start 1 or 2 player on press Upright 095E: "Greetings" Speech Environmental 0B68: "Logic Probe" Speech Environmental 0D37: "Slave" Speech Environmental 0D6A: "Nice" Speech Environmental 14F2: Platform Elevator Sound Check Environmental 1503: Platform Elevator Sound Check Environmental 1520: Platform Elevator Sound Check Environmental 1DA7: Jump Surround Sound Check Environmental 2E6C: BOOM Surround Sound Check? Environmental 3FA2: Disc Surround Sound Check Environmental 4012: Disc Surround Sound Check Environmental 48E1: BOOM Surround Sound Check? Environmental 4CB1: Disc Surround Sound Check Environmental 8BEE: BOOM Surround Sound Check Environmental 8C3A: Chaser Surround Sound Check Environmental 97A0: ? 9BC2: UNUSED - Non-Executable Code? 9CC9: UNUSED - Non-Executable Code? 9CE3: UNUSED - Non-Executable Code? A36A: DATA - Non-Executable N/A A36B: DATA - Non-Executable N/A A36C: DATA - Non-Executable N/A AA5B: DATA - Non-Executable N/A AA7A: DATA - Non-Executable N/A AA7F: DATA - Non-Executable N/A AAE4: DATA - Non-Executable N/A AEC6: DATA - Non-Executable N/A B0A9: DATA - Non-Executable N/A B188: DATA - Non-Executable N/A B7F3: DATA - Non-Executable N/A CD69: Display Game Setup Options Environmental D184: Display Sound Debug Options Environmental F712: DATA - Non-Executable N/A F724: DATA - Non-Executable N/A F736: DATA - Non-Executable N/A ;Since most functions need to be told that the game is ENV, I ;will change the mode checking rouine to always report ENV. ;Then I can specifically change the routines that conversely ;need to think the mode is upright. ;ADD ENVIROMENTAL 2 PLAYER START FEATURE !!!!!!!!!!! ;since the ENV cab will have no 2 player start button, I ;will hack in a way to start 2 player games. Just hold down ;the aiming knob while pressing start to begin a 2 player ;game. Of course 1P and 2P start still work as before. ;Pertinant Game Functions ;Address Function 0x5d6 Get start press 1 or 2 player 0x5E5 Start 1 player game 0x5F9 Start 2 player game ;choosing 1 or 2 players ;UNMODIFIED CODE SNIPPET 05D6: DB 00 in a,($00) ;read port 05D8: 2F cpl 05D9: E6 0C and $0C ;was either 1 or 2p start pressed? 05DB: 47 ld b,a ;make backup of pressed key in 'b' 05DC: C8 ret z ;leave if none pressed 05DD: E7 rst $20 ;check for Enviromental cab 05DE: 28 05 jr z,$05E5 ;if environmental, start 1 player 05E0: 78 ld a,b ;restore port reading to 'a' 05E1: E6 08 and $08 ;is it start 2? 05E3: 20 14 jr nz,$05F9 ;if so start 2 player game ... ;otherwise, 1 player game, here ;NEW CODE SNIPPET 05D6: DB 00 in a,($00) ;read port 05D8: CB 5F bit 3,a ;was 2 Player Pressed? 05DA: 28 1D jr z,$05F9 ;if so, run 2 player game 05DC: CB 57 bit 2,a ;was 1 Player Pressed? 05DE: C0 ret nz ;leave if none pressed 05DF: DB 02 in a,($02) ;check for input on aim down 05E1: CB 67 bit 4,a ;was aim down held? 05E3: 28 14 jr z,$05F9 ;if so, run 2 player game ... ;otherwise, 1 player game, here ;Notice this also hacks out one of the mode jumper calls, so we don't have ;to hack that one otherwise ;COMPLETE LIST OF ROM CHANGES TO ADD ALL FUNCTIONALITY ;make jumper check routine always report ENV ;Address ROM:RELATIVE From To Checksum Change *0x0023 loc-pg0.1c:0x0023 0xCB 0xE6 0x1B *0x0024 loc-pg0.1c:0x0024 0x7F 0x00 0x81 ;make 2 player routines think its always UPR ;Address ROM:RELATIVE From To Checksum Change *0x0309 loc-pg0.1c:0x0309 0xC8 0xC0 0xF8 *0x0503 loc-pg0.1c:0x0503 0x28 0x20 0xF8 ;add hack to allow aim-down plus 1p to start a 2p game (see code snippets above) ;Address ROM:RELATIVE From To Checksum Change *0x05D8 loc-pg0.1c:0x05D8 0x2F 0xCB 0x9C *0x05D9 loc-pg0.1c:0x05D9 0xE6 0x5F 0x79 *0x05DA loc-pg0.1c:0x05DA 0x0C 0x28 0x1C *0x05DB loc-pg0.1c:0x05DB 0x47 0x1D 0xD6 *0x05DC loc-pg0.1c:0x05DC 0xC8 0xCB 0x03 *0X05DD loc-pg0.1c:0x05DD 0xE7 0x57 0x70 *0x05DE loc-pg0.1c:0x05DE 0x28 0xC0 0x98 *0x05DF loc-pg0.1c:0x05DF 0x05 0xDB 0xD6 *0x05E0 loc-pg0.1c:0x05E0 0x78 0x02 0x8A *0x05E1 loc-pg0.1c:0x05E1 0xE6 0xCB 0xE5 *0x05E2 loc-pg0.1c:0x05E2 0x08 0x67 0x5F *0x05E3 loc-pg0.1c:0x05E3 0x20 0x28 0x08 ---- Checksum Change Total: 0x4A ;Adjust a junk 0xff byte to cancel out the checksum change we have caused. ;Checksum Fix ;Address ROM:RELATIVE From To *0x0005 loc-pg0.1c:0x0005 0xFF 0xB5 ;(0xFF-0x4A = 0xB5) ;MAKE ALL "*" CHANGES TO "loc-pg0.1c" ROM to apply patch.