├── .gitignore ├── Contra-III ├── README.md ├── do.bat ├── dynamic_remap │ ├── dma.asm │ └── dp_mvn.asm ├── patch.bps ├── sa1.asm └── static_remap │ ├── new_discrete_abs_remap.asm │ ├── new_discrete_full_abs_remap.asm │ ├── new_discrete_long_remap.asm │ ├── new_indexed_abs_remap.asm │ ├── new_indexed_full_abs_remap.asm │ ├── new_indexed_long_remap.asm │ └── new_indirect_abs_remap.asm ├── Gradius-III ├── README.md ├── addons │ ├── spdwn-j.bps │ ├── spdwn-u.bps │ ├── spdwn.asm │ └── spdwn.bat ├── changes.txt ├── do.bat ├── patch-jpn.bps ├── patch.bps ├── remap │ ├── discrete_abs_remap.asm │ ├── discrete_full_abs_remap.asm │ ├── discrete_long_abs_remap.asm │ ├── discrete_long_remap.asm │ ├── indexed_abs_remap.asm │ ├── indexed_full_abs_remap.asm │ ├── indexed_long_remap.asm │ └── indirect_abs_remap.asm └── sa1.asm ├── README.md ├── Race-Drivin ├── README.md ├── asm │ ├── commit_buffer.asm │ ├── delta_main.asm │ ├── delta_position.asm │ ├── delta_radical.asm │ ├── delta_rpm.asm │ ├── delta_speed.asm │ ├── delta_sprites.asm │ ├── delta_wheel.asm │ ├── extra_remaps.asm │ ├── fixes.asm │ ├── hooks.asm │ ├── new_discrete_abs_remap.asm │ ├── new_indexed_abs_remap.asm │ ├── new_indirect_abs_remap.asm │ ├── render_speedup.asm │ ├── run.sh │ ├── sa1.asm │ ├── sa1_defines.asm │ ├── sa1cpu.asm │ ├── shadow_replay.asm │ ├── title_screen.asm │ ├── title_screen_old.asm │ ├── title_screen_origin.asm │ └── wram.asm ├── patch-origin.bps └── patch.bps └── Super-R-Type ├── README.md ├── asm ├── README.md ├── databank.asm ├── do.sh ├── hooks.asm ├── new_discrete_abs_remap.asm ├── new_indexed_abs_remap.asm ├── new_indexed_long_remap.asm ├── new_indirect_abs_remap.asm ├── sa1.asm ├── sa1cpu.asm └── wram.asm └── patch.bps /.gitignore: -------------------------------------------------------------------------------- 1 | *.smc 2 | *.sfc 3 | *.srm 4 | *.bsz 5 | *.bst 6 | *.zs* 7 | other/* 8 | */other/* 9 | *.html 10 | *.bin 11 | *.bp 12 | *.spc 13 | -------------------------------------------------------------------------------- /Contra-III/README.md: -------------------------------------------------------------------------------- 1 | # SA-1 Root: Contra III 2 | Version 1.2, released 2022-09-19 3 | 4 | Contra III: The Alien Wars is the third Contra game made by Konami and an amazing 5 | cinematic shooting game. 6 | 7 | This SA-1 Root removes all slowdown present on the original game and drastically 8 | reduces the loading times. It also saves the high scores and settings. 9 | 10 | Special thanks to Erivando_BR for sending me the SA-1 Collection trace log files 11 | of Contra III, which made this optimization patch possible to happen. 12 | 13 | ## How to Patch 14 | 15 | Download the latest Contra III .bps patch file available on the 16 | [Releases](https://github.com/VitorVilela7/SA1-Root/releases) tab. 17 | 18 | You can patch it using [beat](https://www.romhacking.net/utilities/893/) 19 | or [FLIPS](https://sneslab.net/tools/floating.zip), both common .bps patchers. 20 | 21 | You can also patch the .asm files directly using 22 | [Asar](https://github.com/RPGHacker/asar). 23 | 24 | For more information on how to apply ROM patches, see this SnesLab 25 | article: https://sneslab.net/wiki/How_to_apply_ROM_patches 26 | 27 | It works only on the american version of Contra III. Contra Spirits and Super 28 | Probotector **does not** work because both games were recompiled and its codes are 29 | different compared to the american version. Depending on the demand I might 30 | do them eventually, but they will likely require the same amount of effort as 31 | a new game conversion. 32 | 33 | Expected checksums: 34 | 35 | ### USA Version: 36 | #### Before patching: 37 | * CRC32: 84DA7CFE 38 | * SHA256: A93EA87FC835C530B5135C5294433D15EEF6DBF656144B387E89AC19CF864996 39 | 40 | #### After patching 41 | * CRC32: FF3EE176 42 | * SHA256: 5D2A0ED336E2681D694395A2183D82BEDCAC93B612CBFB5F543DA80A001E861D 43 | 44 | ## Compatibility 45 | 46 | It works on both real hardware (sd2snes or SA-1 cart) and emulators (Snes9x and bsnes/higan/ares). 47 | 48 | ## Technical details 49 | 50 | * Remapping mode: Full 51 | * Remapping strategy: Runtime 52 | * SA-1 usage: Aggressive 53 | 54 | This game has a very complex data structure. Even more compared compared to Gradius III. 55 | Direct page, indirect addressing and shared ROM/RAM pointers are pretty common on this game. 56 | For that, I had to remap the entire RAM memory to the BW-RAM and for the data structures 57 | that referenced banks 7E/7F were most of the time remapped by runtime for not having 58 | to mine over 950KB of data structures. 59 | 60 | SA-1 was used for the maximum time possible and a callback system was used for the SA-1 61 | CPU calling back the SNES CPU when running on routines that it can't handle (APU uploads 62 | and PPU updates mostly). 63 | 64 | Because of the strategy used, 65 | **128 kB (1024 Kbit) of BW-RAM is required to the game run** correctly. 66 | 67 | ## RAM remap 68 | 69 | * ``$0000-$1FFF`` -> ``$6000-$7FFF`` 70 | * ``$7E:0000-$7F:FFFF`` -> ``$40:0000-$41:FFFF`` 71 | 72 | ## Credits 73 | 74 | Contra III - SA-1 Root wouldn't be that awesome without help from these people: 75 | 76 | * Erivando_BR (testing and trace logs) 77 | * Jeffrey (testing) 78 | * kccheng (testing) 79 | * Rodzilla97 (bug report) 80 | * Vitor Vilela (patch author) 81 | * You (for using it :D) 82 | 83 | ## Contacting me 84 | 85 | You can contact me though the following links: 86 | 87 | * My Website: https://www.sneslab.net/ 88 | * My Github profile: https://github.com/VitorVilela7 89 | * My Twitter profile: https://twitter.com/HackerVilela 90 | * My Patreon: https://www.patreon.com/vitorvilela 91 | -------------------------------------------------------------------------------- /Contra-III/do.bat: -------------------------------------------------------------------------------- 1 | del sa1.sfc 2 | copy "Contra III - The Alien Wars.sfc" sa1.sfc 3 | asar sa1.asm sa1.sfc 4 | -------------------------------------------------------------------------------- /Contra-III/dynamic_remap/dma.asm: -------------------------------------------------------------------------------- 1 | ; DMA remap, everything done by hand... 2 | 3 | org $008463 : LDA.B #$40 ;808463|A97E | ; 4 | 5 | org $00847C : LDA.B #$40 ;80847C|A97E | ; 6 | 7 | org $008F50 : LDX.B #$40 ;808F50|A27E | ; 8 | 9 | org $00A29B : LDX.W #$7828 ;80A29B|A22818 | ; 10 | org $00A29E : STX.W $4302 ;80A29E|8E0243 |054302; 11 | org $00A2D2 : LDX.W #$7838 ;80A2D2|A23818 | ; 12 | org $00A2D5 : STX.W $4302 ;80A2D5|8E0243 |054302; 13 | org $00A309 : LDX.W #$7848 ;80A309|A24818 | ; 14 | org $00A30C : STX.W $4302 ;80A30C|8E0243 |054302; 15 | org $00A340 : LDX.W #$7858 ;80A340|A25818 | ; 16 | org $00A343 : STX.W $4302 ;80A343|8E0243 |054302; 17 | 18 | org $00C2A0 : LDA.W #$0041 ;80C2A0|A97F00 | ; 19 | org $00C2A3 : STA.W $4304 ;80C2A3|8D0443 |054304; 20 | 21 | org $00C33D : LDX.B #$40 ;80C33D|A27E | ; 22 | org $00C33F : STX.W $4304 ;80C33F|8E0443 |054304; 23 | 24 | org $00C599 : LDA.W #$0040 ;80C599|A97E00 | ; 25 | org $00C59C : STA.W $4304 ;80C59C|8D0443 |054304; 26 | 27 | org $00E50C : LDX.W #$770A ;80E50C|A20A17 | ; 28 | org $00E50F : STX.W $4302 ;80E50F|8E0243 |054302; 29 | org $00E523 : LDX.W #$7744 ;80E523|A24417 | ; 30 | org $00E526 : STX.W $4302 ;80E526|8E0243 |054302; 31 | org $00E54B : LDX.W #$772A ;80E54B|A22A17 | ; 32 | org $00E54E : STX.W $4302 ;80E54E|8E0243 |054302; 33 | org $00E562 : LDX.W #$7764 ;80E562|A26417 | ; 34 | org $00E565 : STX.W $4302 ;80E565|8E0243 |054302; 35 | 36 | org $04DC4C : LDX.B #$40 ;84DC4C|A27E | ; 37 | org $04DC4E : STX.W $4304 ;84DC4E|8E0443 |054304; 38 | 39 | ; DMA tables. 40 | 41 | org $02B783 : LDA.W #$0040 ;82B783|A97E00 | ; 42 | org $02B786 : STA.W $75AC ;82B786|8DAC15 |0515AC; 43 | 44 | org $02F195 : LDA.W #$0040 ;82F195|A97E00 | ; 45 | org $02F198 : STA.W $75AC ;82F198|8DAC15 |0515AC; 46 | 47 | 48 | org $E5E0 49 | LDA #$40 50 | 51 | org $02ECB4 ;changes X and #$7E -> #$40 on HDMA bank 52 | LDA.W #$0000 ;82ECB4|A90000 | ; 53 | STA.W $420B ;82ECB7|8D0B42 |05420B; 54 | LDX.W #$4370-$6000 ;82ECBA|A27043 | ; 55 | LDA.W #$0500 ;82ECBD|A90005 | ; 56 | STA.B $00,X ;82ECC0|9500 |000000; 57 | LDA.W #$38E0 ;82ECC2|A9E038 | ; 58 | STA.B $02,X ;82ECC5|9502 |000002; 59 | SEP #$20 ;82ECC7|E220 | ; 60 | LDA.B #$40 ;82ECC9|A97E | ; 61 | STA.B $04,X ;82ECCB|9504 |000004; 62 | REP #$20 ;82ECCD|C220 | ; 63 | LDX.W #$4360-$6000 ;82ECCF|A26043 | ; 64 | LDA.W #$3300 ;82ECD2|A90033 | ; 65 | STA.B $00,X ;82ECD5|9500 |000000; 66 | LDA.W #$38C0 ;82ECD7|A9C038 | ; 67 | STA.B $02,X ;82ECDA|9502 |000002; 68 | SEP #$20 ;82ECDC|E220 | ; 69 | LDA.B #$40 ;82ECDE|A97E | ; 70 | STA.B $04,X ;82ECE0|9504 |000004; 71 | REP #$20 ;82ECE2|C220 | ; 72 | LDX.W #$4350-$6000 ;82ECE4|A25043 | ; 73 | LDA.W #$0000 ;82ECE7|A90000 | ; 74 | STA.B $00,X ;82ECEA|9500 |000000; 75 | LDA.W #$38A0 ;82ECEC|A9A038 | ; 76 | STA.B $02,X ;82ECEF|9502 |000002; 77 | SEP #$20 ;82ECF1|E220 | ; 78 | LDA.B #$40 ;82ECF3|A97E | ; 79 | STA.B $04,X ;82ECF5|9504 |000004; 80 | REP #$20 ;82ECF7|C220 | ; 81 | LDX.W #$4340-$6000 ;82ECF9|A24043 | ; 82 | LDA.W #$2C00 ;82ECFC|A9002C | ; 83 | STA.B $00,X ;82ECFF|9500 |000000; 84 | LDA.W #$3880 ;82ED01|A98038 | ; 85 | STA.B $02,X ;82ED04|9502 |000002; 86 | SEP #$20 ;82ED06|E220 | ; 87 | LDA.B #$40 ;82ED08|A97E | ; 88 | STA.B $04,X ;82ED0A|9504 |000004; 89 | REP #$20 ;82ED0C|C220 | ; 90 | LDX.W #$4330-$6000 ;82ED0E|A23043 | ; 91 | LDA.W #$3100 ;82ED11|A90031 | ; 92 | STA.B $00,X ;82ED14|9500 |000000; 93 | LDA.W #$3860 ;82ED16|A96038 | ; 94 | STA.B $02,X ;82ED19|9502 |000002; 95 | SEP #$20 ;82ED1B|E220 | ; 96 | LDA.B #$40 ;82ED1D|A97E | ; 97 | STA.B $04,X ;82ED1F|9504 |000004; 98 | REP #$20 ;82ED21|C220 | ; 99 | LDX.W #$4320-$6000 ;82ED23|A22043 | ; 100 | LDA.W #$2641 ;82ED26|A94126 | ; 101 | STA.B $00,X ;82ED29|9500 |000000; 102 | LDA.W #$3C00 ;82ED2B|A9003C | ; 103 | STA.B $02,X ;82ED2E|9502 |000002; 104 | SEP #$20 ;82ED30|E220 | ; 105 | LDA.B #$40 ;82ED32|A97E | ; 106 | STA.B $04,X ;82ED34|9504 |000004; 107 | STA.B $07,X ;82ED36|9507 |000007; 108 | REP #$20 ;82ED38|C220 | ; 109 | RTS ;82ED3A|60 | ; 110 | 111 | -------------------------------------------------------------------------------- /Contra-III/dynamic_remap/dp_mvn.asm: -------------------------------------------------------------------------------- 1 | ;All these conversion were doing 100% by hand. 2 | 3 | ;Remap Direct Page 4 | ;LDX.W #$0000 ;80800A|A20000 | ; 5 | ;LDX.W #$0000 ;8080AB|A20000 | ; 6 | ;LDX.W #$0000 ;80816E|A20000 | ; 7 | ;LDX.W #$0000 ;8081A4|A20000 | ; 8 | ;LDX.W #$0000 ;808BEB|A20000 | ; 9 | ;LDY.W #$1300 ;80910F|A00013 | ; 10 | ;LDY.W #$1300 ;809143|A00013 | ; 11 | ;LDY.W #$1340 ;8092BE|A04013 | ; 12 | ;LDA.W #$1F00 ;809645|A9001F | ; 13 | ;LDY.W #$1F00 ;8097A7|A0001F | ; 14 | 15 | org $00800A : LDX.W #$6000 16 | org $0080AB : LDX.W #$6000 17 | org $00816E : LDX.W #$6000 18 | org $0081A4 : LDX.W #$6000 19 | org $008BEB : LDX.W #$6000 20 | org $00910F : LDY.W #$7300 21 | org $009143 : LDY.W #$7300 22 | org $0092BE : LDY.W #$7340 23 | org $009645 : LDA.W #$7F00 24 | org $0097A7 : LDY.W #$7F00 25 | 26 | ;Remap Direct Pages that tried pranking me. 27 | ; LDY.W #$1340 ;809291|A04013 | ; 28 | ; LDY.W #$1F00 ;809343|A0001F | ; 29 | ; LDY.W #$1F00 ;8098F3|A0001F | ; 30 | ; LDY.W #$1300 ;8090D0|A00013 | ; 31 | ; LDY.W #$1300 ;8091BE|A00013 | ; 32 | 33 | org $009291 : LDY.W #$7340 34 | org $009343 : LDY.W #$7F00 35 | org $0098F3 : LDY.W #$7F00 36 | org $0090D0 : LDY.W #$7300 37 | org $0091BE : LDY.W #$7300 38 | 39 | ;Adjust Stack 40 | ;LDX.W #$1DFF ;808006|A2FF1D | ; 41 | ;LDX.W #$1DFF ;8080A7|A2FF1D | ; 42 | 43 | org $008006 : LDX.W #$1FFF 44 | org $0080A7 : LDX.W #$1FFF 45 | 46 | ; MVN/MVP 47 | 48 | org $008056 : MVN $40,$40 49 | org $0080E3 : MVN $40,$40 50 | org $0080F9 : MVN $40,$40 51 | org $00810F : MVN $40,$40 52 | org $008125 : MVN $41,$41 53 | org $00814E : MVN $40,$40 54 | 55 | org $008357 : MVN $40,$40 56 | org $008363 : MVN $40,$40 57 | 58 | org $00882B : MVN $40,$40 59 | org $008842 : MVN $40,$40 60 | org $008859 : MVN $40,$40 61 | org $008870 : MVN $40,$40 62 | org $008887 : MVN $40,$40 63 | org $00889E : MVN $40,$40 64 | org $0088B5 : MVN $40,$40 65 | org $0088CC : MVN $40,$40 66 | org $0088E2 : MVN $40,$40 67 | org $0088F9 : MVN $40,$40 68 | org $00890F : MVN $40,$40 69 | org $008926 : MVN $40,$40 70 | org $00893D : MVN $40,$40 71 | org $008954 : MVN $40,$40 72 | org $00896B : MVN $40,$40 73 | org $008981 : MVN $40,$40 74 | 75 | org $0099F4 : MVN $40,$08 76 | 77 | org $00A422 : MVN $40,$40 78 | org $00A89C : MVN $40,$40 79 | org $00AD9C : MVN $40,$40 80 | 81 | ;org $00E224 : MVN $05,$05 ; TO DO 82 | ;fixed on sa1.asm 83 | 84 | org $00E37B : MVN $40,$40 85 | org $00E749 : MVN $40,$40 86 | 87 | ;org $00EAB8 : MVN $05,$05 ; TO DO 88 | ;fixed on sa1.asm 89 | 90 | org $00FF42 : MVN $40,$40 91 | 92 | ;org $019E69 : MVN $05,$05 ; TO DO 93 | ;fixed on sa1.asm 94 | 95 | org $028496 : MVN $40,$40 96 | 97 | org $028B01 : MVN $40,$40 98 | org $028B17 : MVN $40,$40 99 | org $028C05 : MVN $40,$40 100 | org $028C54 : MVN $40,$40 101 | org $028C6A : MVN $40,$40 102 | org $028C80 : MVN $40,$40 103 | org $028CC7 : MVN $40,$40 104 | org $028CDD : MVN $40,$40 105 | org $028CF3 : MVN $40,$40 106 | 107 | org $029B30 : MVN $40,$40 108 | org $029B46 : MVN $40,$40 109 | org $029B5C : MVN $40,$40 110 | 111 | org $029C2F : MVN $40,$40 112 | org $029C44 : MVN $40,$08 113 | 114 | org $02ECAF : MVN $40,$05 115 | org $02F3BB : MVN $40,$40 116 | org $02F3C9 : MVN $40,$08 117 | 118 | 119 | org $008E90 : LDA.B #$40 120 | org $008F6A : LDA.B #$40 121 | org $0094BD : LDA.B #$40 122 | org $00CAAC : LDA.B #$40 123 | org $00CB9C : LDA.B #$40 124 | org $00CC39 : LDA.B #$40 125 | org $00CFB3 : LDA.B #$40 126 | org $00D110 : LDA.B #$40 127 | org $00D1C6 : LDA.B #$40 128 | org $00D3F9 : LDA.B #$40 129 | org $00D5BA : LDA.B #$40 130 | org $00E665 : LDA.B #$40 131 | org $00E68D : LDA.B #$40 132 | org $00E735 : LDA.B #$40 133 | org $00E7B0 : LDA.B #$40 134 | org $00E8CE : LDA.B #$40 135 | org $00E938 : LDA.B #$40 136 | org $01A4C0 : LDA.B #$40 137 | org $01C509 : LDA.B #$40 138 | org $01F2C5 : LDA.B #$40 139 | org $04902B : LDA.B #$40 140 | org $04DAC7 : LDA.B #$40 141 | org $04DAE6 : LDA.B #$40 142 | org $04DB2B : LDA.B #$40 143 | org $04DC66 : LDA.B #$40 144 | org $04DD1A : LDA.B #$40 145 | org $04E070 : LDA.B #$40 146 | org $04E10C : LDA.B #$40 147 | org $04E1A8 : LDA.B #$40 148 | 149 | org $00E366 : JML [$6000] 150 | org $00EB17 : JML [$6000] 151 | 152 | ; LDA.W #$007E ;808D5C|A97E00 | ; 153 | ; STA.L $7E0008,X ;808D5F|9F08007E|7E0008; 154 | 155 | org $008D5C : LDA #$0040 156 | 157 | ; LDA.W #$007E ;808D86|A97E00 | ; 158 | ; STA.L $7E0008,X ;808D89|9F08007E|7E0008; 159 | 160 | org $008D86 : LDA #$0040 161 | 162 | org $00927D : LDA.B #$40 ;80927D|A97E | ; 163 | org $009651 : LDA.B #$40 ;809651|A97E | ; 164 | org $00E5E0 : LDA.B #$40 ;80E5E0|A97E | ; 165 | org $02ECC9 : LDA.B #$40 ;82ECC9|A97E | ; 166 | org $02ECDE : LDA.B #$40 ;82ECDE|A97E | ; 167 | org $02ECF3 : LDA.B #$40 ;82ECF3|A97E | ; 168 | org $02ED08 : LDA.B #$40 ;82ED08|A97E | ; 169 | org $02ED1D : LDA.B #$40 ;82ED1D|A97E | ; 170 | org $02ED32 : LDA.B #$40 ;82ED32|A97E | ; 171 | 172 | ; to do... 173 | ; Line 2223: CODE_80932C: LDA.B [$43],Y ;80932C|B703 |001343; 174 | ; Line 2224: STA.B [$60] ;80932E|8720 |001360; 175 | ; Line 2305: CODE_8093D4: LDA.B [$03],Y ;8093D4|B703 |001F03; 176 | ; Line 2369: CODE_80945D: LDA.B [$00],Y ;80945D|B700 |001F00; 177 | ; Line 2437: LDA.B [$00],Y ;8094E7|B700 |001F00; 178 | ; Line 2444: CODE_8094F5: STA.B [$03],Y ;8094F5|9703 |001F03; 179 | ; Line 2477: LDA.B [$00],Y ;80952C|B700 |001F00; 180 | ; Line 2511: LDA.B [$00],Y ;80956B|B700 |001300; 181 | ; Line 2524: LDA.B [$00],Y ;809580|B700 |001F00; 182 | ; Line 2561: LDA.B [$00],Y ;8095C0|B700 |001F00; 183 | ; Line 2580: LDA.B [$00],Y ;8095DF|B700 |001F00; 184 | ; Line 2704: LDA.B [$03],Y ;8096D7|B703 |001F03; 185 | ; Line 2774: LDA.B [$03] ;80975C|A703 |001F03; 186 | ; Line 2788: LDA.B [$03],Y ;809778|B703 |001F03; 187 | ; Line 2926: LDA.B [$03],Y ;80989D|B703 |000003; 188 | ; Line 5314: STA.B [$00],Y ;80AE5F|9700 |000000; 189 | ; Line 5318: STA.B [$00],Y ;80AE66|9700 |000000; 190 | ; Line 5340: STA.B [$00],Y ;80AE96|9700 |000000; 191 | ; Line 5344: STA.B [$00],Y ;80AE9D|9700 |000000; 192 | ; Line 5372: LDA.B [$00],Y ;80AEDA|B700 |000000; 193 | ; Line 5375: AND.B [$00],Y ;80AEE1|3700 |000000; 194 | ; Line 5377: LDA.B [$00],Y ;80AEE5|B700 |000000; 195 | ; Line 5381: LDA.B [$00],Y ;80AEEC|B700 |000000; 196 | ; Line 5404: LDA.B [$00],Y ;80AF1E|B700 |000000; 197 | ; Line 5407: AND.B [$00],Y ;80AF25|3700 |000000; 198 | ; Line 5409: LDA.B [$00],Y ;80AF29|B700 |000000; 199 | ; Line 5413: LDA.B [$00],Y ;80AF30|B700 |000000; 200 | 201 | 202 | 203 | ; DATA8_85CBDB: db $0E,$06,$CE,$03 ;85CBDB| | ; 204 | ;isolate case 205 | 206 | org $05CBDB 207 | dw $660E 208 | dw $63CE 209 | ; JSR.W CODE_82FD74 ;82FD5F|2074FD |82FD74; 210 | ; STX.B $00 ;82FD62|8600 |000000; 211 | ; LDA.W #$0000 ;82FD64|A90000 | ; 212 | ; LDY.W #$0000 ;82FD67|A00000 | ; 213 | ; CODE_82FD6A: STA.B ($00),Y ;82FD6A|9100 |000000; 214 | ; INY ;82FD6C|C8 | ; 215 | ; INY ;82FD6D|C8 | ; 216 | ; CPY.W #$0020 ;82FD6E|C02000 | ; 217 | ; BCC CODE_82FD6A ;82FD71|90F7 |82FD6A; 218 | ; CODE_82FD73: RTL ;82FD73|6B | ; 219 | 220 | ; get rid of indirection, with that DP is applied. 221 | 222 | org $02FD62 223 | LDA #$0000 224 | LDY #$0000 225 | - STA $00,x 226 | INY 227 | INY 228 | INX 229 | INX 230 | CPY #$0020 231 | BCC - 232 | RTL 233 | warnpc $02FD74 234 | 235 | ; CODE_82FEA5: STX.B $00 ;82FEA5|8600 |000000; 236 | ; LDA.W #$0000 ;82FEA7|A90000 | ; 237 | ; LDY.W #$0000 ;82FEAA|A00000 | ; 238 | ; CODE_82FEAD: STA.B ($00),Y ;82FEAD|9100 |000000; 239 | ; INY ;82FEAF|C8 | ; 240 | ; INY ;82FEB0|C8 | ; 241 | ; CPY.W #$0020 ;82FEB1|C02000 | ; 242 | ; BCC CODE_82FEAD ;82FEB4|90F7 |82FEAD; 243 | ; CODE_82FEB6: RTL ;82FEB6|6B | ; 244 | 245 | org $02FEA5 246 | LDA #$0000 247 | LDY #$0000 248 | - STA $00,x 249 | INY 250 | INY 251 | INX 252 | INX 253 | CPY #$0020 254 | BCC - 255 | RTL 256 | warnpc $02FEB7 257 | 258 | ; STX.B $00 ;82FE33|8600 |000000; 259 | ; LDA.W #$0000 ;82FE35|A90000 | ; 260 | ; LDY.W #$0000 ;82FE38|A00000 | ; 261 | ; CODE_82FE3B: STA.B ($00),Y ;82FE3B|9100 |000000; 262 | ; INY ;82FE3D|C8 | ; 263 | ; INY ;82FE3E|C8 | ; 264 | ; CPY.W #$0020 ;82FE3F|C02000 | ; 265 | ; BCC CODE_82FE3B ;82FE42|90F7 |82FE3B; 266 | ; CODE_82FE44: RTL ;82FE44|6B | ; 267 | 268 | org $02FE33 269 | LDA #$0000 270 | LDY #$0000 271 | - STA $00,x 272 | INY 273 | INY 274 | INX 275 | INX 276 | CPY #$0020 277 | BCC - 278 | RTL 279 | warnpc $02FE45 -------------------------------------------------------------------------------- /Contra-III/patch.bps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VitorVilela7/SA1-Root/2a552ce891ee3b3d780fca446e5473463fd236f9/Contra-III/patch.bps -------------------------------------------------------------------------------- /Contra-III/static_remap/new_discrete_full_abs_remap.asm: -------------------------------------------------------------------------------- 1 | ;Settings - Indexed: False; Indirect: False; Type: LongSolver 2 | ;Start Address: $000000; End Address: $001FFF 3 | ;Status: verified by Vitor 4 | 5 | ;============== REMAPPER FOR $000000 -> $006000 6 | org $0080D8 ; STA.L $000000 ;8080D7|8F000000|000000; 7 | dl $006000 8 | org $008820 ; STA.L $000000 ;80881F|8F000000|000000; 9 | dl $006000 ; Analysis Missing! 10 | 11 | ;============== REMAPPER FOR $000012 -> $006012 12 | org $04A499 ; STA.L $000012 ;84A498|8F120000|000012; 13 | dl $006012 14 | 15 | ;============== REMAPPER FOR $000070 -> $006070 16 | org $00887C ; STA.L $000070 ;80887B|8F700000|000070; 17 | dl $006070 ; Analysis Missing! 18 | 19 | ;============== REMAPPER FOR $000084 -> $006084 20 | org $008837 ; STA.L $000084 ;808836|8F840000|000084; 21 | dl $006084 ; Analysis Missing! 22 | 23 | ;============== REMAPPER FOR $000200 -> $006200 24 | org $00884E ; STA.L $000200 ;80884D|8F000200|000200; 25 | dl $006200 ; Analysis Missing! 26 | org $0088C1 ; STA.L $000200 ;8088C0|8F000200|000200; 27 | dl $006200 28 | org $028BFA ; STA.L $000200 ;828BF9|8F000200|000200; 29 | dl $006200 30 | org $028C49 ; STA.L $000200 ;828C48|8F000200|000200; 31 | dl $006200 32 | org $028CBC ; STA.L $000200 ;828CBB|8F000200|000200; 33 | dl $006200 34 | 35 | ;============== REMAPPER FOR $000FC0 -> $006FC0 36 | org $02848B ; STA.L $000FC0 ;82848A|8FC00F00|000FC0; 37 | dl $006FC0 ; Analysis Missing! 38 | 39 | ;============== REMAPPER FOR $001200 -> $007200 40 | org $008893 ; STA.L $001200 ;808892|8F001200|001200; 41 | dl $007200 ; Analysis Missing! 42 | org $0088EE ; STA.L $001200 ;8088ED|8F001200|001200; 43 | dl $007200 44 | 45 | ;============== REMAPPER FOR $001280 -> $007280 46 | org $00891B ; STA.L $001280 ;80891A|8F801200|001280; 47 | dl $007280 48 | 49 | ;============== REMAPPER FOR $001380 -> $007380 50 | org $0088AA ; STA.L $001380 ;8088A9|8F801300|001380; 51 | dl $007380 52 | 53 | ;============== REMAPPER FOR $001500 -> $007500 54 | org $00A417 ; STA.L $001500 ;80A416|8F001500|001500; 55 | dl $007500 56 | org $00A891 ; STA.L $001500 ;80A890|8F001500|001500; 57 | dl $007500 58 | org $00AD91 ; STA.L $001500 ;80AD90|8F001500|001500; 59 | dl $007500 60 | org $028AF6 ; STA.L $001500 ;828AF5|8F001500|001500; 61 | dl $007500 62 | org $028C5F ; STA.L $001500 ;828C5E|8F001500|001500; 63 | dl $007500 64 | org $028CD2 ; STA.L $001500 ;828CD1|8F001500|001500; 65 | dl $007500 66 | 67 | ;============== REMAPPER FOR $001700 -> $007700 68 | org $00E370 ; STA.L $001700 ;80E36F|8F001700|001700; 69 | dl $007700 70 | 71 | ;============== REMAPPER FOR $001780 -> $007780 72 | org $028C75 ; STA.L $001780 ;828C74|8F801700|001780; 73 | dl $007780 74 | org $028CE8 ; STA.L $001780 ;828CE7|8F801700|001780; 75 | dl $007780 76 | 77 | ;============== REMAPPER FOR $001B00 -> $007B00 78 | org $008932 ; STA.L $001B00 ;808931|8F001B00|001B00; 79 | dl $007B00 ; Analysis Missing! 80 | 81 | ;============== REMAPPER FOR $001C00 -> $007C00 82 | org $008865 ; STA.L $001C00 ;808864|8F001C00|001C00; 83 | dl $007C00 84 | 85 | ;============== REMAPPER FOR $001E00 -> $007E00 86 | org $00804B ; STA.L $001E00 ;80804A|8F001E00|001E00; 87 | dl $007E00 ; Analysis Missing! 88 | 89 | ;============== REMAPPER FOR $001F00 -> $007F00 90 | org $008143 ; STA.L $001F00 ;808142|8F001F00|001F00; 91 | dl $007F00 92 | 93 | ;============== REMAPPER FOR $001F80 -> $007F80 94 | org $0080EE ; STA.L $001F80 ;8080ED|8F801F00|001F80; 95 | dl $007F80 96 | 97 | ;; SA-1 TLR - The Last Remapper - Analysis results: 98 | 99 | ;; 0080d7 sta $000000 [000000] A:0000 X:0000 Y:ffff S:1dfe D:0000 DB:05 nvmxdIZC V:210 H: 14 F:42 100 | ;; line 99 (offset: 0080D7) - OK from code analysis! 101 | 102 | ;; line 885 (offset: 00881F) - trace is missing! 103 | 104 | ;; 04a498 sta $000012 [000012] A:0000 X:0900 Y:0000 S:1dde D:0000 DB:05 nvmxdiZc V:207 H: 62 F:44 105 | ;; line 55909 (offset: 04A498) - OK from code analysis! 106 | 107 | ;; line 933 (offset: 00887B) - trace is missing! 108 | 109 | ;; line 897 (offset: 008836) - trace is missing! 110 | 111 | ;; line 909 (offset: 00884D) - trace is missing! 112 | 113 | ;; 0088c0 sta $000200 [000200] A:0000 X:0000 Y:0000 S:1de3 D:0000 DB:05 nvmxdiZc V:238 H:317 F:25 114 | ;; line 969 (offset: 0088C0) - OK from code analysis! 115 | 116 | ;; 028bf9 sta $000200 [000200] A:0000 X:0002 Y:0000 S:1de1 D:0000 DB:05 nvmxdiZc V: 8 H: 57 F:21 117 | ;; line 30589 (offset: 028BF9) - OK from code analysis! 118 | 119 | ;; 028c48 sta $000200 [000200] A:0000 X:0008 Y:4600 S:1de4 D:0000 DB:05 nvmxdiZc V: 10 H:168 F:27 120 | ;; line 30621 (offset: 028C48) - OK from code analysis! 121 | 122 | ;; 028cbb sta $000200 [000200] A:0000 X:0008 Y:4900 S:1de4 D:0000 DB:05 nvmxdiZc V: 10 H:174 F:54 123 | ;; line 30669 (offset: 028CBB) - OK from code analysis! 124 | 125 | ;; line 29754 (offset: 02848A) - trace is missing! 126 | 127 | ;; line 945 (offset: 008892) - trace is missing! 128 | 129 | ;; 0088ed sta $001200 [001200] A:0000 X:11df Y:11e0 S:1de3 D:0000 DB:05 nvmxdiZc V:136 H:300 F:26 130 | ;; line 991 (offset: 0088ED) - OK from code analysis! 131 | 132 | ;; 00891a sta $001280 [001280] A:0000 X:23ff Y:2400 S:1de3 D:0000 DB:05 nvmxdiZc V:182 H:161 F:26 133 | ;; line 1013 (offset: 00891A) - OK from code analysis! 134 | 135 | ;; 0088a9 sta $001380 [001380] A:0000 X:0000 Y:ffff S:1de3 D:0000 DB:05 nvmxdiZc V:136 H: 10 F:33 136 | ;; line 957 (offset: 0088A9) - OK from code analysis! 137 | 138 | ;; 00a416 sta $001500 [001500] A:0000 X:1cff Y:1d00 S:1de9 D:0000 DB:05 nvmxdiZc V:169 H:314 F:33 139 | ;; line 4132 (offset: 00A416) - OK from code analysis! 140 | 141 | ;; 00a890 sta $001500 [001500] A:0000 X:0008 Y:0000 S:1dec D:0000 DB:05 nvmxdiZc V:238 H: 6 F:15 142 | ;; line 4628 (offset: 00A890) - OK from code analysis! 143 | 144 | ;; 00ad90 sta $001500 [001500] A:0000 X:0000 Y:0000 S:1de9 D:0000 DB:05 nvmxdiZc V:237 H:326 F:33 145 | ;; line 5220 (offset: 00AD90) - OK from code analysis! 146 | 147 | ;; 028af5 sta $001500 [001500] A:0000 X:0002 Y:0002 S:1de4 D:0000 DB:05 nvmxdiZc V:241 H:188 F:56 148 | ;; line 30492 (offset: 028AF5) - OK from code analysis! 149 | 150 | ;; 028c5e sta $001500 [001500] A:0000 X:11df Y:11e0 S:1de4 D:0000 DB:05 nvmxdiZc V:177 H: 22 F:27 151 | ;; line 30631 (offset: 028C5E) - OK from code analysis! 152 | 153 | ;; 028cd1 sta $001500 [001500] A:0000 X:11df Y:11e0 S:1de4 D:0000 DB:05 nvmxdiZc V:177 H: 25 F:54 154 | ;; line 30679 (offset: 028CD1) - OK from code analysis! 155 | 156 | ;; 00e36f sta $001700 [001700] A:0000 X:13c0 Y:b000 S:1de6 D:0000 DB:05 nvmxdiZc V: 38 H: 97 F:28 157 | ;; line 11434 (offset: 00E36F) - OK from code analysis! 158 | 159 | ;; 028c74 sta $001780 [001780] A:0000 X:16ff Y:1700 S:1de4 D:0000 DB:05 nvmxdiZc V:197 H:100 F:27 160 | ;; line 30641 (offset: 028C74) - OK from code analysis! 161 | 162 | ;; 028ce7 sta $001780 [001780] A:0000 X:16ff Y:1700 S:1de4 D:0000 DB:05 nvmxdiZc V:197 H:103 F:54 163 | ;; line 30689 (offset: 028CE7) - OK from code analysis! 164 | 165 | ;; line 1025 (offset: 008931) - trace is missing! 166 | 167 | ;; 008864 sta $001c00 [001c00] A:0000 X:007f Y:0080 S:1de6 D:0000 DB:05 nvmxdiZc V:159 H:243 F:33 168 | ;; line 921 (offset: 008864) - OK from code analysis! 169 | 170 | ;; line 43 (offset: 00804A) - trace is missing! 171 | 172 | ;; 008142 sta $001f00 [001f00] A:0000 X:ffff Y:0000 S:1dfe D:0000 DB:00 nvmxdIZC V:106 H: 78 F: 2 173 | ;; line 146 (offset: 008142) - OK from code analysis! 174 | 175 | ;; 0080ed sta $001f80 [001f80] A:0000 X:1dff Y:1e00 S:1dfe D:0000 DB:00 nvmxdIZC V:249 H:276 F:43 176 | ;; line 109 (offset: 0080ED) - OK from code analysis! 177 | 178 | ;; End of log. Version of Program: 14.0 179 | -------------------------------------------------------------------------------- /Contra-III/static_remap/new_indexed_full_abs_remap.asm: -------------------------------------------------------------------------------- 1 | ;Settings - Indexed: True; Indirect: False; Type: LongSolver 2 | ;Start Address: $000000; End Address: $001FFF 3 | ;Status: verified by Vitor 4 | 5 | ;============== REMAPPER FOR $000000 -> $006000 6 | org $029B28 ; STA.L $000000,X ;829B27|9F000000|000000; 7 | dl $400000 ; Done manual 8 | org $029B3F ; STA.L $000000,X ;829B3E|9F000000|000000; 9 | dl $400000 ; Done manual 10 | 11 | ;============== REMAPPER FOR $050000 -> $056000 12 | ;org $0090AB ; LDA.L $050000,X ;8090AA|BF000005|050000; 13 | ; dl $056000 14 | ;org $0090E8 ; LDA.L $050000,X ;8090E7|BF000005|050000; 15 | ; dl $056000 16 | ;org $009123 ; LDA.L $050000,X ;809122|BF000005|050000; 17 | ; dl $056000 18 | ;org $00915C ; LDA.L $050000,X ;80915B|BF000005|050000; 19 | ; dl $056000 20 | ;org $0091D6 ; LDA.L $050000,X ;8091D5|BF000005|050000; 21 | ; dl $056000 22 | ;org $0091F0 ; LDA.L $050000,X ;8091EF|BF000005|050000; 23 | ; dl $056000 24 | ;org $009208 ; LDA.L $050000,X ;809207|BF000005|050000; 25 | ; dl $056000 26 | ;org $009225 ; LDA.L $050000,X ;809224|BF000005|050000; 27 | ; dl $056000 28 | ;org $009282 ; LDA.L $050000,X ;809281|BF000005|050000; 29 | ; dl $056000 30 | ;org $0092A5 ; LDA.L $050000,X ;8092A4|BF000005|050000; 31 | ; dl $056000 32 | ;org $0092D1 ; LDA.L $050000,X ;8092D0|BF000005|050000; 33 | ; dl $056000 34 | ;org $0092E3 ; LDA.L $050000,X ;8092E2|BF000005|050000; 35 | ; dl $056000 36 | ;org $009303 ; LDA.L $050000,X ;809302|BF000005|050000; 37 | ; dl $056000 38 | ;org $00930D ; LDA.L $050000,X ;80930C|BF000005|050000; 39 | ; dl $056000 40 | ;org $00935F ; LDA.L $050000,X ;80935E|BF000005|050000; 41 | ; dl $056000 42 | ;org $0093FD ; LDA.L $050000,X ;8093FC|BF000005|050000; 43 | ; dl $056000 44 | ;org $009482 ; LDA.L $050000,X ;809481|BF000005|050000; 45 | ; dl $056000 46 | ;org $0094CC ; LDA.L $050000,X ;8094CB|BF000005|050000; 47 | ; dl $056000 48 | ;org $0094D6 ; LDA.L $050000,X ;8094D5|BF000005|050000; 49 | ; dl $056000 50 | ;org $009628 ; LDA.L $050000,X ;809627|BF000005|050000; 51 | ; dl $056000 ; Analysis Missing! 52 | ;org $009665 ; LDA.L $050000,X ;809664|BF000005|050000; 53 | ; dl $056000 ; Analysis Missing! 54 | ;org $009697 ; LDA.L $050000,X ;809696|BF000005|050000; 55 | ; dl $056000 ; Analysis Missing! 56 | ;org $009703 ; LDA.L $050000,X ;809702|BF000005|050000; 57 | ; dl $056000 ; Analysis Missing! 58 | ;org $009724 ; LDA.L $050000,X ;809723|BF000005|050000; 59 | ; dl $056000 ; Analysis Missing! 60 | ;org $009750 ; LDA.L $050000,X ;80974F|BF000005|050000; 61 | ; dl $056000 ; Analysis Missing! 62 | ;org $0097FB ; LDA.L $050000,X ;8097FA|BF000005|050000; 63 | ; dl $056000 ; Analysis Missing! 64 | ;org $009804 ; LDA.L $050000,X ;809803|BF000005|050000; 65 | ; dl $056000 ; Analysis Missing! 66 | ;org $0098ED ; LDA.L $050000,X ;8098EC|BF000005|050000; 67 | ; dl $056000 68 | 69 | ;============== REMAPPER FOR $050001 -> $056001 70 | ;org $009638 ; LDA.L $050001,X ;809637|BF010005|050001; 71 | ; dl $056001 ; Analysis Missing! 72 | ;org $009793 ; LDA.L $050001,X ;809792|BF010005|050001; 73 | ; dl $056001 ; Analysis Missing! 74 | 75 | ;============== REMAPPER FOR $050002 -> $056002 76 | ;org $009432 ; LDA.L $050002,X ;809431|BF020005|050002; 77 | ; dl $056002 78 | ;org $009748 ; LDA.L $050002,X ;809747|BF020005|050002; 79 | ; dl $056002 ; Analysis Missing! 80 | 81 | ;============== REMAPPER FOR $050004 -> $056004 82 | ;org $009438 ; LDA.L $050004,X ;809437|BF040005|050004; 83 | ; dl $056004 84 | 85 | ;============== REMAPPER FOR $050006 -> $056006 86 | ;org $009440 ; LDA.L $050006,X ;80943F|BF060005|050006; 87 | ; dl $056006 88 | 89 | ;============== REMAPPER FOR $050007 -> $056007 90 | ;org $009448 ; LDA.L $050007,X ;809447|BF070005|050007; 91 | ; dl $056007 92 | 93 | ;============== REMAPPER FOR $080000 -> $086000 94 | ;org $0099EF ; LDA.L $080000,X ;8099EE|BF000008|080000; 95 | ; dl $086000 96 | 97 | ;; SA-1 TLR - The Last Remapper - Analysis results: 98 | 99 | ;; 029b27 sta $000000,x [000dc0] A:0000 X:0dc0 Y:d4f2 S:1dd9 D:0000 DB:05 nvmxdiZc V: 34 H: 96 F:39 100 | ;; line 32450 (offset: 029B27) - OK from code analysis! 101 | 102 | ;; line 32465 (offset: 029B3E) - trace is missing! 103 | 104 | ;; 0090aa lda $050000,x [058add] A:0002 X:8add Y:0000 S:1de7 D:0000 DB:05 Nvmxdizc V:251 H:198 F: 4 105 | ;; line 1904 (offset: 0090AA) - ignored by code analysis. 106 | 107 | ;; 0090e7 lda $050000,x [058adf] A:2400 X:8adf Y:1300 S:1de4 D:1300 DB:05 Nvmxdizc V:252 H:198 F: 4 108 | ;; line 1932 (offset: 0090E7) - ignored by code analysis. 109 | 110 | ;; 009122 lda $050000,x [059e64] A:0000 X:9e64 Y:1300 S:1ddb D:1300 DB:05 Nvmxdizc V:122 H:160 F:33 111 | ;; line 1964 (offset: 009122) - ignored by code analysis. 112 | 113 | ;; 00915b lda $050000,x [058adf] A:5000 X:8adf Y:1300 S:1de1 D:1300 DB:05 Nvmxdizc V:252 H:257 F: 4 114 | ;; line 1993 (offset: 00915B) - ignored by code analysis. 115 | 116 | ;; 0091d5 lda $050000,x [058529] A:2400 X:8529 Y:1300 S:1ddf D:1300 DB:05 NvmxdizC V:172 H: 6 F:45 117 | ;; line 2053 (offset: 0091D5) - ignored by code analysis. 118 | 119 | ;; 0091ef lda $050000,x [05853b] A:2400 X:853b Y:1300 S:1ddf D:1300 DB:05 NvmxdizC V:200 H: 42 F: 1 120 | ;; line 2064 (offset: 0091EF) - ignored by code analysis. 121 | 122 | ;; 009207 lda $050000,x [058529] A:0000 X:8529 Y:1300 S:1ddc D:1300 DB:05 Nvmxdizc V:172 H: 66 F:45 123 | ;; line 2075 (offset: 009207) - ignored by code analysis. 124 | 125 | ;; 009224 lda $050000,x [05853b] A:0000 X:853b Y:1300 S:1ddc D:1300 DB:05 Nvmxdizc V:200 H:103 F: 1 126 | ;; line 2089 (offset: 009224) - ignored by code analysis. 127 | 128 | ;; 009281 lda $050000,x [05f3af] A:2c7e X:f3af Y:1f00 S:1ddd D:1f00 DB:05 nvMxdizc V:238 H:229 F:33 129 | ;; line 2138 (offset: 009281) - ignored by code analysis. 130 | 131 | ;; 0092a4 lda $050000,x [05a84d] A:2800 X:a84d Y:1340 S:1ddb D:1340 DB:05 NvmxdizC V: 11 H: 37 F:29 132 | ;; line 2156 (offset: 0092A4) - ignored by code analysis. 133 | 134 | ;; 0092d0 lda $050000,x [0585d3] A:0000 X:85d3 Y:1340 S:1de2 D:1340 DB:05 NvmxdizC V:120 H:339 F:28 135 | ;; line 2180 (offset: 0092D0) - ignored by code analysis. 136 | 137 | ;; 0092e2 lda $050000,x [0585d5] A:0000 X:85d5 Y:1340 S:1de2 D:1340 DB:05 NvMxdizc V:121 H: 45 F:28 138 | ;; line 2189 (offset: 0092E2) - ignored by code analysis. 139 | 140 | ;; 009302 lda $050000,x [05a84d] A:9000 X:a84d Y:1340 S:1dd8 D:1340 DB:05 Nvmxdizc V: 11 H:110 F:29 141 | ;; line 2203 (offset: 009302) - ignored by code analysis. 142 | 143 | ;; 00930c lda $050000,x [05a84f] A:9000 X:a84f Y:1340 S:1dd8 D:1340 DB:05 NvMxdizc V: 11 H:154 F:29 144 | ;; line 2208 (offset: 00930C) - ignored by code analysis. 145 | 146 | ;; 00935e lda $050000,x [05f3b0] A:0001 X:f3b0 Y:1f00 S:1ddf D:1f00 DB:05 NvmxdizC V: 57 H: 79 F:34 147 | ;; line 2249 (offset: 00935E) - ignored by code analysis. 148 | 149 | ;; 0093fc lda $050000,x [05f3b9] A:00ff X:f3b9 Y:0100 S:1ddc D:1f00 DB:05 NvmxdizC V:216 H: 45 F:34 150 | ;; line 2326 (offset: 0093FC) - ignored by code analysis. 151 | 152 | ;; 009481 lda $050000,x [05f3c2] A:3000 X:f3c2 Y:1e96 S:1ddc D:1f00 DB:05 Nvmxdizc V: 57 H:339 F:53 153 | ;; line 2387 (offset: 009481) - ignored by code analysis. 154 | 155 | ;; 0094cb lda $050000,x [05f3c4] A:0000 X:f3c4 Y:1e96 S:1dd8 D:1f00 DB:7e NvmxdizC V: 59 H:177 F:53 156 | ;; line 2424 (offset: 0094CB) - ignored by code analysis. 157 | 158 | ;; 0094d5 lda $050000,x [05f3c6] A:c08d X:f3c6 Y:1e96 S:1dd8 D:1f00 DB:7e NvMxdizC V: 59 H:210 F:53 159 | ;; line 2429 (offset: 0094D5) - ignored by code analysis. 160 | 161 | ;; line 2619 (offset: 009627) - trace is missing! 162 | 163 | ;; line 2648 (offset: 009664) - trace is missing! 164 | 165 | ;; line 2672 (offset: 009696) - trace is missing! 166 | 167 | ;; line 2729 (offset: 009702) - trace is missing! 168 | 169 | ;; line 2745 (offset: 009723) - trace is missing! 170 | 171 | ;; line 2766 (offset: 00974F) - trace is missing! 172 | 173 | ;; line 2848 (offset: 0097FA) - trace is missing! 174 | 175 | ;; line 2852 (offset: 009803) - trace is missing! 176 | 177 | ;; 0098ec lda $050000,x [05f3ae] A:00ff X:f3ae Y:0000 S:1de2 D:0000 DB:05 nvmxdizc V:238 H:103 F:33 178 | ;; line 2966 (offset: 0098EC) - ignored by code analysis. 179 | 180 | ;; line 2625 (offset: 009637) - trace is missing! 181 | 182 | ;; line 2801 (offset: 009792) - trace is missing! 183 | 184 | ;; 009431 lda $050002,x [05f3b2] A:fffe X:f3b0 Y:1f00 S:1ddc D:1f00 DB:05 NvmxdizC V: 57 H:167 F:34 185 | ;; line 2352 (offset: 009431) - ignored by code analysis. 186 | 187 | ;; line 2763 (offset: 009747) - trace is missing! 188 | 189 | ;; 009437 lda $050004,x [05f3b4] A:5000 X:f3b0 Y:1f00 S:1ddc D:1f00 DB:05 nvmxdizC V: 57 H:187 F:34 190 | ;; line 2354 (offset: 009437) - ignored by code analysis. 191 | 192 | ;; 00943f lda $050006,x [05f3b6] A:8002 X:f3b0 Y:1f00 S:1ddc D:1f00 DB:05 NvMxdizC V: 57 H:213 F:34 193 | ;; line 2357 (offset: 00943F) - ignored by code analysis. 194 | 195 | ;; 009447 lda $050007,x [05f3b7] A:801d X:f3b0 Y:1f00 S:1ddc D:1f00 DB:05 nvmxdizC V: 57 H:234 F:34 196 | ;; line 2360 (offset: 009447) - ignored by code analysis. 197 | 198 | ;; 0099ee lda $080000,x [0882b6] A:2300 X:82b6 Y:2300 S:1de7 D:0000 DB:05 nvmxdizc V:244 H: 18 F: 3 199 | ;; line 3095 (offset: 0099EE) - ignored by code analysis. 200 | 201 | ;; End of log. Version of Program: 14.0 202 | -------------------------------------------------------------------------------- /Gradius-III/README.md: -------------------------------------------------------------------------------- 1 | # SA-1 Root: Gradius III 2 | Version 1.7, released 2022-09-19 3 | 4 | Gradius 3 is a classic shooting game made by Konami. 5 | 6 | This SA-1 Root reduces most of the orignal game's slowdown and lag and minimizes 7 | the overall loading time. As a side effect, the game is now much more difficult. 8 | 9 | ## Base and Origin versions 10 | 11 | There is two versions available. One is the base SA-1 Root patch, where it 12 | activates the SA-1 chip and accelerates the game to the maximum. The BPS files 13 | are Gradius-III-JPN.bps and Gradius-III-USA.bps 14 | 15 | Another version uses GuyPerfect's spdwn add-on that reduces the speeds of most 16 | of the Gradius III bosses, making it closer to the original game speed, but still 17 | without slowdown being used. The BPS files are Gradius-III-Origin-JPN.bps and 18 | Gradius-III-Origin-USA.bps 19 | 20 | ## How to Patch 21 | 22 | Download the latest Gradius III .bps patch file available on the 23 | [Releases](https://github.com/VitorVilela7/SA1-Root/releases) tab. 24 | 25 | You can patch it using [beat](https://www.romhacking.net/utilities/893/) 26 | or [FLIPS](https://sneslab.net/tools/floating.zip), both common .bps patchers. 27 | 28 | You can also patch the .asm files directly using 29 | [Asar](https://github.com/RPGHacker/asar). 30 | 31 | For more information on how to apply ROM patches, see this SnesLab 32 | article: https://sneslab.net/wiki/How_to_apply_ROM_patches 33 | 34 | It works with both American and Japanese version of Gradius III. 35 | 36 | ### Required ROM checksums 37 | 38 | #### Japan (NTSC-J) version 39 | * CRC32: BCA9AB02 40 | * SHA256: 47DDF3204DC99421F6029EAAED4EAA1A6660B5DDF2F07A5C2CD5879C70CA9043 41 | 42 | #### USA (NTSC-U) version 43 | * CRC32: CD973979 44 | * SHA256: 93DA752A0C76167D0907EFA832367E5D14AAB8E835B864F345C386071A9AF718 45 | 46 | ### Checksums after patching - SA-1 Root 47 | 48 | #### Japan (NTSC-J) version 49 | * CRC32: C6105027 50 | * SHA256: A844154BD3887386779E8B796EA9C4FE41715BC03B19C2DEB9B6D1F3AD642540 51 | 52 | #### USA (NTSC-U) version 53 | * CRC32: F696DD2B 54 | * SHA256: D5D5BFA8F694DF4524E1C5963D58E9F5857786C2BF46118152DED4C150A3D303 55 | 56 | ### Checksums after patching - SA-1 Root + Origin 57 | 58 | #### Japan (NTSC-J) version 59 | * CRC32: 7C2E0613 60 | * SHA256: 186EF215E7C6D18D907AAAB212542B013C69A9125EB4AFA383BBF3F5C4D5D402 61 | 62 | #### USA (NTSC-U) version 63 | * CRC32: 0317BDB2 64 | * SHA256: 942B4A3F9C7EC2C2EE187E0C435DD50EE3DBBBE0CDF07B74BD29199D6F833082 65 | 66 | ## Compatibility 67 | 68 | It works on both real hardware (sd2snes or SA-1 cart) and emulators (Snes9x and bsnes/higan/ares). 69 | 70 | ## Technical details 71 | 72 | * Remapping mode: Full 73 | * Remapping strategy: Runtime 74 | * SA-1 usage: Aggressive 75 | 76 | This game has a very complex data structure. 77 | Direct page, indirect addressing and shared ROM/RAM pointers are 78 | pretty common on this game. For that, I had to remap the entire RAM memory 79 | to the BW-RAM and for the data structures that referenced banks 7E/7F were 80 | most of the time remapped by runtime for not having to mine over 450KB 81 | of data structures. 82 | 83 | SA-1 was used for the maximum time possible and a callback system was used 84 | for the SA-1 CPU calling back the SNES CPU when running on routines that 85 | it can't handle (APU uploads and PPU updates mostly). 86 | 87 | Because of the strategy used, 88 | **128 kB (1024 Kbit) of BW-RAM is required to the game run** correctly. 89 | 90 | ## RAM remap 91 | 92 | * ``$0000-$1FFF`` -> ``$6000-$7FFF`` 93 | * ``$7E:0000-$7F:FFFF`` -> ``$40:0000-$41:FFFF`` 94 | 95 | ## Credits 96 | 97 | Gradius III - SA-1 Root wouldn't be that awesome without help from these people: 98 | 99 | * GuyPerfect (Gradius III speed reduction patch add-on) 100 | * indcsion (testing) 101 | * slidelljohn (bug reports and extra help) 102 | * Vitor Vilela (crazy author that did most of the patches) 103 | * You (for using it :D) 104 | 105 | ## Contacting me 106 | 107 | You can contact me though the following links: 108 | 109 | * My Website: https://www.sneslab.net/ 110 | * My Github profile: https://github.com/VitorVilela7 111 | * My Twitter profile: https://twitter.com/HackerVilela 112 | * My Patreon: https://www.patreon.com/vitorvilela 113 | -------------------------------------------------------------------------------- /Gradius-III/addons/spdwn-j.bps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VitorVilela7/SA1-Root/2a552ce891ee3b3d780fca446e5473463fd236f9/Gradius-III/addons/spdwn-j.bps -------------------------------------------------------------------------------- /Gradius-III/addons/spdwn-u.bps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VitorVilela7/SA1-Root/2a552ce891ee3b3d780fca446e5473463fd236f9/Gradius-III/addons/spdwn-u.bps -------------------------------------------------------------------------------- /Gradius-III/addons/spdwn.asm: -------------------------------------------------------------------------------- 1 | ; Speed Down by Guy Perfect 2 | ; for Gradius III (SNES), both versions 3 | ; requires SA-1 Root as a base 4 | 5 | sa1rom 6 | 7 | ; Most of the bosses in the game produce slow-down and are designed accordingly 8 | ; in order to keep the action moving. SA-1 Root eliminates this slow-down, 9 | ; which makes the bosses comically speedy. This mod reduces the speed of the 10 | ; bosses to 75% in an effort to make the game feel as natural as possible with 11 | ; the performance boost offered by SA-1 Root. 12 | 13 | 14 | 15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 16 | ; Entity Behavior ; 17 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 18 | 19 | ; The end of bank 0D has ample padding. 20 | ORG $0DF100 21 | 22 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 23 | 24 | ; Indicate which entity types need to be overridden. Each entity ID is given 25 | ; one byte, and the value of that byte indicates how to override it: 26 | ; 00 = Only process 3 out of every 4 frames. 27 | ; 01 = Same as 00, but also set the scroll-pause flag on the 4th frame. The 28 | ; game ordinarily clears the scroll-pause flag each frame, so if the 29 | ; corresponding boss logic entity isn't processed every 4th frame, the 30 | ; scroll will be released on that frame and cause problems. 31 | ; FF = Do not override. 32 | 33 | FLAGS: 34 | DB -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 35 | DB -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 36 | DB 0, 0, 1, 0, 0, 0,-1,-1,-1,-1,-1,-1, 0, 1, 0, 0 37 | DB 0, 0, 0, 0, 0, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 38 | DB -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 39 | DB -1,-1,-1,-1, 0, 1,-1,-1, 0,-1,-1,-1,-1,-1,-1,-1 40 | DB -1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 1,-1,-1, 1, 1 41 | DB 0,-1, 1,-1, 0,-1,-1,-1,-1,-1,-1, 1,-1,-1,-1,-1 42 | DB -1,-1,-1,-1,-1,-1,-1,-1, 1, 0,-1,-1, 0, 0, 0, 0 43 | DB 0,-1, 0, 0, 0,-1, 0, 0,-1,-1,-1, 0, 0, 0, 0, 0 44 | DB -1,-1,-1, 0, 0, 0,-1,-1, 0, 0,-1,-1,-1, 0, 0,-1 45 | DB -1,-1, 0, 0, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 46 | DB -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 47 | DB -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 48 | DB -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 49 | DB -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 50 | 51 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 52 | 53 | ; The game maintains a collection of active, on-screen entities that it 54 | ; processes every even frame. To slow down the bosses, their entities need to 55 | ; be processed only 3 out of every 4 frames. This routine serves as a preamble 56 | ; to the routine that normally processes entities and runs for all entities in 57 | ; the game. To determine whether a given entity needs to be slowed down, FLAGS 58 | ; above is referenced. If an entity needs to slow down, the game's global frame 59 | ; counter is used to determine whether the current frame is the frame to skip. 60 | 61 | ; Entity behavior override 62 | Entity: 63 | 64 | ; Load the first entity's type 65 | PHA ; Store current entity's type 66 | LDA $68D0 ; First entity's type 67 | 68 | ; Special processing for Choking Weed (stage 6, plant boss) 69 | ; This boss shouldn't be slowed down until the screen stops scrolling. 70 | CMP.W #$0058 ; $58 == Choking Weed 71 | BNE .beacon 72 | LDA $68CA ; Countdown to scroll-stop (not sure exactly what) 73 | CMP.W #$0080 74 | BCS .noSkipReturnB; Do not override yet 75 | LDA.W #$0001 76 | BRA .stopScroll ; Stop scrolling 77 | 78 | ; Special processing for Beacon (stage 7, high-speed boss) 79 | ; This boss does not stop scrolling, but runs it in an endless loop. 80 | .beacon: 81 | CMP.W #$0074 ; $74 == Beacon 82 | BNE .checkFlag 83 | LDA.W #$0001 84 | STA $72FA ; Loop-scroll flags 85 | STA $72BA 86 | BRA .entInit ; Don't need to check the flag or stop the scrolling 87 | 88 | ; Check whether the current entity needs to be adjusted 89 | .checkFlag: 90 | LDA $10, X ; Entity type 91 | TXY ; Store entity address (Y is unused by caller) 92 | TAX 93 | LDA.L $0DF0FF, X ; FLAGS - 1, but apparently asar can't do that? 94 | BMI .noSkipReturn ; Flag is $FF, so do not limit frame processing 95 | 96 | ; Stop the screen from scrolling for bosses 97 | TYX 98 | XBA 99 | AND.W #$00FF 100 | BEQ .entInit ; Flag is $00: do not stop scroll 101 | .stopScroll 102 | STA $72B8 ; Scroll-stop flags (A is $0001) 103 | STA $72F8 104 | 105 | ; Check if the entity has been initialized 106 | .entInit: 107 | LDA $12, X ; Entity state ID: always zero before initialization 108 | BEQ .noSkipReturnB ; Always initialize 109 | 110 | ; Check if the current frame is the skip frame 111 | LDA $603A ; Global frame counter 112 | AND.W #$0006 ; Entities are only processed on even frames 113 | BNE .noSkipReturnB; Skip 1/4 of the even frames 114 | 115 | ; Return to caller without calling the entity handler 116 | .skipReturn: 117 | PLA 118 | RTL 119 | 120 | ; Return without skipping a frame 121 | .noSkipReturn 122 | TYX ; Restore entity address 123 | .noSkipReturnB 124 | PLA ; Restore current entity's type 125 | JML $028000 ; Address of original entity handler 126 | 127 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 128 | 129 | ; Entity $07 is the normal enemy bullet. In the interior of the final level, 130 | ; the graphic is different, but it is otherwise unchanged. This level normally 131 | ; features slow-down, so the firing rate of the enemies was increased to 132 | ; produce adequate challenge. Rather than reduce the firing rate to compensate 133 | ; for SA-1 Root, the sheer multitude of these bullets on higher difficulties 134 | ; warrants slowing them down instead. 135 | 136 | ; Standard bullet velocity override 137 | Bullet: 138 | PHA 139 | 140 | ; Check the current stage index 141 | LDA $6086 ; Stage index 142 | CMP.W #$0009 ; $09 == Planet Bacterion 143 | BNE .return 144 | 145 | ; Check the current level scroll position 146 | LDA $728A ; Current scroll 147 | CMP.W #$0420 ; $0420 == First interior checkpoint 148 | BCC .return 149 | 150 | ; Replace the bullet speed 151 | LDY.W #$000C ; Normal bullet speed is $0010 152 | 153 | ; Return to caller 154 | .return: 155 | PLA 156 | JML $0280EE ; Address of original bullet velocity initializer 157 | 158 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 159 | 160 | ; Entity handler override patch 161 | ORG $00F421 : JSL Entity 162 | 163 | ; Bullet spawner velocity patch 164 | ORG $0285C9 : JSL Bullet 165 | 166 | ; Tentacle bullet velocity (meatball enemy in the last stage) 167 | ORG $02F6F9 : DW $000C ; Originally $0010 168 | 169 | 170 | 171 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 172 | ; Bosses ; 173 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 174 | 175 | ; Logic processing for all boss entities is overridden using the FLAGS lookup 176 | ; table. Each object in the scene has a motion vector that runs at the full 177 | ; frame rate independently from the logic processor, so the velocities used to 178 | ; initialize these vectors need to be adjusted. The literal numeric values for 179 | ; these velocities are all multiplied by 75% and rounded toward nearest. 180 | 181 | ;;;;;;;;;;; 182 | ; Goliath ; 183 | ;;;;;;;;;;; 184 | 185 | ; Entities 186 | ; 20 00 (Hitbox?) 187 | ; 21 00 Main 188 | ; 22 01 (Pincers?) 189 | ; 23 00 Spore ball 190 | ; 24 00 Spore 191 | ; 25 00 Larva 192 | 193 | ; Vectors ; Defaults 194 | ORG $02936A : DW $FF40 ; Main $FF00 195 | ORG $02959B : DW $0012 ; Spore ball $0018 196 | ORG $02961E : DW $0015 ; Spore $001C 197 | ORG $0296BE : DW $000F ; Larva $0014 198 | 199 | ;;;;;;;;;;;;;; 200 | ; Bubble Eye ; 201 | ;;;;;;;;;;;;;; 202 | 203 | ; Entities 204 | ; 20 00 (Hitbox?) 205 | ; 54 00 Main 206 | ; 88 01 (Body?) 207 | ; 89 00 (Hurtbox?) 208 | ; 8C 00 (Unknown) 209 | 210 | ; No changes to movement speed are necessary 211 | 212 | ;;;;;;;;;;;;;;;;;;; 213 | ; Big Core Mk-III ; 214 | ;;;;;;;;;;;;;;;;;;; 215 | 216 | ; Entities 217 | ; 20 00 (Hitbox?) 218 | ; 2C 00 Main 219 | ; 2D 01 (Body?) 220 | ; 2E 00 (Top wing?) 221 | ; 2F 00 (Bottom wing?) 222 | ; 30 00 Core 223 | ; 31 00 Barrier 224 | ; 32 00 Gun 225 | ; 33 00 Big laser 226 | ; 34 00 Bouncing laser 227 | ; 35 00 Normal laser 228 | 229 | ; Vectors ; Defaults 230 | ORG $02A56F : DW $FFFD ; Big Laser $FFFC 231 | ORG $02A67E : DW $FD00 ; Normal Laser $FC00 232 | 233 | ;;;;;;;;;;;;; 234 | ; Twin Vaif ; 235 | ;;;;;;;;;;;;; 236 | 237 | ; Entities 238 | ; 7B 01 Main 239 | ; B1 -- Head (not overridden because of an intermittent bug) 240 | ; B2 00 Petit Moai 241 | ; B3 00 Mini ion ring 242 | ; B4 00 Rock 243 | 244 | ; Vectors ; Defaults 245 | ORG $02A859 : DW $0009 ; Petit Moai 1 $000C 246 | ORG $02A8BB : DW $000F ; Petit Moai 2 $0014 247 | ORG $02A92F : DW $000C ; Mini ion ring $0010 248 | ORG $02A980 : DW $1800 ; Rock $2000 249 | 250 | ;;;;;;;;;;;;;;;;;; 251 | ; Vulture Dragon ; 252 | ;;;;;;;;;;;;;;;;;; 253 | 254 | ; Entities 255 | ; 55 01 Main 256 | ; 8D 00 Leading head 257 | ; 8E 00 Segment 258 | ; 8F 00 Trailing head 259 | ; 90 00 Flame 260 | 261 | ; Vectors ; Defaults 262 | ORG $02B2F9 : DW $0021 ; Flame $002C 263 | 264 | ; Depending on your challenge rank (difficulty, number of Options, shield, 265 | ; etc.), the speed of the boss will increase. This is read from a 4-element 266 | ; table of 2-byte elements, the first byte of which is velocity and the second 267 | ; byte of which is the number of frames between adjustments to direction. 268 | if read1($00FFD9) == $00 269 | ORG $01E890 ; Japanese 270 | else 271 | ORG $01E8E2 ; North American 272 | endif 273 | ; Defaults 274 | DB $0E, $07 ; $12, $07 275 | DB $0F, $06 ; $14, $06 276 | DB $12, $05 ; $18, $05 277 | DB $15, $04 ; $1C, $04 278 | 279 | ;;;;;;;;;;;;;;;; 280 | ; Choking Weed ; 281 | ;;;;;;;;;;;;;;;; 282 | 283 | ; Entities 284 | ; 20 00 (Hitbox?) 285 | ; 58 00 Main 286 | ; 92 00 Bulb 287 | ; 93 00 (Stalk?) 288 | ; 94 00 (More stalk?) 289 | ; 96 00 Arm 290 | ; 97 00 Bullet 291 | 292 | ; Vectors ; Defaults 293 | ORG $02B9CF : DW $0012 ; Bullet $0018 294 | 295 | ;;;;;;;;; 296 | ; Death ; 297 | ;;;;;;;;; 298 | 299 | ; This boss is not slowed down. 300 | 301 | ;;;;;;;;;;;;;;;; 302 | ; Crystal Core ; 303 | ;;;;;;;;;;;;;;;; 304 | 305 | ; Entities 306 | ; 20 00 (Hitbox?) 307 | ; 30 00 Core 308 | ; 31 00 Barrier 309 | ; 6B 01 Main 310 | ; 9B 00 Tentacle root 311 | ; 9C 00 Tentacle segment 312 | ; 9D 00 Tentacle gun 313 | ; 9E 00 Laser 314 | ; 9F 00 Blast 315 | 316 | ; Vectors ; Defaults 317 | ORG $02C02A : DW $00C0 ; Main $0100 318 | ORG $02C2B5 : DW $0023 ; Blast $002E 319 | ORG $02F895 : DW $FD00 ; Laser $FC00 320 | 321 | ;;;;;;;;;;;;;;;;;; 322 | ; Big Core Mk-II ; 323 | ;;;;;;;;;;;;;;;;;; 324 | 325 | ; Entities 326 | ; 20 00 (Hitbox?) 327 | ; 30 00 Core 328 | ; 31 00 Barrier 329 | ; 6E 01 Main 330 | ; 9E 00 Laser 331 | ; A9 00 Wing 332 | 333 | ; Vectors ; Defaults 334 | ORG $02F895 : DW $FD00 ; Laser $FC00 335 | 336 | ;;;;;;;;;;;;;;;; 337 | ; Covered Core ; 338 | ;;;;;;;;;;;;;;;; 339 | 340 | ; Entities 341 | ; 20 00 (Hitbox?) 342 | ; 30 00 Core 343 | ; 31 00 Barrier 344 | ; 6F 01 Main 345 | 346 | ; The missile is entity $AA, but it is not overridden because I think it feels 347 | ; pretty natural with the rest of what goes on in the game with SA-1 Root. If 348 | ; it's later determined that it should be slowed down, bear in mind that it has 349 | ; multiple vectors depending on how long it's been since it was spawned. 350 | 351 | ; Vectors ; Defaults 352 | ORG $02C784 : DW $0002 ; Main $0003 353 | 354 | ;;;;;;;;;;;;;;;;;; 355 | ; Derringer Core ; 356 | ;;;;;;;;;;;;;;;;;; 357 | 358 | ; Entities 359 | ; 20 00 (Hitbox?) 360 | ; 30 00 Core 361 | ; 31 00 Barrier 362 | ; 72 01 Main 363 | ; 9E 00 Straight laser 364 | ; A3 00 Diagonal laser 365 | ; AD 00 Wings 366 | 367 | ; Vectors ; Defaults 368 | ORG $02CA47 : DW $FF40 ; Main vertical $FF00 369 | ORG $02CB19 : DW $FD00 ; Main ramming $FC00 370 | ORG $02F895 : DW $FD00 ; Straight laser $FC00 371 | ORG $02CC8E : DW $0030 ; Diagonal laser $0040 372 | 373 | ;;;;;;;;;;; 374 | ; Disrupt ; 375 | ;;;;;;;;;;; 376 | 377 | ; Entities 378 | ; 69 00 Gun 379 | ; 6A 00 Laser 380 | ; 6D -1 Main (not overridden) 381 | ; 70 00 (Flying thing?) 382 | ; A5 00 (Flying thing hatch?) 383 | ; A6 -- (Core?) (not overridden) 384 | ; A7 -- Barrier (not overridden) 385 | ; A8 00 (Ducker hatch?) 386 | ; AC -- (Top/bottom during intro only?) (not overridden) 387 | ; AE 00 Ducker 388 | 389 | ; Vectors ; Defaults 390 | ORG $02D915 : DW $0030 ; Laser $0040 391 | 392 | ;;;;;;;;;;;;;;;;;;;;; 393 | ; Shadow Gear Mk-II ; 394 | ;;;;;;;;;;;;;;;;;;;;; 395 | 396 | ; This boss is not slowed down. 397 | 398 | ;;;;;;;;;;;;; 399 | ; Bacterion ; 400 | ;;;;;;;;;;;;; 401 | 402 | ; This boss is not slowed down. 403 | -------------------------------------------------------------------------------- /Gradius-III/addons/spdwn.bat: -------------------------------------------------------------------------------- 1 | del spdwn-j.sfc spdwn-u.sfc spdwn-u.smc 2 | copy "Gradius 3.sfc" spdwn-j.sfc 3 | asar sa1.asm spdwn-j.sfc 4 | asar spdwn.asm spdwn-j.sfc 5 | copy "Gradius 3.smc" spdwn-u.sfc 6 | asar sa1.asm spdwn-u.sfc 7 | asar spdwn.asm spdwn-u.sfc 8 | ren spdwn-u.sfc spdwn-u.smc 9 | -------------------------------------------------------------------------------- /Gradius-III/changes.txt: -------------------------------------------------------------------------------- 1 | Version 1.5: 2 | - Fixed the slowdown and graphical glitches on the dissolving effect after beating stages. 3 | Special thanks to slidelljohn for figuring out what was causing the problem. 4 | 5 | Version 1.4: 6 | - First stable release. 7 | - Fixed the game crashing on ending cutscenes. 8 | 9 | Version 1.3: 10 | - Fixed most of the issues generated by dynamic graphics changing (mostly bosses). 11 | 12 | Version 1.2: 13 | - Fixed the game sometimes crashing on weapon select screen. 14 | 15 | Version 1.1: 16 | - First beta release. 17 | -------------------------------------------------------------------------------- /Gradius-III/do.bat: -------------------------------------------------------------------------------- 1 | del sa1.sfc 2 | copy "Gradius 3.sfc" sa1.sfc 3 | asar sa1.asm sa1.sfc 4 | -------------------------------------------------------------------------------- /Gradius-III/patch-jpn.bps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VitorVilela7/SA1-Root/2a552ce891ee3b3d780fca446e5473463fd236f9/Gradius-III/patch-jpn.bps -------------------------------------------------------------------------------- /Gradius-III/patch.bps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VitorVilela7/SA1-Root/2a552ce891ee3b3d780fca446e5473463fd236f9/Gradius-III/patch.bps -------------------------------------------------------------------------------- /Gradius-III/remap/discrete_abs_remap.asm: -------------------------------------------------------------------------------- 1 | ;Settings - Indexed: False; Indirect: False; Type: AbsoluteSolver 2 | 3 | ;============== REMAPPER FOR $0028 -> $6028 4 | org $00B3F7 ; LDA.W $0028 ;00B3F6|AD2800 |010028; 5 | dw $6028 6 | 7 | ;============== REMAPPER FOR $002A -> $602A 8 | org $00B402 ; LDA.W $002A ;00B401|AD2A00 |01002A; 9 | dw $602A 10 | 11 | ;============== REMAPPER FOR $0038 -> $6038 12 | org $00CFB2 ; STA.W $0038 ;00CFB1|8D3800 |010038; 13 | dw $6038 14 | 15 | ;============== REMAPPER FOR $003A -> $603A 16 | org $00B35A ; LDA.W $003A ;00B359|AD3A00 |01003A; 17 | dw $603A 18 | org $00B573 ; LDA.W $003A ;00B572|AD3A00 |01003A; 19 | dw $603A 20 | 21 | ;============== REMAPPER FOR $003C -> $603C 22 | org $0086D8 ; STA.W $003C ;0086D7|8D3C00 |01003C; 23 | dw $603C 24 | org $0086DB ; LDA.W $003C ;0086DA|AD3C00 |01003C; 25 | dw $603C 26 | 27 | ;============== REMAPPER FOR $003E -> $603E 28 | org $0086C1 ; STA.W $003E ;0086C0|8D3E00 |01003E; 29 | dw $603E 30 | 31 | ;============== REMAPPER FOR $0042 -> $6042 32 | org $00C239 ; STZ.W $0042 ;00C238|9C4200 |010042; 33 | dw $6042 34 | org $02D1FB ; STA.W $0042 ;02D1FA|8D4200 |010042; 35 | dw $6042 36 | 37 | ;============== REMAPPER FOR $0044 -> $6044 38 | org $00A8CF ; STA.W $0044 ;00A8CE|8D4400 |010044; 39 | dw $6044 40 | org $00AFC7 ; STA.W $0044 ;00AFC6|8D4400 |010044; 41 | dw $6044 42 | 43 | ;============== REMAPPER FOR $0046 -> $6046 44 | org $00AFC1 ; STA.W $0046 ;00AFC0|8D4600 |010046; 45 | dw $6046 46 | 47 | ;============== REMAPPER FOR $004E -> $604E 48 | org $00931A ; LDX.W $004E ;009319|AE4E00 |01004E; 49 | dw $604E 50 | org $00935A ; STX.W $004E ;009359|8E4E00 |01004E; 51 | dw $604E 52 | 53 | ;============== REMAPPER FOR $0072 -> $6072 54 | org $00A7A9 ; LDA.W $0072 ;00A7A8|AD7200 |010072; 55 | dw $6072 56 | org $00A7D5 ; LDA.W $0072 ;00A7D4|AD7200 |010072; 57 | dw $6072 58 | org $00A7F7 ; LDA.W $0072 ;00A7F6|AD7200 |010072; 59 | dw $6072 60 | org $00A818 ; STA.W $0072 ;00A817|8D7200 |010072; 61 | dw $6072 62 | org $00A823 ; STA.W $0072 ;00A822|8D7200 |010072; 63 | dw $6072 64 | org $00A82B ; LDA.W $0072 ;00A82A|AD7200 |010072; 65 | dw $6072 66 | org $00A831 ; STZ.W $0072 ;00A830|9C7200 |010072; 67 | dw $6072 68 | org $00A835 ; LDA.W $0072 ;00A834|AD7200 |010072; 69 | dw $6072 70 | org $00A8DA ; INC.W $0072 ;00A8D9|EE7200 |010072; 71 | dw $6072 72 | org $00A8E7 ; INC.W $0072 ;00A8E6|EE7200 |010072; 73 | dw $6072 74 | org $00A931 ; INC.W $0072 ;00A930|EE7200 |010072; 75 | dw $6072 76 | org $00AFE8 ; INC.W $0072 ;00AFE7|EE7200 |010072; 77 | dw $6072 78 | org $00B0CD ; INC.W $0072 ;00B0CC|EE7200 |010072; 79 | dw $6072 80 | org $00B0E7 ; INC.W $0072 ;00B0E6|EE7200 |010072; 81 | dw $6072 82 | org $00B101 ; INC.W $0072 ;00B100|EE7200 |010072; 83 | dw $6072 84 | org $00B11B ; INC.W $0072 ;00B11A|EE7200 |010072; 85 | dw $6072 86 | org $00B12B ; INC.W $0072 ;00B12A|EE7200 |010072; 87 | dw $6072 88 | org $00B13B ; INC.W $0072 ;00B13A|EE7200 |010072; 89 | dw $6072 90 | org $00B145 ; INC.W $0072 ;00B144|EE7200 |010072; 91 | dw $6072 92 | org $00B159 ; INC.W $0072 ;00B158|EE7200 |010072; 93 | dw $6072 94 | org $00B171 ; INC.W $0072 ;00B170|EE7200 |010072; 95 | dw $6072 96 | org $00B1CC ; INC.W $0072 ;00B1CB|EE7200 |010072; 97 | dw $6072 98 | 99 | ;============== REMAPPER FOR $0074 -> $6074 100 | org $00C9ED ; STA.W $0074 ;00C9EC|8D7400 |010074; 101 | dw $6074 102 | org $00CFAB ; STA.W $0074 ;00CFAA|8D7400 |010074; 103 | dw $6074 104 | 105 | ;============== REMAPPER FOR $007A -> $607A 106 | org $00B020 ; LDX.W $007A ;00B01F|AE7A00 |01007A; 107 | dw $607A 108 | org $00B08D ; LDX.W $007A ;00B08C|AE7A00 |01007A; 109 | dw $607A 110 | org $00C2A8 ; LDA.W $007A ;00C2A7|AD7A00 |01007A; 111 | dw $607A 112 | org $00C464 ; LDX.W $007A ;00C463|AE7A00 |01007A; 113 | dw $607A 114 | org $00C539 ; LDX.W $007A ;00C538|AE7A00 |01007A; 115 | dw $607A 116 | org $00C61C ; LDX.W $007A ;00C61B|AE7A00 |01007A; 117 | dw $607A 118 | org $00CB3B ; LDX.W $007A ;00CB3A|AE7A00 |01007A; 119 | dw $607A 120 | org $00CCDB ; LDX.W $007A ;00CCDA|AE7A00 |01007A; 121 | dw $607A 122 | org $00CDD4 ; LDX.W $007A ;00CDD3|AE7A00 |01007A; 123 | dw $607A 124 | org $00CF7B ; LDX.W $007A ;00CF7A|AE7A00 |01007A; 125 | dw $607A 126 | org $00D113 ; LDA.W $007A ;00D112|AD7A00 |01007A; 127 | dw $607A 128 | org $02E2D2 ; LDA.W $007A ;02E2D1|AD7A00 |01007A; 129 | dw $607A 130 | 131 | ;============== REMAPPER FOR $0084 -> $6084 132 | org $02EA3D ; SBC.W $0084 ;02EA3C|ED8400 |010084; 133 | dw $6084 134 | 135 | ;============== REMAPPER FOR $0088 -> $6088 136 | org $02CFBC ; LDA.W $0088 ;02CFBB|AD8800 |010088; 137 | dw $6088 138 | org $02E592 ; LDA.W $0088 ;02E591|AD8800 |010088; 139 | dw $6088 140 | org $02E80E ; LDA.W $0088 ;02E80D|AD8800 |010088; 141 | dw $6088 142 | org $02E94C ; LDA.W $0088 ;02E94B|AD8800 |010088; 143 | dw $6088 144 | 145 | ;============== REMAPPER FOR $00B0 -> $60B0 146 | org $02E2C7 ; LDA.W $00B0 ;02E2C6|ADB000 |0100B0; 147 | dw $60B0 148 | 149 | ;============== REMAPPER FOR $00BA -> $60BA 150 | org $00C81B ; STA.W $00BA ;00C81A|8DBA00 |0100BA; 151 | dw $60BA 152 | 153 | ;============== REMAPPER FOR $00BC -> $60BC 154 | org $00C821 ; STA.W $00BC ;00C820|8DBC00 |0100BC; 155 | dw $60BC 156 | 157 | ;============== REMAPPER FOR $00BE -> $60BE 158 | org $00C827 ; STA.W $00BE ;00C826|8DBE00 |0100BE; 159 | dw $60BE 160 | 161 | ;============== REMAPPER FOR $00C0 -> $60C0 162 | org $00C82D ; STA.W $00C0 ;00C82C|8DC000 |0100C0; 163 | dw $60C0 164 | 165 | ;============== REMAPPER FOR $00C2 -> $60C2 166 | org $00C838 ; STA.W $00C2 ;00C837|8DC200 |0100C2; 167 | dw $60C2 168 | 169 | ;============== REMAPPER FOR $00C4 -> $60C4 170 | org $00C83E ; STA.W $00C4 ;00C83D|8DC400 |0100C4; 171 | dw $60C4 172 | 173 | ;============== REMAPPER FOR $00CE -> $60CE 174 | org $02E2B5 ; STA.W $00CE ;02E2B4|8DCE00 |0100CE; 175 | dw $60CE 176 | org $02E2C3 ; STA.W $00CE ;02E2C2|8DCE00 |0100CE; 177 | dw $60CE 178 | org $02E2CE ; STA.W $00CE ;02E2CD|8DCE00 |0100CE; 179 | dw $60CE 180 | org $02E2EE ; STA.W $00CE ;02E2ED|8DCE00 |0100CE; 181 | dw $60CE 182 | org $02E2F9 ; STA.W $00CE ;02E2F8|8DCE00 |0100CE; 183 | dw $60CE 184 | 185 | ;============== REMAPPER FOR $00DC -> $60DC 186 | org $02E0BE ; LDA.W $00DC ;02E0BD|ADDC00 |0100DC; 187 | dw $60DC 188 | 189 | ;; Scanlog: 190 | ;; line 5951 (offset: 00B3F6) - success! 191 | ;; line 5956 (offset: 00B401) - success! 192 | ;; line 9107 (offset: 00CFB1) - success! 193 | ;; line 5872 (offset: 00B359) - success! 194 | ;; line 6117 (offset: 00B572) - success! 195 | ;; line 700 (offset: 0086D7) - success! 196 | ;; line 701 (offset: 0086DA) - success! 197 | ;; line 688 (offset: 0086C0) - success! 198 | ;; line 7569 (offset: 00C238) - success! 199 | ;; line 26502 (offset: 02D1FA) - success! 200 | ;; line 4797 (offset: 00A8CE) - success! 201 | ;; line 5476 (offset: 00AFC6) - success! 202 | ;; line 5474 (offset: 00AFC0) - success! 203 | ;; line 2199 (offset: 009319) - success! 204 | ;; line 2226 (offset: 009359) - success! 205 | ;; line 4658 (offset: 00A7A8) - success! 206 | ;; line 4682 (offset: 00A7D4) - success! 207 | ;; line 4701 (offset: 00A7F6) - success! 208 | ;; line 4719 (offset: 00A817) - success! 209 | ;; line 4723 (offset: 00A822) - success! 210 | ;; line 4727 (offset: 00A82A) - success! 211 | ;; line 4729 (offset: 00A830) - success! 212 | ;; line 4732 (offset: 00A834) - success! 213 | ;; line 4802 (offset: 00A8D9) - success! 214 | ;; line 4808 (offset: 00A8E6) - success! 215 | ;; line 4844 (offset: 00A930) - success! 216 | ;; line 5488 (offset: 00AFE7) - success! 217 | ;; line 5574 (offset: 00B0CC) - success! 218 | ;; line 5585 (offset: 00B0E6) - success! 219 | ;; line 5596 (offset: 00B100) - success! 220 | ;; line 5607 (offset: 00B11A) - success! 221 | ;; line 5614 (offset: 00B12A) - success! 222 | ;; line 5621 (offset: 00B13A) - success! 223 | ;; line 5626 (offset: 00B144) - success! 224 | ;; line 5636 (offset: 00B158) - success! 225 | ;; line 5645 (offset: 00B170) - success! 226 | ;; line 5678 (offset: 00B1CB) - success! 227 | ;; line 8478 (offset: 00C9EC) - success! 228 | ;; line 9103 (offset: 00CFAA) - success! 229 | ;; line 5513 (offset: 00B01F) - success! 230 | ;; line 5552 (offset: 00B08C) - success! 231 | ;; line 7616 (offset: 00C2A7) - success! 232 | ;; line 7823 (offset: 00C463) - success! 233 | ;; line 7914 (offset: 00C538) - success! 234 | ;; line 8015 (offset: 00C61B) - success! 235 | ;; line 8622 (offset: 00CB3A) - success! 236 | ;; line 8803 (offset: 00CCDA) - success! 237 | ;; line 8906 (offset: 00CDD3) - success! 238 | ;; line 9081 (offset: 00CF7A) - success! 239 | ;; line 9273 (offset: 00D112) - success! 240 | ;; line 28587 (offset: 02E2D1) - success! 241 | ;; line 29511 (offset: 02EA3C) - success! 242 | ;; line 26226 (offset: 02CFBB) - success! 243 | ;; line 28938 (offset: 02E591) - success! 244 | ;; line 29241 (offset: 02E80D) - success! 245 | ;; line 29396 (offset: 02E94B) - success! 246 | ;; line 28581 (offset: 02E2C6) - success! 247 | ;; line 8261 (offset: 00C81A) - success! 248 | ;; line 8263 (offset: 00C820) - success! 249 | ;; line 8265 (offset: 00C826) - success! 250 | ;; line 8267 (offset: 00C82C) - success! 251 | ;; line 8272 (offset: 00C837) - success! 252 | ;; line 8274 (offset: 00C83D) - success! 253 | ;; line 28571 (offset: 02E2B4) - success! 254 | ;; line 28578 (offset: 02E2C2) - success! 255 | ;; line 28584 (offset: 02E2CD) - success! 256 | ;; line 28599 (offset: 02E2ED) - success! 257 | ;; line 28605 (offset: 02E2F8) - success! 258 | ;; line 28308 (offset: 02E0BD) - success! 259 | ;; End of log. Version of scanner: 12.0 260 | -------------------------------------------------------------------------------- /Gradius-III/remap/discrete_long_abs_remap.asm: -------------------------------------------------------------------------------- 1 | ;Settings - Indexed: False; Indirect: False; Type: LongSolver 2 | 3 | ;============== REMAPPER FOR $000000 -> $006000 4 | org $008037 ; STA.L $000000 ;008036|8F000000|000000; 5 | dl $006000 6 | org $008B45 ; STA.L $000000 ;008B44|8F000000|000000; 7 | dl $006000 8 | 9 | ;============== REMAPPER FOR $000070 -> $006070 10 | org $008BA8 ; STA.L $000070 ;008BA7|8F700000|000070; 11 | dl $006070 12 | 13 | ;============== REMAPPER FOR $000084 -> $006084 14 | org $008B5E ; STA.L $000084 ;008B5D|8F840000|000084; 15 | dl $006084 16 | 17 | ;============== REMAPPER FOR $000200 -> $006200 18 | org $008B78 ; STA.L $000200 ;008B77|8F000200|000200; 19 | dl $006200 20 | org $008BF0 ; STA.L $000200 ;008BEF|8F000200|000200; 21 | dl $006200 22 | 23 | ;============== REMAPPER FOR $0008C0 -> $0068C0 24 | org $02CD06 ; STA.L $0008C0 ;02CD05|8FC00800|0008C0; 25 | dl $0068C0 26 | 27 | ;============== REMAPPER FOR $000ED0 -> $006ED0 28 | org $009029 ; LDA.L $000ED0 ;009028|AFD00E00|000ED0; 29 | dl $006ED0 30 | 31 | ;============== REMAPPER FOR $0011D0 -> $0071D0 32 | org $009032 ; LDA.L $0011D0 ;009031|AFD01100|0011D0; 33 | dl $0071D0 34 | 35 | ;============== REMAPPER FOR $001200 -> $007200 36 | org $008BC0 ; STA.L $001200 ;008BBF|8F001200|001200; 37 | dl $007200 38 | org $008C3A ; STA.L $001200 ;008C39|8F001200|001200; 39 | dl $007200 40 | 41 | ;============== REMAPPER FOR $001280 -> $007280 42 | org $008C09 ; STA.L $001280 ;008C08|8F801200|001280; 43 | dl $007280 44 | 45 | ;============== REMAPPER FOR $001480 -> $007480 46 | org $008C53 ; STA.L $001480 ;008C52|8F801400|001480; 47 | dl $007480 48 | 49 | ;============== REMAPPER FOR $001500 -> $007500 50 | org $00C244 ; STA.L $001500 ;00C243|8F001500|001500; 51 | dl $007500 52 | 53 | ;============== REMAPPER FOR $001540 -> $007540 54 | org $00C9A3 ; STA.L $001540 ;00C9A2|8F401500|001540; 55 | dl $007540 56 | org $00CAB8 ; STA.L $001540 ;00CAB7|8F401500|001540; 57 | dl $007540 58 | 59 | ;============== REMAPPER FOR $001A80 -> $007A80 60 | org $008C6C ; STA.L $001A80 ;008C6B|8F801A00|001A80; 61 | dl $007A80 62 | 63 | ;============== REMAPPER FOR $001B00 -> $007B00 64 | org $008C85 ; STA.L $001B00 ;008C84|8F001B00|001B00; 65 | dl $007B00 66 | 67 | ;============== REMAPPER FOR $001C00 -> $007C00 68 | org $008B90 ; STA.L $001C00 ;008B8F|8F001C00|001C00; 69 | dl $007C00 70 | 71 | ;============== REMAPPER FOR $001E00 -> $007E00 72 | org $0080F7 ; STA.L $001E00 ;0080F6|8F001E00|001E00; 73 | dl $007E00 74 | 75 | ;============== REMAPPER FOR $0112F8 -> $0172F8 76 | org $008F9A ; ORA.L $0112F8 ;008F99|0FF81201|0112F8; 77 | dl $0172F8 78 | 79 | ;; Scanlog: 80 | ;; line 36 (offset: 008036) - success! 81 | ;; line 1216 (offset: 008B44) - success! 82 | ;; line 1264 (offset: 008BA7) - success! 83 | ;; line 1229 (offset: 008B5D) - success! 84 | ;; line 1242 (offset: 008B77) - success! 85 | ;; line 1297 (offset: 008BEF) - success! 86 | ;; line 25886 (offset: 02CD05) - success! 87 | ;; line 1828 (offset: 009028) - success! 88 | ;; line 1831 (offset: 009031) - success! 89 | ;; line 1275 (offset: 008BBF) - success! 90 | ;; line 1334 (offset: 008C39) - success! 91 | ;; line 1310 (offset: 008C08) - success! 92 | ;; line 1347 (offset: 008C52) - success! 93 | ;; line 7574 (offset: 00C243) - success! 94 | ;; line 8447 (offset: 00C9A2) - success! 95 | ;; line 8564 (offset: 00CAB7) - success! 96 | ;; line 1360 (offset: 008C6B) - success! 97 | ;; line 1373 (offset: 008C84) - success! 98 | ;; line 1253 (offset: 008B8F) - success! 99 | ;; line 110 (offset: 0080F6) - success! 100 | ;; line 1758 (offset: 008F99) - success! 101 | ;; End of log. Version of scanner: 12.0 102 | -------------------------------------------------------------------------------- /Gradius-III/remap/discrete_long_remap.asm: -------------------------------------------------------------------------------- 1 | ;Settings - Indexed: False; Indirect: False; Type: LongSolver 2 | 3 | ;============== REMAPPER FOR $7E2000 -> $402000 4 | org $008063 ; STA.L $7E2000 ;008062|8F00207E|7E2000; 5 | dl $402000 6 | org $008077 ; STA.L $7E2000 ;008076|8F00207E|7E2000; 7 | dl $402000 8 | org $008C22 ; STA.L $7E2000 ;008C21|8F00207E|7E2000; 9 | dl $402000 10 | 11 | ;============== REMAPPER FOR $7E2222 -> $402222 12 | org $02FA58 ; STA.L $7E2222 ;02FA57|8F22227E|7E2222; 13 | dl $402222 14 | 15 | ;============== REMAPPER FOR $7E2224 -> $402224 16 | org $02FA6D ; STA.L $7E2224 ;02FA6C|8F24227E|7E2224; 17 | dl $402224 18 | 19 | ;============== REMAPPER FOR $7E2226 -> $402226 20 | org $02FA85 ; STA.L $7E2226 ;02FA84|8F26227E|7E2226; 21 | dl $402226 22 | 23 | ;============== REMAPPER FOR $7E2242 -> $402242 24 | org $02BF09 ; STA.L $7E2242 ;02BF08|8F42227E|7E2242; 25 | dl $402242 26 | 27 | ;============== REMAPPER FOR $7E2244 -> $402244 28 | org $02BF10 ; STA.L $7E2244 ;02BF0F|8F44227E|7E2244; 29 | dl $402244 30 | 31 | ;============== REMAPPER FOR $7E2246 -> $402246 32 | org $02BF17 ; STA.L $7E2246 ;02BF16|8F46227E|7E2246; 33 | dl $402246 34 | 35 | ;============== REMAPPER FOR $7E22A2 -> $4022A2 36 | org $02943C ; STA.L $7E22A2 ;02943B|8FA2227E|7E22A2; 37 | dl $4022A2 38 | 39 | ;============== REMAPPER FOR $7E22A4 -> $4022A4 40 | org $029443 ; STA.L $7E22A4 ;029442|8FA4227E|7E22A4; 41 | dl $4022A4 42 | 43 | ;============== REMAPPER FOR $7E22A6 -> $4022A6 44 | org $02944A ; STA.L $7E22A6 ;029449|8FA6227E|7E22A6; 45 | dl $4022A6 46 | 47 | ;============== REMAPPER FOR $7E22A8 -> $4022A8 48 | org $029451 ; STA.L $7E22A8 ;029450|8FA8227E|7E22A8; 49 | dl $4022A8 50 | 51 | ;============== REMAPPER FOR $7E22E2 -> $4022E2 52 | org $02A0CF ; STA.L $7E22E2 ;02A0CE|8FE2227E|7E22E2; 53 | dl $4022E2 54 | org $02C767 ; STA.L $7E22E2 ;02C766|8FE2227E|7E22E2; 55 | dl $4022E2 56 | 57 | ;============== REMAPPER FOR $7E22E4 -> $4022E4 58 | org $02C76E ; STA.L $7E22E4 ;02C76D|8FE4227E|7E22E4; 59 | dl $4022E4 60 | 61 | ;============== REMAPPER FOR $7E22E6 -> $4022E6 62 | org $02C775 ; STA.L $7E22E6 ;02C774|8FE6227E|7E22E6; 63 | dl $4022E6 64 | 65 | ;============== REMAPPER FOR $7E2302 -> $402302 66 | org $00D776 ; STA.L $7E2302 ;00D775|8F02237E|7E2302; 67 | dl $402302 68 | 69 | ;============== REMAPPER FOR $7E2304 -> $402304 70 | org $00D77D ; STA.L $7E2304 ;00D77C|8F04237E|7E2304; 71 | dl $402304 72 | 73 | ;============== REMAPPER FOR $7E2306 -> $402306 74 | org $00D784 ; STA.L $7E2306 ;00D783|8F06237E|7E2306; 75 | dl $402306 76 | 77 | ;============== REMAPPER FOR $7E2310 -> $402310 78 | org $00D75A ; STA.L $7E2310 ;00D759|8F10237E|7E2310; 79 | dl $402310 80 | 81 | ;============== REMAPPER FOR $7E3F00 -> $403F00 82 | org $0083AB ; STA.L $7E3F00 ;0083AA|8F003F7E|7E3F00; 83 | dl $403F00 84 | org $008427 ; STA.L $7E3F00 ;008426|8F003F7E|7E3F00; 85 | dl $403F00 86 | 87 | ;============== REMAPPER FOR $7E3F01 -> $403F01 88 | org $0083B6 ; STA.L $7E3F01 ;0083B5|8F013F7E|7E3F01; 89 | dl $403F01 90 | org $008439 ; STA.L $7E3F01 ;008438|8F013F7E|7E3F01; 91 | dl $403F01 92 | 93 | ;============== REMAPPER FOR $7E3F03 -> $403F03 94 | org $0083C2 ; STA.L $7E3F03 ;0083C1|8F033F7E|7E3F03; 95 | dl $403F03 96 | org $008448 ; STA.L $7E3F03 ;008447|8F033F7E|7E3F03; 97 | dl $403F03 98 | 99 | ;============== REMAPPER FOR $7E3F04 -> $403F04 100 | org $008453 ; STA.L $7E3F04 ;008452|8F043F7E|7E3F04; 101 | dl $403F04 102 | 103 | ;============== REMAPPER FOR $7E3F05 -> $403F05 104 | org $0083CD ; STA.L $7E3F05 ;0083CC|8F053F7E|7E3F05; 105 | dl $403F05 106 | 107 | ;============== REMAPPER FOR $7E3F06 -> $403F06 108 | org $0083DC ; STA.L $7E3F06 ;0083DB|8F063F7E|7E3F06; 109 | dl $403F06 110 | org $008432 ; STA.L $7E3F06 ;008431|8F063F7E|7E3F06; 111 | dl $403F06 112 | 113 | ;============== REMAPPER FOR $7E3F07 -> $403F07 114 | org $00843D ; STA.L $7E3F07 ;00843C|8F073F7E|7E3F07; 115 | dl $403F07 116 | 117 | ;============== REMAPPER FOR $7E3F08 -> $403F08 118 | org $0083EB ; STA.L $7E3F08 ;0083EA|8F083F7E|7E3F08; 119 | dl $403F08 120 | 121 | ;============== REMAPPER FOR $7E3F09 -> $403F09 122 | org $00844C ; STA.L $7E3F09 ;00844B|8F093F7E|7E3F09; 123 | dl $403F09 124 | 125 | ;============== REMAPPER FOR $7E3F0A -> $403F0A 126 | org $0083D1 ; STA.L $7E3F0A ;0083D0|8F0A3F7E|7E3F0A; 127 | dl $403F0A 128 | org $008457 ; STA.L $7E3F0A ;008456|8F0A3F7E|7E3F0A; 129 | dl $403F0A 130 | 131 | ;============== REMAPPER FOR $7E3F0B -> $403F0B 132 | org $0083E0 ; STA.L $7E3F0B ;0083DF|8F0B3F7E|7E3F0B; 133 | dl $403F0B 134 | 135 | ;============== REMAPPER FOR $7E3F0C -> $403F0C 136 | org $00842B ; STA.L $7E3F0C ;00842A|8F0C3F7E|7E3F0C; 137 | dl $403F0C 138 | 139 | ;============== REMAPPER FOR $7E3F0D -> $403F0D 140 | org $0083EF ; STA.L $7E3F0D ;0083EE|8F0D3F7E|7E3F0D; 141 | dl $403F0D 142 | org $008441 ; STA.L $7E3F0D ;008440|8F0D3F7E|7E3F0D; 143 | dl $403F0D 144 | 145 | ;============== REMAPPER FOR $7E3F0F -> $403F0F 146 | org $0083AF ; STA.L $7E3F0F ;0083AE|8F0F3F7E|7E3F0F; 147 | dl $403F0F 148 | org $00845E ; STA.L $7E3F0F ;00845D|8F0F3F7E|7E3F0F; 149 | dl $403F0F 150 | 151 | ;============== REMAPPER FOR $7E3F10 -> $403F10 152 | org $0083BA ; STA.L $7E3F10 ;0083B9|8F103F7E|7E3F10; 153 | dl $403F10 154 | 155 | ;============== REMAPPER FOR $7E3F12 -> $403F12 156 | org $0083C6 ; STA.L $7E3F12 ;0083C5|8F123F7E|7E3F12; 157 | dl $403F12 158 | 159 | ;============== REMAPPER FOR $7E3F14 -> $403F14 160 | org $0083F6 ; STA.L $7E3F14 ;0083F5|8F143F7E|7E3F14; 161 | dl $403F14 162 | 163 | ;============== REMAPPER FOR $7E3F20 -> $403F20 164 | org $00848D ; STA.L $7E3F20 ;00848C|8F203F7E|7E3F20; 165 | dl $403F20 166 | 167 | ;============== REMAPPER FOR $7E3F21 -> $403F21 168 | org $008498 ; STA.L $7E3F21 ;008497|8F213F7E|7E3F21; 169 | dl $403F21 170 | 171 | ;============== REMAPPER FOR $7E3F23 -> $403F23 172 | org $0084A4 ; STA.L $7E3F23 ;0084A3|8F233F7E|7E3F23; 173 | dl $403F23 174 | 175 | ;============== REMAPPER FOR $7E3F25 -> $403F25 176 | org $0084AF ; STA.L $7E3F25 ;0084AE|8F253F7E|7E3F25; 177 | dl $403F25 178 | 179 | ;============== REMAPPER FOR $7E3F26 -> $403F26 180 | org $0084BE ; STA.L $7E3F26 ;0084BD|8F263F7E|7E3F26; 181 | dl $403F26 182 | 183 | ;============== REMAPPER FOR $7E3F28 -> $403F28 184 | org $0084C9 ; STA.L $7E3F28 ;0084C8|8F283F7E|7E3F28; 185 | dl $403F28 186 | 187 | ;============== REMAPPER FOR $7E3F2A -> $403F2A 188 | org $0084B3 ; STA.L $7E3F2A ;0084B2|8F2A3F7E|7E3F2A; 189 | dl $403F2A 190 | 191 | ;============== REMAPPER FOR $7E3F2B -> $403F2B 192 | org $0084C2 ; STA.L $7E3F2B ;0084C1|8F2B3F7E|7E3F2B; 193 | dl $403F2B 194 | 195 | ;============== REMAPPER FOR $7E3F2D -> $403F2D 196 | org $0084CD ; STA.L $7E3F2D ;0084CC|8F2D3F7E|7E3F2D; 197 | dl $403F2D 198 | 199 | ;============== REMAPPER FOR $7E3F2F -> $403F2F 200 | org $008491 ; STA.L $7E3F2F ;008490|8F2F3F7E|7E3F2F; 201 | dl $403F2F 202 | 203 | ;============== REMAPPER FOR $7E3F30 -> $403F30 204 | org $00849C ; STA.L $7E3F30 ;00849B|8F303F7E|7E3F30; 205 | dl $403F30 206 | 207 | ;============== REMAPPER FOR $7E3F32 -> $403F32 208 | org $0084A8 ; STA.L $7E3F32 ;0084A7|8F323F7E|7E3F32; 209 | dl $403F32 210 | 211 | ;============== REMAPPER FOR $7E3F34 -> $403F34 212 | org $0084D4 ; STA.L $7E3F34 ;0084D3|8F343F7E|7E3F34; 213 | dl $403F34 214 | 215 | ;============== REMAPPER FOR $7E3F40 -> $403F40 216 | org $008502 ; STA.L $7E3F40 ;008501|8F403F7E|7E3F40; 217 | dl $403F40 218 | 219 | ;============== REMAPPER FOR $7E3F41 -> $403F41 220 | org $008511 ; STA.L $7E3F41 ;008510|8F413F7E|7E3F41; 221 | dl $403F41 222 | 223 | ;============== REMAPPER FOR $7E3F43 -> $403F43 224 | org $00851C ; STA.L $7E3F43 ;00851B|8F433F7E|7E3F43; 225 | dl $403F43 226 | 227 | ;============== REMAPPER FOR $7E3F45 -> $403F45 228 | org $008506 ; STA.L $7E3F45 ;008505|8F453F7E|7E3F45; 229 | dl $403F45 230 | 231 | ;============== REMAPPER FOR $7E3F46 -> $403F46 232 | org $008515 ; STA.L $7E3F46 ;008514|8F463F7E|7E3F46; 233 | dl $403F46 234 | 235 | ;============== REMAPPER FOR $7E3F48 -> $403F48 236 | org $008520 ; STA.L $7E3F48 ;00851F|8F483F7E|7E3F48; 237 | dl $403F48 238 | 239 | ;============== REMAPPER FOR $7E3F4A -> $403F4A 240 | org $008527 ; STA.L $7E3F4A ;008526|8F4A3F7E|7E3F4A; 241 | dl $403F4A 242 | 243 | ;============== REMAPPER FOR $7E8000 -> $408000 244 | org $008C9E ; STA.L $7E8000 ;008C9D|8F00807E|7E8000; 245 | dl $408000 246 | org $008CB7 ; STA.L $7E8000 ;008CB6|8F00807E|7E8000; 247 | dl $408000 248 | 249 | ;============== REMAPPER FOR $7EC000 -> $40C000 250 | org $008CCF ; STA.L $7EC000 ;008CCE|8F00C07E|7EC000; 251 | dl $40C000 252 | 253 | ;============== REMAPPER FOR $7FF800 -> $41F800 254 | org $008BD8 ; STA.L $7FF800 ;008BD7|8F00F87F|7FF800; 255 | dl $41F800 256 | 257 | ;; Scanlog: 258 | ;; line 54 (offset: 008062) - success! 259 | ;; line 63 (offset: 008076) - success! 260 | ;; line 1323 (offset: 008C21) - success! 261 | ;; line 31485 (offset: 02FA57) - success! 262 | ;; line 31493 (offset: 02FA6C) - success! 263 | ;; line 31504 (offset: 02FA84) - success! 264 | ;; line 24354 (offset: 02BF08) - success! 265 | ;; line 24356 (offset: 02BF0F) - success! 266 | ;; line 24358 (offset: 02BF16) - success! 267 | ;; line 19412 (offset: 02943B) - success! 268 | ;; line 19414 (offset: 029442) - success! 269 | ;; line 19416 (offset: 029449) - success! 270 | ;; line 19418 (offset: 029450) - success! 271 | ;; line 20886 (offset: 02A0CE) - success! 272 | ;; line 25252 (offset: 02C766) - success! 273 | ;; line 25254 (offset: 02C76D) - success! 274 | ;; line 25256 (offset: 02C774) - success! 275 | ;; line 10023 (offset: 00D775) - success! 276 | ;; line 10025 (offset: 00D77C) - success! 277 | ;; line 10027 (offset: 00D783) - success! 278 | ;; line 10010 (offset: 00D759) - success! 279 | ;; line 384 (offset: 0083AA) - success! 280 | ;; line 429 (offset: 008426) - success! 281 | ;; line 387 (offset: 0083B5) - success! 282 | ;; line 434 (offset: 008438) - success! 283 | ;; line 391 (offset: 0083C1) - success! 284 | ;; line 438 (offset: 008447) - success! 285 | ;; line 441 (offset: 008452) - success! 286 | ;; line 394 (offset: 0083CC) - success! 287 | ;; line 399 (offset: 0083DB) - success! 288 | ;; line 432 (offset: 008431) - success! 289 | ;; line 435 (offset: 00843C) - success! 290 | ;; line 404 (offset: 0083EA) - success! 291 | ;; line 439 (offset: 00844B) - success! 292 | ;; line 395 (offset: 0083D0) - success! 293 | ;; line 442 (offset: 008456) - success! 294 | ;; line 400 (offset: 0083DF) - success! 295 | ;; line 430 (offset: 00842A) - success! 296 | ;; line 405 (offset: 0083EE) - success! 297 | ;; line 436 (offset: 008440) - success! 298 | ;; line 385 (offset: 0083AE) - success! 299 | ;; line 444 (offset: 00845D) - success! 300 | ;; line 388 (offset: 0083B9) - success! 301 | ;; line 392 (offset: 0083C5) - success! 302 | ;; line 407 (offset: 0083F5) - success! 303 | ;; line 463 (offset: 00848C) - success! 304 | ;; line 466 (offset: 008497) - success! 305 | ;; line 470 (offset: 0084A3) - success! 306 | ;; line 473 (offset: 0084AE) - success! 307 | ;; line 478 (offset: 0084BD) - success! 308 | ;; line 481 (offset: 0084C8) - success! 309 | ;; line 474 (offset: 0084B2) - success! 310 | ;; line 479 (offset: 0084C1) - success! 311 | ;; line 482 (offset: 0084CC) - success! 312 | ;; line 464 (offset: 008490) - success! 313 | ;; line 467 (offset: 00849B) - success! 314 | ;; line 471 (offset: 0084A7) - success! 315 | ;; line 484 (offset: 0084D3) - success! 316 | ;; line 502 (offset: 008501) - success! 317 | ;; line 507 (offset: 008510) - success! 318 | ;; line 510 (offset: 00851B) - success! 319 | ;; line 503 (offset: 008505) - success! 320 | ;; line 508 (offset: 008514) - success! 321 | ;; line 511 (offset: 00851F) - success! 322 | ;; line 513 (offset: 008526) - success! 323 | ;; line 1386 (offset: 008C9D) - success! 324 | ;; line 1399 (offset: 008CB6) - success! 325 | ;; line 1410 (offset: 008CCE) - success! 326 | ;; line 1286 (offset: 008BD7) - success! 327 | ;; End of log. Version of scanner: 12.0 328 | -------------------------------------------------------------------------------- /Gradius-III/remap/indexed_full_abs_remap.asm: -------------------------------------------------------------------------------- 1 | ;Settings - Indexed: True; Indirect: False; Type: AbsoluteSolver 2 | 3 | ;============== REMAPPER FOR $0100 -> $6100 4 | org $0086FF ; LDA.W $0100,X ;0086FE|BD0001 |010100; 5 | dw $6100 6 | org $00877F ; STA.W $0100,X ;00877E|9D0001 |010100; 7 | dw $6100 8 | 9 | ;============== REMAPPER FOR $0130 -> $6130 10 | org $02F553 ; LDA.W $0130,X ;02F552|BD3001 |010130; 11 | dw $6130 12 | 13 | ;============== REMAPPER FOR $0150 -> $6150 14 | org $00DACA ; ORA.W $0150,Y ;00DAC9|195001 |010150; 15 | dw $6150 16 | 17 | ;============== REMAPPER FOR $08EE -> $68EE 18 | org $02DEE1 ; LDA.W $08EE,X ;02DEE0|BDEE08 |0108EE; 19 | dw $68EE 20 | 21 | ;============== REMAPPER FOR $150A -> $750A 22 | org $00C2F0 ; LDA.W $150A,Y ;00C2EF|B90A15 |01150A; 23 | dw $750A 24 | org $00C637 ; LDA.W $150A,Y ;00C636|B90A15 |01150A; 25 | dw $750A 26 | org $00C650 ; LDA.W $150A,Y ;00C64F|B90A15 |01150A; 27 | dw $750A 28 | org $00C657 ; STA.W $150A,Y ;00C656|990A15 |01150A; 29 | dw $750A 30 | org $00C6A0 ; LDA.W $150A,Y ;00C69F|B90A15 |01150A; 31 | dw $750A 32 | org $00C6B9 ; LDA.W $150A,Y ;00C6B8|B90A15 |01150A; 33 | dw $750A 34 | org $00C6C0 ; STA.W $150A,Y ;00C6BF|990A15 |01150A; 35 | dw $750A 36 | org $00C7AB ; LDA.W $150A,Y ;00C7AA|B90A15 |01150A; 37 | dw $750A 38 | org $00C852 ; LDA.W $150A,X ;00C851|BD0A15 |01150A; 39 | dw $750A 40 | 41 | ;============== REMAPPER FOR $15D6 -> $75D6 42 | org $00B1D7 ; STA.W $15D6,Y ;00B1D6|99D615 |0115D6; 43 | dw $75D6 44 | org $00B1E2 ; STA.W $15D6,Y ;00B1E1|99D615 |0115D6; 45 | dw $75D6 46 | org $00B24B ; STA.W $15D6,X ;00B24A|9DD615 |0115D6; 47 | dw $75D6 48 | org $00B29D ; STA.W $15D6,X ;00B29C|9DD615 |0115D6; 49 | dw $75D6 50 | 51 | ;============== REMAPPER FOR $1C00 -> $7C00 52 | org $00B53B ; LDA.W $1C00,X ;00B53A|BD001C |011C00; 53 | dw $7C00 54 | org $00B5E7 ; INC.W $1C00,X ;00B5E6|FE001C |011C00; 55 | dw $7C00 56 | org $00B5FC ; STA.W $1C00,X ;00B5FB|9D001C |011C00; 57 | dw $7C00 58 | org $00B65C ; INC.W $1C00,X ;00B65B|FE001C |011C00; 59 | dw $7C00 60 | org $00B66E ; DEC.W $1C00,X ;00B66D|DE001C |011C00; 61 | dw $7C00 62 | org $00B6CE ; INC.W $1C00,X ;00B6CD|FE001C |011C00; 63 | dw $7C00 64 | org $00B6E0 ; DEC.W $1C00,X ;00B6DF|DE001C |011C00; 65 | dw $7C00 66 | org $00B740 ; INC.W $1C00,X ;00B73F|FE001C |011C00; 67 | dw $7C00 68 | org $00B752 ; DEC.W $1C00,X ;00B751|DE001C |011C00; 69 | dw $7C00 70 | org $00B786 ; INC.W $1C00,X ;00B785|FE001C |011C00; 71 | dw $7C00 72 | org $00B798 ; DEC.W $1C00,X ;00B797|DE001C |011C00; 73 | dw $7C00 74 | org $00B7CC ; INC.W $1C00,X ;00B7CB|FE001C |011C00; 75 | dw $7C00 76 | org $00B7DE ; DEC.W $1C00,X ;00B7DD|DE001C |011C00; 77 | dw $7C00 78 | org $00B822 ; STZ.W $1C00,X ;00B821|9E001C |011C00; 79 | dw $7C00 80 | org $00B834 ; DEC.W $1C00,X ;00B833|DE001C |011C00; 81 | dw $7C00 82 | org $00B8E9 ; CMP.W $1C00,Y ;00B8E8|D9001C |011C00; 83 | dw $7C00 84 | org $00B8FD ; LDA.W $1C00,Y ;00B8FC|B9001C |011C00; 85 | dw $7C00 86 | org $00B91B ; LDA.W $1C00,Y ;00B91A|B9001C |011C00; 87 | dw $7C00 88 | 89 | ;============== REMAPPER FOR $1C08 -> $7C08 90 | org $00B598 ; STA.W $1C08,X ;00B597|9D081C |011C08; 91 | dw $7C08 92 | org $00B5B5 ; LDA.W $1C08,X ;00B5B4|BD081C |011C08; 93 | dw $7C08 94 | org $00B5CD ; LDA.W $1C08,X ;00B5CC|BD081C |011C08; 95 | dw $7C08 96 | 97 | ;============== REMAPPER FOR $1C0C -> $7C0C 98 | org $00B562 ; LDA.W $1C0C,X ;00B561|BD0C1C |011C0C; 99 | dw $7C0C 100 | org $00B57C ; LDA.W $1C0C,X ;00B57B|BD0C1C |011C0C; 101 | dw $7C0C 102 | org $00B59E ; INC.W $1C0C,X ;00B59D|FE0C1C |011C0C; 103 | dw $7C0C 104 | 105 | ;============== REMAPPER FOR $1C14 -> $7C14 106 | org $00B501 ; DEC.W $1C14,X ;00B500|DE141C |011C14; 107 | dw $7C14 108 | org $00B511 ; STA.W $1C14,X ;00B510|9D141C |011C14; 109 | dw $7C14 110 | org $00B51F ; STA.W $1C14,X ;00B51E|9D141C |011C14; 111 | dw $7C14 112 | 113 | ;============== REMAPPER FOR $1C18 -> $7C18 114 | org $00B4FC ; CMP.W $1C18,X ;00B4FB|DD181C |011C18; 115 | dw $7C18 116 | org $00B50B ; STA.W $1C18,X ;00B50A|9D181C |011C18; 117 | dw $7C18 118 | org $00B514 ; LDA.W $1C18,X ;00B513|BD181C |011C18; 119 | dw $7C18 120 | org $00B519 ; STA.W $1C18,X ;00B518|9D181C |011C18; 121 | dw $7C18 122 | org $00B522 ; LDA.W $1C18,X ;00B521|BD181C |011C18; 123 | dw $7C18 124 | 125 | ;============== REMAPPER FOR $1C1C -> $7C1C 126 | org $00B56E ; LDA.W $1C1C,Y ;00B56D|B91C1C |011C1C; 127 | dw $7C1C 128 | org $00B579 ; STA.W $1C1C,Y ;00B578|991C1C |011C1C; 129 | dw $7C1C 130 | org $00B584 ; LDA.W $1C1C,Y ;00B583|B91C1C |011C1C; 131 | dw $7C1C 132 | 133 | ;============== REMAPPER FOR $1E20 -> $7E20 134 | org $00B023 ; LDA.W $1E20,X ;00B022|BD201E |011E20; 135 | dw $7E20 136 | org $00B090 ; LDA.W $1E20,X ;00B08F|BD201E |011E20; 137 | dw $7E20 138 | org $00B59B ; STA.W $1E20,X ;00B59A|9D201E |011E20; 139 | dw $7E20 140 | org $00B5B0 ; DEC.W $1E20,X ;00B5AF|DE201E |011E20; 141 | dw $7E20 142 | org $00B5B8 ; STA.W $1E20,X ;00B5B7|9D201E |011E20; 143 | dw $7E20 144 | org $00B5CA ; INC.W $1E20,X ;00B5C9|FE201E |011E20; 145 | dw $7E20 146 | org $00B5D0 ; CMP.W $1E20,X ;00B5CF|DD201E |011E20; 147 | dw $7E20 148 | org $00B5D5 ; STZ.W $1E20,X ;00B5D4|9E201E |011E20; 149 | dw $7E20 150 | org $00B893 ; LDA.W $1E20,Y ;00B892|B9201E |011E20; 151 | dw $7E20 152 | org $00BAE3 ; LDA.W $1E20,X ;00BAE2|BD201E |011E20; 153 | dw $7E20 154 | org $00BE2E ; LDA.W $1E20,X ;00BE2D|BD201E |011E20; 155 | dw $7E20 156 | 157 | ;============== REMAPPER FOR $1E24 -> $7E24 158 | org $00B60E ; LDA.W $1E24,X ;00B60D|BD241E |011E24; 159 | dw $7E24 160 | org $00B615 ; STA.W $1E24,X ;00B614|9D241E |011E24; 161 | dw $7E24 162 | org $00B627 ; LDA.W $1E24,X ;00B626|BD241E |011E24; 163 | dw $7E24 164 | org $00B62E ; STA.W $1E24,X ;00B62D|9D241E |011E24; 165 | dw $7E24 166 | org $00B64A ; STA.W $1E24,X ;00B649|9D241E |011E24; 167 | dw $7E24 168 | org $00BB93 ; LDA.W $1E24,Y ;00BB92|B9241E |011E24; 169 | dw $7E24 170 | 171 | ;============== REMAPPER FOR $1E28 -> $7E28 172 | org $00B680 ; LDA.W $1E28,X ;00B67F|BD281E |011E28; 173 | dw $7E28 174 | org $00B687 ; STA.W $1E28,X ;00B686|9D281E |011E28; 175 | dw $7E28 176 | org $00B699 ; LDA.W $1E28,X ;00B698|BD281E |011E28; 177 | dw $7E28 178 | org $00B6A0 ; STA.W $1E28,X ;00B69F|9D281E |011E28; 179 | dw $7E28 180 | org $00B6BC ; STA.W $1E28,X ;00B6BB|9D281E |011E28; 181 | dw $7E28 182 | org $00BB98 ; LDA.W $1E28,Y ;00BB97|B9281E |011E28; 183 | dw $7E28 184 | 185 | ;============== REMAPPER FOR $1E2C -> $7E2C 186 | org $00B6F2 ; LDA.W $1E2C,X ;00B6F1|BD2C1E |011E2C; 187 | dw $7E2C 188 | org $00B6F9 ; STA.W $1E2C,X ;00B6F8|9D2C1E |011E2C; 189 | dw $7E2C 190 | org $00B70B ; LDA.W $1E2C,X ;00B70A|BD2C1E |011E2C; 191 | dw $7E2C 192 | org $00B712 ; STA.W $1E2C,X ;00B711|9D2C1E |011E2C; 193 | dw $7E2C 194 | org $00B72E ; STA.W $1E2C,X ;00B72D|9D2C1E |011E2C; 195 | dw $7E2C 196 | org $00BB9D ; LDA.W $1E2C,Y ;00BB9C|B92C1E |011E2C; 197 | dw $7E2C 198 | 199 | ;============== REMAPPER FOR $1E30 -> $7E30 200 | org $00B76D ; LDA.W $1E30,X ;00B76C|BD301E |011E30; 201 | dw $7E30 202 | org $00B774 ; STA.W $1E30,X ;00B773|9D301E |011E30; 203 | dw $7E30 204 | org $00BBA2 ; LDA.W $1E30,Y ;00BBA1|B9301E |011E30; 205 | dw $7E30 206 | 207 | ;============== REMAPPER FOR $1E34 -> $7E34 208 | org $00B7B3 ; LDA.W $1E34,X ;00B7B2|BD341E |011E34; 209 | dw $7E34 210 | org $00B7BA ; STA.W $1E34,X ;00B7B9|9D341E |011E34; 211 | dw $7E34 212 | org $00BBA7 ; LDA.W $1E34,Y ;00BBA6|B9341E |011E34; 213 | dw $7E34 214 | 215 | ;============== REMAPPER FOR $1F2D -> $7F2D 216 | org $008737 ; LDA.W $1F2D,Y ;008736|B92D1F |011F2D; 217 | dw $7F2D 218 | 219 | ;============== REMAPPER FOR $1F2E -> $7F2E 220 | org $00993D ; STA.W $1F2E,Y ;00993C|992E1F |011F2E; 221 | dw $7F2E 222 | 223 | ;============== REMAPPER FOR $1F44 -> $7F44 224 | org $008D02 ; ADC.W $1F44,Y ;008D01|79441F |011F44; 225 | dw $7F44 226 | org $008D05 ; STA.W $1F44,Y ;008D04|99441F |011F44; 227 | dw $7F44 228 | org $008D19 ; STA.W $1F44,Y ;008D18|99441F |011F44; 229 | dw $7F44 230 | org $008D4B ; CMP.W $1F44,Y ;008D4A|D9441F |011F44; 231 | dw $7F44 232 | org $008D50 ; LDA.W $1F44,Y ;008D4F|B9441F |011F44; 233 | dw $7F44 234 | org $00BA8D ; STZ.W $1F44,X ;00BA8C|9E441F |011F44; 235 | dw $7F44 236 | org $00BD53 ; STZ.W $1F44,X ;00BD52|9E441F |011F44; 237 | dw $7F44 238 | org $00D118 ; LDA.W $1F44,Y ;00D117|B9441F |011F44; 239 | dw $7F44 240 | 241 | ;============== REMAPPER FOR $1F45 -> $7F45 242 | org $02E2D7 ; LDA.W $1F45,Y ;02E2D6|B9451F |011F45; 243 | dw $7F45 244 | 245 | ;============== REMAPPER FOR $1F46 -> $7F46 246 | org $008D0A ; ADC.W $1F46,Y ;008D09|79461F |011F46; 247 | dw $7F46 248 | org $008D0D ; STA.W $1F46,Y ;008D0C|99461F |011F46; 249 | dw $7F46 250 | org $008D1F ; STA.W $1F46,Y ;008D1E|99461F |011F46; 251 | dw $7F46 252 | org $008D24 ; LDA.W $1F46,Y ;008D23|B9461F |011F46; 253 | dw $7F46 254 | org $008D41 ; CMP.W $1F46,Y ;008D40|D9461F |011F46; 255 | dw $7F46 256 | org $008D56 ; LDA.W $1F46,Y ;008D55|B9461F |011F46; 257 | dw $7F46 258 | org $00BA90 ; STZ.W $1F46,X ;00BA8F|9E461F |011F46; 259 | dw $7F46 260 | org $00BD56 ; STZ.W $1F46,X ;00BD55|9E461F |011F46; 261 | dw $7F46 262 | org $00D11D ; LDA.W $1F46,Y ;00D11C|B9461F |011F46; 263 | dw $7F46 264 | 265 | ;============== REMAPPER FOR $1F80 -> $7F80 266 | org $00D1A6 ; LDA.W $1F80,X ;00D1A5|BD801F |011F80; 267 | dw $7F80 268 | org $00D1A9 ; STA.W $1F80,Y ;00D1A8|99801F |011F80; 269 | dw $7F80 270 | 271 | ;; Scanlog: 272 | ;; line 720 (offset: 0086FE) - success! 273 | ;; line 791 (offset: 00877E) - success! 274 | ;; line 30897 (offset: 02F552) - success! 275 | ;; line 10428 (offset: 00DAC9) - success! 276 | ;; line 28081 (offset: 02DEE0) - success! 277 | ;; line 7646 (offset: 00C2EF) - success! 278 | ;; line 8026 (offset: 00C636) - success! 279 | ;; line 8040 (offset: 00C64F) - success! 280 | ;; line 8043 (offset: 00C656) - success! 281 | ;; line 8079 (offset: 00C69F) - success! 282 | ;; line 8093 (offset: 00C6B8) - success! 283 | ;; line 8096 (offset: 00C6BF) - success! 284 | ;; line 8201 (offset: 00C7AA) - success! 285 | ;; line 8285 (offset: 00C851) - success! 286 | ;; line 5684 (offset: 00B1D6) - success! 287 | ;; line 5689 (offset: 00B1E1) - success! 288 | ;; line 5740 (offset: 00B24A) - success! 289 | ;; line 5775 (offset: 00B29C) - success! 290 | ;; line 6087 (offset: 00B53A) - success! 291 | ;; line 6165 (offset: 00B5E6) - success! 292 | ;; line 6174 (offset: 00B5FB) - success! 293 | ;; line 6215 (offset: 00B65B) - success! 294 | ;; line 6223 (offset: 00B66D) - success! 295 | ;; line 6264 (offset: 00B6CD) - success! 296 | ;; line 6272 (offset: 00B6DF) - success! 297 | ;; line 6313 (offset: 00B73F) - success! 298 | ;; line 6321 (offset: 00B751) - success! 299 | ;; line 6345 (offset: 00B785) - success! 300 | ;; line 6353 (offset: 00B797) - success! 301 | ;; line 6377 (offset: 00B7CB) - success! 302 | ;; line 6385 (offset: 00B7DD) - success! 303 | ;; line 6415 (offset: 00B821) - success! 304 | ;; line 6423 (offset: 00B833) - success! 305 | ;; line 6511 (offset: 00B8E8) - success! 306 | ;; line 6520 (offset: 00B8FC) - success! 307 | ;; line 6533 (offset: 00B91A) - success! 308 | ;; line 6132 (offset: 00B597) - success! 309 | ;; line 6144 (offset: 00B5B4) - success! 310 | ;; line 6154 (offset: 00B5CC) - success! 311 | ;; line 6108 (offset: 00B561) - success! 312 | ;; line 6120 (offset: 00B57B) - success! 313 | ;; line 6134 (offset: 00B59D) - success! 314 | ;; line 6061 (offset: 00B500) - success! 315 | ;; line 6068 (offset: 00B510) - success! 316 | ;; line 6074 (offset: 00B51E) - success! 317 | ;; line 6059 (offset: 00B4FB) - success! 318 | ;; line 6066 (offset: 00B50A) - success! 319 | ;; line 6069 (offset: 00B513) - success! 320 | ;; line 6072 (offset: 00B518) - success! 321 | ;; line 6075 (offset: 00B521) - success! 322 | ;; line 6115 (offset: 00B56D) - success! 323 | ;; line 6119 (offset: 00B578) - success! 324 | ;; line 6123 (offset: 00B583) - success! 325 | ;; line 5514 (offset: 00B022) - success! 326 | ;; line 5553 (offset: 00B08F) - success! 327 | ;; line 6133 (offset: 00B59A) - success! 328 | ;; line 6142 (offset: 00B5AF) - success! 329 | ;; line 6145 (offset: 00B5B7) - success! 330 | ;; line 6153 (offset: 00B5C9) - success! 331 | ;; line 6155 (offset: 00B5CF) - success! 332 | ;; line 6157 (offset: 00B5D4) - success! 333 | ;; line 6468 (offset: 00B892) - success! 334 | ;; line 6741 (offset: 00BAE2) - success! 335 | ;; line 7097 (offset: 00BE2D) - success! 336 | ;; line 6182 (offset: 00B60D) - success! 337 | ;; line 6184 (offset: 00B614) - success! 338 | ;; line 6192 (offset: 00B626) - success! 339 | ;; line 6194 (offset: 00B62D) - success! 340 | ;; line 6207 (offset: 00B649) - success! 341 | ;; line 6814 (offset: 00BB92) - success! 342 | ;; line 6231 (offset: 00B67F) - success! 343 | ;; line 6233 (offset: 00B686) - success! 344 | ;; line 6241 (offset: 00B698) - success! 345 | ;; line 6243 (offset: 00B69F) - success! 346 | ;; line 6256 (offset: 00B6BB) - success! 347 | ;; line 6816 (offset: 00BB97) - success! 348 | ;; line 6280 (offset: 00B6F1) - success! 349 | ;; line 6282 (offset: 00B6F8) - success! 350 | ;; line 6290 (offset: 00B70A) - success! 351 | ;; line 6292 (offset: 00B711) - success! 352 | ;; line 6305 (offset: 00B72D) - success! 353 | ;; line 6818 (offset: 00BB9C) - success! 354 | ;; line 6334 (offset: 00B76C) - success! 355 | ;; line 6337 (offset: 00B773) - success! 356 | ;; line 6820 (offset: 00BBA1) - success! 357 | ;; line 6366 (offset: 00B7B2) - success! 358 | ;; line 6369 (offset: 00B7B9) - success! 359 | ;; line 6822 (offset: 00BBA6) - success! 360 | ;; line 750 (offset: 008736) - success! 361 | ;; line 2945 (offset: 00993C) - success! 362 | ;; line 1439 (offset: 008D01) - success! 363 | ;; line 1440 (offset: 008D04) - success! 364 | ;; line 1448 (offset: 008D18) - success! 365 | ;; line 1469 (offset: 008D4A) - success! 366 | ;; line 1471 (offset: 008D4F) - success! 367 | ;; line 6705 (offset: 00BA8C) - success! 368 | ;; line 6999 (offset: 00BD52) - success! 369 | ;; line 9276 (offset: 00D117) - success! 370 | ;; line 28590 (offset: 02E2D6) - success! 371 | ;; line 1442 (offset: 008D09) - success! 372 | ;; line 1443 (offset: 008D0C) - success! 373 | ;; line 1450 (offset: 008D1E) - success! 374 | ;; line 1452 (offset: 008D23) - success! 375 | ;; line 1465 (offset: 008D40) - success! 376 | ;; line 1473 (offset: 008D55) - success! 377 | ;; line 6706 (offset: 00BA8F) - success! 378 | ;; line 7000 (offset: 00BD55) - success! 379 | ;; line 9278 (offset: 00D11C) - success! 380 | ;; line 9350 (offset: 00D1A5) - success! 381 | ;; line 9351 (offset: 00D1A8) - success! 382 | ;; End of log. Version of scanner: 12.0 383 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | _____ __ _____ _ 3 | / ____| /\ /_ | | __ \ | | 4 | | (___ / \ ______| | | |__) |___ ___ | |_ 5 | \___ \ / /\ \______| | | _ // _ \ / _ \| __| 6 | ____) / ____ \ | | | | \ \ (_) | (_) | |_ 7 | |_____/_/ \_\ |_| |_| \_\___/ \___/ \__| 8 | Version 1.8 by Vitor Vilela 9 | ``` 10 | 11 | SA-1 Root is a project for enabling and accelerating games using the SA-1 chip. 12 | It's a pack of patches that optimizes the game to the maximum possible keeping 13 | high hardware compatibility and keeping most of the game aspects intact. 14 | 15 | So far the following games are available: 16 | * [Contra III](Contra-III) v1.2 17 | * [Gradius III](Gradius-III) v1.7 18 | * [Race Drivin'](Race-Drivin) v1.2 19 | * [Super R-Type](Super-R-Type) v1.1 20 | * Super Mario World ([SA-1 Pack only](https://github.com/VitorVilela7/SA1-Pack)) 21 | 22 | What is it? 23 | =========== 24 | 25 | SA-1 (Super Accelerator) is a co-processor included on some SNES games cartridges. 26 | It is made to work together with the Super NES CPU and used to enhance its 27 | processing speed, graphics and memory. 28 | 29 | With its 10.74 MHz clock, the SA-1 CPU is four times faster than the normal SNES 30 | CPU processing. The SA-1 CPU and SNES CPU also runs simultaneously, which can 31 | result in up to five times faster processing over a game with no enhancement chips. 32 | Using that power, the Super Accelerator System (SAS) can be used to process game 33 | engines much faster than the normal, allowing more sprites to be processed at once, 34 | more in-game effects, faster loading and much more. 35 | 36 | SA-1 Root not just activates the co-processor, but also modifies a good part of 37 | the game engine to use and explore the chip features, which gives an extreme 38 | boost to the overall performance of the game. 39 | 40 | ## System Features 41 | * 16-bit 65c816 processor clocked at 10.74 MHz. 42 | * 2 kB fast internal work memory (I-RAM), clocked at 10.74 MHz. 43 | * Multi-processor processing, with parallel operating mode and memory sharing 44 | control. 45 | * Large capacity memory, with a total capability of 8 MB of ROM clocked at 46 | 10.74 MHz and 256 kB of BW-RAM, clocked at 5.37 MHz. 47 | * High speed arithmetic hardware of multiplication, division and cumulative 48 | sum. 49 | * Bitmap and Character Conversion functions for fast graphics manipulation. 50 | * Custom DMA circuit for fast transfers between ROM, I-RAM and BW-RAM. 51 | * Variable-Length Bit data processing for enhanced algorithms such as graphics 52 | and data compression. 53 | * Super MMC memory mapping capabilities for BW-RAM and bank switching for 54 | multiple ROM image access and mirroring. 55 | 56 | ## Differences with SA-1 Pack 57 | 58 | SA-1 Root is intended to be the base pack for enabling SA-1 on the games 59 | and optimizing it. SA-1 Pack is intended to be a full featured pack that 60 | not just enables SA-1 and accelerate the game, but also improve the game 61 | engine and provide additional tools for ROM hacking. 62 | 63 | For example, Super Mario World's SA-1 Pack doubles the maximum physical 64 | amount of allowed enemies on screen and includes different shared 65 | routines for additional SA-1 features. 66 | 67 | Compatibility 68 | ============= 69 | 70 | SA-1 Root is warranted to work with real hardware, including SA-1 carts 71 | plus the most up-to-date SNES emulators including bsnes and Snes9x. 72 | 73 | ZSNES is not compatible with the SA-1 Root patches. 74 | 75 | Credits 76 | ======= 77 | 78 | SA-1 Root wouldn't be that awesome without help from these people: 79 | 80 | * arcademaster01 (SA-1 hardware bug report) 81 | * indcsion (Gradius III testing) 82 | * Erivando_BR (Contra III testing, Contra III trace logs, Super R-Type trace logs and Race Drivin' trace logs) 83 | * Ethan Tabor (Race Drivin' testing and bug report) 84 | * GuyPerfect (Gradius III speed reduction patch add-on) 85 | * Jeffrey (Contra III testing) 86 | * Jonas Quinn (SA-1 hardware bug report) 87 | * kccheng (Contra III and Super R-Type testing) 88 | * Rodzilla97 (Contra III bug report) 89 | * slidelljohn (Gradius III bug report and extra help) 90 | * Vitor Vilela (crazy author that did most of the patches) 91 | * Voultar (SA-1 hardware bug report) 92 | * You (for using it :D) 93 | 94 | Special thanks also for all my patrons from 95 | https://www.patreon.com/vitorvilela, specially for: 96 | 97 | * Fabio Akita 98 | * Frogamus Lewd 99 | * gunmakuma 100 | * kccheng 101 | * PsychoFox 102 | 103 | Useful Links 104 | ============ 105 | 106 | #### Technical documents 107 | 108 | Useful documents for understanding SA-1: 109 | 110 | * SA-1 article at SnesLab: https://www.sneslab.net/wiki/SA-1 111 | * SNES Dev. Book: https://www.romhacking.net/documents/226/ 112 | * SA-1 Registers: https://wiki.superfamicom.org/sa-1-registers 113 | * SA-1 Doc: https://github.com/VitorVilela7/SNES-SA-1-doc/ 114 | 115 | #### Contacting me 116 | 117 | You can contact me though the following links: 118 | 119 | * My Website: https://www.sneslab.net/ 120 | * My Github profile: https://github.com/VitorVilela7 121 | * My Twitter profile: https://twitter.com/HackerVilela 122 | * My Patreon: https://www.patreon.com/vitorvilela 123 | -------------------------------------------------------------------------------- /Race-Drivin/README.md: -------------------------------------------------------------------------------- 1 | # SA-1 Root: Race Drivin' 2 | Version 1.1, released 2021-04-04 3 | 4 | Race Drivin' is a car driving game made by Atari Games and ported to the 5 | SNES by Toy Headquarters. It features a first person driving game, with 6 | three cars available and three stages to play. 7 | 8 | It simulates a driving experience where you can go though radical tracks 9 | using racing-like cars with semi-automatic or manual gearbox system. The 10 | game is 3D, which is pretty unique to the SNES, however the port was 11 | horribly slow, with frame rate on average being 4.77 FPS. 12 | 13 | This SA-1 Root patch increases the internal frame rate up to 30 FPS and 14 | applies Delta-Based Frame Correction to make sure the game internal speed 15 | stays consistent regardless of the frame rate. This means that the game 16 | internal speed will stay the same even if the frame rate increases or 17 | decreases, by counting the number of V-Blank events and comparing against 18 | the time it took to draw a frame. 19 | 20 | Special thanks to Erivando_BR for sending me the SA-1 Collection trace 21 | log files of Race Drivin', which was an important help during the 22 | disassembly process. 23 | 24 | ## Base and Origin versions 25 | 26 | There is two versions available. One is the base SA-1 Root patch, where it 27 | installs the SA-1 chip + Delta-Based and brings optimal gameplay experience. 28 | Use the BPS file Race-Drivin-USA.bps to play this version. 29 | 30 | Another version uses changes the internal speed to make it as close as the 31 | original SNES version, which makes the game slower but still with the smooth 32 | 30 FPS frame rate. It makes the controls harder, because they are now less 33 | sensisive compared to the base version. Use BPS Race-Drivin-Origin-USA.bps to 34 | play this version. 35 | 36 | ## How to Patch 37 | 38 | Download the latest Race Drivin' BPS patch file available on the 39 | [Releases](https://github.com/VitorVilela7/SA1-Root/releases) tab. 40 | 41 | You can patch it using [beat](https://www.romhacking.net/utilities/893/) 42 | or [FLIPS](https://sneslab.net/tools/floating.zip), both common 43 | .bps patchers. 44 | 45 | You can also patch the .asm files directly using 46 | [Asar](https://github.com/RPGHacker/asar). Check the !origin flag on sa1.asm 47 | before patching, if you want to the patch acts as "Origin" or "Base" speed. 48 | 49 | For more information on how to apply ROM patches, see this SnesLab 50 | article: https://sneslab.net/wiki/How_to_apply_ROM_patches 51 | 52 | It works only on the american version of Race Drivin'. 53 | 54 | Expected checksums: 55 | 56 | ### USA Version: 57 | #### Before patching: 58 | * CRC32: C5BAB870 59 | * SHA256: DD0FEB78E2D5D81F59241BAF3BCA5E2EDAEBBE98F0AC860A4EB6D448718F1CA5 60 | 61 | #### After patching (base version) 62 | * CRC32: 23EAA97E 63 | * SHA256: 6CA9486BDF492228DCC75BA09A4364A6000EF96B0B63FB960F5F963FC906686B 64 | 65 | #### After patching (origin version) 66 | * CRC32: BB42A085 67 | * SHA256: 6890DC6D69D656775EF70A5A353CA3639DA119BECDBB488B05B1FF31A37E01D7 68 | 69 | ## Compatibility 70 | 71 | It works on both real hardware (FXPAK or SA-1 cart) and emulators 72 | (Snes9x and bsnes/higan/ares). 73 | 74 | ## Known issues 75 | 76 | * The title screen demo may not play correctly on some emulators or systems, 77 | because of the Delta-Based Frame Correction limitations. 78 | * Some places of the game may not render correctly, because of the engine 79 | limitations. 80 | * Some sections of Super Stunt Track may reduce frame rate to 12 FPS instead 81 | of 30 FPS. 82 | 83 | ## Technical details 84 | 85 | * Remapping mode: partial 86 | * Remapping strategy: semi-static 87 | * SA-1 usage: full with parallelism 88 | * Delta-Based Frame Correction is used 89 | 90 | In terms of RAM remapping, this game data structure is reasonably simple. 91 | It uses a lot of direct page memory while working and there is not much 92 | dynamic pointers. The main challenge was for optimizing the game internal 93 | engine for using SA-1 features, since it relies a lot of mathematical 94 | algorithms which are slow to be done on the SNES CPU side (including PPU 95 | registers). The game also had a few bottlenecks which contributed to the 96 | slowdown, in particular the frame buffer (5 frames delay) and unneeded 97 | amount of synchronization with the NMI. 98 | 99 | Once the game was accelerated, it was noted that the game was running way 100 | too much faster. For that reason, **Delta-Based Frame Correction** was 101 | introduced for making smoother intermediate frames according the amount 102 | of time it was passed. In case the game expects to 5 frames to be passed 103 | but only 2 frames passed, then all derivations (delta) values would 104 | get multiplied by 2/5 to compensate the excessive speed. This way, the 105 | game will still run as normal but with smoothier and intermediate frames. 106 | 107 | Because the game is mostly vector based, it's possible to add smoothier 108 | frames without having to draw additional graphics frames by hand. 109 | 110 | Some structures are still on the WRAM side, in particular the positions 111 | of all cars and trucks which is used on the instant replay and on the 112 | autcross track for the shadow replay. 113 | 114 | Like Super R-Type, SA-1 was used as the "master" processor, being 115 | responsible for running the whole game and only routines that really 116 | required the SNES CPU were executed on the other processor. All calls to 117 | the SNES CPU are asynchronous and parallel, meaning that the SA-1 requests 118 | the SNES CPU to process a specific routine and continues executing without 119 | waiting the SNES CPU to terminate its job. Some routines were adapted to 120 | not cause RAM collision during the parallel execution of the routines. 121 | 122 | Because of the game characteristics, 123 | **32 kB (256 Kbit) of BW-RAM is required to the game run** correctly. 124 | 125 | ## RAM remap 126 | 127 | * ``$0000-$00FF`` -> ``$3000-$30FF`` (I-RAM) 128 | * ``$0100-$1FFF`` -> ``$6100-$7FFF`` (BW-RAM) 129 | * ``$7E:2000-$7E:7FFF`` -> ``$40:2000-$40:7FFF`` (BW-RAM, except $0D00-$0DFF) 130 | * ``$7E:0D00-$7E:0DFF`` -> ``$7E:1000-$7E:17FF`` (expanded) 131 | * ``$7E:7000-$7F:7FFF`` -> ``$7E:2000-$7F:9FFF`` (expanded) 132 | * ``$7E:8000-$7F:7FFF`` -> ``$7E:A000-$7F:9FFF`` (moved) 133 | 134 | ## Credits 135 | 136 | Race Drivin' - SA-1 Root wouldn't be that awesome without help from 137 | these people: 138 | 139 | * Erivando_BR (trace logs) 140 | * Ethan Tabor (testing) 141 | * Vitor Vilela (patch author) 142 | * You (for using it :D) 143 | 144 | ## Contacting me 145 | 146 | You can contact me though the following links: 147 | 148 | * My Website: https://www.sneslab.net/ 149 | * My Github profile: https://github.com/VitorVilela7 150 | * My Twitter profile: https://twitter.com/HackerVilela 151 | * My Patreon: https://www.patreon.com/vitorvilela 152 | * My personal blog: https://vilela.sneslab.net/ 153 | -------------------------------------------------------------------------------- /Race-Drivin/asm/commit_buffer.asm: -------------------------------------------------------------------------------- 1 | ; Implements Commit-Based Frame Buffering 2 | ; Gets rids of the bottlenecks 3 | 4 | macro skip_spin(addr) 5 | assert read1(+0) == $22 6 | assert read3(+1) == $F3AB 7 | 8 | pushpc 9 | org 10 | BRA ?skip 11 | NOP #2 12 | ?skip: 13 | pullpc 14 | endmacro 15 | 16 | macro add_spin(addr) 17 | assert read1(+0) == $22 18 | assert read3(+1) == $F3AB 19 | 20 | pushpc 21 | org 22 | JSL spin_up 23 | ?skip: 24 | pullpc 25 | endmacro 26 | 27 | ; spin for 'n' frames 28 | %add_spin($D82F) 29 | 30 | ; track select 31 | %skip_spin($8D5A) 32 | 33 | ; main game 34 | %skip_spin($D208) 35 | 36 | ; demo load 37 | %add_spin($8EE9) 38 | 39 | ; collision 40 | %add_spin($A5E3) 41 | 42 | ; timeout 43 | %skip_spin($92A3) 44 | %skip_spin($8DF9) 45 | %skip_spin($8F57) 46 | 47 | ; reload after crash 48 | %skip_spin($A8CC) 49 | 50 | ; game over 51 | %skip_spin($D20D) 52 | %skip_spin($D4FE) 53 | 54 | ; your name screen 55 | %add_spin($D525) 56 | %add_spin($D66F) 57 | %skip_spin($D68A) 58 | %skip_spin($D6C8) 59 | 60 | ; title screen end? 61 | %skip_spin($96D3) 62 | 63 | ; title screen, key pressed 64 | %add_spin($9548) 65 | %add_spin($9558) 66 | 67 | ; car select load 2 68 | %skip_spin($8A80) 69 | %skip_spin($8A8B) 70 | 71 | ; track select load 2 72 | %skip_spin($8C09) 73 | %skip_spin($8C14) 74 | %skip_spin($8C23) 75 | 76 | ; track preview 77 | %skip_spin($8D74) 78 | %skip_spin($8D7B) 79 | 80 | ; high scores 81 | %add_spin($D6A5) 82 | %skip_spin($D74D) 83 | %skip_spin($D6BC) 84 | 85 | ; pause. important to spin, 86 | ; so accidentally double pause presses 87 | ; can be filtered. 88 | %add_spin($9227) 89 | %add_spin($9249) 90 | 91 | ; credits 92 | %skip_spin($D78E) 93 | %add_spin($D7A5) 94 | %skip_spin($D7BC) 95 | %skip_spin($D7C8) 96 | %skip_spin($96F8) 97 | %skip_spin($9715) 98 | 99 | ; fade in 100 | %add_spin($E211) 101 | %skip_spin($E215) 102 | 103 | ; fade out 104 | %add_spin($E22B) 105 | %skip_spin($E22F) 106 | 107 | ; title screen 108 | %add_spin($89C2) 109 | 110 | ; I guess the purpose here is warranting 111 | ; the input won't be processed immediately. 112 | %add_spin($8A9A) 113 | 114 | ; car select 115 | %add_spin($8AAC) 116 | 117 | ; track select 118 | %add_spin($8C36) 119 | 120 | ; track preview 121 | %add_spin($8D65) 122 | 123 | ; championship symbol? 124 | %add_spin($8FBF) 125 | 126 | ; press start? 127 | %add_spin($9018) 128 | 129 | ; car boot 130 | %add_spin($9079) 131 | 132 | pushpc 133 | 134 | ; never spin-up the game 135 | org $00F3AB 136 | RTL 137 | 138 | ; expect some regions that will use this address now. 139 | org $00F3AE 140 | spin_up: 141 | STZ $6200 142 | 143 | pullpc 144 | -------------------------------------------------------------------------------- /Race-Drivin/asm/delta_main.asm: -------------------------------------------------------------------------------- 1 | ; Implement DELTA-BASED frame correction 2 | ; for Race Drivin 3 | 4 | ; Constants 5 | 6 | if !origin == 1 7 | ; Defind by round(65536/(60/4.772052)) 8 | ; Solely based on average frame rate of the 9 | ; title screen section. 10 | 11 | !magic_delta = $145C 12 | 13 | else 14 | ; Defined by round(65536/(60/5.361557)*2*0.8) 15 | ; The values was based on the average instant FPS 16 | ; + an % adjust to feel more realistic. 17 | 18 | !magic_delta = $249A 19 | endif 20 | 21 | ; How many frame buffer steps 22 | !fb_steps = 2 23 | 24 | !transfer_size = $04*5/!fb_steps 25 | 26 | ; RAM defines 27 | !counter = $3100 28 | !last_counter = $3102 29 | 30 | !previous = $3101 31 | !passed16 = $3102 32 | !passed = $3103 33 | 34 | !tmp_delta1 = $3104 35 | !tmp_delta2 = $3106 36 | !tmp_delta3 = $3108 37 | 38 | !x_dt = $310A ;$5C 39 | !y_dt = $310C ;$5E 40 | !z_dt = $310E ;$60 41 | 42 | !x_dt_cpy = $3110 ;$1A 43 | !y_dt_cpy = $3112 ;$1C 44 | !z_dt_cpy = $3114 ;$1E 45 | 46 | !speed_dt = $3116 ;$68 47 | 48 | !wheel_dt = $3118 ;$62 49 | 50 | !rpm_dt = $311A ;$0254 51 | 52 | !x_dt_cpyhi = $311C ;$0C06 53 | !y_dt_cpyhi = $311E ;$0C08 54 | !z_dt_cpyhi = $3120 ;$0C0A 55 | 56 | !radical_dt = $3122 57 | 58 | !radical_aux = $3124 59 | 60 | !tmp0 = $3126 61 | !tmp1 = $3128 62 | !tmp2 = $312A 63 | !tmp3 = $312C 64 | !tmp4 = $312E 65 | !tmp5 = $3130 66 | 67 | !delta_tilt = $3132 68 | 69 | !rotation_dt = $3134 70 | !angle_dt = $3136 71 | 72 | !gravity_timer_dt = $3138 73 | 74 | !fc_counter = $313A 75 | 76 | !fb_counter = $313C 77 | 78 | !gradual_speed = $313E 79 | 80 | !sprite_timer_dt = $3140 81 | 82 | !sprite_timer = $3142 83 | 84 | !demo_dt = $3144 85 | 86 | !demo_ctl = $3146 87 | 88 | !rpm_copy = $3148 89 | 90 | !fps_value = $61FE 91 | 92 | !tmp_mul = $40 93 | !tmp_mul2 = $3E 94 | 95 | ;!wheel_dt_cpy = $311A ;$62->$0218 96 | ;!wheel_dt_cpy2 = $311A ;$62->$02A4 97 | ;!wheel_dt_cpy3 = $311A ;$62->$02A6 98 | 99 | macro push_delta_add_speed(count) 100 | LDA !passed16 101 | PHA 102 | LSR 103 | LSR 104 | STA !passed16 105 | LDA $68 106 | XBA 107 | LSR # 108 | ADC !passed16 109 | BCC + 110 | LDA #$FFFF 111 | + STA !passed16 112 | endmacro 113 | 114 | macro pop_delta_y() 115 | PLY 116 | STY !passed16 117 | endmacro 118 | 119 | macro pop_delta() 120 | PLA 121 | STA !passed16 122 | endmacro 123 | 124 | macro delta_mul(dest) 125 | STA !tmp_mul 126 | STA $2251 127 | LDA !passed16 128 | STA $2253 129 | ASL 130 | if == 0 131 | LDA $2306 132 | STA 133 | endif 134 | LDA $2308 135 | BCC ?skip 136 | CLC 137 | ADC !tmp_mul 138 | ?skip 139 | endmacro 140 | 141 | macro delta_muladd(dest) 142 | STA !tmp_mul 143 | STA $2251 144 | LDA !passed16 145 | STA $2253 146 | LDA 147 | CLC 148 | ADC $2306 149 | STA 150 | LDA #$0000 151 | BIT !passed16 152 | BPL ?skip 153 | LDA !tmp_mul 154 | ?skip: 155 | ADC $2308 156 | CLC 157 | endmacro 158 | 159 | init_time: 160 | STZ !counter 161 | ;STZ !previous 162 | 163 | STZ !passed16 164 | ;STZ !passed 165 | 166 | RTS 167 | 168 | get_time_passed: 169 | SEP #$21 170 | LDA !counter 171 | SBC !previous 172 | BEQ get_time_passed 173 | TAY 174 | STA $2251 175 | STZ $2252 176 | REP #$20 177 | LDA.w #!magic_delta 178 | STA $2253 179 | CLC 180 | LDA $2306 181 | STA !passed16 182 | 183 | LDA !counter 184 | STA !previous 185 | 186 | ; frame rate calculation 187 | TYA 188 | AND #$00FF 189 | ADC !fc_counter 190 | STA !fc_counter 191 | INC !fb_counter 192 | 193 | CMP.w #60 194 | BCC + 195 | CMP.w #120 196 | BCC ++ 197 | LDA.w #60 198 | ++ SEC 199 | SBC.w #60 200 | STA !fc_counter 201 | LDA !fb_counter 202 | STZ !fb_counter 203 | STA !fps_value 204 | + 205 | 206 | JSL apply_rpm_new 207 | 208 | RTS 209 | 210 | pushpc 211 | 212 | ; code below is related to NMI 213 | ; and frame buffering. 214 | 215 | ; rewrite buffer system 216 | org $00B49C 217 | RTL 218 | 219 | org $00B4A1 220 | JSR get_time_passed 221 | 222 | ; if there's pending transfers, 223 | ; we're screwed. 224 | - LDA $F8 225 | BNE - 226 | 227 | LDX #$0C00 228 | LDY #$2000 229 | 230 | LDA $7A 231 | BEQ + 232 | LDX #$4C00 233 | LDY #$4800 234 | + 235 | 236 | STX $FC 237 | STY $FA 238 | 239 | LDA.w #!fb_steps 240 | STA $F8 241 | RTL 242 | 243 | warnpc $00B4D2 244 | 245 | org $00B4D2 246 | transfer_framebuffer: 247 | SEP #$21 248 | 249 | LDA $F8 250 | BEQ .abort 251 | 252 | LDY $FC 253 | STY $2116 254 | LDY #$1801 255 | STY $4300 256 | LDY $FA 257 | STY $4302 258 | LDY.w #2*256*!transfer_size 259 | STY $4305 260 | 261 | LDA #$40 262 | STA $4304 263 | LDA #$01 264 | STA $420B 265 | 266 | LDA $FD 267 | ;SEC 268 | ADC.b #!transfer_size-1 269 | STA $FD 270 | 271 | LDA $FB 272 | ;CLC 273 | ADC.b #2*!transfer_size 274 | STA $FB 275 | 276 | DEC $F8 277 | .abort 278 | REP #$20 279 | RTS 280 | 281 | warnpc $00B520 282 | 283 | ; optimize NMI 284 | org $00F420 285 | REP #$30 286 | INC $6BFA 287 | PHB 288 | PHK 289 | PLB 290 | PHA 291 | PHX 292 | PHY 293 | PHD 294 | LDA #$3000 295 | TCD 296 | 297 | LDA $0C 298 | BNE .premature_return 299 | INC 300 | STA $0C 301 | 302 | SEP #$20 303 | 304 | INC $6200 305 | INC $7200 306 | 307 | LDY #$0000 308 | STY $2102 309 | 310 | LDY #$0400 311 | STY $4300 312 | LDY #$7DE0 313 | STY $4302 314 | STZ $4304 315 | LDY #$0220 316 | STY $4305 317 | 318 | LDA #$01 319 | STA $420B 320 | 321 | REP #$20 322 | INC $6202 323 | 324 | JSR $8211 325 | 326 | STZ $0C 327 | 328 | INC !counter 329 | 330 | .premature_return 331 | PLD 332 | PLY 333 | PLX 334 | PLA 335 | PLB 336 | RTI 337 | 338 | warnpc $00F48C 339 | 340 | ; optimize NMI part 2 341 | org $8211 342 | 343 | nmi_part2: 344 | SEP #$30 345 | 346 | LDA #$01 347 | CMP $F8 348 | BNE .no_swap 349 | EOR $7E 350 | STA $7E 351 | 352 | .no_swap 353 | LDX #$04 354 | 355 | LDA $7E 356 | BNE + 357 | 358 | LDX #$40 359 | 360 | + STX $210B 361 | 362 | LDA $F8 363 | CMP #$01 364 | BNE .skip 365 | 366 | REP #$30 367 | 368 | LDX #$0016 369 | LDA $621A 370 | BEQ + 371 | LDX #$0012 372 | + 373 | SEP #$30 374 | STX $212C 375 | 376 | REP #$30 377 | 378 | LDA $6218 379 | AND #$007F 380 | ASL 381 | STA $6214 382 | 383 | LDA $621E 384 | EOR #$FFFF 385 | INC 386 | 387 | CMP #$FFB8 388 | BPL + 389 | LDA #$FFB8 390 | + 391 | CMP #$0048 392 | BMI + 393 | LDA #$0048 394 | + 395 | CLC 396 | ADC #$0048 397 | STA $6216 398 | 399 | SEP #$30 400 | .skip 401 | 402 | LDX #$00 403 | 404 | LDA $620C 405 | STA $210D 406 | STX $210D 407 | 408 | LDA $620E 409 | STA $210E 410 | STX $210E 411 | 412 | LDA $6210 413 | STA $210F 414 | STX $210F 415 | 416 | LDA $6212 417 | STA $2110 418 | STX $2110 419 | 420 | LDA $6214 421 | STA $2111 422 | STX $2111 423 | 424 | LDA $6216 425 | STA $2112 426 | STX $2112 427 | 428 | REP #$30 429 | JMP transfer_framebuffer 430 | 431 | warnpc $0082D2 432 | 433 | pullpc -------------------------------------------------------------------------------- /Race-Drivin/asm/delta_position.asm: -------------------------------------------------------------------------------- 1 | ; This creates delta X/Y/Z positions of the car/camera 2 | 3 | pushpc 4 | org $00A217 5 | JSL copy_pos_deltas 6 | 7 | pullpc 8 | 9 | copy_pos_deltas: 10 | LDA $60 11 | STA $1E 12 | 13 | LDA !x_dt 14 | STA !x_dt_cpy 15 | LDA !y_dt 16 | STA !y_dt_cpy 17 | LDA !z_dt 18 | STA !z_dt_cpy 19 | RTL 20 | 21 | pushpc 22 | org $00A544 23 | JSL copyback_pos_deltas 24 | 25 | org $00A566 26 | JSL copyback_pos_deltas 27 | 28 | org $00A5BF 29 | JSL copyback_pos_deltas 30 | 31 | org $00A5D4 32 | JSL copyback_xz_deltas 33 | pullpc 34 | 35 | copyback_pos_deltas: 36 | LDA !y_dt_cpy 37 | STA !y_dt 38 | 39 | copyback_xz_deltas: 40 | LDA !x_dt_cpy 41 | STA !x_dt 42 | LDA !z_dt_cpy 43 | STA !z_dt 44 | 45 | LDA $1E 46 | STA $60 47 | RTL 48 | 49 | pushpc 50 | org $00B728 51 | JML copy_pos_hi_deltas 52 | 53 | org $00B829 54 | JML copyback_pos_hi_deltas 55 | pullpc 56 | 57 | copy_pos_hi_deltas: 58 | LDA $60 59 | STA $6C0A 60 | 61 | LDA !x_dt 62 | STA !x_dt_cpyhi 63 | LDA !y_dt 64 | STA !y_dt_cpyhi 65 | LDA !z_dt 66 | STA !z_dt_cpyhi 67 | 68 | JML $00B72D 69 | 70 | copyback_pos_hi_deltas: 71 | LDA $6C06 72 | STA $5C 73 | 74 | LDA !x_dt_cpyhi 75 | STA !x_dt 76 | LDA !y_dt_cpyhi 77 | STA !y_dt 78 | LDA !z_dt_cpyhi 79 | STA !z_dt 80 | 81 | JML $00B82E 82 | 83 | 84 | ; preciso investigar: CODE_00A99D 85 | ; preciso olhar: deve ter algo que só mexe com Y 86 | ; visto que temos algo com XZ 87 | 88 | ; se eu tiver problemas com replay: 89 | ; copy: 00AA36 90 | ; restore: 00AAB9 91 | 92 | ; checar: 00ABDD 00AC00 93 | 94 | ; checar: push/pop 00B565 95 | 96 | ; checar: mais uma cópia 00B5E3 00B71E 97 | ; transferencia: 00CFC6 98 | 99 | pushpc 100 | 101 | org $00AB1B 102 | JSL $00AB53 103 | LDA !x_dt 104 | SEC 105 | SBC !tmp_delta1 106 | STA !x_dt 107 | LDA $5C 108 | SBC $90 109 | STA $5C 110 | 111 | LDA !y_dt 112 | CLC 113 | JML finish_1 114 | warnpc $00AB37 115 | 116 | org $00AB37 117 | JSL multiply_without_delta 118 | 119 | pullpc 120 | 121 | multiply_without_delta: 122 | LDA !passed16 123 | PHA 124 | LDA #$FFFF 125 | STA !passed16 126 | 127 | JSL $00AB53 128 | 129 | PLA 130 | STA !passed16 131 | RTL 132 | 133 | finish_1: 134 | ADC !tmp_delta2 135 | STA !y_dt 136 | LDA $5E 137 | ADC $92 138 | STA $5E 139 | 140 | LDA !z_dt 141 | SEC 142 | SBC !tmp_delta3 143 | STA !z_dt 144 | LDA $60 145 | SBC $94 146 | STA $60 147 | RTL 148 | 149 | pushpc 150 | 151 | org $00AB70 152 | JSR multiply_then_delta1 153 | 154 | org $00AB83 155 | JSR multiply_then_delta2 156 | 157 | org $00ABA5 158 | JSR multiply_then_delta3 159 | 160 | org $00ABAA 161 | RTL 162 | 163 | ; use the now unused space for multiplication 164 | org $00C541 165 | 166 | multiply_then_delta1: 167 | JSR $C5F2 168 | %delta_mul(!tmp_delta1) 169 | RTS 170 | 171 | multiply_then_delta2: 172 | JSR $C5F2 173 | %delta_mul(!tmp_delta2) 174 | RTS 175 | 176 | multiply_then_delta3: 177 | JSR $C5F2 178 | %delta_mul(!tmp_delta3) 179 | RTS 180 | 181 | ;print pc 182 | warnpc $00C5F2 183 | 184 | pullpc 185 | 186 | pushpc 187 | 188 | ; other cases for $5E 189 | 190 | org $009F6B 191 | LDA #-$000F 192 | JSL apply_gravity 193 | NOP 194 | 195 | org $009FFB 196 | LDA #-$0004 197 | JSL apply_gravity 198 | NOP 199 | 200 | org $00ABAD 201 | JSL apply_gravity 202 | NOP 203 | 204 | org $00ABBD 205 | LDA $68 206 | EOR #$FFFF 207 | INC 208 | JML apply_gravity_positive 209 | 210 | ;org $00A0BF; 211 | ; BRK #$00 212 | 213 | org $00A0DD 214 | JML gravity_timer 215 | 216 | pullpc 217 | 218 | gravity_timer: 219 | LDA #-$0001 220 | %delta_muladd(!gravity_timer_dt) 221 | ADC $6242 222 | STA $6242 223 | BPL + 224 | STZ $6242 225 | - JML $00A0E2 226 | 227 | + BEQ - 228 | JML $00A1D9 229 | 230 | apply_gravity_positive: 231 | %delta_muladd(!y_dt) 232 | ADC $5E 233 | BPL + 234 | LDA #$0000 235 | + STA $5E 236 | RTL 237 | 238 | apply_gravity: 239 | %delta_muladd(!y_dt) 240 | ADC $5E 241 | STA $5E 242 | RTL 243 | 244 | ; other cases for $5C and $60 245 | pushpc 246 | 247 | org $00ABDD 248 | JML sub_5c 249 | 250 | org $00ABE5 251 | JML add_60 252 | 253 | org $00AC00 254 | JML add_5c 255 | 256 | org $00AC08 257 | JML sub_60 258 | 259 | pullpc 260 | 261 | sub_5c: 262 | LDA $68 263 | EOR #$FFFF 264 | INC 265 | %delta_muladd(!x_dt) 266 | ADC $5C 267 | STA $5C 268 | RTL 269 | 270 | sub_60: 271 | LDA $68 272 | EOR #$FFFF 273 | INC 274 | %delta_muladd(!z_dt) 275 | ADC $60 276 | STA $60 277 | RTL 278 | 279 | add_5c: 280 | LDA $68 281 | %delta_muladd(!x_dt) 282 | ADC $5C 283 | STA $5C 284 | RTL 285 | 286 | add_60: 287 | LDA $68 288 | %delta_muladd(!z_dt) 289 | ADC $60 290 | STA $60 291 | RTL 292 | -------------------------------------------------------------------------------- /Race-Drivin/asm/delta_radical.asm: -------------------------------------------------------------------------------- 1 | ; Delta Radical 2 | 3 | ; Macros 4 | ;table+2 gets multiplied by #$0000+!radical_dt 5 | ;table+0 gets multiplied by #$FFFF-!radical_dt 6 | 7 | ; this uses the (s)16bit*(u)16bit=(s)32bit 8 | ; multiplication trick 9 | macro interpolate(var, table) 10 | LDA.w +2,x 11 | STA $2251 12 | TYA 13 | STA $2253 14 | ASL 15 | LDA $2308 16 | BCC ?skip 17 | CLC 18 | ADC.w
+2,x 19 | ?skip: 20 | STA.w 21 | 22 | LDA.w
+0,x 23 | STA $2251 24 | TYA 25 | EOR #$FFFF 26 | INC 27 | STA $2253 28 | ASL 29 | LDA $2308 30 | BCC ?skip2 31 | CLC 32 | ADC.w
+0,x 33 | CLC 34 | ?skip2: 35 | ADC.w 36 | STA.w 37 | endmacro 38 | 39 | ; uses 9-bit sign-extension 40 | macro interpolate_rad(var, table) 41 | LDA.w
+0,x 42 | STA !tmp_mul 43 | CLC 44 | ADC #$0200 45 | SEC 46 | SBC.w
+2,x 47 | BPL ?no_abs 48 | EOR #$FFFF 49 | INC 50 | ?no_abs: 51 | STA !tmp_mul2 52 | 53 | LDA !tmp_mul 54 | SEC 55 | SBC.w
+2,x 56 | BPL ?no_abs2 57 | EOR #$FFFF 58 | INC 59 | ?no_abs2 60 | CMP !tmp_mul2 61 | BCC ?no_wrap 62 | LDA !tmp_mul 63 | ADC #$01FF 64 | STA !tmp_mul 65 | 66 | ?no_wrap: 67 | LDA.w
+2,x 68 | STA !tmp_mul2 69 | STA $2251 70 | TYA 71 | STA $2253 72 | ASL 73 | LDA $2308 74 | BCC ?skip 75 | CLC 76 | ADC !tmp_mul2 77 | ?skip: 78 | STA.w 79 | 80 | LDA !tmp_mul 81 | STA $2251 82 | TYA 83 | EOR #$FFFF 84 | INC 85 | STA $2253 86 | ASL 87 | LDA $2308 88 | BCC ?skip2 89 | CLC 90 | ADC !tmp_mul 91 | CLC 92 | ?skip2: 93 | ADC.w 94 | AND #$01FF 95 | STA.w 96 | endmacro 97 | 98 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 99 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 100 | 101 | pushpc 102 | 103 | org $009C0B 104 | JSL tilt_hack_inc 105 | NOP #2 106 | 107 | org $009B52 108 | JML tilt_fall_inc 109 | 110 | org $009B69 111 | JML tilt_fall_dec 112 | 113 | org $009B71 114 | JSL tilt_init_hack 115 | NOP #2 116 | 117 | org $009BC2 118 | JSL tilt_interpolate_62 119 | NOP 120 | 121 | ;test 122 | ;org $009B2D 123 | ; NOP #3 124 | 125 | org $009B28 126 | JSL tilt_fall_autoinc 127 | NOP #4 128 | ;NOP #3 129 | 130 | org $009BEC 131 | JSL tilt_interpolate_60 132 | 133 | org $009C02 134 | LDA !tmp1 135 | 136 | org $009B89 137 | LDX !radical_aux 138 | 139 | org $009BAF 140 | LDA !radical_aux 141 | 142 | pullpc 143 | 144 | ; execution ends at 009B79 145 | 146 | tilt_fall_dec: 147 | ;%push_delta_add_speed(0) 148 | LDA #-$0001 149 | %delta_muladd(!delta_tilt) 150 | ADC $6240 151 | BPL + 152 | LDA #$0000 153 | + STA $6240 154 | 155 | ;%pop_delta() 156 | JML $009B71 157 | 158 | tilt_fall_inc: 159 | ;%push_delta_add_speed(0) 160 | LDA #$0001 161 | %delta_muladd(!delta_tilt) 162 | ADC $6240 163 | STA $6240 164 | ;%pop_delta() 165 | JML $009B71 166 | 167 | tilt_fall_autoinc: 168 | LDA $622C 169 | BNE .skip 170 | ;%push_delta_add_speed(0) 171 | LDA #$0001 172 | %delta_muladd(!delta_tilt) 173 | ADC $6240 174 | STA $6240 175 | ;%pop_delta() 176 | 177 | .skip 178 | RTL 179 | 180 | tilt_interpolate_60: 181 | TAX 182 | LDY !tmp5 183 | ;LDY !radical_dt 184 | %interpolate(!tmp0, $00E781) 185 | %interpolate(!tmp1, $00E961) 186 | LDA !tmp0 187 | RTL 188 | 189 | tilt_interpolate_62: 190 | LDY !radical_dt 191 | BNE + 192 | INY 193 | + CPX #$0014 194 | BNE + 195 | STA !tmp5 196 | TYA 197 | EOR #$FFFF 198 | INC 199 | TAY 200 | LDA !tmp5 201 | DEC 202 | 203 | + 204 | STY !tmp5 205 | ASL 206 | TAX 207 | %interpolate_rad(!tmp0, $00E751) 208 | 209 | LDA !tmp0 210 | RTL 211 | 212 | tilt_init_hack: 213 | LDA $623C 214 | BNE + 215 | STZ !radical_aux 216 | STZ !radical_dt 217 | + 218 | JSR tilt_main 219 | 220 | LDA !radical_aux 221 | CMP #$0018-1 222 | RTL 223 | 224 | tilt_main: 225 | RTS 226 | 227 | tilt_hack_inc: 228 | INC $623C 229 | 230 | %push_delta_add_speed(0) 231 | ;LDA !passed16 232 | ;PHA 233 | ;LSR !passed16 234 | 235 | LDA #$0001 236 | %delta_muladd(!radical_dt) 237 | ADC !radical_aux 238 | STA !radical_aux 239 | 240 | ;PLA 241 | ;STA !passed16 242 | %pop_delta() 243 | 244 | LDA $6240 245 | RTL 246 | 247 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 248 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 249 | 250 | pushpc 251 | 252 | ; gira-gira maluco 253 | org $009A0F 254 | JSL spinning_redelta 255 | NOP #2 256 | 257 | ; make the car fall on if < ~40 mph 258 | org $009A24 259 | LDA $68 260 | CMP #$0020 261 | BCC + 262 | LDA #$0200 263 | 264 | org $009A3F 265 | + 266 | 267 | ; adjust sensibility to not make 268 | ; car fall when it's not supposed to 269 | org $009A35 270 | CMP #$0005 271 | 272 | org $009A3A 273 | CMP #$000B 274 | 275 | ; remap tables 276 | org $009A49 277 | LDA !tmp0 278 | 279 | org $009A52 280 | LDA !tmp1 281 | 282 | org $009A57 283 | LDA !tmp2 284 | 285 | org $009A64 286 | LDA !tmp3 287 | 288 | org $009A69 289 | LDA !tmp4 290 | 291 | ; let the game know which section it is currently 292 | org $009A32 293 | LDA.w !radical_aux 294 | 295 | ; skip indexing 296 | org $009A44 297 | BRA + 298 | NOP #3 299 | + 300 | 301 | ; remove virtual lag 302 | org $009A70 303 | BRA + 304 | 305 | org $009A7A 306 | + 307 | 308 | ; remove virtual lag 309 | org $009A17 310 | BRA + 311 | 312 | org $009A21 313 | + 314 | 315 | ; improve camera 316 | ; 'olhar cima, baixo' 317 | org $00EBC5 318 | dw $0018,$0040,$0040,$0040 319 | dw $0040,$0000,$0000,$0000 320 | dw $0000,$0000,$0000,$0000 321 | dw $0020,$0040,$0020,$0000 322 | ;dw $01F0,$01E0,$01C0,$01C0 323 | ;dw $01D0,$01F0 324 | 325 | ; 'olhar cima, baixo' 326 | org $00EBE5 327 | dw $01F0,$01E0,$01C0,$01C8 328 | dw $01E0,$01FE 329 | 330 | ; improve camera 331 | ; 'giro' 332 | org $00EBF1 333 | dw $0000,$0000,$0000,$01F0 334 | dw $01D8,$01C0,$0180,$0140 335 | dw $0100,$00C0,$0080,$0040 336 | dw $0000,$0000 337 | 338 | ;org $00EBC5 339 | ; dw $0010,$0010,$0010,$0000 340 | 341 | ; Y axis 342 | org $00EB6D 343 | dw $0000,$0017,$002D,$003F 344 | dw $0057,$006E,$0075,$0069 345 | dw $005A,$0030,$001D,$0030 346 | dw $003C,$005A,$005A,$005A 347 | dw $005A,$005A,$0043,$002D 348 | dw $0017,$0000 349 | 350 | pullpc 351 | 352 | !table0 = $00EB41 353 | !table1 = $00EB6D 354 | !table2 = $00EB99 355 | !table3 = $00EBC5 356 | !table4 = $00EBF1 357 | 358 | spinning_redelta_end: 359 | ; ensure the proper position is set 360 | ; at the end... 361 | LDA $EB99+($02*$15) 362 | CLC 363 | ADC #$03E8 364 | EOR #$FFFF 365 | STA $60 366 | 367 | SEC 368 | RTL 369 | 370 | spinning_redelta_init: 371 | CLC 372 | STZ !radical_aux 373 | STZ !radical_dt 374 | 375 | spinning_redelta_copy: 376 | LDA !table0,x : STA !tmp0 377 | LDA !table1,x : STA !tmp1 378 | LDA !table2,x : STA !tmp2 379 | LDA !table3,x : STA !tmp3 380 | LDA !table4,x : STA !tmp4 381 | RTL 382 | 383 | spinning_redelta: 384 | LDX #$0000 385 | 386 | LDA $623C 387 | BEQ .init 388 | 389 | %push_delta_add_speed(1) 390 | 391 | LDA #$0001 392 | %delta_muladd(!radical_dt) 393 | ADC !radical_aux 394 | STA !radical_aux 395 | 396 | %pop_delta_y() 397 | 398 | CMP #$0015 399 | BCC + 400 | JMP .end 401 | + ASL 402 | TAX 403 | 404 | LDY !radical_dt 405 | BNE + 406 | JMP .copy 407 | + 408 | 409 | %interpolate(!tmp0, !table0) 410 | %interpolate(!tmp1, !table1) 411 | %interpolate(!tmp2, !table2) 412 | %interpolate_rad(!tmp3, !table3) 413 | %interpolate_rad(!tmp4, !table4) 414 | 415 | CLC 416 | RTL 417 | 418 | 419 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 420 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 421 | 422 | pushpc 423 | 424 | ; ladeira da parte final do super stunk track 425 | org $009E09 426 | JSL megaslope_redelta 427 | 428 | org $009E0E 429 | LDA !tmp0 430 | 431 | org $009E18 432 | LDA !tmp1 433 | 434 | org $009E21 435 | LDA !tmp2 436 | 437 | org $009E32 438 | LDA !tmp3 439 | 440 | ; bug fix, since the cyclic interpolation 441 | ; doesn't cover $01FF->$0000 case. 442 | org $00E663 443 | dw $0200,$0200 444 | 445 | pullpc 446 | 447 | !table0 = $00E623 448 | !table1 = $00E669 449 | !table2 = $00E6AF 450 | !table3 = $00E6F5 451 | 452 | megaslope_redelta_end: 453 | STA !tmp0 454 | BRA megaslope_redelta_p1 455 | 456 | megaslope_redelta_init: 457 | STZ !radical_aux 458 | STZ !radical_dt 459 | 460 | megaslope_redelta_copy: 461 | LDA !table0,x : STA !tmp0 462 | 463 | megaslope_redelta_p1: 464 | LDA !table1,x : STA !tmp1 465 | LDA !table2,x : STA !tmp2 466 | LDA !table3,x : STA !tmp3 467 | RTL 468 | 469 | megaslope_redelta: 470 | LDX #$0000 471 | 472 | LDA $623C 473 | BEQ .init 474 | 475 | LDA #$0001 476 | %delta_muladd(!radical_dt) 477 | ADC !radical_aux 478 | STA !radical_aux 479 | 480 | ASL 481 | TAX 482 | 483 | LDY !radical_dt 484 | 485 | LDA !table0+2,x 486 | CMP #$FFFF 487 | BEQ .end 488 | 489 | CPY #$0000 490 | BEQ .copy 491 | 492 | %interpolate_rad(!tmp0, !table0) 493 | %interpolate(!tmp1, !table1) 494 | %interpolate(!tmp2, !table2) 495 | %interpolate(!tmp3, !table3) 496 | RTL 497 | 498 | 499 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 500 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 501 | 502 | pushpc 503 | 504 | ; "roda gigante" 505 | ; fixes a buggy angle present in the original table 506 | org $00E513+2 507 | dw $01FF 508 | 509 | ; "roda gigante" 510 | ; add intermediate value for smoother interpolation 511 | org $00E549 512 | dw $0003 513 | 514 | ; "roda gigante" 515 | !table0 = $00E4E3 516 | !table1 = $00E519 517 | !table2 = $00E54F 518 | !table3 = $00E585 519 | !table4 = $00E5BB 520 | !table5 = $00E5EF 521 | 522 | org $009CC6 523 | LDA !tmp0 524 | ;LDA.w TABLE_00E4E3,x 525 | 526 | org $009CE3 527 | LDA !tmp0 528 | ;LDA.w TABLE_00E4E3,x 529 | 530 | org $009CEB 531 | LDA !tmp1 532 | ;LDA.W TABLE_00E519,X 533 | 534 | org $009CF0 535 | LDA !tmp2 536 | ;LDA.W TABLE_00E54F,X 537 | 538 | org $009CF9 539 | LDA !tmp3 540 | ;LDA.W TABLE_00E585,X 541 | 542 | org $009D39 543 | LDA !tmp4 544 | ;LDA.W TABLE_00E5BB,Y 545 | 546 | org $009D42 547 | LDA !tmp5 548 | ;LDA.W TABLE_00E5EF,Y 549 | 550 | org $009CC1 551 | JSL redelta 552 | 553 | pullpc 554 | 555 | redelta_end: 556 | STA !tmp0 557 | BRA redelta_p1 558 | 559 | redelta_init: 560 | STZ !radical_aux 561 | STZ !radical_dt 562 | 563 | redelta_copy: 564 | LDA !table0,x : STA !tmp0 565 | 566 | redelta_p1: 567 | LDA !table1,x : STA !tmp1 568 | LDA !table2,x : STA !tmp2 569 | LDA !table3,x : STA !tmp3 570 | LDA !table4,x : STA !tmp4 571 | LDA !table5,x : STA !tmp5 572 | RTL 573 | 574 | redelta: 575 | LDX #$0000 576 | 577 | LDA $623C 578 | BEQ .init 579 | 580 | LDA #$0001 581 | %delta_muladd(!radical_dt) 582 | ADC !radical_aux 583 | STA !radical_aux 584 | 585 | ASL 586 | TAX 587 | 588 | LDY !radical_dt 589 | 590 | LDA !table0+2,x 591 | CMP #$FFFF 592 | BEQ .end 593 | 594 | CPY #$0000 595 | BEQ .copy 596 | 597 | %interpolate(!tmp0, !table0) 598 | %interpolate(!tmp1, !table1) 599 | %interpolate(!tmp2, !table2) 600 | %interpolate(!tmp3, !table3) 601 | %interpolate(!tmp4, !table4) 602 | %interpolate(!tmp5, !table5) 603 | RTL 604 | 605 | -------------------------------------------------------------------------------- /Race-Drivin/asm/delta_rpm.asm: -------------------------------------------------------------------------------- 1 | ; This create a delta RPM value for $1C 2 | 3 | ; For simplification, the delta is only used for 4 | ; addition or subtraction of the value. It's left 5 | ; untouched otherwise. 6 | 7 | ; Noteworth that RPM is often subtracted or added 8 | ; when changing gears. These values doesn't use delta 9 | 10 | pushpc 11 | 12 | ; Read a copy of the RPM value, which doesn't 13 | ; suffers from modifications 14 | org $00E069 15 | LDA !rpm_copy 16 | 17 | ; RPM value is reset at 00A5E7 and 00A843 18 | ; which is taken care by delta_speed 19 | 20 | ; pitch gets acute too fast 21 | org $00F296 22 | ADC.W #$0004 23 | 24 | org $00F2B2 25 | ADC.W #$0004 26 | 27 | org $00F2AE 28 | LDA !rpm_dt 29 | ADC #$0400 30 | STA $6256 31 | LSR #2 32 | ADC $6256 33 | CMP #$2000 34 | BCC + 35 | LSR 36 | ADC #$2000/2 37 | + STA $6256 38 | RTL 39 | 40 | warnpc $00F2CE 41 | 42 | org $009843 43 | LDA #$0004 44 | JSL apply_rpm 45 | 46 | org $00988B 47 | LDA #$0004 48 | JSL apply_rpm 49 | 50 | ; acceleration 51 | org $0098F3 52 | LDA #$0002 53 | JSL apply_rpm 54 | 55 | ; deacceleration 56 | org $009940 57 | LDA #-$0002 58 | JSL apply_rpm 59 | BPL + 60 | LDA #$0000 61 | + 62 | ;print pc 63 | warnpc $00994C 64 | 65 | ; appears to be used when on offroad 66 | org $00E05A 67 | LDA #-$0002 68 | JSL apply_rpm 69 | BPL + 70 | LDA #$0000 71 | + 72 | ;;print pc 73 | warnpc $00E066 74 | 75 | org $0097BA 76 | db $90 ;change BNE to BCS 77 | 78 | ; no RPM limit 79 | org $009902 80 | NOP #3 81 | 82 | ; recalculate RPM on gear change 83 | org $0097C7 84 | JSL apply_rpm_new 85 | NOP #6 86 | 87 | org $009812 88 | JSL apply_rpm_new 89 | NOP #6 90 | 91 | org $0098B5 92 | TXA 93 | ASL 94 | TAX 95 | 96 | LDA $6254 97 | CMP #$0016 98 | BCC rotation_ok 99 | LDA $68 100 | CMP.l max_gear_speed,x 101 | BCC + 102 | DEC 103 | + STA $68 104 | BRA rotation_ok;max_rotation 105 | 106 | org $0098E1 107 | max_rotation: 108 | 109 | org $0098E4 110 | rotation_ok: 111 | 112 | pullpc 113 | 114 | ; use current gear and time passed for calculation. 115 | 116 | math round off 117 | 118 | rpm_gear_ratio: 119 | dw $5000/3.60*3.60 120 | dw $5000/3.60*1.88 121 | dw $5000/3.60*1.23 122 | dw $5000/3.60*0.82 123 | 124 | max_gear_speed: 125 | ;dw 38-7, 54-7, 71-7, 127 126 | ;dw 127,127,127,127 127 | dw 25, 41, 58, 127 ;82 128 | 129 | math round on 130 | 131 | ; no RPM is applied, value 132 | ; stays constant within speed. 133 | apply_rpm: 134 | LDA $6254 135 | RTL 136 | 137 | apply_rpm_new: 138 | PHX 139 | 140 | LDA $624A 141 | ASL 142 | TAX 143 | LDA $68 144 | CMP.l max_gear_speed,x 145 | BMI + 146 | DEC 147 | BMI + 148 | STA $68 149 | BRA ++ 150 | + 151 | 152 | CPX #$0003*2 153 | BEQ ++ 154 | LDA $6254 155 | CMP #$0017 156 | BCC ++ 157 | DEC $68 158 | BPL ++ 159 | STZ $68 160 | ++ 161 | 162 | 163 | LDA !gradual_speed 164 | ASL #2 165 | CLC 166 | ADC !gradual_speed 167 | CLC 168 | ADC !gradual_speed 169 | CLC 170 | ADC !gradual_speed 171 | CLC 172 | ADC $68 173 | LSR : ADC #$0000 174 | LSR : ADC #$0000 175 | LSR : ADC #$0000 176 | STA !gradual_speed 177 | 178 | SEC 179 | SBC #$0008 180 | BPL + 181 | LDA #$0001 182 | + ASL #2 183 | STA $2251 184 | LDA.l rpm_gear_ratio,x 185 | STA $2253 186 | LDA $2308 187 | BPL + 188 | LDA #$0000 189 | + CLC 190 | ADC #$0001 191 | CMP #$001A 192 | BCC + 193 | ; maximum rotation reached. 194 | LDA #$001A 195 | + STA $6254 196 | STA !rpm_copy 197 | 198 | ; internal RPM for pitch 199 | LDA $2307 200 | INC 201 | BPL + 202 | LDA #$0000 203 | + CMP #$2000 204 | BCC + 205 | LSR 206 | ADC #$1000 207 | + CMP #$3000 208 | BCC + 209 | LSR 210 | ADC #$1800 211 | + STA !rpm_dt 212 | 213 | PLX 214 | RTL 215 | -------------------------------------------------------------------------------- /Race-Drivin/asm/delta_speed.asm: -------------------------------------------------------------------------------- 1 | ; This create a delta speed value for $68 2 | 3 | ; TO DO: analyze ADC.B $68 and SBC.B $68 4 | ; Note that if you involve delta values there, 5 | ; you will likely have issues with push/pop 6 | ; and you will have to cover them 7 | 8 | macro reset_speed() 9 | STZ $68 10 | STZ !speed_dt 11 | STZ !gradual_speed 12 | endmacro 13 | 14 | pushpc 15 | 16 | org $0096C1 17 | JSL reset_speed 18 | 19 | org $0099E9 20 | JSL reset_speed2 21 | 22 | org $009DE8 23 | JSL reset_speed2 24 | 25 | org $009EB6 26 | JSL reset_speed2 27 | 28 | org $009F2C 29 | JSL reset_speed3 30 | 31 | org $009F7F 32 | JSL reset_speed4 33 | 34 | org $00A00F 35 | JSL reset_speed4 36 | 37 | org $00A5E7 38 | JSL reset_speed_rpm 39 | NOP 40 | 41 | org $00A843 42 | JSL reset_speed_rpm 43 | NOP 44 | 45 | ;ignored: 009F04 009F5E 46 | 47 | pullpc 48 | 49 | reset_speed_rpm: 50 | %reset_speed() 51 | STZ $6254 52 | STZ !rpm_copy 53 | STZ !rpm_dt 54 | RTL 55 | 56 | reset_speed: 57 | %reset_speed() 58 | STZ $10 59 | RTL 60 | 61 | reset_speed2: 62 | %reset_speed() 63 | STZ $32 64 | RTL 65 | 66 | reset_speed3: 67 | %reset_speed() 68 | STZ $2A 69 | RTL 70 | 71 | reset_speed4: 72 | %reset_speed() 73 | STZ $30 74 | RTL 75 | 76 | pushpc 77 | 78 | org $0098DB 79 | JSL apply_speed_minus4 80 | 81 | org $009917 82 | JSL apply_speed_plus4 83 | 84 | org $009954 ;desaceleração 85 | JSL apply_speed_table 86 | NOP #2 87 | 88 | org $009972 ;offroad 89 | JSL apply_speed_minus12 90 | 91 | pullpc 92 | 93 | apply_speed_table: 94 | LDA $EC27,Y 95 | LSR 96 | EOR #$FFFF 97 | INC 98 | BRA apply_speed 99 | 100 | apply_speed_plus4: 101 | LDA.w #$0004/2 102 | BRA apply_speed 103 | 104 | apply_speed_minus12: 105 | LDA.W #-$000C/2 ;-$0C 106 | BRA apply_speed 107 | 108 | ; maximum rpm? 109 | apply_speed_minus4: 110 | LDA.w #-$0004/4 ;-$04 111 | 112 | apply_speed: 113 | %delta_muladd(!speed_dt) 114 | ADC $68 115 | BPL + 116 | LDA #$0000 117 | + STA $68 118 | 119 | ; always update rpm together 120 | JSL apply_rpm_new 121 | 122 | LDA $68 123 | RTL 124 | -------------------------------------------------------------------------------- /Race-Drivin/asm/delta_sprites.asm: -------------------------------------------------------------------------------- 1 | pushpc 2 | 3 | org $00D94F 4 | JML adjust_sprite_timer 5 | 6 | org $00D97F 7 | JSL turn_around_negative 8 | NOP #3 9 | 10 | org $00D9D5 11 | JSL turn_around_positive 12 | NOP #3 13 | 14 | pullpc 15 | 16 | adjust_sprite_timer: 17 | LDA $28 18 | BNE + 19 | STZ !sprite_timer 20 | STZ !sprite_timer_dt 21 | BRA ++ 22 | + 23 | LDA #$0001 24 | %delta_muladd(!sprite_timer_dt) 25 | ADC !sprite_timer 26 | STA !sprite_timer 27 | ++ 28 | 29 | LDA #$0800 30 | LDX $6296 31 | BEQ + 32 | LDA #$1800 33 | CPX #$0001 34 | BEQ + 35 | LDA.w !sprite_timer_dt+1 36 | + JML $00D961 37 | 38 | turn_around_positive: 39 | LDA #$0006 40 | BRA turn_around 41 | 42 | turn_around_negative: 43 | LDA #-$0006 44 | 45 | turn_around: 46 | %delta_mul(0) 47 | ADC $6E12 48 | RTL 49 | 50 | pushpc 51 | 52 | org $00D963 53 | AND #$7F00 54 | CMP #$2000 55 | 56 | org $00D96C 57 | LSR #5 58 | AND #$01FF 59 | STA $6E18 60 | LDA #$060E+$FF06 61 | STA $6E16 62 | NOP #2 63 | ;print pc 64 | warnpc $00D97F 65 | 66 | org $00D98B 67 | CMP #$4000 68 | 69 | org $00D990 70 | SBC #$1FFF 71 | LSR #5 72 | EOR #$FFFF 73 | CLC 74 | ADC #$060F 75 | ;print pc 76 | warnpc $00D99F 77 | 78 | org $00D9B4 79 | CMP #$6000 80 | 81 | org $00D9B9 82 | SBC #$3FFE 83 | LSR #5 84 | ;print pc 85 | warnpc $00D9C1 86 | 87 | org $00D9E1 88 | SBC #$6000 89 | EOR #$1FFF 90 | LSR #5 91 | EOR #$FFFF 92 | CLC 93 | ADC #$060F 94 | ;print pc 95 | warnpc $00D9F3 96 | 97 | pullpc 98 | -------------------------------------------------------------------------------- /Race-Drivin/asm/delta_wheel.asm: -------------------------------------------------------------------------------- 1 | ; This create a delta speed value for $62, $64 and $66. 2 | 3 | ; For simplification, the delta is only used for 4 | ; addition or subtraction of the value. It's left 5 | ; untouched otherwise. 6 | 7 | pushpc 8 | 9 | org $00AC26 10 | JML apply_wheel 11 | 12 | org $00AC2F 13 | JML apply_wheel_inv 14 | 15 | org $00AC3C 16 | JML apply_angle 17 | 18 | org $00AC45 19 | JML apply_angle_inv 20 | 21 | org $00AC10 22 | JML apply_rotation 23 | 24 | ; likely to be unused in original game. 25 | org $00AC19 26 | JML apply_rotation_inv 27 | 28 | 29 | pullpc 30 | 31 | apply_angle_inv: 32 | STA $38 33 | EOR #$FFFF 34 | INC 35 | 36 | apply_angle: 37 | %delta_muladd(!angle_dt) 38 | ADC $66 39 | AND #$01FF 40 | STA $66 41 | RTL 42 | 43 | apply_rotation_inv: 44 | STA $38 45 | EOR #$FFFF 46 | INC 47 | 48 | apply_rotation: 49 | %delta_muladd(!rotation_dt) 50 | ADC $64 51 | AND #$01FF 52 | STA $64 53 | RTL 54 | 55 | apply_wheel_inv: 56 | STA $38 57 | EOR #$FFFF 58 | INC 59 | 60 | apply_wheel: 61 | %delta_muladd(!wheel_dt) 62 | ADC $62 63 | AND #$01FF 64 | STA $62 65 | RTL 66 | -------------------------------------------------------------------------------- /Race-Drivin/asm/extra_remaps.asm: -------------------------------------------------------------------------------- 1 | %remap_directpage($0000, $00F42B) 2 | %remap_directpage($0000, $00FA08) 3 | %remap_directpage($0000, $00FA18) 4 | %remap_directpage($0000, $00FA44) 5 | %remap_directpage($0000, $00FA6A) 6 | %remap_directpage($0000, $00FA99) 7 | %remap_directpage($0000, $00FDD8) 8 | %remap_directpage($0000, $00FDF7) 9 | 10 | %remap_directpage($1200, $0FDF04) 11 | 12 | ; the LDA/PHA/PLB reuses A 13 | ; so let's rewrite a bit 14 | ; only irq and brk are affected. 15 | macro interrupt(addr) 16 | org -2 17 | LDA #$3000 18 | TCD 19 | PHK 20 | PLB 21 | BRA + 22 | NOP #3 23 | + 24 | 25 | endmacro 26 | 27 | %interrupt($00F3E0) 28 | %interrupt($00F408) 29 | 30 | ; data bank defines 31 | %remap_wram($00A992) 32 | %remap_wram($00AA66) 33 | %remap_wram($00AAE9) 34 | %remap_wram($00AC5A) 35 | %remap_wram($00C514) 36 | %remap_wram($00DB9E) 37 | %remap_wram($00DC04) 38 | %remap_wram($00DC34) 39 | 40 | ; DMA parameters 41 | %remap_wram($00B4EA) 42 | %remap_wram_local($00F45E) 43 | -------------------------------------------------------------------------------- /Race-Drivin/asm/fixes.asm: -------------------------------------------------------------------------------- 1 | 2 | ; fixes a bug where the game would soft lock on 3 | ; certain situations when getting near a ramp 4 | pushpc 5 | 6 | org $00A84E 7 | BNE + 8 | 9 | org $00A857 10 | + 11 | 12 | pullpc -------------------------------------------------------------------------------- /Race-Drivin/asm/hooks.asm: -------------------------------------------------------------------------------- 1 | 2 | ; Parallel the work between SA-1 and SNES 3 | initialize_system: 4 | JSR init_time 5 | JML $008013 6 | 7 | macro create_callback(addr) 8 | !created_ = 1 9 | 10 | callback_: 11 | %wait_snes_16() 12 | STA $31F0 13 | %call_snes_a(.my_code) 14 | %wait_snes_16() 15 | RTL 16 | 17 | .my_code 18 | LDA $31F0 19 | JML $ 20 | endmacro 21 | 22 | macro create_callback_async_nocopy(addr) 23 | !created_ = 1 24 | 25 | callback_: 26 | %wait_snes_16() 27 | %call_snes_a(.my_code) 28 | RTL 29 | 30 | .my_code 31 | JML $ 32 | endmacro 33 | 34 | macro create_callback_nocopy(addr) 35 | !created_ = 1 36 | 37 | callback_: 38 | %wait_snes_16() 39 | %call_snes_a(.my_code) 40 | %wait_snes_16() 41 | RTL 42 | 43 | .my_code 44 | JML $ 45 | endmacro 46 | 47 | macro make_callback(addr, call) 48 | pushpc 49 | assert read1(+0) == $22 50 | assert read3(+1) == $ 51 | 52 | org 53 | JSL callback_ 54 | pullpc 55 | 56 | !created_ ?= 0 57 | 58 | if !created_ == 0 59 | %create_callback() 60 | endif 61 | endmacro 62 | 63 | macro set_register_a(addr, reg) 64 | pushpc 65 | if !super_strict == 1 66 | assert read2(-4) == $20E2 67 | assert read1(-2) == $A9 68 | endif 69 | 70 | assert read1(+0) == $8D 71 | assert read2(+1) == $ 72 | 73 | if !super_strict == 1 74 | assert read2(+3) == $20C2 75 | endif 76 | 77 | !created_reg_ ?= 0 78 | 79 | org 80 | JSR set_ 81 | pullpc 82 | 83 | if !created_reg_ == 0 84 | !created_reg_ = 1 85 | 86 | set_: 87 | %wait_snes_8() 88 | STA $31F0 89 | %call_snes(".snes") 90 | %wait_ack_8() 91 | RTS 92 | 93 | .snes 94 | SEP #$20 95 | LDA $31F0 96 | STA.w $ 97 | RTL 98 | endif 99 | 100 | endmacro 101 | 102 | %make_callback($00802C, "00F2FA") 103 | %make_callback($008030, "00F368") 104 | ;%make_callback($008034, "0082D3") 105 | %make_callback($008038, "00EEA7") 106 | 107 | %make_callback($008E79, "00F2FA") 108 | %make_callback($008E7D, "00F368") 109 | %make_callback($008E8A, "008801") 110 | %make_callback($008E8E, "008931") 111 | 112 | %make_callback($00845e, "00847F") 113 | 114 | %make_callback($008a1a, "008910") 115 | %make_callback($008B96, "008910") 116 | %make_callback($008D14, "008910") 117 | 118 | !super_strict = 1 119 | %set_register_a($008973+4, "2100") 120 | %set_register_a($00897C+4, "4200") 121 | %set_register_a($00898E+4, "4200") 122 | 123 | !super_strict = 0 124 | %set_register_a($00E20C, "2100") 125 | %set_register_a($00E226, "2100") 126 | 127 | !super_strict = 1 128 | %set_register_a($0089FF, "2100") 129 | %set_register_a($008a08, "4200") 130 | %set_register_a($008a11, "2105") 131 | %set_register_a($008e6b, "2100") 132 | %set_register_a($008e74, "4200") 133 | %set_register_a($008e85, "2105") 134 | %set_register_a($008EAD, "212C") 135 | %set_register_a($008EBE, "4200") 136 | 137 | %set_register_a($008F1C, "4200") 138 | %set_register_a($008F25, "4200") 139 | %set_register_a($008F2E, "4207") 140 | %set_register_a($008F37, "4208") 141 | %set_register_a($008F40, "4209") 142 | %set_register_a($008F49, "420A") 143 | %set_register_a($008F52, "4200") 144 | 145 | %set_register_a($009550, "2100") 146 | 147 | %set_register_a($008447, "2100") 148 | %set_register_a($008450, "4200") 149 | %set_register_a($008459, "2105") 150 | %set_register_a($008476, "212C") 151 | 152 | %set_register_a($008a52, "212C") 153 | %set_register_a($008a63, "4200") 154 | 155 | %set_register_a($008b7b, "2100") 156 | %set_register_a($008b84, "4200") 157 | %set_register_a($008b8d, "2105") 158 | 159 | %make_callback($008b92, "0085C9") 160 | %make_callback($008d10, "0086A5") 161 | 162 | %make_callback($00d22c, "00855B") 163 | %make_callback($00d230, "008952") 164 | 165 | %set_register_a($00d215, "2100") 166 | %set_register_a($00d21e, "2105") 167 | %set_register_a($00d227, "4200") 168 | 169 | %set_register_a($00d4e8, "212C") 170 | %set_register_a($00d4f9, "4200") 171 | 172 | %set_register_a($00d6d0, "2100") 173 | %set_register_a($00d6dd, "4200") 174 | 175 | %set_register_a($008bdb, "212C") 176 | %set_register_a($008bec, "4200") 177 | %set_register_a($008cf9, "2100") 178 | %set_register_a($008d02, "4200") 179 | %set_register_a($008d0b, "2105") 180 | %set_register_a($008d2c, "212C") 181 | %set_register_a($008d3d, "4200") 182 | 183 | %set_register_a($00a8d4, "2100") 184 | 185 | %make_callback($00d76c, "0084ED") 186 | %make_callback($00d770, "008952") 187 | 188 | %set_register_a($00d755, "2100") 189 | %set_register_a($00d75e, "2105") 190 | %set_register_a($00d767, "4200") 191 | 192 | %set_register_a($00d778, "212C") 193 | %set_register_a($00d789, "4200") 194 | 195 | %set_register_a($00d7d0, "2100") 196 | %set_register_a($00d7d9, "4200") 197 | 198 | %set_register_a($009700, "2100") 199 | %set_register_a($00970d, "4200") 200 | 201 | %set_register_a($0092ab, "2100") 202 | %set_register_a($0092b8, "4200") 203 | 204 | pushpc 205 | ; chamada desnecessária 206 | org $008041 207 | BRA + 208 | org $00804a 209 | + 210 | pullpc 211 | 212 | ; APU I/O 213 | %make_callback($0089B3, "0FDF25") 214 | %make_callback($008A76, "0FDF25") 215 | %make_callback($008BFF, "0FDF25") 216 | %make_callback($008D50, "0FDF25") 217 | %make_callback($008D9E, "0FDF25") 218 | %make_callback($008F7F, "0FDF25") 219 | %make_callback($008FD8, "0FDF25") 220 | %make_callback($009048, "0FDF25") 221 | %make_callback($009067, "0FDF25") 222 | %make_callback($00911F, "0FDF25") 223 | %make_callback($00927D, "0FDF25") 224 | %make_callback($009329, "0FDF25") 225 | %make_callback($009345, "0FDF25") 226 | %make_callback($00A687, "0FDF25") 227 | %make_callback($00A71A, "0FDF25") 228 | %make_callback($00A79D, "0FDF25") 229 | %make_callback($00A83C, "0FDF25") 230 | %make_callback($00D514, "0FDF25") 231 | %make_callback($00D6F0, "0FDF25") 232 | 233 | ; Controller I/O 234 | %make_callback($0089C6, "00F3BD") 235 | %make_callback($008A8F, "00F3BD") 236 | %make_callback($008AB0, "00F3BD") 237 | %make_callback($008C18, "00F3BD") 238 | %make_callback($008C3A, "00F3BD") 239 | %make_callback($008D69, "00F3BD") 240 | %make_callback($008D7F, "00F3BD") 241 | %make_callback($00901C, "00F3BD") 242 | %make_callback($0091B1, "00F3BD") 243 | %make_callback($00A780, "00F3BD") 244 | %make_callback($00A816, "00F3BD") 245 | %make_callback($00D52F, "00F3BD") 246 | %make_callback($00D673, "00F3BD") 247 | %make_callback($00D68E, "00F3BD") 248 | %make_callback($00D6AA, "00F3BD") 249 | %make_callback($00D6C0, "00F3BD") 250 | %make_callback($00D7AA, "00F3BD") 251 | %make_callback($00D7C0, "00F3BD") 252 | 253 | ; PPU stuff 254 | %make_callback($008A16, "008637") 255 | 256 | pushpc 257 | 258 | org $00C5F2 259 | LDA $3A 260 | STA $2251 261 | LDA $3C 262 | STA $2253 263 | NOP 264 | LDA $2306 265 | ASL 266 | BMI + 267 | LDA $2308 268 | ROL 269 | RTS 270 | 271 | + LDA $2308 272 | ROL 273 | INC 274 | RTS 275 | 276 | warnpc $00C679 277 | 278 | org $00C52F 279 | LDA $3A 280 | STA $2251 281 | LDA $3C 282 | STA $2253 283 | NOP 284 | LDA $2306 285 | LDX $2308 286 | RTS 287 | ;print pc 288 | warnpc $00C541 289 | ;warnpc $00C5F2 290 | 291 | ; optimize division algorithm 292 | org $00C690 293 | LSR 294 | ROR $3A 295 | CPX #$0001 296 | BNE .here 297 | LSR 298 | ROR $3A 299 | LSR 300 | ROR $3A 301 | STA $3C 302 | STA $42 303 | LDA $3A 304 | LSR $42 305 | ROR 306 | LSR $42 307 | ROR 308 | CLC 309 | ADC $3A 310 | STA $3A 311 | LDA $42 312 | ADC $3C 313 | BRA .here 314 | 315 | NOP #11 316 | 317 | warnpc $00C6C0 318 | org $00C6C0 319 | .here 320 | 321 | pullpc 322 | -------------------------------------------------------------------------------- /Race-Drivin/asm/new_indirect_abs_remap.asm: -------------------------------------------------------------------------------- 1 | ;Settings - Indexed: False; Indirect: True; Type: AbsoluteSolver 2 | ;Start Address: $0000; End Address: $1FFF 3 | 4 | ;============== REMAPPER FOR $0076 -> $6076 5 | org $00CB90 ; JMP.W ($0076) ;00CB8F|6C7600 |000076; 6 | dw $3076 ; Analysis Missing! 7 | org $00CC0B ; JMP.W ($0076) ;00CC0A|6C7600 |000076; 8 | dw $3076 ; Analysis Missing! 9 | 10 | ;; SA-1 TLR - The Last Remapper - Analysis results: 11 | 12 | ;; line 8369 (offset: 00CB8F) - trace is missing! 13 | 14 | ;; line 8414 (offset: 00CC0A) - trace is missing! 15 | 16 | ;; End of log. Version of Program: 21.0 17 | -------------------------------------------------------------------------------- /Race-Drivin/asm/render_speedup.asm: -------------------------------------------------------------------------------- 1 | ; Improves rendering speed 2 | pushpc 3 | 4 | org $00CD13 5 | BNE + 6 | 7 | org $00CD1C 8 | NOP #3 9 | 10 | + 11 | LDA $C2 12 | CMP #$0001 13 | db $30 ;BMI 14 | 15 | ;print pc 16 | warnpc $00CD24+1 17 | 18 | ; case: max($3a,-$3c) 19 | 20 | org $00BE78 21 | LDA $3A 22 | BPL + 23 | CLC 24 | ADC $3C 25 | BPL + 26 | STZ $A2 27 | BRA ++ 28 | 29 | org $00BE8A 30 | + 31 | 32 | org $00BE8C 33 | ++ 34 | 35 | ; case min($38,$3c) 36 | org $00BE38 37 | LDA $38 38 | BMI + 39 | CMP $3C 40 | BMI + 41 | BEQ + 42 | STZ $9C 43 | BRA ++ 44 | 45 | org $00BE4A 46 | + 47 | 48 | org $00BE4C 49 | ++ 50 | 51 | ; case max($c0,-$c2) 52 | org $00CE41 53 | BNE + 54 | 55 | org $00CE4D 56 | NOP #7 57 | 58 | + LDA $C0 59 | CLC 60 | ADC $C2 61 | BMI + 62 | BEQ ++ 63 | ;print pc 64 | warnpc $00CE5D 65 | 66 | org $00CE78 67 | + 68 | 69 | org $00CE93 70 | ++ 71 | 72 | org $00CDE0 73 | BNE + 74 | 75 | org $00CDE8 76 | NOP #3 77 | 78 | + LDA $BE 79 | CMP $C2 80 | BEQ + 81 | BPL ++ 82 | ;print pc 83 | warnpc $00CDF3 84 | 85 | org $00CE29 86 | + 87 | 88 | org $00CE0E 89 | ++ 90 | 91 | ;;;;;;;;;;;;;;;;;;;;;;;; 92 | ;00ceb7 93 | 94 | org $00CEAB 95 | BNE + 96 | 97 | org $00CEB3 98 | NOP #3 99 | 100 | + 101 | LDA $C0 102 | CMP $C2 103 | BEQ + 104 | BPL ++ 105 | 106 | ;print pc 107 | warnpc $00CEBE 108 | 109 | org $00CEF4 110 | + 111 | 112 | org $00CED9 113 | ++ 114 | 115 | ;;;;;;;;;;;;;;;;;;;;;;;; 116 | ;00cd8b 117 | 118 | org $00CD76 119 | BNE + 120 | 121 | org $00CD82 122 | NOP #7 123 | + 124 | LDA $BE 125 | CLC 126 | ADC $C2 127 | BMI + 128 | BEQ ++ 129 | ;print pc 130 | warnpc $00CD92 131 | 132 | org $00CDAD 133 | + 134 | 135 | org $00CDC8 136 | ++ 137 | 138 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; 139 | ;00be57 140 | 141 | org $00BE4C 142 | LDA $38 143 | BPL + 144 | CLC 145 | ADC $3C 146 | BPL + 147 | STZ $9E 148 | BRA ++ 149 | 150 | org $00BE60 151 | + 152 | org $00BE62 153 | ++ 154 | 155 | 156 | ;;;;;;;;;;;;;;;;;;;;;;;;;;; 157 | ;00BD0E 158 | 159 | org $00BD0B 160 | CMP #$0001 161 | BPL + 162 | INC $9C 163 | + LDA $6506,y 164 | 165 | ;;;;;;;;;;;;;;;;;;;;;;;;;;; 166 | ;00bd1b 167 | 168 | ;org $00BD18 169 | CMP #$0001 170 | BPL + 171 | LDA #$0002 172 | TSB $9C 173 | BRA + 174 | ;print pc 175 | warnpc $00BD27 176 | 177 | org $00BD27 178 | + 179 | 180 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; 181 | ;00BE69 182 | 183 | org $00BE62 184 | LDA $3A 185 | BMI + 186 | CMP $3C 187 | BMI + 188 | BEQ + 189 | STZ $A0 190 | BRA ++ 191 | 192 | org $00BE74 193 | + 194 | org $00BE76 195 | ++ 196 | 197 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 198 | ;00C1A0 e 00C1B2 199 | 200 | org $00C195 201 | LDA $64FC,y 202 | CLC 203 | ADC $64FE,y 204 | BPL + 205 | INC $AC 206 | + 207 | LDA $6504,y 208 | CLC 209 | ADC $6506,y 210 | BPL + 211 | LDA #$0002 212 | TSB $AC 213 | + 214 | LDA $AC 215 | CMP #$0003 216 | BNE + 217 | JMP ++ 218 | 219 | NOP #16 220 | 221 | ;print pc 222 | warnpc $00C1C8 223 | 224 | org $00C1C8 225 | + 226 | 227 | org $00C25E 228 | ++ 229 | 230 | pullpc 231 | 232 | ; the average algorithm 233 | 234 | pushpc 235 | 236 | ; warning: ROR after CMP #$8000 should contain 237 | ; a.d15 ^ b.d15 ^ carry from ADC 238 | macro average(a,b,d1,d2) 239 | CLC 240 | LDA.b $10+ 241 | ADC.b $10+ 242 | TAX 243 | 244 | LDA.b $00+ 245 | ADC.b $00+ 246 | CMP #$8000 247 | ROR 248 | STA.b 249 | 250 | TXA 251 | ROR 252 | STA.b 253 | endmacro 254 | 255 | ; faster version, given the 256 | ; game never uses 32-bit math. 257 | macro average16(a,b,d1,d2) 258 | LDA.b $00+ 259 | CLC 260 | ADC.b $00+ 261 | STA.b 262 | 263 | ROR 264 | EOR.b $00+ 265 | EOR.b $00+ 266 | ASL 267 | ROR.b 268 | endmacro 269 | 270 | org $00CEF7 271 | %average16($46,$40,$BE,$D6) 272 | %average16($48,$42,$C0,$D8) 273 | %average16($4A,$44,$C2,$DA) 274 | RTS 275 | 276 | ;print pc 277 | warnpc $00CF4F 278 | 279 | 280 | pullpc -------------------------------------------------------------------------------- /Race-Drivin/asm/run.sh: -------------------------------------------------------------------------------- 1 | rm rd.sfc; cp "rd_base.sfc" "rd.sfc"; asar -Dstrict=1 sa1.asm rd.sfc 2 | -------------------------------------------------------------------------------- /Race-Drivin/asm/sa1.asm: -------------------------------------------------------------------------------- 1 | ; SA-1 Root 2 | ; for Race Drivin (USA) 3 | 4 | ; Set value to 0 for optimized Race Drivin' speed and 1 for close-as-original speed. 5 | !origin = 0 6 | 7 | ; $3180-$3182 SA-1 -> SNES pointer 8 | ; $3183 SA-1 -> SNES flag 9 | ; $3184-$3185 Run game flag. 10 | 11 | sa1rom 12 | 13 | incsrc "sa1_defines.asm" 14 | incsrc "new_discrete_abs_remap.asm" 15 | incsrc "new_indexed_abs_remap.asm" 16 | incsrc "new_indirect_abs_remap.asm" 17 | incsrc "extra_remaps.asm" 18 | 19 | ; SA-1 ROM 20 | org $FFD5 21 | db $23,$35 22 | 23 | ; 128 kB RAM 24 | org $FFD8 25 | db $05 26 | 27 | ; Change reset vector to initialize SA-1 28 | org $00FFFC 29 | dw reset 30 | 31 | org $00B663 32 | JSR apply_remap 33 | 34 | ; Bank $00 work area 35 | org $00F48E 36 | apply_remap: 37 | LDA $0004,Y 38 | CMP #$2000 39 | BCS + 40 | ORA #$6000 41 | + RTS 42 | 43 | reset: 44 | SEI 45 | CLC 46 | XCE 47 | CLD 48 | SEP #$30 49 | 50 | LDA #$80 51 | STA $2100 52 | STZ $4200 53 | 54 | REP #$20 55 | LDA #$01FF 56 | TCS 57 | LDA #$3000 58 | TCD 59 | 60 | LDA #$0020 61 | STA $2200 62 | 63 | LDA #sa1_reset 64 | STA $2203 65 | LDA #sa1_nmi 66 | STA $2205 67 | LDA #sa1_irq 68 | STA $2207 69 | 70 | SEP #$20 71 | 72 | ; 1 MB ROM mode 73 | LDA #$80 74 | STA $2220 75 | STA $2221 76 | STA $2222 77 | STA $2223 78 | 79 | ; enable BW-RAM write 80 | LDA #$80 81 | STA $2226 82 | 83 | ; base $6000 -> $40:0000 84 | STZ $2224 ; Map $6000-$7FFF to $40:0000-$40:1FFF (S-CPU) 85 | 86 | ; disable BW-RAM write protection 87 | STZ $2228 ; Disable BW-RAM write protection area. 88 | 89 | ; enable I-RAM write 90 | LDA #$FF ; \ Enable I-RAM Write (S-CPU) 91 | STA $2229 ; / 92 | 93 | ; allow IRQs from SA-1 94 | LDA #$A0 95 | STA $2201 96 | STA $2202 97 | 98 | ; initial I-RAM value 99 | STZ $00 100 | 101 | ; start SA-1 CPU 102 | STZ $2200 ; Enable and reset SA-1. 103 | 104 | ; upload WRAM code 105 | REP #$30 106 | LDA #wram_code_end-wram_code-1 107 | LDX #wram_code 108 | LDY #$1E00 109 | MVN $00,$00 110 | SEP #$20 111 | 112 | JMP $1E00 113 | 114 | sa1_code: 115 | incsrc "sa1cpu.asm" 116 | 117 | wram_code: 118 | base $001E00 119 | incsrc "wram.asm" 120 | base off 121 | wram_code_end: 122 | 123 | 124 | ; code responsible for making 125 | ; the game able to run on the SA-1 side 126 | incsrc "hooks.asm" 127 | incsrc "fixes.asm" 128 | 129 | print "F1 Area: $", pc 130 | warnpc $00F900 131 | 132 | ; Extra freespace 133 | org $00FED4 134 | ; code reponsible for improving the game 135 | incsrc "delta_main.asm" 136 | 137 | print "F2 Area: $", pc 138 | warnpc $00FFC0 139 | 140 | org $018E02 141 | incsrc "commit_buffer.asm" 142 | incsrc "shadow_replay.asm" 143 | incsrc "render_speedup.asm" 144 | 145 | ; Origin-specific adjusts 146 | if !origin == 1 147 | ; slower version requires different title screen demo timings. 148 | incsrc "title_screen_origin.asm" 149 | else 150 | incsrc "title_screen.asm" 151 | endif 152 | 153 | incsrc "delta_position.asm" 154 | incsrc "delta_speed.asm" 155 | incsrc "delta_wheel.asm" 156 | incsrc "delta_rpm.asm" 157 | incsrc "delta_radical.asm" 158 | incsrc "delta_sprites.asm" 159 | 160 | print "FX Area: $", pc 161 | warnpc $028000 162 | -------------------------------------------------------------------------------- /Race-Drivin/asm/sa1_defines.asm: -------------------------------------------------------------------------------- 1 | ; option to include strict testing mode 2 | !strict ?= 0 3 | 4 | if !strict == 1 5 | print "strict mode on" 6 | endif 7 | 8 | ; Section: remapping macros 9 | macro remap_wram_base(addr, old, new, size) 10 | assert read1(+0) == $A9 11 | 12 | if !strict == 1 13 | assert read(+1) == 14 | endif 15 | 16 | org 17 | LDA 18 | endmacro 19 | 20 | macro remap_wram(addr) 21 | %remap_wram_base(, $7E, ".B #$40", 1) 22 | endmacro 23 | 24 | macro remap_wram_local(addr) 25 | %remap_wram_base(, $00, ".B #$40", 1) 26 | endmacro 27 | 28 | macro remap_wram_16(addr) 29 | %remap_wram_base(, $007E, ".W #$0040", 2) 30 | endmacro 31 | 32 | ; Indirect pointers that uses local RAM 33 | macro remap_indirect(orig, addr, reg, reg_byte) 34 | assert read1(+0) == 35 | 36 | if !strict == 1 37 | assert read2(+1) == 38 | endif 39 | 40 | org 41 | if < $0100 42 | assert >= $0000 43 | assert <= $00FF 44 | 45 | LD.W #$3000| 46 | else 47 | assert >= $0100 48 | assert <= $1FFF 49 | 50 | LD.W #$6000| 51 | endif 52 | endmacro 53 | 54 | macro remap_directpage(orig, addr) 55 | %remap_indirect(, , "A", $A9) 56 | endmacro 57 | 58 | macro remap_mvn(b1, b2, addr) 59 | if !strict == 1 60 | assert read1(+0) == $54 61 | assert read1(+1) == 62 | assert read1(+2) == 63 | endif 64 | 65 | !sb1 = 66 | !sb2 = 67 | 68 | if !sb1&$FE == $7E 69 | !sb1 #= !sb1-$7E+$40 70 | endif 71 | 72 | if !sb2&$FE == $7E 73 | !sb2 #= !sb2-$7E+$40 74 | endif 75 | 76 | assert !sb1 == $40 || !sb1 == $41 || !sb2 == $40 || !sb2 == $41 77 | assert !sb1 != $7E && !sb2 != $7E && !sb1 != $7F && !sb2 != $7F 78 | 79 | org 80 | MVN !sb1, !sb2 81 | endmacro 82 | 83 | macro remap_indirect_jump(dest, addr) 84 | assert read1(+0) == $DC 85 | 86 | if !strict == 1 87 | assert read2(+1) == 88 | endif 89 | 90 | !res #= |$3000 91 | 92 | assert !res >= $3000 && !res <= $37FF 93 | 94 | org 95 | JMP.W [!res] 96 | endmacro 97 | 98 | ; Section: SA-1 CPU macros 99 | 100 | ; assume A 8-bit and XY 16-bit 101 | macro call_snes(ptr) 102 | LDY.w # 103 | STY $3180 104 | LDY.w #>>16|$4000 105 | STY $3182 106 | endmacro 107 | 108 | macro call_snes_a(ptr) 109 | LDA.w # 110 | STA $3180 111 | LDA.w #>>16|$4000 112 | STA $3182 113 | endmacro 114 | 115 | macro call_snes_x(ptr) 116 | LDX.w # 117 | STX $3180 118 | LDX.w #>>16|$4000 119 | STX $3182 120 | endmacro 121 | 122 | macro wait_ack_8() 123 | ?wait: 124 | BIT $3183 125 | BPL ?wait 126 | endmacro 127 | 128 | macro wait_ack_16() 129 | ?wait: 130 | BIT $3182 131 | BPL ?wait 132 | endmacro 133 | 134 | macro wait_snes_8() 135 | ?wait: 136 | BIT $3183 137 | BVS ?wait 138 | endmacro 139 | 140 | macro wait_snes_16() 141 | ?wait: 142 | BIT $3182 143 | BVS ?wait 144 | endmacro 145 | 146 | ; Assumes A 8-bit, XY 16-bit 147 | macro execute_routine_snes_cpu_b0(ptr, routine) 148 | pushpc 149 | org 150 | JSR ?execute_snes 151 | pullpc 152 | 153 | ?execute_snes: 154 | PHY 155 | %wait_snes_16() 156 | ;just for ?snes_code macro label work 157 | LDY.w #?snes_code 158 | STY $3180 159 | LDY.w #?snes_code>>16|$4000 160 | STY $3182 161 | %wait_ack_16() 162 | PLY 163 | RTS 164 | 165 | ?snes_code: 166 | JSR 167 | RTL 168 | endmacro 169 | -------------------------------------------------------------------------------- /Race-Drivin/asm/sa1cpu.asm: -------------------------------------------------------------------------------- 1 | sa1_nmi: 2 | sa1_cop: 3 | sa1_irq: 4 | STP 5 | 6 | sa1_reset: 7 | SEI 8 | CLC 9 | XCE 10 | 11 | REP #$38 12 | 13 | LDA #$3000 14 | TCD 15 | LDA #$37FF 16 | TCS 17 | 18 | SEP #$30 19 | 20 | PHK 21 | PLB 22 | 23 | STZ $2230 24 | 25 | LDA #$80 26 | STA $2227 27 | STZ $2225 28 | LDA #$FF 29 | STA $222A 30 | 31 | LDA #$B0 32 | STA $220A 33 | STA $220B 34 | 35 | REP #$20 36 | LDA $00FFEE 37 | STA $220E 38 | LDA $00FFEA 39 | STA $220C 40 | SEP #$20 41 | 42 | LDA #$50 43 | STA $2209 44 | 45 | ; clear I-RAM via MVN 46 | STZ $00 47 | REP #$30 48 | LDA #$07FE 49 | LDX #$0000 50 | LDY #$0001 51 | MVN $00,$00 52 | SEP #$20 53 | 54 | ; signal S-CPU we're done 55 | LDA #$AA 56 | STA $00 57 | 58 | ; principle: we'll never use division or 59 | ; cumulative sum. Otherwise, you must restore 60 | ; to multiplication mode. 61 | STZ $2250 62 | 63 | ;- bra - 64 | ; start executing game 65 | JMP initialize_system 66 | -------------------------------------------------------------------------------- /Race-Drivin/asm/shadow_replay.asm: -------------------------------------------------------------------------------- 1 | ; This is responsible for making the replay last for longer frames 2 | ; and by offling to WRAM the car positions, so you don't have to use 3 | ; a so large BW-RAM size. 4 | 5 | ; push replay data 6 | %create_callback_async_nocopy("00AA2D") 7 | 8 | %make_callback($008F11, "00AA2D") 9 | %make_callback($00909A, "00AA2D") 10 | %make_callback($00A639, "00AA2D") 11 | %make_callback($00A927, "00AA2D") 12 | 13 | ; pull replay data 14 | %create_callback_nocopy("00AAA2") 15 | 16 | %make_callback($00A738, "00AAA2") 17 | 18 | ; pull replay data 19 | %create_callback_nocopy("00AAA9") 20 | 21 | %make_callback($00A6A3, "00AAA9") 22 | %make_callback($00A7B5, "00AAA9") 23 | 24 | ; Original capacity: 25 | ; 16 slots: 256 bytes + 4096 bytes 26 | !replay_slots = 128 27 | 28 | ; up to $7E:17FF 29 | !position_history = $1000 30 | 31 | ; up to $7E:9FFF 32 | !sprite_history = $7E2000 33 | 34 | pushpc 35 | 36 | org $00A724 37 | SBC.W #!replay_slots-2 38 | AND.W #!replay_slots-1 39 | 40 | org $00A733 41 | LDA.W #!replay_slots-3 42 | 43 | org $00AA38 44 | STA.w !position_history+0,x 45 | 46 | org $00AA3D 47 | STA.w !position_history+2,x 48 | 49 | org $00AA42 50 | STA.w !position_history+4,x 51 | 52 | org $00AA47 53 | STA.w !position_history+6,x 54 | 55 | org $00AA4C 56 | STA.w !position_history+8,x 57 | 58 | org $00AA51 59 | STA.w !position_history+10,x 60 | 61 | org $00AA64 62 | PEA $4040 63 | PLB 64 | PLB 65 | CLC 66 | - LDA $0E12,y 67 | STA.l !sprite_history+0,x 68 | LDA $0E14,y 69 | STA.l !sprite_history+2,x 70 | LDA $0E16,y 71 | STA.l !sprite_history+4,x 72 | LDA $0E18,y 73 | STA.l !sprite_history+6,x 74 | TYA 75 | ADC #$0010 76 | TAY 77 | TXA 78 | ADC #$0010 79 | TAX 80 | CPY #$00E0 81 | BCC - 82 | ;print pc 83 | warnpc $00AA95 84 | 85 | org $00AA9A 86 | AND.W #!replay_slots-1 87 | 88 | org $00AAAE 89 | AND.W #!replay_slots-1 90 | 91 | org $00AAB9 92 | LDA.w !position_history+0,x 93 | 94 | org $00AABE 95 | LDA.w !position_history+2,x 96 | 97 | org $00AAC3 98 | LDA.w !position_history+4,x 99 | 100 | org $00AAC8 101 | LDA.w !position_history+6,x 102 | 103 | org $00AACD 104 | LDA.w !position_history+8,x 105 | 106 | org $00AAD2 107 | LDA.w !position_history+10,x 108 | 109 | org $00AAE7 110 | PEA $4040 111 | PLB 112 | PLB 113 | CLC 114 | - LDA.l !sprite_history+0,x 115 | STA $0E12,y 116 | LDA.l !sprite_history+2,x 117 | STA $0E14,y 118 | LDA.l !sprite_history+4,x 119 | STA $0E16,y 120 | LDA.l !sprite_history+6,x 121 | STA $0E18,y 122 | TYA 123 | ADC #$0010 124 | TAY 125 | TXA 126 | ADC #$0010 127 | TAX 128 | CPY #$00E0 129 | BCC - 130 | 131 | ;print pc 132 | warnpc $00AB18 133 | 134 | org $008F0E 135 | LDY.w #!replay_slots 136 | 137 | pullpc 138 | 139 | ; Special code to handle Autocross Track 140 | 141 | ; initialization 142 | %create_callback_nocopy("00DB87") 143 | %create_callback_nocopy("00DBC3") 144 | 145 | %make_callback($008DBB, "00DB87") 146 | %make_callback($00D91D, "00DBC3") 147 | 148 | !autocross_bank = $7E 149 | !autocross_shadow = $7EA000 150 | 151 | !shadow_final_ptr = $1800 152 | 153 | pushpc 154 | 155 | org $00DB9C 156 | LDX $6234 157 | SEP #$20 158 | LDA.b #!autocross_bank 159 | PHA 160 | PLB 161 | REP #$20 162 | ;print pc 163 | warnpc $00DBA7 164 | 165 | org $00DBA9 166 | STA.w !autocross_shadow+0,x 167 | 168 | org $00DBAE 169 | STA.w !autocross_shadow+2,x 170 | 171 | org $00DBB3 172 | STA.w !autocross_shadow+4,x 173 | 174 | ; instead of copying the same value till 175 | ; the end of the buffer, point which position 176 | ; to read forever. 177 | 178 | org $00DBB6 179 | STX !shadow_final_ptr 180 | PLB 181 | RTL 182 | 183 | pullpc 184 | 185 | %create_callback_nocopy("00DBE1") 186 | %make_callback($00D930, "00DBE1") 187 | 188 | pushpc 189 | 190 | org $00DC02 191 | LDX $6234 192 | SEP #$20 193 | LDA.b #!autocross_bank 194 | PHA 195 | PLB 196 | REP #$20 197 | ;print pc 198 | warnpc $00DC0D 199 | 200 | org $00DC0F 201 | STA.w !autocross_shadow+0,x 202 | 203 | org $00DC14 204 | STA.w !autocross_shadow+2,x 205 | 206 | org $00DC19 207 | STA.w !autocross_shadow+4,x 208 | 209 | org $00DC25 210 | PLB 211 | BCS + 212 | STX $6234 213 | + 214 | ;print pc 215 | warnpc $00DC2B 216 | 217 | pullpc 218 | 219 | %create_callback_nocopy("00DC2C") 220 | %make_callback($00D924, "00DC2C") 221 | 222 | pushpc 223 | 224 | org $00DC31 225 | LDX $6234 226 | CPX.w !shadow_final_ptr 227 | BCC + 228 | LDX.w !shadow_final_ptr 229 | + LDA.l !autocross_shadow+0,x 230 | STA $6E12 231 | LDA.l !autocross_shadow+2,x 232 | STA $6E16 233 | LDA.l !autocross_shadow+4,x 234 | STA $6E18 235 | LDA #$99E0 236 | STA $6E1E 237 | JML shadow_finish_load 238 | ;print pc 239 | warnpc $00DC5D-1 240 | 241 | pullpc 242 | 243 | shadow_finish_load: 244 | LDA #$000A 245 | STA $6E20 246 | RTL 247 | -------------------------------------------------------------------------------- /Race-Drivin/asm/title_screen.asm: -------------------------------------------------------------------------------- 1 | 2 | pushpc 3 | 4 | org $00957A 5 | JSL demo_tick_delta 6 | NOP #2 7 | 8 | org $009585 9 | JSL demo_init_delta 10 | NOP 11 | 12 | org $0095A9 13 | CMP #$0023+7 14 | 15 | org $0095AE 16 | CMP #$002B+8 17 | 18 | org $0095E0 19 | CMP #$0039-1 20 | 21 | org $0095E5 22 | CMP #$0045-1 23 | 24 | org $00964A 25 | CMP #$0011+1 26 | 27 | org $00964F 28 | CMP #$0019+1 29 | 30 | org $009686 31 | CMP #$0044-7 32 | 33 | org $00968B 34 | CMP #$004C-6 35 | 36 | org $0096BC 37 | CMP #$0030 38 | 39 | org $0096CE 40 | CMP #$004A 41 | 42 | pullpc 43 | 44 | demo_init_delta: 45 | STZ $10 46 | STZ $6258 47 | LDA #$7777 48 | STA !demo_ctl 49 | RTL 50 | 51 | demo_tick_delta: 52 | LDA $622E 53 | BEQ .init 54 | 55 | LDA #$5555 56 | STA !demo_ctl 57 | 58 | .back 59 | LDA #$0001 60 | %delta_muladd(!demo_dt) 61 | ADC $622E 62 | STA $622E 63 | 64 | LDA $622C 65 | RTL 66 | 67 | .init 68 | LDA #$7777 69 | CMP !demo_ctl 70 | BEQ .back 71 | LDA #$EAEA 72 | CMP !demo_ctl 73 | BEQ .back 74 | STA !demo_ctl 75 | 76 | STZ !demo_dt 77 | BRA .back 78 | -------------------------------------------------------------------------------- /Race-Drivin/asm/title_screen_old.asm: -------------------------------------------------------------------------------- 1 | ; Old title screen demo adjust, breaks on any sensitive 2 | ; timing change. 3 | 4 | pushpc 5 | 6 | !mult = 4 7 | 8 | org $009590 9 | CMP #$0008*!mult 10 | 11 | org $0095A9 12 | CMP #$0023*!mult-18 13 | 14 | org $0095AE 15 | CMP #$002B*!mult-18 16 | 17 | org $0095E0 18 | CMP #$0039*!mult-$0030-20 19 | 20 | org $0095E5 21 | CMP #$0045*!mult-$0040-20 22 | 23 | org $00964A 24 | CMP #$0011*!mult-$0008 25 | 26 | org $00964F 27 | CMP #$0019*!mult-$000B 28 | 29 | org $009686 30 | CMP #$0044*!mult-$0044-8 31 | 32 | org $00968B 33 | CMP #$004C*!mult-$0044-8 34 | 35 | org $0096BC 36 | CMP #$0030*!mult-$0016-12 37 | 38 | org $0096CE 39 | CMP #$004A*!mult-$0016-12 40 | 41 | pullpc -------------------------------------------------------------------------------- /Race-Drivin/asm/title_screen_origin.asm: -------------------------------------------------------------------------------- 1 | 2 | pushpc 3 | 4 | org $00957A 5 | JSL demo_tick_delta 6 | NOP #2 7 | 8 | org $009585 9 | JSL demo_init_delta 10 | NOP 11 | 12 | org $0095A9 13 | CMP #$0023+8+2 14 | 15 | org $0095AE 16 | CMP #$002B+8+2 17 | 18 | org $0095E0 19 | CMP #$0039 20 | 21 | org $0095E5 22 | CMP #$0045-1 23 | 24 | org $00964A 25 | CMP #$0011+2 26 | 27 | org $00964F 28 | CMP #$0019+2 29 | 30 | org $009686 31 | CMP #$0044-11 32 | 33 | org $00968B 34 | CMP #$004C-11 35 | 36 | org $0096BC 37 | CMP #$0030+1 38 | 39 | org $0096CE 40 | CMP #$004A+1 41 | 42 | pullpc 43 | 44 | demo_init_delta: 45 | STZ $10 46 | STZ $6258 47 | LDA #$7777 48 | STA !demo_ctl 49 | RTL 50 | 51 | demo_tick_delta: 52 | LDA $622E 53 | BEQ .init 54 | 55 | LDA #$5555 56 | STA !demo_ctl 57 | 58 | .back 59 | LDA #$0001 60 | %delta_muladd(!demo_dt) 61 | ADC $622E 62 | STA $622E 63 | 64 | LDA $622C 65 | RTL 66 | 67 | .init 68 | LDA #$7777 69 | CMP !demo_ctl 70 | BEQ .back 71 | LDA #$EAEA 72 | CMP !demo_ctl 73 | BEQ .back 74 | STA !demo_ctl 75 | 76 | STZ !demo_dt 77 | BRA .back 78 | -------------------------------------------------------------------------------- /Race-Drivin/asm/wram.asm: -------------------------------------------------------------------------------- 1 | wram_main: 2 | .wait 3 | NOP #4 4 | 5 | LDA $3000 6 | CMP #$AA 7 | BNE .wait 8 | 9 | CLI 10 | 11 | ;JML $008000 12 | 13 | wram_loop: 14 | ; prevent I-RAM bus conflict exaustion 15 | NOP #4 16 | 17 | BIT $3183 18 | BVC wram_loop 19 | 20 | ; Acknowledge that SNES started running 21 | LDA #$80 22 | TSB $3183 23 | 24 | REP #$20 25 | 26 | PHK 27 | PEA.w .return-1 28 | JML [$3180] 29 | 30 | .return 31 | SEP #$20 32 | STZ $3183 33 | BRA wram_loop 34 | -------------------------------------------------------------------------------- /Race-Drivin/patch-origin.bps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VitorVilela7/SA1-Root/2a552ce891ee3b3d780fca446e5473463fd236f9/Race-Drivin/patch-origin.bps -------------------------------------------------------------------------------- /Race-Drivin/patch.bps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VitorVilela7/SA1-Root/2a552ce891ee3b3d780fca446e5473463fd236f9/Race-Drivin/patch.bps -------------------------------------------------------------------------------- /Super-R-Type/README.md: -------------------------------------------------------------------------------- 1 | # SA-1 Root: Super R-Type 2 | Version 1.2, released 2022-09-19 3 | 4 | Super R-Type is a classic shooter game made by Irem, being kind of a upgrade from R-Type II. 5 | 6 | This SA-1 Root patch removes all slowdown present on the original game and drastically reduces the 7 | loading times. 8 | 9 | Special thanks to Erivando_BR for sending me the SA-1 Collection trace log files of Super R-Type, 10 | which made this optimization patch possible to happen. 11 | 12 | ## How to Patch 13 | 14 | Download the latest Super R-Type BPS patch file available on the 15 | [Releases](https://github.com/VitorVilela7/SA1-Root/releases) tab. 16 | 17 | You can patch it using [beat](https://www.romhacking.net/utilities/893/) 18 | or [FLIPS](https://sneslab.net/tools/floating.zip), both common .bps patchers. 19 | 20 | You can also patch the .asm files directly using 21 | [Asar](https://github.com/RPGHacker/asar). 22 | 23 | For more information on how to apply ROM patches, see this SnesLab 24 | article: https://sneslab.net/wiki/How_to_apply_ROM_patches 25 | 26 | It works only on the american version of Super R-Type. The japanese version is still being studied, 27 | and it will likely not work with this patch version. 28 | 29 | Expected checksums: 30 | 31 | ### USA Version: 32 | #### Before patching: 33 | * CRC32: 8B22C830 34 | * SHA256: 05C7F6461209020785FBA33007E1830820AA44ADA4B1A6F991D936BF2335B15B 35 | 36 | #### After patching 37 | * CRC32: 0D73E7D3 38 | * SHA256: 292F295D44D0569A7954151AB74B28845361DF1E5C12EDBE4F519DA14E18A892 39 | 40 | ## Compatibility 41 | 42 | It works on both real hardware (sd2snes or SA-1 cart) and emulators (Snes9x and bsnes/higan/ares). 43 | 44 | ## Technical details 45 | 46 | * Remapping mode: full 47 | * Remapping strategy: static 48 | * SA-1 usage: full with parallelism 49 | 50 | This game relies on dynamic data pointers, but overall it does not use much of the Super Nintendo 51 | features. The game likes passing 16-bit pointers to RAM, using simple indirection to store into 52 | the registers, but overall the routines are somewhat organized, I didn't have to add dynamic 53 | remappers. The game only uses 32 KB of RAM ($7E:0000-$7E:7FFF), although it initializes 64 KB 54 | ($7E:0000-$7E:FFFF). After some adjusts, it got it working with just 32 KB of BW-RAM. 55 | 56 | Unlike earlier patches, SA-1 was used as the "master" processor, being responsible for running the 57 | whole game and only routines that really required the SNES CPU were executed on the other processor. 58 | All calls to the SNES CPU are asynchronous and parallel, meaning that the SA-1 requests the SNES CPU 59 | to process a specific routine and continues executing without waiting the SNES CPU to terminate its 60 | job. Some routines were adapted to not cause RAM collision during the parallel execution of the 61 | routines. 62 | 63 | Because of the game characteristics, **32 kB (256 Kbit) of BW-RAM is required to the game run** 64 | correctly. 65 | 66 | ## RAM remap 67 | 68 | * ``$0000-$1FFF`` -> ``$6000-$7FFF`` 69 | * ``$7E:0000-$7E:7FFF`` -> ``$40:0000-$40:7FFF`` 70 | 71 | ## Credits 72 | 73 | Super R-Type - SA-1 Root wouldn't be that awesome without help from these people: 74 | 75 | * Erivando_BR (trace logs) 76 | * kccheng (testing) 77 | * Vitor Vilela (patch author) 78 | * You (for using it :D) 79 | 80 | ## Contacting me 81 | 82 | You can contact me though the following links: 83 | 84 | * My Website: https://www.sneslab.net/ 85 | * My Github profile: https://github.com/VitorVilela7 86 | * My Twitter profile: https://twitter.com/HackerVilela 87 | * My Patreon: https://www.patreon.com/vitorvilela 88 | -------------------------------------------------------------------------------- /Super-R-Type/asm/README.md: -------------------------------------------------------------------------------- 1 | Instructions 2 | ============ 3 | 4 | Apply sa1.asm to the USA version of Super R-Type. Alternatively, use the do.sh script. 5 | 6 | You can also patch the .asm files directly using [Asar](https://github.com/RPGHacker/asar). 7 | 8 | -------------------------------------------------------------------------------- /Super-R-Type/asm/databank.asm: -------------------------------------------------------------------------------- 1 | macro remap_wram_base(addr, old, new, size) 2 | assert read1(+0) == $A9 3 | 4 | if !strict == 1 5 | assert read(+1) == 6 | endif 7 | 8 | org 9 | LDA 10 | endmacro 11 | 12 | macro remap_wram(addr) 13 | %remap_wram_base(, $7E, ".B #$40", 1) 14 | endmacro 15 | 16 | macro remap_wram_local(addr) 17 | %remap_wram_base(, $00, ".B #$40", 1) 18 | endmacro 19 | 20 | macro remap_wram_16(addr) 21 | %remap_wram_base(, $007E, ".W #$0040", 2) 22 | endmacro 23 | 24 | ; Bank 7E 25 | %remap_wram($008010) 26 | %remap_wram($0080A8) 27 | %remap_wram($008406) 28 | %remap_wram($008514) 29 | %remap_wram($00916F) 30 | %remap_wram($0091B6) 31 | %remap_wram($009206) 32 | %remap_wram($00982F) 33 | %remap_wram($009858) 34 | %remap_wram($009881) 35 | %remap_wram($0098A9) 36 | %remap_wram($0098FA) 37 | 38 | ; Indirect pointers building 39 | %remap_wram($00A1A6) 40 | %remap_wram_16($00A1CF) 41 | 42 | ; Indirect pointers that uses local RAM 43 | macro remap_indirect(orig, addr) 44 | assert read1(+0) == $A0 45 | 46 | if !strict == 1 47 | assert read2(+1) == 48 | endif 49 | 50 | org 51 | LDY.W #$6000| 52 | 53 | endmacro 54 | 55 | %remap_wram_local($008936) 56 | %remap_wram_local($0089AF) 57 | 58 | ;these below doesn't work because the game often uses the pointers with DB set to $7E, 59 | ;I made TLR remap differently the indexes by consequence. 60 | ;%remap_indirect($189A, $008933) 61 | ;%remap_indirect($189A, $0089AC) 62 | ;%remap_indirect($1892, $009651) 63 | ;%remap_indirect($1832, $009647) 64 | ;%remap_indirect($1862, $00964C) 65 | 66 | ; DMA parameters 67 | ; Other DMA are either static, ROM-only or unused... 68 | %remap_wram($008329) 69 | %remap_wram($00834F) 70 | %remap_wram($00838C) 71 | %remap_wram_local($0083C2) 72 | 73 | macro remap_mvn(b1, b2, addr) 74 | if !strict == 1 75 | assert read1(+0) == $54 76 | assert read1(+1) == 77 | assert read1(+2) == 78 | endif 79 | 80 | !sb1 = 81 | !sb2 = 82 | 83 | if !sb1&$FE == $7E 84 | !sb1 #= !sb1-$7E+$40 85 | endif 86 | 87 | if !sb2&$FE == $7E 88 | !sb2 #= !sb2-$7E+$40 89 | endif 90 | 91 | assert !sb1 == $40 || !sb1 == $41 || !sb2 == $40 || !sb2 == $41 92 | assert !sb1 != $7E && !sb2 != $7E && !sb1 != $7F && !sb2 != $7F 93 | 94 | org 95 | MVN !sb1, !sb2 96 | endmacro 97 | 98 | %remap_mvn($7E, $7E, $008720) 99 | %remap_mvn($7E, $7E, $008744) 100 | %remap_mvn($7E, $05, $009B81) 101 | %remap_mvn($7E, $05, $009BA4) 102 | %remap_mvn($7E, $05, $009BB6) 103 | %remap_mvn($7E, $05, $00A183) 104 | 105 | macro remap_indirect_jump(dest, addr) 106 | assert read1(+0) == $DC 107 | 108 | if !strict == 1 109 | assert read2(+1) == 110 | endif 111 | 112 | !res #= |$6000 113 | 114 | assert !res >= $6000 && !res <= $7FFF 115 | 116 | org 117 | JMP.W [!res] 118 | endmacro 119 | 120 | %remap_indirect_jump($0010, $008253) 121 | %remap_indirect_jump($1801, $0084D4) 122 | %remap_indirect_jump($1801, $00872D) 123 | %remap_indirect_jump($00F5, $008758) 124 | %remap_indirect_jump($00F5, $008791) 125 | %remap_indirect_jump($00F5, $0087D7) 126 | %remap_indirect_jump($00F5, $00881A) 127 | 128 | ; Format:
, 129 | ; Remap the WRAM specific to BWRAM. 130 | 131 | ; It's worth commenting that the address is incremented by 5, 132 | ; while the code only read the first four values. It's suggestive 133 | ; that the table was supposed to be incremented by 4. 134 | 135 | ; It's very likely a bug, but we have to remain the original behavior 136 | org $0480BC 137 | db $02,$21,$00,$00,$07 138 | db $42,$60,$00,$09,$42 139 | db $00,$00,$16,$21,$00 140 | db $00,$00,$00 141 | 142 | 143 | -------------------------------------------------------------------------------- /Super-R-Type/asm/do.sh: -------------------------------------------------------------------------------- 1 | rm srtype.sfc; cp srtype_base.sfc srtype.sfc && asar -Dstrict=1 sa1.asm srtype.sfc 2 | -------------------------------------------------------------------------------- /Super-R-Type/asm/hooks.asm: -------------------------------------------------------------------------------- 1 | ; assume A 8-bit and XY 16-bit 2 | macro call_snes(ptr) 3 | LDY.w # 4 | STY $3080 5 | LDY.w #>>16|$4000 6 | STY $3082 7 | endmacro 8 | 9 | macro call_snes_a(ptr) 10 | LDA.w # 11 | STA $3080 12 | LDA.w #>>16|$4000 13 | STA $3082 14 | endmacro 15 | 16 | macro call_snes_x(ptr) 17 | LDX.w # 18 | STX $3080 19 | LDX.w #>>16|$4000 20 | STX $3082 21 | endmacro 22 | 23 | macro wait_ack_8() 24 | ?wait: 25 | BIT $3083 26 | BPL ?wait 27 | endmacro 28 | 29 | macro wait_ack_16() 30 | ?wait: 31 | BIT $3082 32 | BPL ?wait 33 | endmacro 34 | 35 | macro wait_snes_8() 36 | ?wait: 37 | BIT $3083 38 | BVS ?wait 39 | endmacro 40 | 41 | macro wait_snes_16() 42 | ?wait: 43 | BIT $3082 44 | BVS ?wait 45 | endmacro 46 | 47 | pushpc 48 | org $00804E 49 | JML initialize_system_continue 50 | 51 | ; SNES side execution ends here 52 | org $0081B7 53 | RTL 54 | 55 | ; skip the WRAM setting up values by SNES 56 | ; SA-1 will do that after clearing WRAM 57 | org $0080A7 58 | REP #$20 59 | BRA + 60 | 61 | ; Makes the SA-1 stop there 62 | org $0080CF 63 | RTL 64 | 65 | org $0080D0 66 | + 67 | 68 | ; Fix a JSL with RTS bug on the original game 69 | ; that ends up causing problems with SA-1 70 | org $00A41A 71 | RTL 72 | 73 | pullpc 74 | 75 | ; Parallel the work between SA-1 and SNES 76 | initialize_system: 77 | STZ $6000 78 | REP #$20 79 | LDA #$7FFF 80 | LDX #$0000 81 | LDY #$0001 82 | MVN $40,$40 83 | 84 | PHB 85 | SEP #$20 86 | LDA #$04 87 | PHA 88 | PLB 89 | 90 | %wait_snes_8() 91 | %call_snes(initialize_snes_side) 92 | %wait_snes_8() 93 | 94 | PLB 95 | REP #$20 96 | 97 | ; Set up $40:2XXX 98 | JSL $0080AE 99 | 100 | JML $00802C 101 | 102 | .continue 103 | STY.B $FB 104 | STA.B $FD 105 | 106 | ;%wait_snes_8() 107 | 108 | ; This seems to be the main loop 109 | REP #$20 110 | JML $0081B9 111 | 112 | 113 | ; A8/XY16 114 | initialize_snes_side: 115 | LDA.B #$80 116 | STA.W $2100 117 | STZ.W $4200 118 | 119 | JML $008052 120 | 121 | ; NMI adjusts 122 | pushpc 123 | org $0082CB 124 | TSB.W $3084 125 | pullpc 126 | 127 | ; Assumes A 8-bit, XY 16-bit 128 | macro execute_routine_snes_cpu_b0(ptr, routine) 129 | pushpc 130 | org 131 | JSR ?execute_snes 132 | pullpc 133 | 134 | ?execute_snes: 135 | PHY 136 | %wait_snes_16() 137 | ;just for ?snes_code macro label work 138 | LDY.w #?snes_code 139 | STY $3080 140 | LDY.w #?snes_code>>16|$4000 141 | STY $3082 142 | %wait_ack_16() 143 | PLY 144 | RTS 145 | 146 | ?snes_code: 147 | JSR 148 | RTL 149 | endmacro 150 | 151 | %execute_routine_snes_cpu_b0($008233, $a510) 152 | 153 | ; Make change music routine run on SNES side 154 | pushpc 155 | org $00A4AE 156 | JMP music_code 157 | pullpc 158 | 159 | music_code: 160 | STA $00 161 | %wait_snes_16() 162 | %call_snes_a(.snes_code) 163 | %wait_ack_16() 164 | RTL 165 | 166 | .snes_code 167 | PHB 168 | PHX 169 | REP #$20 170 | LDA $00 171 | JML $00A4B2 172 | 173 | ; $2100 related 174 | 175 | snes_update_display: 176 | LDA $80 177 | STA $2100 178 | RTL 179 | 180 | update_display: 181 | REP #$20 182 | %wait_snes_16() 183 | %call_snes_a(snes_update_display) 184 | %wait_ack_16() 185 | RTL 186 | 187 | macro update_display(addr, cnt) 188 | pushpc 189 | org 190 | JSL update_display 191 | if != 0 192 | NOP # 193 | endif 194 | 195 | warnpc +4+ 196 | pullpc 197 | endmacro 198 | 199 | %update_display($018006, 1) 200 | %update_display($01846D, 1) 201 | %update_display($018960, 1) 202 | %update_display($01896F, 1) 203 | 204 | macro orig_code() 205 | SEP #$20 ;0187F4 206 | LDA.B $80 ;0187F6 207 | ORA.B #$0F ;0187F8 208 | STA.B $80 ;0187FA 209 | STA.W $2100 ;0187FC 210 | STZ.W $2106 ;0187FF 211 | REP #$20 ;018802 212 | RTS ;018804 213 | endmacro 214 | 215 | pushpc 216 | 217 | org $0187FC 218 | JSL update_display_2106 219 | RTS 220 | 221 | org $018AD1 222 | NOP #3 223 | 224 | pullpc 225 | 226 | update_display_2106: 227 | REP #$20 228 | %wait_snes_16() 229 | %call_snes_a(.snes_code) 230 | %wait_snes_16() 231 | RTL 232 | 233 | .snes_code 234 | LDA $80 235 | STA $2100 236 | STZ $2106 237 | RTL 238 | 239 | 240 | macro orig_code_2() 241 | SEP #$20 ;019882 242 | LDA.B $80 ;019884 243 | AND.B #$F0 ;019886 244 | STA.B $80 ;019888 245 | STA.W $2100 ;01988A 246 | endmacro 247 | 248 | macro update_display_2(addr) 249 | assert read2(+0) == $8085 250 | assert read3(+2) == $21008D 251 | 252 | pushpc 253 | org 254 | JSL update_display_2 255 | NOP 256 | warnpc +5 257 | pullpc 258 | endmacro 259 | 260 | %update_display_2($019888) 261 | %update_display_2($01B12F) 262 | %update_display_2($038006) 263 | %update_display_2($0380B7) 264 | %update_display_2($038196) 265 | %update_display_2($03823D) 266 | %update_display_2($038E42) 267 | %update_display_2($03927E) 268 | %update_display_2($04AB7B) 269 | %update_display_2($04ABB0) 270 | 271 | update_display_2: 272 | STA $80 273 | PHY 274 | %wait_snes_8() 275 | %call_snes(snes_update_display) 276 | %wait_snes_8() 277 | PLY 278 | RTL 279 | 280 | ; responsible for the palette 281 | pushpc 282 | org $00A188 283 | JSR upload_palette 284 | pullpc 285 | 286 | upload_palette: 287 | TSC 288 | CMP #$3700 289 | BCS .sa1 290 | JMP $A19B 291 | 292 | .sa1 293 | %wait_snes_16() 294 | STY $3000 295 | %call_snes(.snes_code) 296 | ; parallel mode doesn't work here 297 | ; because the palette is overwritten. 298 | %wait_snes_16() 299 | RTS 300 | 301 | .snes_code 302 | REP #$20 303 | LDY $3000 304 | JSR $A19B 305 | RTL 306 | 307 | ; responsible for (some) VRAM uploads 308 | snes_vram_handler: 309 | PHX 310 | LDA $3002 311 | LDY $3003 312 | JMP ($3000) 313 | 314 | macro vram_upload(addr) 315 | pushpc 316 | org 317 | JMP ?my_upload 318 | pullpc 319 | 320 | ?my_upload: 321 | PHX 322 | REP #$20 323 | STA $3002 324 | STY $3003 325 | LDX.w #+3 326 | STX $3000 327 | %wait_snes_16() 328 | %call_snes_x(snes_vram_handler) 329 | %wait_ack_16() 330 | PLX 331 | RTL 332 | 333 | endmacro 334 | 335 | %vram_upload($00977D) 336 | %vram_upload($0097A5) 337 | %vram_upload($0097CD) 338 | %vram_upload($0097F5) 339 | 340 | pushpc 341 | org $008B18 342 | JMP upload_layers 343 | pullpc 344 | 345 | upload_layers: 346 | PHX 347 | %wait_snes_16() 348 | STA $00 349 | ASL 350 | ADC $00 351 | STA $3000 352 | %call_snes_a(.snes) 353 | %wait_ack_16() 354 | PLX 355 | RTL 356 | 357 | .snes 358 | REP #$20 359 | PHX 360 | LDA $3000 361 | JMP $8B1F 362 | 363 | ; Handle mosaic 364 | pushpc 365 | org $04ABE4 366 | JSR mosaic 367 | 368 | org $04AC16 369 | JSR mosaic 370 | 371 | org $04FFE0 372 | mosaic: 373 | PHY 374 | %wait_snes_8() 375 | STA $3000 376 | %call_snes(.snes) 377 | PLY 378 | RTS 379 | 380 | .snes 381 | LDA $3000 382 | STA $2106 383 | RTL 384 | 385 | warnpc $04FFFF+1 386 | 387 | pullpc 388 | 389 | pushpc 390 | ; Optimize NMI and avoid RAM colission in case of lag 391 | org $00828D 392 | optimize_nmi: 393 | INC $4E 394 | SEP #$20 395 | 396 | LDA #$04 397 | PHA 398 | PLB 399 | 400 | LDA $4210 401 | 402 | LDA $4C 403 | BIT #$80 404 | BEQ .continue 405 | JMP nmi_abort 406 | 407 | .continue 408 | LDA $12 409 | PHA 410 | PEI ($10) 411 | LDA $16 412 | PHA 413 | PEI ($14) 414 | PEI ($00) 415 | PEI ($02) 416 | PEI ($04) 417 | PEI ($06) 418 | PEI ($08) 419 | PEI ($0A) 420 | PEI ($0C) 421 | PEI ($0E) 422 | 423 | REP #$20 424 | BRA nmi_continue 425 | 426 | NOP #9 427 | 428 | warnpc $0082C8 429 | 430 | org $0082C8 431 | nmi_continue: 432 | 433 | org $0084FD 434 | nmi_abort: 435 | 436 | pullpc 437 | 438 | ; Multiplication and division registers 439 | ; There are no references in the disassembly, 440 | ; which makes me unsure if they are even used. 441 | 442 | ; However, given jump tables from bank 04, it's 443 | ; important to have them covered at least. 444 | pushpc 445 | org $008AD5 446 | STZ $2250 447 | LDA $00 448 | AND #$00FF 449 | STA $2251 450 | LDA $02 451 | AND #$00FF 452 | STA $2253 453 | NOP 454 | LDA $2306 455 | STA $00 456 | RTL 457 | 458 | NOP 459 | warnpc $8AF0 460 | 461 | org $008AF0 462 | LDA #$0001 463 | STA $2250 464 | LDA $00 465 | STA $2251 466 | LDA $02 467 | AND #$00FF 468 | STA $2253 469 | NOP 470 | LDA $2306 471 | STA $00 472 | LDA $2308 473 | STA $02 474 | RTL 475 | 476 | NOP #9 477 | warnpc $008B18 478 | pullpc -------------------------------------------------------------------------------- /Super-R-Type/asm/new_indexed_long_remap.asm: -------------------------------------------------------------------------------- 1 | ;Settings - Indexed: True; Indirect: False; Type: LongSolver 2 | ;Start Address: $7D0000; End Address: $7FFFFF 3 | 4 | ;============== REMAPPER FOR $7E3160 -> $403160 5 | org $0095F5 ; LDA.L $7E3160,X ;0095F4|BF60317E|7E3160; 6 | dl $403160 7 | org $00961B ; LDA.L $7E3160,X ;00961A|BF60317E|7E3160; 8 | dl $403160 9 | 10 | ;============== REMAPPER FOR $7E59E0 -> $4059E0 11 | org $009C4B ; STA.L $7E59E0,X ;009C4A|9FE0597E|7E59E0; 12 | dl $4059E0 13 | org $009C5C ; STA.L $7E59E0,X ;009C5B|9FE0597E|7E59E0; 14 | dl $4059E0 15 | 16 | ;; SA-1 TLR - The Last Remapper - Analysis results: 17 | 18 | ;; 0095f4 lda $7e3160,x [7e338d] A:022d X:022d Y:1832 S:0176 D:0000 DB:04 nvmxdIzc V:260 H:224 F:26 19 | ;; line 2608 (offset: 0095F4) - OK from code analysis! 20 | 21 | ;; 00961a lda $7e3160,x [7e4861] A:1701 X:1701 Y:1862 S:0176 D:0000 DB:04 nvmxdIzc V: 12 H:172 F:32 22 | ;; line 2625 (offset: 00961A) - OK from code analysis! 23 | 24 | ;; 009c4a sta $7e59e0,x [7e59e0] A:7000 X:0000 Y:1cbc S:0174 D:0000 DB:07 nvmxdIzc V: 1 H:192 F:50 25 | ;; line 3476 (offset: 009C4A) - OK from code analysis! 26 | 27 | ;; 009c5b sta $7e59e0,x [7e59e2] A:0000 X:0002 Y:bd80 S:0172 D:0000 DB:07 nvmxdIZc V: 1 H:252 F:50 28 | ;; line 3484 (offset: 009C5B) - OK from code analysis! 29 | 30 | ;; End of log. Version of Program: 15.0 31 | -------------------------------------------------------------------------------- /Super-R-Type/asm/new_indirect_abs_remap.asm: -------------------------------------------------------------------------------- 1 | ;Settings - Indexed: False; Indirect: True; Type: AbsoluteSolver 2 | ;Start Address: $0000; End Address: $1FFF 3 | 4 | ;============== REMAPPER FOR $0000 -> $6000 5 | org $008E81 ; JMP.W ($0000) ;008E80|6C0000 |000000; 6 | dw $6000 ; Analysis Missing! 7 | org $008E89 ; JMP.W ($0000) ;008E88|6C0000 |000000; 8 | dw $6000 ; Analysis Missing! 9 | org $009DB9 ; JMP.W ($0000) ;009DB8|6C0000 |000000; 10 | dw $6000 ; Analysis Missing! 11 | org $01AF6E ; JMP.W ($0000) ;01AF6D|6C0000 |000000; 12 | dw $6000 ; Analysis Missing! 13 | org $01E5FF ; JMP.W ($0000) ;01E5FE|6C0000 |000000; 14 | dw $6000 ; Analysis Missing! 15 | org $01E67D ; JMP.W ($0000) ;01E67C|6C0000 |000000; 16 | dw $6000 ; Analysis Missing! 17 | org $01ED98 ; JMP.W ($0000) ;01ED97|6C0000 |000000; 18 | dw $6000 ; Analysis Missing! 19 | org $02865B ; JMP.W ($0000) ;02865A|6C0000 |000000; 20 | dw $6000 ; Analysis Missing! 21 | 22 | ;============== REMAPPER FOR $0002 -> $6002 23 | org $0089AA ; JMP.W ($0002) ;0089A9|6C0200 |000002; 24 | dw $6002 ; Analysis Missing! 25 | org $008A23 ; JMP.W ($0002) ;008A22|6C0200 |000002; 26 | dw $6002 ; Analysis Missing! 27 | org $00A049 ; JMP.W ($0002) ;00A048|6C0200 |000002; 28 | dw $6002 ; Analysis Missing! 29 | 30 | ;============== REMAPPER FOR $0010 -> $6010 31 | org $01BAC5 ; JMP.W ($0010) ;01BAC4|6C1000 |000010; 32 | dw $6010 ; Analysis Missing! 33 | 34 | ;============== REMAPPER FOR $00E0 -> $60E0 35 | org $009275 ; JMP.W ($00E0) ;009274|6CE000 |0000E0; 36 | dw $60E0 ; Analysis Missing! 37 | org $009DBF ; JMP.W ($00E0) ;009DBE|6CE000 |0000E0; 38 | dw $60E0 ; Analysis Missing! 39 | 40 | ;============== REMAPPER FOR $00E2 -> $60E2 41 | org $009A29 ; JMP.W ($00E2) ;009A28|6CE200 |0000E2; 42 | dw $60E2 ; Analysis Missing! 43 | 44 | ;============== REMAPPER FOR $00E4 -> $60E4 45 | org $008C47 ; JMP.W ($00E4) ;008C46|6CE400 |0000E4; 46 | dw $60E4 ; Analysis Missing! 47 | 48 | ;============== REMAPPER FOR $00E6 -> $60E6 49 | org $008DBB ; JMP.W ($00E6) ;008DBA|6CE600 |0000E6; 50 | dw $60E6 ; Analysis Missing! 51 | org $008DDB ; JMP.W ($00E6) ;008DDA|6CE600 |0000E6; 52 | dw $60E6 ; Analysis Missing! 53 | 54 | ;============== REMAPPER FOR $00E8 -> $60E8 55 | org $008DB5 ; JMP.W ($00E8) ;008DB4|6CE800 |0000E8; 56 | dw $60E8 ; Analysis Missing! 57 | org $008DD5 ; JMP.W ($00E8) ;008DD4|6CE800 |0000E8; 58 | dw $60E8 ; Analysis Missing! 59 | 60 | ;============== REMAPPER FOR $00F0 -> $60F0 61 | org $009FD4 ; JMP.W ($00F0) ;009FD3|6CF000 |0000F0; 62 | dw $60F0 ; Analysis Missing! 63 | 64 | ;============== REMAPPER FOR $173F -> $773F 65 | org $01DEE7 ; JMP.W ($173F) ;01DEE6|6C3F17 |00173F; 66 | dw $773F ; Analysis Missing! 67 | org $01DF57 ; JMP.W ($173F) ;01DF56|6C3F17 |00173F; 68 | dw $773F ; Analysis Missing! 69 | org $01DFDE ; JMP.W ($173F) ;01DFDD|6C3F17 |00173F; 70 | dw $773F ; Analysis Missing! 71 | org $01E04E ; JMP.W ($173F) ;01E04D|6C3F17 |00173F; 72 | dw $773F ; Analysis Missing! 73 | org $01E0B1 ; JMP.W ($173F) ;01E0B0|6C3F17 |00173F; 74 | dw $773F ; Analysis Missing! 75 | org $01E126 ; JMP.W ($173F) ;01E125|6C3F17 |00173F; 76 | dw $773F ; Analysis Missing! 77 | org $01E1A1 ; JMP.W ($173F) ;01E1A0|6C3F17 |00173F; 78 | dw $773F ; Analysis Missing! 79 | org $01E222 ; JMP.W ($173F) ;01E221|6C3F17 |00173F; 80 | dw $773F ; Analysis Missing! 81 | org $01E29A ; JMP.W ($173F) ;01E299|6C3F17 |00173F; 82 | dw $773F ; Analysis Missing! 83 | org $01E318 ; JMP.W ($173F) ;01E317|6C3F17 |00173F; 84 | dw $773F ; Analysis Missing! 85 | org $01E393 ; JMP.W ($173F) ;01E392|6C3F17 |00173F; 86 | dw $773F ; Analysis Missing! 87 | org $01E414 ; JMP.W ($173F) ;01E413|6C3F17 |00173F; 88 | dw $773F ; Analysis Missing! 89 | org $01E48C ; JMP.W ($173F) ;01E48B|6C3F17 |00173F; 90 | dw $773F ; Analysis Missing! 91 | org $01E50A ; JMP.W ($173F) ;01E509|6C3F17 |00173F; 92 | dw $773F ; Analysis Missing! 93 | org $01E5BA ; JMP.W ($173F) ;01E5B9|6C3F17 |00173F; 94 | dw $773F ; Analysis Missing! 95 | org $01E638 ; JMP.W ($173F) ;01E637|6C3F17 |00173F; 96 | dw $773F ; Analysis Missing! 97 | org $01E707 ; JMP.W ($173F) ;01E706|6C3F17 |00173F; 98 | dw $773F ; Analysis Missing! 99 | org $01E774 ; JMP.W ($173F) ;01E773|6C3F17 |00173F; 100 | dw $773F ; Analysis Missing! 101 | org $01E7D6 ; JMP.W ($173F) ;01E7D5|6C3F17 |00173F; 102 | dw $773F ; Analysis Missing! 103 | org $01E83B ; JMP.W ($173F) ;01E83A|6C3F17 |00173F; 104 | dw $773F ; Analysis Missing! 105 | org $01E8A6 ; JMP.W ($173F) ;01E8A5|6C3F17 |00173F; 106 | dw $773F ; Analysis Missing! 107 | org $01E90B ; JMP.W ($173F) ;01E90A|6C3F17 |00173F; 108 | dw $773F ; Analysis Missing! 109 | org $01E9BB ; JMP.W ($173F) ;01E9BA|6C3F17 |00173F; 110 | dw $773F ; Analysis Missing! 111 | org $01EA28 ; JMP.W ($173F) ;01EA27|6C3F17 |00173F; 112 | dw $773F ; Analysis Missing! 113 | org $01EA8A ; JMP.W ($173F) ;01EA89|6C3F17 |00173F; 114 | dw $773F ; Analysis Missing! 115 | org $01EAEF ; JMP.W ($173F) ;01EAEE|6C3F17 |00173F; 116 | dw $773F ; Analysis Missing! 117 | org $01EB5A ; JMP.W ($173F) ;01EB59|6C3F17 |00173F; 118 | dw $773F ; Analysis Missing! 119 | org $01EBBF ; JMP.W ($173F) ;01EBBE|6C3F17 |00173F; 120 | dw $773F ; Analysis Missing! 121 | org $01ECB1 ; JMP.W ($173F) ;01ECB0|6C3F17 |00173F; 122 | dw $773F ; Analysis Missing! 123 | org $01ECE0 ; JMP.W ($173F) ;01ECDF|6C3F17 |00173F; 124 | dw $773F ; Analysis Missing! 125 | org $01ED16 ; JMP.W ($173F) ;01ED15|6C3F17 |00173F; 126 | dw $773F ; Analysis Missing! 127 | org $01ED4E ; JMP.W ($173F) ;01ED4D|6C3F17 |00173F; 128 | dw $773F ; Analysis Missing! 129 | 130 | ;============== REMAPPER FOR $1741 -> $7741 131 | org $01F0C7 ; JMP.W ($1741) ;01F0C6|6C4117 |001741; 132 | dw $7741 ; Analysis Missing! 133 | 134 | ;; SA-1 TLR - The Last Remapper - Analysis results: 135 | 136 | ;; line 1663 (offset: 008E80) - trace is missing! 137 | 138 | ;; line 1667 (offset: 008E88) - trace is missing! 139 | 140 | ;; line 3652 (offset: 009DB8) - trace is missing! 141 | 142 | ;; line 12876 (offset: 01AF6D) - trace is missing! 143 | 144 | ;; line 18746 (offset: 01E5FE) - trace is missing! 145 | 146 | ;; line 18802 (offset: 01E67C) - trace is missing! 147 | 148 | ;; line 19582 (offset: 01ED97) - trace is missing! 149 | 150 | ;; line 22158 (offset: 02865A) - trace is missing! 151 | 152 | ;; line 1075 (offset: 0089A9) - trace is missing! 153 | 154 | ;; line 1128 (offset: 008A22) - trace is missing! 155 | 156 | ;; line 3976 (offset: 00A048) - trace is missing! 157 | 158 | ;; line 14103 (offset: 01BAC4) - trace is missing! 159 | 160 | ;; line 2153 (offset: 009274) - trace is missing! 161 | 162 | ;; line 3655 (offset: 009DBE) - trace is missing! 163 | 164 | ;; line 3154 (offset: 009A28) - trace is missing! 165 | 166 | ;; line 1412 (offset: 008C46) - trace is missing! 167 | 168 | ;; line 1573 (offset: 008DBA) - trace is missing! 169 | 170 | ;; line 1587 (offset: 008DDA) - trace is missing! 171 | 172 | ;; line 1570 (offset: 008DB4) - trace is missing! 173 | 174 | ;; line 1584 (offset: 008DD4) - trace is missing! 175 | 176 | ;; line 3909 (offset: 009FD3) - trace is missing! 177 | 178 | ;; line 17955 (offset: 01DEE6) - trace is missing! 179 | 180 | ;; line 18003 (offset: 01DF56) - trace is missing! 181 | 182 | ;; line 18061 (offset: 01DFDD) - trace is missing! 183 | 184 | ;; line 18109 (offset: 01E04D) - trace is missing! 185 | 186 | ;; line 18153 (offset: 01E0B0) - trace is missing! 187 | 188 | ;; line 18206 (offset: 01E125) - trace is missing! 189 | 190 | ;; line 18261 (offset: 01E1A0) - trace is missing! 191 | 192 | ;; line 18316 (offset: 01E221) - trace is missing! 193 | 194 | ;; line 18369 (offset: 01E299) - trace is missing! 195 | 196 | ;; line 18423 (offset: 01E317) - trace is missing! 197 | 198 | ;; line 18478 (offset: 01E392) - trace is missing! 199 | 200 | ;; line 18533 (offset: 01E413) - trace is missing! 201 | 202 | ;; line 18586 (offset: 01E48B) - trace is missing! 203 | 204 | ;; line 18640 (offset: 01E509) - trace is missing! 205 | 206 | ;; line 18714 (offset: 01E5B9) - trace is missing! 207 | 208 | ;; line 18770 (offset: 01E637) - trace is missing! 209 | 210 | ;; line 18860 (offset: 01E706) - trace is missing! 211 | 212 | ;; line 18907 (offset: 01E773) - trace is missing! 213 | 214 | ;; line 18950 (offset: 01E7D5) - trace is missing! 215 | 216 | ;; line 18993 (offset: 01E83A) - trace is missing! 217 | 218 | ;; line 19042 (offset: 01E8A5) - trace is missing! 219 | 220 | ;; line 19085 (offset: 01E90A) - trace is missing! 221 | 222 | ;; line 19159 (offset: 01E9BA) - trace is missing! 223 | 224 | ;; line 19206 (offset: 01EA27) - trace is missing! 225 | 226 | ;; line 19249 (offset: 01EA89) - trace is missing! 227 | 228 | ;; line 19292 (offset: 01EAEE) - trace is missing! 229 | 230 | ;; line 19341 (offset: 01EB59) - trace is missing! 231 | 232 | ;; line 19384 (offset: 01EBBE) - trace is missing! 233 | 234 | ;; line 19484 (offset: 01ECB0) - trace is missing! 235 | 236 | ;; line 19504 (offset: 01ECDF) - trace is missing! 237 | 238 | ;; line 19526 (offset: 01ED15) - trace is missing! 239 | 240 | ;; line 19552 (offset: 01ED4D) - trace is missing! 241 | 242 | ;; line 19898 (offset: 01F0C6) - trace is missing! 243 | 244 | ;; End of log. Version of Program: 15.0 245 | -------------------------------------------------------------------------------- /Super-R-Type/asm/sa1.asm: -------------------------------------------------------------------------------- 1 | ; SA-1 Root 2 | ; for Super R-Type (USA) 3 | 4 | ; $3080-$3082 SA-1 -> SNES pointer 5 | ; $3083 SA-1 -> SNES flag 6 | ; $3084-$3085 Run game flag. 7 | 8 | sa1rom 9 | 10 | ; option to include strict testing mode 11 | !strict ?= 0 12 | 13 | if !strict == 1 14 | print "strict mode on" 15 | endif 16 | 17 | ; SA-1 ROM 18 | org $FFD5 19 | db $23,$35 20 | 21 | ; 32 kB RAM 22 | org $FFD8 23 | db $05 24 | 25 | ; Direct Page 26 | org $008024 27 | LDA #$6000 28 | 29 | ; Stack Pointer 30 | org $008028 31 | LDA #$37FF 32 | 33 | ; SA-1 CPU jumps directly to $8010 and needs 16-bit XY 34 | org $008014 35 | REP #$30 36 | 37 | ; RAM remap files 38 | incsrc "new_discrete_abs_remap.asm" 39 | incsrc "new_indexed_abs_remap.asm" 40 | incsrc "new_indexed_long_remap.asm" 41 | incsrc "new_indirect_abs_remap.asm" 42 | incsrc "databank.asm" 43 | 44 | ; Change reset vector to initialize SA-1 45 | org $00FFFC 46 | dw reset 47 | 48 | org $00FFE4 49 | dw cop_start 50 | dw brk_start 51 | 52 | ; Bank $00 work area 53 | org $00A76D 54 | reset: 55 | SEI 56 | CLC 57 | XCE 58 | CLD 59 | SEP #$30 60 | 61 | LDA #$80 62 | STA $2100 63 | STZ $4200 64 | 65 | REP #$20 66 | LDA #$1FFF 67 | TCS 68 | LDA #$6000 69 | TCD 70 | 71 | LDA #$0020 72 | STA $2200 73 | 74 | LDA #sa1_reset 75 | STA $2203 76 | LDA #sa1_nmi 77 | STA $2205 78 | LDA #sa1_irq 79 | STA $2207 80 | 81 | SEP #$20 82 | 83 | ; 1 MB ROM mode 84 | LDA #$80 85 | STA $2220 86 | STA $2221 87 | STA $2222 88 | STA $2223 89 | 90 | ; enable BW-RAM write 91 | LDA #$80 92 | STA $2226 93 | 94 | ; base $6000 -> $40:0000 95 | STZ $2224 ; Map $6000-$7FFF to $40:0000-$40:1FFF (S-CPU) 96 | 97 | ; disable BW-RAM write protection 98 | STZ $2228 ; Disable BW-RAM write protection area. 99 | 100 | ; enable I-RAM write 101 | LDA #$FF ; \ Enable I-RAM Write (S-CPU) 102 | STA $2229 ; / 103 | 104 | ; allow IRQs from SA-1 105 | LDA #$A0 106 | STA $2201 107 | STA $2202 108 | 109 | ; initial I-RAM value 110 | STZ $3000 111 | 112 | ; start SA-1 CPU 113 | STZ $2200 ; Enable and reset SA-1. 114 | 115 | ; upload WRAM code 116 | PHB 117 | REP #$30 118 | LDA #wram_code_end-wram_code-1 119 | LDX #wram_code 120 | LDY #$1E00 121 | MVN $7E,$00 122 | SEP #$20 123 | PLB 124 | 125 | LDA #$04 126 | PHA 127 | PLB 128 | 129 | JMP $1E00 130 | 131 | cop_start: 132 | brk_start: 133 | BRA brk_start 134 | 135 | sa1_code: 136 | incsrc "sa1cpu.asm" 137 | 138 | wram_code: 139 | base $001E00 140 | incsrc "wram.asm" 141 | base off 142 | wram_code_end: 143 | 144 | incsrc "hooks.asm" 145 | 146 | warnpc $00FFC0 147 | -------------------------------------------------------------------------------- /Super-R-Type/asm/sa1cpu.asm: -------------------------------------------------------------------------------- 1 | sa1_nmi: 2 | sa1_irq: 3 | sa1_cop: 4 | STP 5 | 6 | 7 | sa1_reset: 8 | SEI 9 | CLC 10 | XCE 11 | 12 | REP #$38 13 | 14 | LDA #$6000 15 | TCD 16 | LDA #$37FF 17 | TCS 18 | 19 | SEP #$30 20 | 21 | ; Enable I-RAM write 22 | LDA #$FF 23 | STA $00222A 24 | 25 | ; Set up DB, now that we can use the stack 26 | LDA #$04 27 | PHA 28 | PLB 29 | 30 | STZ $2230 31 | 32 | LDA #$80 33 | STA $2227 34 | STZ $2225 35 | 36 | LDA #$B0 37 | STA $220A 38 | STA $220B 39 | 40 | REP #$20 41 | LDA $00FFEE 42 | STA $220E 43 | LDA $00FFEA 44 | STA $220C 45 | SEP #$20 46 | 47 | LDA #$50 48 | STA $2209 49 | 50 | ; clear I-RAM via MVN 51 | STZ $3000 52 | REP #$30 53 | LDA #$07FE 54 | LDX #$3000 55 | LDY #$3001 56 | MVN $00,$00 57 | SEP #$20 58 | 59 | ; signal S-CPU we're done 60 | LDA #$AA 61 | STA $3000 62 | 63 | ; start executing game 64 | JMP initialize_system 65 | -------------------------------------------------------------------------------- /Super-R-Type/asm/wram.asm: -------------------------------------------------------------------------------- 1 | wram_main: 2 | .wait 3 | NOP #4 4 | 5 | LDA $3000 6 | CMP #$AA 7 | BNE .wait 8 | 9 | ;JML $008010 10 | 11 | wram_loop: 12 | ; prevent I-RAM bus conflict exaustion 13 | NOP #4 14 | 15 | ; Authorize SA-1 to execute 16 | LDA $3084 17 | AND #$80 18 | BEQ + 19 | TSB $4C 20 | STZ $3084 21 | + 22 | 23 | BIT $3083 24 | BVC wram_loop 25 | 26 | ; Acknowledge that SNES started running 27 | LDA #$80 28 | TSB $3083 29 | 30 | PHK 31 | PEA.w .return-1 32 | JML [$3080] 33 | 34 | .return 35 | SEP #$20 36 | STZ $3083 37 | BRA wram_loop 38 | -------------------------------------------------------------------------------- /Super-R-Type/patch.bps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VitorVilela7/SA1-Root/2a552ce891ee3b3d780fca446e5473463fd236f9/Super-R-Type/patch.bps --------------------------------------------------------------------------------