Jump to content
IGNORED

MADS bug with .SB and strings


Recommended Posts

I've been trying to reconstruct old ANALOG game binaries from the original source code by translating the AMAC or MAC/65 code to MADS format (using a bit of perl) and then assembling them with MADS. I got excellent results until I tried Planetary Defense, which has some lines like:

 

.SBYTE +$40," PLANETARY"

 

Here I replaced .SBYTE with .SB, which then compiles to

 

187 2030 60 D0 CC C1 CE C5 + .SB +$40, " PLANETARY"

 

All those bytes are incorrect, for instance, the first should be $40.

 

Although I'm nearly thirty years out of practice on Pascal and don't read a word of Polish, I was able to muddle my way through the MADS source code and find the bug. For screen bytes, you apply the offset after converting to screen values. MADS was doing it in the opposite order when the input was string. Interestingly, it did the correct translation when the values are bytes.

 

Anyhow, here's a patch.

mads.diff.txt

 

  • Like 1
Link to comment
Share on other sites

Thanks for the quick response!

 

That fixes my case, but it looks like save_dta still has incorrect logic when "if aray or put_used", so perhaps there is a case with .ARRAY or .PUT that will have similar problems. It's hard to tell from the code if they can ever be called with invers non-zero, but I'd still change it to be safe.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...