Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Compile to strict TRS-80 compatibility #40

Open
jpcompton opened this issue Jun 15, 2020 · 2 comments
Open

Request: Compile to strict TRS-80 compatibility #40

jpcompton opened this issue Jun 15, 2020 · 2 comments

Comments

@jpcompton
Copy link

jpcompton commented Jun 15, 2020

auraes has put some time into trying to get Ghost King running on the original Scott Adams interpreter (v8.5) for TRS-80 and has highlighted some areas where SK's output is not compliant. Perhaps there can be a command-line switch to tell SK to prepare object code that is strictly compliant?

A lot of the information comes from Bruce Hansen's Advedit for TRS-80, and the documentation helps explain some of the missing pieces (this issue will probably need to be a work-in-progress):

  1. Header should begin with "the number of bytes required to hold all of the text descriptions such as verbs, nouns, messages, room descriptions and object descriptions." (Advedit docs p5-6.) You can see this figure at the top of most SA games. SK's decompiler seems to treat this as "unknown1", but I would say it is now known. (On the other hand it looks like Howarth's interpreter just takes the zero that I think SK is putting in this position, his games tend to start with 0.)

  2. occur and action must not be intermingled, all non-0% occurs must appear before all actions. It looks like SK already pre-sorts rooms and items per the SA spec, but then just lets the chips fall where we left them when it comes to blending occur and action. You can see in a decompiled SA game that they do rigidly follow the room-item-nonzero occur-action flow.

  3. Checksum! Unknown2 can now be known. See page 17 of the Advedit docs: "the security checksum is 2 * #actions + #objects + version" and the SA interpreter demands this number be correct. (SK seems to just output a 0?)

bonus - (And this isn't a bug but a documentation note: SA interpreter displays a game's version number 123 as "1.23", which may help explain the very high version number mentioned in the SK docs! GK's version 7 is shown on-screen as 0.07, for example.)

@jpcompton
Copy link
Author

jpcompton commented Jun 15, 2020

Attached is the TRS-80 version. advent.d1 is the .dat/.sao equivalent, which is playable in the ScottKit inbuilt interpreter and also plays at a very high level of compatibility in TRS-80's adv85 interpreter. (The only thing I noticed in going through the critical path on a TRS-80 emulator is that for some unknown-to-me reason the X synonym was not honored. Other synonyms seemed fine, however. And X still works fine in the SK interpreter.)

I started out by manually re-sorting occur and action blocks in source so they would compile in the proper order. (that's the "gst.dat" I provided to him.) Auraes then went through that file and waved various magic wands to complete the header and footer and make whatever-other-changes-were-necessary. Hopefully the difference between gst.dat and advent.d1 will be very instructive!

ghost_king_aureas.zip

@MikeTaylor
Copy link
Owner

Lots of great stuff here, many thanks! I hope to get to this soon. Your issues are not forgotten!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants