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

Author: andrewbroad

Date: 26/03/2006

Subject: Patch to reset cells' FLASH-bits

 

Alexandra wrote:

>
> john_elliott_uk wrote:
> >
> > Alternatively, you could use (for example) Bright and Flash to
> > distinguish cells, and then have a super-Mono that forces Bright
> > on and Flash off. Compare the 4-colour patches in JSW64:BBC.
>
> We like this idea! Simply stripping out Flash-information would be
> enough to give 4 types of cell the same colour instead of the usual
> two.

I have just written a patch to do exactly that: to reset the FLASH-
bit of every cell in the secondary attributes-buffer.

In an unpatched JSW game-engine, the code at #8A0B-8A25 is used to
make the screen colour-cycle according to the byte at #85CD (34253),
as Manic Miner does when you get an extra life.

But this code is unused in the unpatched JSW game-engine (since the
byte at #85CD is never set to anything but 0), so if we're prepared
to sacrifice the possibility of using 'extra-life' colour-cycling in
another patch, then this is a good place to insert code which
recolours the screen.

The patch to reset FLASH:

#8A0B: LD HL,#5C00 ; secondary attributes-buffer
#8A0E: LD BC,#200 ;; going to process 512 bytes (i.e. 32*16 cells)
#8A11: RES 7,(HL) ;; set cell to FLASH 0 (Bit 7 of colour-attribute)
#8A13: INC HL ;;;;;; next cell
#8A14: DEC BC ;;;;;; decrement counter
#8A15: LD A,B ;;;;;; going to check if B and C are both 0...
#8A16: OR C ;;;;;;;; ...by bitwise-ORing them together
#8A17: JR NZ,#8A11 ; if BC <> 0 then loop back to process next cell
#8A19: JR #8A26 ;;;; skip dead code

To apply this patch using JSWED's hex-editor:
_________8A0B: 21 00 5C 01 00
8A10: 02 CB BE 23 0B 78 B1 20
8A18: F8 18 0B

Having tested this patch on JSW48 and JSW64:W, I assume that it will
work like a charm on all the JSW48/128/64 game-engines. You can
still have bonus-rooms in JSW64, but the extra lives won't be
accompanied by colour-cycling, because the patch overwrites that
code.

(I encountered a bug in JSWED when setting "The Off Licence" to be a
bonus-room: I ticked "Bonus room" in "Room properties", but when I
checked back there, it was unticked. When I playtested it, it /was/
a bonus-room: the items gave me extra lives, without colour-cycling.)

If you wanted certain rooms to have FLASHing cell-classes, you could
use a patch-vector - perhaps to NOP out the RES 7,(HL) instruction
on entry (#8A11: 00 00), and reinstate it on exit (#8A11: CB BE).

Writing this patch was a nice warm-up for the patch I need for
Advanced MM/JSW Trainer: a chequered cell-grid where alternate cells
have their PAPER set to blue iff their PAPER is black. This will
facilitate counting Air-cells, and the user will be able to turn it
on/off in the BASIC loader.

This will save me from needing two cell-classes for every cell-type
in each room (i.e. for each black-PAPER cell-class a corresponding
blue-PAPER cell-class), and I'm now strongly considering using
Variant W instead of X, so that I'll not have to worry about going
over a 64-room limit because W allows up to 128 rooms.

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

 

 

arrowleft
arrowright