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: 5911

Author: andrewbroad

Date: 23/08/2006

Subject: Re: J.G. Harston's patch and the Softricks JSW engine

 

Daniel wrote:

>
> 3. A question to Jonathan
>
> Would your ever consider releasing a variant of your patch which
> would be useful for the Softricks variant of the game engine?

Basically, this would entail tweaking the part of the patch that
deals with the item-table:

#8800: 26 A6 __ LD H,#A6

#93D1: 26 A6 __ LD H,#A6

#93D7: CB 76 __ BIT 6,(HL)
#93D9: 28 77 __ JR Z,#9452
#93DB: 25 __ __ DEC H
#93DC: 25 __ __ DEC H
#93DD: CD F4 96 CALL #96F4

#93EB: 24 __ __ INC H

#943E: 7A __ __ LD A,D
#943F: 00 __ __ NOP

#96F4: 4E __ __ LD C,(HL)
#96F5: CB B9 __ RES 7,C
#96F7: 3A 20 84 LD A,(#8420)
#96FA: B9 __ __ CP C
#96FB: C8 __ __ RET Z
#96FC: 24 __ __ INC H
#96FD: 24 __ __ INC H
#96FE: C9 __ __ RET


Firstly, you have to choose a free page of memory (256 contiguous
bytes, starting at an address which is divisible by 256 = #100)
to hold the table of items-collected flags.

J.G. Harston's patch locates this table at page #A6, but the
Softricks engine uses this for the extended guardian-class table.

Suppose the items-collected table is held in page pp.

Set the byte at #8801 to pp.
Set the byte at #93D2 to pp.


Secondly, the two DEC H instructions at #93DB need to be replaced
with a single LD H,#FE instruction to access the item-table at #FE00.
Fortunately, we can do this without any shunting:

#93DB: 26 FE


Thirdly, the purpose of the INC H instruction at #93EB is to access
page #A6, so it must be replaced with LD H,pp.

Unfortunately, since we're replacing a one-byte instruction with a
two-byte instruction, we must either:

(a) shunt all instructions between #93EC and #943E forwards one
byte, so that the byte at #943E will overwrite the NOP at #943F;

or:

(b) replace the instructions at #93EB-93ED with a call to a new
subroutine which does LD H,pp followed by the instructions that the
call overwrites.

Method (a) is more elegant and space-efficient, but the following
instruction:

#942E: 18 22 __ JR #9452

must be recoded as:

#942F: 18 21 __ JR #9452

because #9452 is one byte nearer after the shunt.

After doing the shunt, insert the LD H,pp instruction:

#93EB: 26 pp


Fourthly, the two INC H instructions at #96FC need to be replaced
with a single LD H,pp instruction to access the item-table at page
pp. Fortunately, we can do this without any shunting:

#93FC: 26 pp


I do not guarantee that the above information is correct, having
made no attempt to implement and test it myself. If you try
implementing it and it doesn't work, I'd be happy to have a look at
it.

--
Dr. Andrew Broad
http://geocities.com/andrewbroad/
http://geocities.com/andrewbroad/spectrum/
http://geocities.com/andrewbroad/spectrum/willy/

 

 

arrowleft
arrowright