Solar Wars (UNROM version)

Solar Wars (UNROM version)
by on (#135550)
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
Re: Solar Wars (UNROM version)
by on (#136604)
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
Re: Solar Wars (UNROM version)
by on (#136606)
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.
Re: Solar Wars (UNROM version)
by on (#136607)
You are right, that is a bit opaque.
For this binary it changes from
$f566: jmp $f542
$f566: jmp $f552

If the source was available it basically corrects the InitP1X loop point in the subroutine InitTanks.
Re: Solar Wars (UNROM version)
by on (#136629)
The source has been available for 15 years:

Thanks for finding & correcting the bug!

Also, GG en/decoder:
Re: Solar Wars (UNROM version)
by on (#136632)
ccovell wrote:
The source has been available for 15 years:

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.
Re: Solar Wars (UNROM version)
by on (#136676)
Using compression yet keeping in the easter egg image that only shows up in CHR viewers...
Re: Solar Wars (UNROM version)
by on (#136686)
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.
Re: Solar Wars (UNROM version)
by on (#136691)
Thanks for the fix. Can others bang on it before I put out DA53 RC2?
Re: Solar Wars (UNROM version)
by on (#136692)
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.
Re: Solar Wars (UNROM version)
by on (#136693)
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.
Re: Solar Wars (UNROM version)
by on (#136697)
You guys know the source code to the Nerdtracker 2 engine has been available since day one, right?

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.
Re: Solar Wars (UNROM version)
by on (#136700)
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.

  • 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
Re: Solar Wars (UNROM version)
by on (#136718)
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.
Re: Solar Wars (UNROM version)
by on (#136719)
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.
Re: Solar Wars (UNROM version)
by on (#140126)
Fun little secret I found today.

Enter the title screen[1] while holding left+down OR right+down [2], then select Credits. One of two secret messages will be printed before the thanks.

[1]: For example by exiting the controller screen.
[2]: When the title screen appears you may release the buttons.

March 13 ninja edit:

in this post, tepples wrote:
There's also some apparently unused code related to the NerdTracker II playback code at $8006, but I have no idea what it's supposed to be doing.

These Game Genie Codes will turn Solar Wars into a graphic-less sound test mode:

The A button advances to the next track.