Resource centre for ZX Spectrum games
using Manic Miner and Jet Set Willy game engines
Archive of the
Manic Miner & Jet Set Willy Yahoo! Group
messages
|
|
||
|
|
Message: 6237
Author: john_elliott_uk
Date: 29/08/2007
Subject: Re: Tweaking the JSW engine: One for the experts
--- In manicminerandjetsetwilly@yahoogroups.com, adban_de_corcy
> Thanks a lot, John... So it can be done.
The instructions are in Z80 assembly language. You can get the patch
>
> Now, how could one do that in JSWED?
> Or how could it be done... by us, computer-analphabets?
> I have no idea what computer language are your instructions in, much
> less how to type them in or apply them to a JSW game...
into JSW64 using the hex editor, but you need to have a certain
familiarity with hex and the way memory is laid out.
Here's how I did this particular patch in the Bathroom, for example.
I've rather naughtily put the code in the space reserved for the
guardian table, so any changes to the Bathroom guardians will corrupt
it and cause a crash. The proper course of action is to reserve an
area of memory with the memory map tool and use that.
Start with JSW64 (variant W).
Go to the hex editor. Select bank 3, offset #C210. Enter the following
bytes:
16 22 3a 83 85 fe 30 28
06 fe 35 28 02 16 1d 7a
32 e9 80 c9
Now go to offset #C2FD and enter
10 80
Then press Ctrl+W to commit the changes, and F5 to playtest. If the
last digit of the time is '0' or '5' the left exit will lead to the
Top Landing; otherwise, to the Nightmare Room. Note that this only
applies to the real Bathroom, not the four fake ones.
Now, how to generalise this?
In the hex bytes above, the second byte on the first row '22' is the
number of the Top Landing, and the sixth byte on the second row '16'
is the number of the Nightmare Room. So you can change where things
lead by adjusting these bytes.
The second byte on the third row 'e9' says which exit is changed.
It's 'e9' for left, 'ea' for right, and 'eb' / 'ec' for up and down,
but I can't remember which way round just now.
The "10 80" says where the patch is loaded. If, for example, you had
used the memory map to reserve page CC00, then use "00 cc" instead of
"10 80", and enter the main body of the patch at #CC00 in bank 0.
To put the patch in a different room, you have to work out where the
room layout is stored. In JSW64:W, what you do is divide the room
number by 32. The quotient will be 0, 1, 2 or 3, corresponding to
memory banks 1, 3, 4, 6 respectively. Then take the remainder,
multiply it by 512, convert to hex and add #C0FD. That gives you the
address of the patch vector to change.
Let's take 'A bit of tree' as an example. This is room 36.
36 / 32 = 1 remainder 4. The quotient is 1 so the room is in bank 3.
The remainder is 4, so the address is 4 * 512 = 2048 = #800. Add #C0FD
to give a room address of #C8FD.
Oh yes. To take a patch vector out again, change the two bytes back
to 9F 86.
