Advertisement
Hiradur

Neon64 Mapper10

Sep 2nd, 2013
625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Small patch to make Neon64 support Mapper 10.
  2.  
  3. ***
  4. ROM.INC
  5. ***
  6.  
  7. *** LINES 197+ ***
  8. notmapper9
  9.                 li      t1,10
  10.                 bne     t0,t1,notmapper10
  11.                 nop
  12.                 ; Mapper 10 (MMC4, identical to MMC2 but PRGROM)
  13.                 jal     mmc4prgrom
  14.                 nop
  15.                 jal     nchrrom
  16.                 nop
  17.  
  18.                 j       endofloadrom
  19.                 nop
  20. notmapper10
  21. ...
  22.  
  23. *** LINES 443+ ***
  24. mmc4prgrom      ; Mapper #10 (MMC4)-style PRGROM load
  25.                 ; first 16k ROM bank at $8000,
  26.                 ; last 16k ROM bank at $c000
  27.                 _tpa(lbu,t2,prgromsize)
  28.                 nop
  29.                 addi    t2,-1   ; last page
  30.                 sll     t2,10+4 ; 16 K
  31.                 la      t1,prgrom
  32.                 addu    t2,t1
  33.                 li      t1,0xC000
  34.                 subu    t2,t1
  35.  
  36.                 li      t1,0x40-1
  37.                 la      t3,nespagetable+(0xC0*4)
  38. map10resetPRGloop
  39.                 sw      t2,(t3)
  40.                 addi    t3,4
  41.                 bnez    t1,map10resetPRGloop
  42.                 addi    t1,-1
  43.                 jr      ra
  44.                 nop
  45.  
  46.  
  47.  
  48. ***
  49. MMC4.INC
  50. ***
  51.  
  52. ; MMC4 (nearly identical to MMC2 but PRGROM storage is different)
  53.  
  54.         andi    t4,A6502_regaddr,$f000
  55.         li      t5,$a000
  56.         bne     t5,t4,map9notprgrom
  57.         li      t5,$b000
  58.        
  59.         andi    A6502_regval, 0x0F
  60.         sll     A6502_regval,10+4   ; 16K
  61.  
  62.         la      t4,prgrom
  63.         addu    A6502_regval,t4
  64.         li      t4,0x8000
  65.         subu    A6502_regval,t4
  66.  
  67.         li      t4,0x40-1
  68.         la      t5,nespagetable+(0x80*4)
  69. map10setPRGloop
  70.         sw      A6502_regval,(t5)
  71.         addi    t5,4
  72.         bnez    t4,map10setPRGloop
  73.         addi    t4,-1
  74.         jr      A6502_return
  75.         nop
  76.         ; remaining stuff is done in mmc2.inc
  77.  
  78. ***
  79. NEON64.ASM
  80. ***
  81.                 ; Da Cheat!
  82.                 _tpa(lbu,t0,mapper)
  83.                 li      t1,9
  84.                 beq     t0,t1,mmc2_4_hack
  85.                 nop
  86. mmc4test        ;could probably be more efficient with one flag set for both mapper 9 and 10
  87.                 li      t1,10
  88.                 bne     t0,t1,mmc2not_1
  89.                 nop
  90. mmc2_4_hack
  91.                 li      t0,1
  92.                 _tpa(sb,t0,mmc2_toggle)
  93.                 jal     mmc2latchgfx
  94.                 nop
  95.  
  96.            
  97. mmc2not_1
  98. ...nothing changed here...
  99.  
  100.  
  101. ***
  102. WRITE.INC
  103. ***
  104.  
  105. LINE 629
  106.  
  107. map10
  108. #include mmc4.inc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement