It is currently Wed Jan 18, 2017 4:56 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Sat Oct 25, 2014 11:34 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 17574
Location: NE Indiana, USA (NTSC)
Chris Covell has given us permission to include Solar Wars in the Double Action 53 multicart. So I mapper hacked it from CNROM to UNROM, which fits in better with the current menu program. Because the publicly distributed source code of Solar Wars lacks Memblers' music, I had to start from the binary, not the source code.

The patching tool requires Python 2.x, ca65, and ld65. It makes these changes:
  • Inserts two blank 16K banks before the game, leaving the original program at banks 2 and 3
  • Moves machine init code to bank 0
  • Compresses CHR ROM data with PB53 codec and adds it along with decompressor to banks 0 and 1
  • Replaces all five CNROM bank switches with calls to the decompressor
  • Adds quit code for Action 53 mapper at $FFEB
  • Fix for initial tank placement per 43110
  • Fix for tank movement stack overflow per 43110


Attachments:
File comment: ...and I didn't even need to go to stackoverflow.com
SolarWarsUNROM.zip [65.09 KiB]
Downloaded 204 times
Top
 Profile  
 
PostPosted: Tue Nov 18, 2014 9:36 am 
Offline
Formerly 43110
User avatar

Joined: Wed Feb 05, 2014 7:01 am
Posts: 246
So there was a bug in the original and this version that made the game freeze randomly on the start of a round. Long story short here's the game genie code that'll fix it: ZIVYYIZG


Top
 Profile  
 
PostPosted: Tue Nov 18, 2014 10:08 am 
Offline
Formerly 65024U

Joined: Sat Mar 27, 2010 12:57 pm
Posts: 2241
Why not just post what to change in the code? I can't easily find a Linux GG decoder, plus we have to go back and change the source code anyway.


Top
 Profile  
 
PostPosted: Tue Nov 18, 2014 10:22 am 
Offline
Formerly 43110
User avatar

Joined: Wed Feb 05, 2014 7:01 am
Posts: 246
You are right, that is a bit opaque.
For this binary it changes from
$f566: jmp $f542
to
$f566: jmp $f552

If the source was available it basically corrects the InitP1X loop point in the subroutine InitTanks.


Top
 Profile  
 
PostPosted: Tue Nov 18, 2014 6:52 pm 
Offline

Joined: Sun Mar 19, 2006 9:44 pm
Posts: 841
Location: Japan
The source has been available for 15 years: http://www.chrismcovell.com/data/SolarWarsSource.zip
http://www.chrismcovell.com/solarwars.html

Thanks for finding & correcting the bug!

Also, GG en/decoder: http://www.chrismcovell.com/CheatConverter.html

_________________
http://www.chrismcovell.com


Top
 Profile  
 
PostPosted: Tue Nov 18, 2014 8:06 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 17574
Location: NE Indiana, USA (NTSC)
ccovell wrote:
The source has been available for 15 years: http://www.chrismcovell.com/data/SolarWarsSource.zip

In Diary.TXT in the zipfile, ccovell wrote:
Because the music is entirely his work, and the code isn't mine, I won't be including his music data.


In any case, I've updated the mapper hack with 43110's patch. Thank you.


Top
 Profile  
 
PostPosted: Thu Nov 20, 2014 8:11 am 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3713
Using compression yet keeping in the easter egg image that only shows up in CHR viewers...

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
PostPosted: Thu Nov 20, 2014 1:25 pm 
Offline
Formerly 43110
User avatar

Joined: Wed Feb 05, 2014 7:01 am
Posts: 246
Found another potentially fatal bug, but only fatal in the UNROM version.

When a tank attempts to move up a wall (something like 5 or more blocks tall), a byte gets pushed to stack but never gets pulled. Since now half of stack is used for uncompressing CHR pages and that the call stack can be moved into that space. There's a potential situation where the call stack gets completely clobbered.

Quickest fix is to redirect 2 jumps to a part of the code that pops the value.
$db8c: jmp $dba9
$dc4c: jmp $dc69

As for where this is in source, I've been working off a personal disassembly (I was curious about the music engine) that doesn't have all the labels yet.


Top
 Profile  
 
PostPosted: Thu Nov 20, 2014 2:34 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 17574
Location: NE Indiana, USA (NTSC)
Thanks for the fix. Can others bang on it before I put out DA53 RC2?


Top
 Profile  
 
PostPosted: Thu Nov 20, 2014 2:44 pm 
Offline
Formerly 43110
User avatar

Joined: Wed Feb 05, 2014 7:01 am
Posts: 246
Maybe wait a day or two before RC2? it's up to you.

Also now reading my disassembly. I think the palette is at $e193-$e373, and the fading palette table is at $fb19-$fb59, and a immediate loaded byte at $e0b7 (all cpu address space). You could replace the blacker then black values in those ranges.

Edit: Edit: Actually there is lots of hard coded palette values in many places. It might be easier to finish labeling my disassembly and fix the blacker then black values from that.


Last edited by JRoatch on Thu Nov 20, 2014 3:03 pm, edited 2 times in total.

Top
 Profile  
 
PostPosted: Thu Nov 20, 2014 3:00 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 17574
Location: NE Indiana, USA (NTSC)
Judgment call: I might end up leaving fixing $0D black for the remix compo.

This might help you understand the music code, as might this.


Top
 Profile  
 
PostPosted: Thu Nov 20, 2014 4:16 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3351
Location: Indianapolis
You guys know the source code to the Nerdtracker 2 engine has been available since day one, right?
http://nesdev.com/nt2/
http://nesdev.com/nt2/download/nedplay.zip

And about the music not being included with Solar Wars source, the way I supplied it to Chris was just a binary file, so you'll have same thing by ripping it out of the ROM or NSF. Unfortunately I lost (by overwriting) one of the .NED files included in the soundtrack, and while I might have the .DAT file for it sitting around, I have long since overwritten the "songs.asm" file that included the .dat files, so reconstructing it in source form would be, at best, a pain in the ass.

Thanks for fixing that bug, that's pretty awesome to see it gone after all this time.


Top
 Profile  
 
PostPosted: Thu Nov 20, 2014 4:30 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 17574
Location: NE Indiana, USA (NTSC)
Thanks for clarifying.

Perhaps a good remix compo project might involve extracting the music (using the format doc I made) and converting it to something a more modern music engine can play, then doing a monster refactor of the game source itself to eliminate the cargo cult programming that was common in the pre-PowerPak days. Yes, I know it'll be a big job.


Wishlist
  • Dump all music as instrument and pattern definitions
  • Get the title screen music playing in a modern NES music player (such as FamiTone, GGSound, or Pently), as a proof of concept
  • Get the rest of the music playing
  • Eliminate use of color $0D
  • Thorough code review, eliminating what have since been discovered as poor practices
  • Compress the nametables!
  • Add crosshair to visualize the velocity better
  • Add alternate polar control scheme to match more conventional Scorched Earth/Gorillas clones
  • Add a way to display the tongueman


Top
 Profile  
 
PostPosted: Thu Nov 20, 2014 10:33 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3351
Location: Indianapolis
On the subject of wishlists, I've always thought Solar Wars would be a good test case for multi-player over the internet. Then you could chat, or type taunting messages while the other player is taking their turn. :) Could be done with cheap hardware, just USB/RS232 over the controller port, I remember after a long search finding some nice free software that was worked as a COM-port to TCP bridge, but I can't remember what it was called (I do believe the author is Russian, but it was documented in English as well). I'm sorta gradually working my way back to that problem again, because I'm definitely wanting internet access for some NES apps I'm working on, and in my case as well, it doesn't need to be low latency or anything.

Thinking about the Solar Wars soundtrack, I remember that the temp.dat file I used, which would have been track 0 in the NSF, was actually a blank file (probably with just note-off commands, and the DPCM note table), which means that I certainly do have all the .dat files here, I can see them here dated Oct 6th, 1999 which must have been the day I sent off the binary. So I could post the set of those, if they're really wanted. And/or NEDs for all but the lost one.


Top
 Profile  
 
PostPosted: Thu Nov 20, 2014 10:44 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 5174
Location: Seattle
Memblers wrote:
as a COM-port to TCP bridge
Socat should give you enough rope... although I don't know if cygwin's COMx:-to-ttySx emulation is adequate.

Or SLIP if you want something a little more general.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group