Jump to content
Jet Set Willy & Manic Miner Community

Free space and code optimisation in "JSW"


jetsetdanny

Recommended Posts

The original "Jet Set Willy" has a number of addresses which are unused and can be utilised for "higher purposes", such as inserting new code.

 

A list of these addresses is included in SkoolKid's disassembly:

 

http://skoolkid.github.io/jetsetwilly/maps/unused.html (in hex)

 

http://skoolkit.ca/disassemblies/jet_set_willy/maps/unused.html (in decimal)

 

Apart from the addresses mentioned in the list, there are other places in the original code which can be modified safely, such as e.g. everything that pertains to the colour code protection scheme.

 

There are also some places where the original code can be optimised to gain a byte or three.

 

I do not intend to describe all of them now (due to time constraints), but I would like to start a thread in which all the pertinent information can be placed, so that new pieces of information can be added as they emerge.

 

While working on the Special Edition of "Willy's New Mansion" today I have discovered the following instances of possible optimisation of the original code:

 

[the addresses below are in hex and refer to the original "JSW"]

 

8892 - 8894 The JP NZ instruction can be changed to JR NZ, saving one byte.

 

8898 The DI instruction is unnecessary (it disables interrupts which are already disabled; IIUC at 8400) - it can be NOPped out.

 

88AE - 88B0 The JP NZ instruction can be changed to JR NZ, saving one byte.

 

That's a gain of three bytes altogether  :) .

Link to comment
Share on other sites

I am wondering about the six bytes from A3F9 to A3FE.

 

IIUC, they would be guardian 7F in JSWED, but it doesn't exist.

 

SkoolKid says in his disassembly, 

 

The following entity definition (127) - whose eighth byte is at A3FF - is copied into the entity buffer at 8100 for any entity specification whose first byte is 127 or 255; the first byte of the definition (255) serves to terminate the entity buffer.

 

So A3F8 is out of the question, because it has to be FF, and A3FF is out of the question, because it is the index of the first item.

 

However, the six bytes in-between - are they used by *anything*, for *anything* at all?

 

Any thoughts on this?

Link to comment
Share on other sites

Good question!

 

I suppose - like inserting data into the unused addresses in the Rope Animation table - you could 'suck it and see'!

 

I've done just that and the results are not encouraging.

 

I put the code which stops the border from getting stuck on the wrong colour for the room Willy is in, if Willy collects an item or the arrow warning sound occurs whilst the in-game music is switched off (called from 925E and 941D) at A3F9

Link to comment
Share on other sites

If you don't mind having a shorter Title Screen tune - or none at all - then up to 99 bytes could be available for other purposes where the Title Screen tune is currently located in the code (#85FB to #865D).

 

The value 'FF' at #865E terminates the playing of the music on the title screen (and progresses the program to the screeching noise/scrolling message), so if you are shortening the music, then the 'FF' should be located to just after the shortened tune code (or to #85FB in the case of having no Title Screen tune).

Link to comment
Share on other sites

  • 2 weeks later...

There are 2 spare bytes here:

 

http://skoolkid.gith...y/asm/8C01.html
8C20 OR $10 Set bit 4 of A (for no apparent reason)

The command sets (assigns a value of 1) to bit 4 of A. But then it is immediately followed at #8C22 by XOR A, which resets all the bits of A (including bit 4) to 0.

So I am quite confident that those two bytes can be reused for other purposes.

Link to comment
Share on other sites

  • 4 weeks later...

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...

Important Information

By using this site, you agree to our Terms of Use.