Skip to content

Commit

Permalink
Cleaned up mappers a bit. (#19)
Browse files Browse the repository at this point in the history
Added more comments about each mapper.
  • Loading branch information
FluBBaOfWard authored Jun 9, 2024
1 parent 4f0356c commit 0c8b359
Show file tree
Hide file tree
Showing 67 changed files with 463 additions and 266 deletions.
3 changes: 2 additions & 1 deletion arm9/source/cart.s
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ mappertbl:
.word 111,mapper111init
.word 118,mapper118init
.word 119,mapper119init
.word 140,mapper66init
.word 140,mapper140init
.word 146,mapper79init
.word 151,mapper151init
.word 152,mapper152init
.word 153,mapper16init
Expand Down
8 changes: 4 additions & 4 deletions arm9/source/mappers/konami.s
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ counter = mapperData+3
.section .text,"ax"
@---------------------------------------------------------------------------------
Konami_Init:
ldr r0,=Konami_IRQ_Hook
adr r0,Konami_IRQ_Hook
str_ r0,scanlineHook
bx lr
@---------------------------------------------------------------------------------
Expand Down Expand Up @@ -52,13 +52,13 @@ KoIRQen: @- - - - - - - - - - - - - - -
Konami_IRQ_Hook:
@---------------------------------------------------------------------------------
ldr_ r0,latch
tst r0,#0x200 @timer active?
tst r0,#0x200 ;@ Timer active?
beq h1

adds r0,r0,#0x01000000 @counter++
adds r0,r0,#0x01000000 ;@ Counter++
bcc h0

strb_ r0,counter @copy latch to counter
strb_ r0,counter ;@ Copy latch to counter
@ b irq6502
b CheckI
h0:
Expand Down
7 changes: 0 additions & 7 deletions arm9/source/mappers/map023771.s
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "equates.h"
#include "6502mac.h"
@---------------------------------------------------------------------------------
.global mapper0init
.global mapper2init
.global mapper3init
.global mapper7init
Expand All @@ -12,12 +11,6 @@
@---------------------------------------------------------------------------------
.section .text,"ax"
@---------------------------------------------------------------------------------
/*
mapper0init:
@---------------------------------------------------------------------------------
.word void,void,void,void
bx lr*/
@---------------------------------------------------------------------------------
mapper2init:
@---------------------------------------------------------------------------------
.word map89AB_,map89AB_,map89AB_,map89AB_
Expand Down
12 changes: 6 additions & 6 deletions arm9/source/mappers/map1.s
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ mapper1init:
@patch for games...
stmfd sp!, {lr}
ldr_ r1, romBase @src
ldr_ r2, romsize8k @size
ldr_ r2, romSize8k @size
mov r2, r2, lsl#13
bl crc
Expand Down Expand Up @@ -312,7 +312,7 @@ b1:
and r0, r0, #3
tst r0, #2
bne 0f

tst r0, #1
bl mirror1H_
b b2
Expand Down Expand Up @@ -355,7 +355,7 @@ b3:
ldrcsb_ r1, reg1
andcs r1, r1, #0x10
movcc r1, #0
str r1, prombase
str r1, promBase

ldrb_ r0, reg0
tst r0, #0x8
Expand All @@ -369,7 +369,7 @@ b3:
add r0, r1, r2
bl map89AB_

ldr r1, prombase
ldr r1, promBase
ldr_ r2, prgSize16k
cmp r2, #32
addcs r0, r1, #15
Expand All @@ -382,7 +382,7 @@ b4:
add r0, r1, r2
bl mapCDEF_

ldr r1, prombase
ldr r1, promBase
ldr_ r2, prgSize16k
cmp r2, #32
movcs r0, r1
Expand All @@ -398,5 +398,5 @@ b5:
ldmfd sp!, {pc}

@-----------------
prombase:
promBase:
.word 0
3 changes: 3 additions & 0 deletions arm9/source/mappers/map105.s
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
@---------------------------------------------------------------------------------
.section .text,"ax"
@---------------------------------------------------------------------------------
@ Board with MMC1 plus timers
@ Used in:
@ Nintendo World Championships
mapper105init:
@---------------------------------------------------------------------------------
.word write0,write1,void,write3
Expand Down
23 changes: 21 additions & 2 deletions arm9/source/mappers/map1166.s
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,43 @@
@---------------------------------------------------------------------------------
.global mapper11init
.global mapper66init
.global mapper140init
@---------------------------------------------------------------------------------
.section .text,"ax"
@---------------------------------------------------------------------------------
@ Color Dreams
mapper11init:
@---------------------------------------------------------------------------------
.word write11,write11,write11,write11
bx lr
@---------------------------------------------------------------------------------
@ NES-GNROM & NES-MHROM
@ Used in:
@ Gumshoe
@ Super Mario Bros. + Duck Hunt
mapper66init:
@---------------------------------------------------------------------------------
.word write66,write66,write66,write66

ldr r1,mapper66init
ldrb_ r0,cartFlags
orr r0,r0,#MIRROR
strb_ r0,cartFlags

bx lr
@---------------------------------------------------------------------------------
@ Jaleco JF-11 & JF-14
@ Used in:
@ Bio Senshi Dan - Increaser Tono Tatakai
mapper140init:
@---------------------------------------------------------------------------------
.word void,void,void,void

adr r1,write66
str_ r1,m6502WriteTbl+12

ldrb_ r0,cartFlags
orr r0,r0,#MIRROR
strb r0,[r1]
strb_ r0,cartFlags

bx lr
@---------------------------------------------------------------------------------
Expand Down
21 changes: 11 additions & 10 deletions arm9/source/mappers/map118.s
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
@---------------------------------------------------------------------------------
.section .text,"ax"
@---------------------------------------------------------------------------------
@ MMC3 on TKSROM & TLSROM boards
@ Used in:
@ Armadillo
@ Pro Sport Hockey
@ Also see mapper 95, 158 & 207
mapper118init:
@---------------------------------------------------------------------------------
.word write0, empty_W, write2, write3
Expand Down Expand Up @@ -71,30 +76,26 @@ mapper118init:
setbank_cpu:
@-------------------------------------------------------------------
stmfd sp!, {lr}
ldrb_ r0, prg1
bl mapAB_
ldrb_ r0, reg0
tst r0, #0x40
beq sbc1

mov r0, #-2
bl map89_
ldrb_ r0, prg1
bl mapAB_
ldrb_ r0, prg0
bl mapCD_
ldmfd sp!, {lr}
mov r0, #-1
bl mapEF_
b cend
b mapEF_

sbc1:
ldrb_ r0, prg0
bl map89_
ldrb_ r0, prg1
bl mapAB_
ldmfd sp!, {lr}
mov r0, #-1
bl mapCDEF_

cend:
ldmfd sp!, {pc}
b mapCDEF_

@-------------------------------------------------------------------
setbank_ppu:
Expand Down
6 changes: 5 additions & 1 deletion arm9/source/mappers/map15.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
@---------------------------------------------------------------------------------
.section .text,"ax"
@---------------------------------------------------------------------------------
mapper15init: @100-in-1 Contra 16
@ K-1029 and K-1030P boards
@ Used in:
@ 100-in-1 Contra Function 16
@ 168-in-1 New Contra Function 16
mapper15init:
@---------------------------------------------------------------------------------
.word write800x,void,void,void

Expand Down
4 changes: 3 additions & 1 deletion arm9/source/mappers/map151.s
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
@---------------------------------------------------------------------------------
.section .text,"ax"
@---------------------------------------------------------------------------------
@ VRC1 on the Vs. System
@ Should be mapper 75
mapper151init:
@---------------------------------------------------------------------------------
.word write0,write1,write2,write3

ldrb_ r0,cartFlags
orr r0,r0,#VS
strb r0,[r1]
strb_ r0,cartFlags

bx lr
@---------------------------------------------------------------------------------
Expand Down
9 changes: 8 additions & 1 deletion arm9/source/mappers/map159.s
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@
@----------------------------------------------------------------------------
.section .text,"ax"
@---------------------------------------------------------------------------------
mapper159init:@ Bandai
@ Bandai FCG boards with an LZ93D50 and a 128-byte serial EEPROM (X24C01).
@ Used in:
@ Dragon Ball Z: Kyoushuu! Saiya-jin
@ Magical Taruruuto-kun: Fantastic World!!
@ Magical Taruruuto-kun 2: Mahou Daibouken
@ SD Gundam Gaiden - Knight Gundam Monogatari
@ See also mapper 16
mapper159init:
@----------------------------------------------------------------------------
.word write0,write0,write0,write0

Expand Down
4 changes: 3 additions & 1 deletion arm9/source/mappers/map16.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
patch = mapperData @may never used
eeprom_type = mapperData + 1
irq_enable = mapperData + 2
irq_type = mapperData + 3
unused = mapperData + 3
reg0 = mapperData + 4
reg1 = mapperData + 5
reg2 = mapperData + 6
Expand All @@ -16,6 +16,8 @@
@---------------------------------------------------------------------------------
.section .text,"ax"
@---------------------------------------------------------------------------------
@ Bandai FCG boards with the FCG-1 that supports no EEPROM, and the LZ93D50 with no or 256 bytes of EEPROM.
@ See also mapper 159
mapper16init:
@---------------------------------------------------------------------------------
.word write, write, write, write
Expand Down
7 changes: 7 additions & 0 deletions arm9/source/mappers/map163.s
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
@---------------------------------------------------------------------------------
.section .text,"ax"
@---------------------------------------------------------------------------------
@ 南晶 (Nánjīng) FC-001 board
@ Used in:
@ 牧场物语 - Harvest Moon (NJ011)
@ 水浒神兽 (Shuǐhǔ Shénshòu, NJ019)
@ 暗黑破坏神 - Diablo (NJ037)
@ 轩辕剑外传 之 天之痕 (Xuānyuánjiàn Wàizhuàn zhī Tiānzhīhén, NJ045)
@ Final Fantasy IV - 最终幻想 4꞉ 光与暗 水晶纷争 (NJ098)
mapper163init:
@---------------------------------------------------------------------------------
.word void, void, void, void
Expand Down
6 changes: 3 additions & 3 deletions arm9/source/mappers/map17.s
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@---------------------------------------------------------------------------------
.section .text,"ax"
@---------------------------------------------------------------------------------
@ Front Fareast Super Magic Card
mapper17init:
@---------------------------------------------------------------------------------
.word void,void,void,void
Expand Down Expand Up @@ -35,9 +36,8 @@ write0:
tst r2,#0x10
subne r2,r2,#8

adr r1,jmptbl
ldr pc,[r1,r2,lsl#2]

ldr pc,[pc,r2,lsl#2]
nop
jmptbl: .word void,_1,_2,_3,map89_,mapAB_,mapCD_,mapEF_
.word chr0_,chr1_,chr2_,chr3_,chr4_,chr5_,chr6_,chr7_

Expand Down
7 changes: 6 additions & 1 deletion arm9/source/mappers/map18.s
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
@---------------------------------------------------------------------------------
.section .text,"ax"
@---------------------------------------------------------------------------------
mapper18init: @Jaleco SS8806..
@ Jaleco SS8806
@ Used in:
@ The Lord of King
@ Magic John
@ Pizza Pop
mapper18init:
@---------------------------------------------------------------------------------
.word write8000,writeA000,writeC000,writeE000

Expand Down
1 change: 1 addition & 0 deletions arm9/source/mappers/map184.s
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
@---------------------------------------------------------------------------------
.section .text,"ax"
@---------------------------------------------------------------------------------
@ Sunsoft-1
mapper184init:
@---------------------------------------------------------------------------------
.word write184,write184,write184,write184
Expand Down
6 changes: 5 additions & 1 deletion arm9/source/mappers/map189.s
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "6502mac.h"
@---------------------------------------------------------------------------------
.global mapper189init
.word write0, write1, write2, write3

reg0 = mapperData
reg1 = mapperData+1
Expand Down Expand Up @@ -33,6 +32,11 @@
@---------------------------------------------------------------------------------
.section .text,"ax"
@---------------------------------------------------------------------------------
@ This mapper is a modified MMC3.
@ Everything operates just as it does on the MMC3, only the normal PRG regs
@ (R:6,R:7) are ignored, and a new PRG Reg is used instead.
@ Used in:
@ Thunder Warrior
mapper189init:
@---------------------------------------------------------------------------------
.word write0, write1, write2, write3
Expand Down
8 changes: 6 additions & 2 deletions arm9/source/mappers/map19.s
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
#include "6502mac.h"
@---------------------------------------------------------------------------------
.global mapper19init
.global framehook
.global hbhook
counter = mapperData+0
enable = mapperData+4
reg0 = mapperData+8
reg1 = mapperData+9
@---------------------------------------------------------------------------------
.section .text,"ax"
@---------------------------------------------------------------------------------
@ Namco 129 & Namco 163
@ Used in:
@ Digital Devil Story: Megami Tensei II
@ Final Lap
@ Hydlide 3
@ Star Wars
mapper19init:
@---------------------------------------------------------------------------------
.word map19_8,map19_A,map19_C,map19_E
Expand Down
1 change: 1 addition & 0 deletions arm9/source/mappers/map198.s
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
@---------------------------------------------------------------------------------
.section .text,"ax"
@---------------------------------------------------------------------------------
@ MMC3 plus more
mapper198init:
@---------------------------------------------------------------------------------
.word write0, writeABCDEF, writeABCDEF, writeABCDEF
Expand Down
Loading

0 comments on commit 0c8b359

Please sign in to comment.