SPC700 timers

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

byuu

Post by byuu »

Super Battleship and Gemfire both run for me when I initialize all 64k of SPCRAM to rand() at power on. The SPC700 appears to still be functional in both games, and I played a good 5-10 minutes with each. I obviously can't test Panic Bomber World (yet).

You can try it for yourself by using this beta here:
http://byuu.org/files/bsnes_v009_wip9a.zip
I ask that nobody posts this file anywhere, it is a private beta and not meant for release.

Nach, you can build this on Linux with SDL by using make in the src/sdl folder. You have to remove the #define _WIN32_ from the top of the file sdlmain.cpp, first. You also may need to change the sdl11-config tool to be sdl-config in the makefile. sdl11-config is a FreeBSD thing. I build with GCC 4.0.0.
You'll also need to run the program once, then exit. Then edit the config file bsnes_sdl.cfg and change apu.enabled to true.

Anyway, it could just be luck on my part. I trust you guys know what you're doing, and even if it were random, it wouldn't hurt to set SPCRAM like you've said. Thanks for the code, I'll add it and stop being a pest. But I'll still let you know the results I get when I finally hook up my copier again and try it for myself nonetheless.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

byuusan wrote:Super Battleship and Gemfire both run for me when I initialize all 64k of SPCRAM to rand() at power on. The SPC700 appears to still be functional in both games, and I played a good 5-10 minutes with each. I obviously can't test Panic Bomber World (yet).
Not long enough. You have to play Gemfire for quite a while and have one CPU opponent start a war with the other and have it go on a bit till the game locks up.

I'm not sure about Super Battleship, ask Overload.

Panic Bomber World requires you to start from beginning and play through at least 4 levels.

See:
http://board.zsnes.com/phpBB2/viewtopic.php?t=1316
http://www.snes9x.com/forum/topic.asp?TOPIC_ID=8166

I could give you more info if a lot of posts weren't deleted from various boards.
byuusan wrote: Nach, you can build this on Linux with SDL by using make in the src/sdl folder. You have to remove the #define _WIN32_ from the top of the file sdlmain.cpp, first. You also may need to change the sdl11-config tool to be sdl-config in the makefile. sdl11-config is a FreeBSD thing. I build with GCC 4.0.0.
You'll also need to run the program once, then exit. Then edit the config file bsnes_sdl.cfg and change apu.enabled to true.
With instructions like that, do I want to run it? :P
BTW, did you ever merge in my XKas patch I sent you?
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 »

Not long enough. You have to play Gemfire for quite a while
Ugh, I don't think I can bear to play that game that long...
With instructions like that, do I want to run it? :P
BTW, did you ever merge in my XKas patch I sent you?
Up to you. I didn't think the instructions were too bad, though :/

I modified xkas like you said (thanks again), but I didn't post the new version to my website. It uses an old string library that's incompatible with my new one that has all of that class/template/overloaded operator stuff...
Overload
Hazed
Posts: 70
Joined: Sat Sep 18, 2004 12:47 am
Location: Australia
Contact:

Post by Overload »

I got two older Super Famicoms out and they init spcram different again. Each system is a version 1. When i did my intial testing i didn't have these machines and assumed that all machines inited spcram the same. :oops:

SFC (CPU:1, PPU1:1, PPU2:1)
00: FF
01: 00
02: 00
03: FF
04: FF
05: 00
06: 00
07: FF
...

SFC (CPU:2, PPU1:1, PPU2:2)
Random, the value $A5 occurs the most.

PAL (CPU:2, PPU1:1, PPU2:3)
I believe no other PAL version exists.
00..1F: 00
20..3F: FF
...

Also, I used a Pro Action Replay to boot my GD3 on my PAL machine and spcram is definately inited, it is not the copier bios setting the pattern.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

byuusan wrote:
With instructions like that, do I want to run it? :P
BTW, did you ever merge in my XKas patch I sent you?
Up to you. I didn't think the instructions were too bad, though :/
Well, I figured why not...

And I'm sorry to say, but it bombs out.
In config.cpp, you need false, not FALSE.

And once it is compiled, the first strcat() in main segfaults.

I would try the Windows version if it could be compiled with GCC.

BTW, you should be able to do things all from one config file and without having to edit it each time.

Look at this for some ideas: http://cvs.sourceforge.net/viewcvs.py/z ... iew=markup
That makefile can compile ZSNES for DOS with DJGPP, or cross compile from Linux for DOS with DJGPP, or compile ZSNES for Windows with MSVC, or compile ZSNES for Windows with MinGW, or compile ZSNES for Windows with MinGW inside a unix shell such as BASH or MSYS, or can cross compile for Windows from Linux with MinGW.

I like being able to cross compile and load up in WINE, so I don't have to go ahead and boot Windows on a different machine to test.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Overload wrote:I got two older Super Famicoms out and they init spcram different again. Each system is a version 1. When i did my intial testing i didn't have these machines and assumed that all machines inited spcram the same. :oops:

SFC (CPU:1, PPU1:1, PPU2:1)
00: FF
01: 00
02: 00
03: FF
04: FF
05: 00
06: 00
07: FF
...
I'm fairly proficient at PBW, so I'll try it later with this alternate init and see what happens.

Perhaps the game only wants 00 and FF in a few particular places to work right. Still sounds very bizare though.

Edit: Is it possible at all for the SA-1 to init this? Could you check?
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 »

Well, I figured why not... And I'm sorry to say, but it bombs out.
...works fine for me. This is a screenshot running on FreeBSD.
Image

But obviously it doesn't work on Linux. Thank you for trying. After I release the next version, I'll ask for help in getting it to work on Linux, too.

I'll definitely take a look at that makefile. That's a huge help, thank you. I'm not familiar with makefiles that much.

I just wrote a small demo to test SPCRAM on my two Japanese SNES units. Overload's was written with a different cross assembler. I'm having trouble getting it to save RAM properly, and even when I do my UFO alwyas only saves 32k, so I'll have to run the test twice to get it all :/
Overload
Hazed
Posts: 70
Joined: Sat Sep 18, 2004 12:47 am
Location: Australia
Contact:

Post by Overload »

Nach wrote: Edit: Is it possible at all for the SA-1 to init this? Could you check?
The SA-1 can't access the spc700 at all. I'll make a log of all accesses to spcram which hasn't been set.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

byuusan wrote:
Well, I figured why not... And I'm sorry to say, but it bombs out.
...works fine for me. This is a screenshot running on FreeBSD.
Image

But obviously it doesn't work on Linux. Thank you for trying. After I release the next version, I'll ask for help in getting it to work on Linux, too.
No problem.
byuusan wrote: I'll definitely take a look at that makefile. That's a huge help, thank you. I'm not familiar with makefiles that much.
You're welcome. I wasn't too familiar at first either, then I wrote that...
Unforunetly it does so much now, some of it might be a bit tricky, if you need any help, just ask.
Overload wrote:
Nach wrote: Edit: Is it possible at all for the SA-1 to init this? Could you check?
The SA-1 can't access the spc700 at all. I'll make a log of all accesses to spcram which hasn't been set.
Great!
I don't mean to bother you or anything, but if you're doing this, perhaps look into all those EA games that go nuts on sound?
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Overload
Hazed
Posts: 70
Joined: Sat Sep 18, 2004 12:47 am
Location: Australia
Contact:

Post by Overload »

byuusan wrote:I just wrote a small demo to test SPCRAM on my two Japanese SNES units. Overload's was written with a different cross assembler. I'm having trouble getting it to save RAM properly, and even when I do my UFO alwyas only saves 32k, so I'll have to run the test twice to get it all :/
Yeah, i wish copiers had more than 32k of SRAM too. Alternatively you could shift it into WRAM and do a real-time save.
byuu

Post by byuu »

I'll make a log of all accesses to spcram which hasn't been set.
Ingenius. Wish I were to think of that.

Ok, here's my test RAM file. This is from a 2/1/3 Japanese SNES:
http://byuu.org/files/ufo.ram

The UFO BIOS does not have a way to turn off sound, so obviously this test has its flaws. I am however, 98% certain that there are untouched sections of SPCRAM from 62xx-7fff, and in 0xffxx.
It's definitely a pattern similar to what Overload is getting.
It seems to be this:

Code: Select all

for(x=0x0000;x<=0xffff;x++) {
  if(!(x & 0x100)) {
    spcram[x] = (!(x & 1))?0xff:0x00;
  } else {
    spcram[x] = (!(x & 1))?0x00:0xff;
  }
}
Yeah, i wish copiers had more than 32k of SRAM too. Alternatively you could shift it into WRAM and do a real-time save.
Under ROM options, it gives me the option to select 64k/256k modes for SRAM size, but obviously the support is not really there :(
Overload
Hazed
Posts: 70
Joined: Sat Sep 18, 2004 12:47 am
Location: Australia
Contact:

Post by Overload »

http://users.tpg.com.au/trauma/temp/spclogs.zip

What EA games in particular. I tried a few and none were detected.

[Edit]
I only played through one level of PBW
byuu

Post by byuu »

Hey Overload, is there any chance that some of those reads are a result of adding in anomie and TRAC's findings that most mov opcodes are actually read-modify-write instructions? I don't know if you've added that or not yet.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Nice. Can I do this with Super Sleuth now? I'd like to see why things degenerate so badly once you get to the 4th level of PBW, or see how many games do this.
Overload wrote: What EA games in particular. I tried a few and none were detected.
http://www.snes9x.com/forum/topic.asp?TOPIC_ID=9025
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Overload
Hazed
Posts: 70
Joined: Sat Sep 18, 2004 12:47 am
Location: Australia
Contact:

Post by Overload »

byuusan wrote:Hey Overload, is there any chance that some of those reads are a result of adding in anomie and TRAC's findings that most mov opcodes are actually read-modify-write instructions? I don't know if you've added that or not yet.
I haven't added anthing like that in yet.
Post Reply