Fix for SuperFX 2

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.libera.chat in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

Post Reply
hector
Rookie
Posts: 49
Joined: Fri Jun 09, 2006 12:47 am

Fix for SuperFX 2

Post by hector »

The conversion of initsnes to C was not completely fault free. Here's one fault I found in map_sfx():

Code: Select all

Index: initc.c
===================================================================
--- initc.c     (revision 3191)
+++ initc.c     (working copy)
@@ -2579,7 +2579,7 @@
   map_set(snesmmap,ROM,0x40,0x10000);
 
   // set banks 40-6F (30h x 64KB ROM banks @ 0000h)
-  map_set(snesmmap+0x40,ROM,0x40,0x20000);
+  map_set(snesmmap+0x40,ROM+0x8000,0x40,0x20000);
 
   // set banks 80-BF (40h x 32KB ROM banks @ 8000h)
   map_set(snesmmap+0x80,ROM,0x40,0x10000);
@@ -2592,7 +2592,7 @@
   map_set(snesmap2,wramdata,0x40,0);
 
   // set banks 40-6F (30h x 64KB ROM banks @ 0000h)
-  map_set(snesmap2+0x40,ROM,0x40,0x20000);
+  map_set(snesmap2+0x40,ROM+0x8000,0x40,0x20000);
 
   // set banks 80-BF (01h x 32KB WRAM @ 0000h)
   map_set(snesmap2+0x80,wramdata,0x40,0);
This is to match the original asm code:
line 1603 of init.asm

Code: Select all

    ; set banks 40-6F (30h x 64KB ROM banks @ 0000h)
    mov eax,[romdata]
;    add eax,200000h
    add eax,8000h
    mov ecx,40h
.loopb3s
    stosd
    add eax,20000h
    dec ecx
    jnz .loopb3s
line 1641 of init.asm

Code: Select all

    ; set banks 40-6F (30h x 64KB ROM banks @ 0000h)
    mov eax,[romdata]
    add eax,8000h
    mov ecx,40h
.loopb23s
    stosd
    add eax,20000h
    dec ecx
    jnz .loopb23s
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

I knew it wasn't fault free, I fixed what I noticed off the bat, but I was hoping someone else would point out the other bugs. Thanks, I appreciate it, keep up the good work.
:)
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Post Reply