Japtro by Holocaust

STe patch by Orion_ [11/2016]

The demo claims to run on an STe, but it doesn't.
(Crash after the beginning of the first 3D Starfield)

I made this patch so this nice demo can now work on an STe !


Hacking Detail:

Just after the Sangoku White Flash / Screen crackling:
Timer A is setup at $A388, with a routine writing to $9FBCE
On ST, when this Timer A routine is finished, value at $9FBCE is $0000.
On STe, when this Timer A routine is finished, value at $9FBCE is $FB00.
(why ??)

Later, this value is read (at $A0CA) and is used as an Index to load a table pointer (at $A0F2)
On STe this pointer value goes banana and crash the computer when loaded from at $A11A.

So, I just needed to zero the value at $9FBCE to fix the problem.
I needed to find some space in the code to do that.
I found 3 nops at $A2B6 which were written by a code just below at $A2C2
It was used to disable a line of code (so it was executed only one time)
I replaced the nop writing by my code to clear $9FBCE.

26FC 4E71 4E71	move.l	#$4E714E71,(a3)+	nop nop
36BC 4E71	move.w	#$4E71,(a3)		nop

replaced by:

26FC 4279 0009	move.l	#$42790009,(a3)+	clr.w	$9fbce
36BC FBCE	move.w	#$FBCE,(a3)

This code was a part of a bigger program, packed using Atomic Packer
The packed data is found on disk at $034800 (ATM5 header)
Interlaced by block of $1400 (data read on one face only)

Since the new code was repacked, lots of data were changed on the disk, even if only 6 bytes were modifed on the code.
