Screen Freeze at Star Ocean (Really.. new stuff...)

Found a bug? Please report it, but remember to follow the bug reporting guidelines.
Missing a sane feature? Let us know!
But please do NOT request ports to other systems.

Moderator: ZSNES Mods

byuu

Post by byuu »

grinvader wrote:zvoodoo in all its awesome.
Resistance is futile.
Meh, I figured it out. For I have the dark powers necessary to read pages and pages of virtually commentless assembler code written for multiple processors ;)

Here are my findings:

Code: Select all

DeJap Star Ocean disassembly:
cc2428 lda #$5008
cc242b pea $00e9
cc242e ldx #$0400
cc2431 ldy #$04e0
cc2434 jsr $244c
cc244c sta $2116
cc244f sep #$20
cc2451 stz $4800
cc2454 lda #$01
cc2456 bra $247c
cc247c sta $4300 ;*1
cc247f lda #$18
cc2481 sta $4301
cc2484 stx $4302
cc2487 lda $03,s
cc2489 sta $4304
cc248c sty $4305
cc248f lda #$01
cc2491 sta $4801 ;*2
cc2494 pha
cc2495 pla
cc2496 sta $420b ;*3
cc2499 stz $4800

*1:
https://zsnes.bountysource.com/svn/!source/5112/trunk/src/cpu/regsw.inc
calls reg43X0w
does not do anything but save value to temporary memory variable, to be used
later.

*2:
https://zsnes.bountysource.com/svn/!source/5112/trunk/src/chips/sa1regs.asm
calls sdd14801w
value written is not zero, so AddrNoIncr is cleared by this function.
sets up banks $c0-$ff to read bytes from memaccessbankr8sdd1, which allows
S-DD1 decompression when certain conditions are met.
note:
AddrNoIncr appears to be set to 0 when fixed address transfers are *disabled*.
Thusly, AddrNoIncr is set to 1 when fixed address transfers are *enabled*.
fairly self-explanatory, but just in case ...

*3:
https://zsnes.bountysource.com/svn/!source/5112/trunk/src/cpu/dma.asm
calls reg420Bw, which calls transdma
transdma reads $43x0, which in our case here, clears AddrNoIncr

now, DMA begins and uses
https://zsnes.bountysource.com/svn/!source/5112/trunk/src/cpu/memory.asm
memaccessbankr8sdd1
this function tests AddrNoIncr, and sees that the value is zero and then
jumps to .failed, which calls memaccessbankr8, or the standard read function.
this basically bypasses decompression entirely.

notes:

ZSNES' setup is to basically map banks $c0-$ff to an S-DD1 custom memory reader
function. it then expects to only transfer data when the fixed DMA transfer flag
is set, so it intentionally keeps this flag clear except when transmitting DMA
data. however, the same memory read function is called both for normal memory
accesses, as well as for DMA. it appears to be a clever trick to bypass the
overhead of having to test during DMA if a transfer should use the S-DD1
decompression routine, even when games do not have S-DD1 chips.

findings:

1:
it appears that ZSNES does not update the AddrNoIncr flag when writing to $43x0.
instead, ZSNES loads this value upon writing to $420b.
this is unlikely to be the case for real hardware, but is technically possible.
this action would be completely transparent outside of S-DD1 support. it looks to
be more a workaround for ZSNES' unique setup, as setting the value inside $43x0
would enable S-DD1 decompression during standard code reads ... something that is
definitely not possible and would likely immediately crash a game.

2:
writes that set any bits at all in $4801 will clear the AddrNoIncr flag.
this is definitely not the case on real hardware, the S-DD1 cannot interfere with
SNES hardware to control how transfers occur.
it does this so that memaccesssbankr8sdd1 will not start decompressing data
immediately. S-DD1 only decompresses on DMA, so you definitely don't want it
decompressing on standard reads (which could be just the S-CPU executing code from
banks $c0-$ff).
only DMA transfer routine (after $420b write) sets AddrNoIncr to 1.

3:
it is unlikely that the S-DD1 monitors all writes to $43x0 registers (and possibly
to $420b as well) to know whether or not the transfer is set for fixed addressing or
not.
the S-DD1 has no reason to care about whether or not fixed address transferring is
enabled, as it has no interface with S-CPU's DMA unit and its' registers.
the S-DD1 simply intercepts reads from the cartridge ROM and returns decompressed
bytes. therefore, the S-DD1 has its' own internal address transfer position.
further, if one were to attempt to transfer without S-DD1 decompression, it would
make the most sense to simply not set the S-DD1 enable flag bit in $4801 for said
channel.

conclusions:

it appears that clearing the fixed transfer flag in a DMA transfer with $4801 set
not decompressing is merely a side effect of ZSNES' very unique speed-sensitive
considerations, and does not appear to be consistent with what actual hardware
would do.

it is my educated, researched opinion that the issue is in both DeJap's translation,
and in ZSNES' S-DD1 implementation, that the title screen graphic appears corrupt,
and that it is not a bug in other emulators -- I believe other emulators are working
as the Star Ocean translation would on real hardware.

however, I have to reiterate once again, we don't have access to the real hardware
to definitively rule this out. therefore, we can only make educated guesses, which
is what this is.
I'm done researching this, and still waiting on someone to host my fixed patch for me to link here.

If anyone wants to bring this issue up to me or the SNES9x team, please present actual hardware evidence of your claims. Do not claim it's a bug simply because it does not display correctly, unless you can test the game on actual hardware, using a real S-DD1 chip to do so.
Last edited by byuu on Wed Jun 13, 2007 11:16 pm, edited 1 time in total.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Being that DF did a lot of the S-DD1 RE'ing, and he did crazy stuff with his copier, there is a chance he did do some tests on his S-DD1 regarding this.
We also had decompression figured out *before* the final SO patch was released, he even got Andreas' compressor sometime prior to the release.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
byuu

Post by byuu »

Ah, you're right, Andreas released his tools in August of 2003, I was under the mistaken impression it was 2004. I will amend my post, but I still believe the S-DD1 will attempt to decompress regardless of the fixed transfer flag.

If I ever get this answered, or better yet get to test it myself, I'll be the first to publically document all two functions of the S-DD1 interface.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

byuu wrote:I'll be the first to publically document all two functions of the S-DD1 interface.
I doubt it. We had them documented, and the docs were up on Gamer-X's site. I've misplaced the docs though, and Gamer-X's site has since vanished.

There are those of us that still have them. I would have them if not for the fact that some HD which I used for putting stuff like this on which I didn't care much about crashed :P

CaitSith2 also has some routines for starting decompression listed on his site, but he took it down. It may also be possible to find some notes on this in the old Snes9x forum.

Edit:
Here's some info I found with a quick search: http://snes9x.com/forum/topic.asp?TOPIC_ID=7695

It'd be good if someone still had DF's write up though. Remember, he setup his copier with custom software to feed the S-DD1 to rip out the decompressed packs.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
byuu

Post by byuu »

Alright, fuck it. Nobody else wants to host it ...

Code: Select all

http://www.geocities.com/byuu64/soepatch.zip
Don't blame me if the link dies, I'm deleting my work on this and I will not redo it.
Here's some info I found with a quick search:
Thanks, but I've already looked over the posts there. They ask very important questions, but none ever actually get answered, so it's useless. We never even got a definitive answer on whether or not writes to $420b are visible to the cartridge or not. If not, that makes the S-DD1 implementation many times more complex.
It'd be good if someone still had DF's write up though. Remember, he setup his copier with custom software to feed the S-DD1 to rip out the decompressed packs.
I would appreciate getting a hold of that, if possible. I'll fix the problem in all open source emulators if I can get a single person to verify what happens when you both enable $4801.dN and clear $43x0.d3: does the S-DD1 still attempt to decompress the data, or does it send back the raw ROM data? Neither SO nor SFA2 ever do this, so I have no way to verify myself.
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

byuu wrote:Alright, fuck it. Nobody else wants to host it ...
Not even RHDN?
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
byuu

Post by byuu »

Well, either my e-mails to Nightcrawler are getting dropped in a spam filter, or he's not interested in the last few submissions I've made.

I don't really care either way. It is technically an unofficial derivative work that I did not ask permission to make, so I can see why some would be upset by it.
franpa
Gecko snack
Posts: 2374
Joined: Sun Aug 21, 2005 11:06 am
Location: Australia, QLD
Contact:

Post by franpa »

http://web.aanet.com.au/Student_WebZone/soepatch.zip

heres a mirror for the file byuu =)
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
FitzRoy
Veteran
Posts: 861
Joined: Wed Aug 04, 2004 5:43 pm
Location: Sloop

Post by FitzRoy »

byuu wrote:Well, either my e-mails to Nightcrawler are getting dropped in a spam filter, or he's not interested in the last few submissions I've made.

I don't really care either way. It is technically an unofficial derivative work that I did not ask permission to make, so I can see why some would be upset by it.
Upset? I'd be upset if I were an emulator author getting endless false bug reports because a group completely dissolved without giving someone else the discretion to make another maintenance release in the event of such a discovery. Course, this is DeJap, and they had all kinds of crazy shit happen to them.
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

The game is working 100% at proper speed without bugs for me in ZSNES x.xx which is my working version.

This bug is closed.
Watering ur plants.
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

pagefault wrote:The game is working 100% at proper speed without bugs for me in ZSNES x.xx which is my working version.

This bug is closed.
New core IRQ timing fixed battle speed ? Wooo !
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Post Reply