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: 6634
Author: rogernorth84
Date: 19/02/2010
Subject: Re: Patch-vectors in JSW64
Thanks for that, it worked fine.
I wondered why the calculation for a room's main loop patch vector had the base address #C0FD in your reply here but was given as #C0FB in the advanced trainer. I noticed that both these will work because the default 9F 86 normally appears twice in the resulting room data.
The possibilities of this technique should prove very interesting in my next game.
Cheers :-)
--- In manicminerandjetsetwilly@yahoogroups.com, andrewbroadwrote:
>
> Roger wrote:
> >
> > I downloaded your JSW 64V version 0.01 HL 12.tap file from WoS
> > expecting that it would make the perfect template file for future
> > 64V games but I ran into trouble with Room 63 straight away because
> > any guardians placed there behave like the eye sprite in the clock
> > tower even when this has been deleted. They attempt to jump around
> > a non-existent clock face.
> >
> > I presume that this special guardian path must have been done with a
> > patch that remains in that room. Can it be removed with a poke so
> > that the room can be re-used like any other?
>
> Room 63 uses the main-loop patch-vector (Room-offsets #FD-FE) to call a subroutine at #C500.
>
> The address of Room r's main-loop patch-vector is
>
> bank : #C0FD + #200*(r mod 32)
> where
> bank = 1 if {0 <= r <= 31}
> bank = 3 if {32 <= r <= 63}
> bank = 4 if {64 <= r <= 95}
> bank = 6 if {96 <= r <= 127}
>
> Thus, the address of Room 63's main-loop patch-vector is
> 3:#C0FD + #200*31 = 3:#FEFD
>
> The default patch-vector is #869F, which just returns.
> To make Room 63 use the default patch-vector, set:
> 3:#FEFD: 9F 86
>
>
> > Are there instructions published anywhere on how to call a
> > subroutine in free memory that would poke something on room entry
> > and then how would normal conditions be regained on leaving the
> > room?
>
> To do that, you need to write a room-setup patch-vector (Room-offsets #FB-FC) to apply the poke, and a default patch-vector that is called by every other room in the game to set the normal conditions.
>
> An example of this is documented in my Advanced MM/JSW Trainer, which makes guardians harmless by default, but certain rooms call a room-setup patch-vector to make them harmful:
>
> http://abroad.sqweebs.com/spectrum/software/trainer.html
> (download v0.1.0 and see TECHNICA.TXT: sections "Default room-setup patch-vector" and "Harmful guardians").
>
> --
> Dr. Andrew Broad
> http://abroad.sqweebs.com/spectrum/mmjsw/
>
