[img] Bugfixes and patches to JSW48
 MDFS::Software.JSW.JGH.Docs.Patch/htm Search  

Removing the Attic bug

The attic bug is cause by a faulty arrow in the attic's guardian data. This causes the arrow to fly through the game code and data instead of across the screen, resulting in corrupt data in other rooms. The faulty arrow can be removed with POKE 59900,255 or the arrow can be fixed with POKE 59901,82 and can be applied to the JSW48 code with Attic.hex.

Releasing password code space

Releasing the memory used by the start-up password protection allows that memory to be used for extra code and extra room definitions. POKE 33797,135:POKE 33800,202 will do this.
Original code:                    Changed to:
8404 36 86        LD   (HL),&86   8404 36 87        LD   (HL),&87
8406 2B           DEC  HL         8406 2B           DEC  HL
8407 36 9F        LD   (HL),&9F   8407 36 CA        LD   (HL),&CA
This can be applied to the JSW48 code with
NoPass.hex or with NoPass2.hex which releases more code space.

This releases the following code space:

Address Previous use New use
&858B-&85CA password text  
&869F-&87C9 password code  
&9B00-&9BFF sprite and screen data becomes room 91
&9E00-&9EFF password data becomes room 94

Room-specific Willy sprites

A common change is the Geoff/Broad/Elliot patch to allow Willy's sprite to be specified in the room data instead of the engine hardwiring the flying pig in the Nightmare Room. This extends the room specification to use a previously unused byte at ROOM+237 to hold the sprite page to use if bit 7 is set.
Original code:                    Changed to:
9651 16 9D        LD D,&9D        9651 16 9D        LD   D,&9D
9653 3A 20 84     LD A,(HERE)     9653 3A ED 80     LD   A,(WILLYSP)
9656 FE 1D        CP &1D          9656 A7           AND  A
9658 20 06        JR NZ,&9660     9657 F2 60 96     JP   P,L9660
965A 16 B6        LD D,&B6        965A 57           LD   D,A
                                  965B 00           NOP
This can be done by using the following:
  POKE 38484,237:POKE 38485,128:POKE 38486,167
  POKE 38487,242:POKE 38488,96:POKE 38489,150
  POKE 38490,87:POKE 38491,0
and with the
WillySP.hex patch file. If this patch is used, then WILLYSP must be set in The Nightmare Room to ensure that the flying pig is used, with POKE 56557,182.

Checking for walls at head height

As pointed out by Andrew Broad, the checks in the code that moves Willy around is unbalanced. When moving right a check is made for a wall block just to the right of Willy's head and feet. However, when moving left a check is only made to the left of Willy's feet. Consequently, Willy can move through wall blocks at head height if moving left, but not if moving right.

Two changes can be made here. The code can check for wall at head height when moving leftwards, so eliminating the quirk, or walls at head height can be ignored when moving rightwards, so making the quirk work in both directions.

Ignore walls in both directions
Using POKE 37032,0 will remove the check for walls when moving rightwards. It can be applied with WallL.hex.

Original code:                    Changed to:
90A7 BE           CP   (HL)       90A7 BE           CP   (HL)
90A8 C8           RET  Z          90A8 00           NOP

Check for walls in both directions
The quirk can be eliminated by checking for a wall block when moving left:

Original code:                         Changed to:
9035 22 D3 85     LD    (POSITION),HL  9035 3A B2 80     LD   A,(WALL)
9038 78           LD    A,B            9038 BE           CP   (HL)
9039 32 CF 85     LD    (YPOSN),A      9039 C8           RET  Z
903C 3E 03        LD    A,&03          903A 22 D3 85     LD   (POSITION),HL
903E 32 D2 85     LD    (FRAME),A      903D 3E 03        LD   A,&03
9041 C9           RET                  903F C3 AE 90     JP   &90AE
This can be done by using the following:
  POKE 36917,58:POKE 36918,178:POKE 36919,128
  POKE 36920,190:POKE 36921,200:POKE 36922,34
  POKE 36923,211:POKE 36924,133:POKE 36925,62
  POKE 36926,3:POKE 36927,195:POKE 36928,174
  POKE 36929,144
This can be applied using the WallR.hex patch file.


Best viewed with Any Browser Valid HTML 4.0! Authored by J.G.Harston
Last update: 20-Apr-2004