Shauing wrote: ↑July 12th, 2020, 5:27 pm
Ah, so it uses the longer, first version of the hack that I used on The Queen Of Light.
Why is the time limit a maximum of 65535 ticks?
Because the elapsed time counter is stored in 16 bits (2 bytes), both in the RAM and in the password.
Though, there is another counter which measures time spent on the current level, and that one has an overflow area for more significant bits.
Actually, both counters have an extra separate bit which is
less significant than the main 16 bits, but this bit is not recorded in the password.
The bits are stored in the following RAM addresses:
elapsed time since game start:
$052F -- bit 0 is the least significant bit of the counter
$052D -- the next 8 bits
$052E -- the next 8 bits
elapsed time on this level:
$054D -- bit 0 is the least significant bit of the counter
$054B -- the next 8 bits
$054C -- the next 8 bits
$054D -- bits 1..7 are the next 7 bits
However, for the password and the best times list, only the main 8+8 bits are used.
It's possible to tell the game to put the *two* least significant bits into the separate byte, which means the main 16 bits will count twice as slower.
At 0xE9CE write: 29 03
At 0xF97E write: A9 04
At 0xF96B write: 20 C0 FF
At 0xFFC0 write: AD 4D 05 1A 89 03 D0 03 38 E9 04 60
At 0xF971 write: 29 03
At 0x15870 write: C9 04
At 0x15CA1 write: C9 04
After this you need to halve the number of ticks in a minute and in a second. (See the bottom of this post.)
You also need to adjust the starting minutes and other things as described here:
viewtopic.php?p=24207#p24207
For the formulas in that post, you need to use the new number of ticks in a minute instead of 425.
Details:
Code: Select all
01:E9CA: ad 2f 05 LDA $052f ; ? elapsed time low bit?
01:E9CD: 1a INC
01:E9CE: 29 01 AND #$01 ; <-- change to #$03
01:E9D0: 8d 2f 05 STA $052f ; ? elapsed time low bit?
01:F969: a9 01 LDA #$01
01:F96B: 4d 4d 05 EOR $054d ; elapsed time on this level low bit and high bits
01:F96E: 8d 4d 05 STA $054d ; elapsed time on this level low bit and high bits
01:F971: 29 01 AND #$01 ; <-- change to #$03
[...]
01:F97E: a9 02 LDA #$02 ; <-- change to #$04
01:F980: 18 CLC
01:F981: 6d 4d 05 ADC $054d ; elapsed time on this level low bit and high bits
At 0xF96B write:
20 C0 FF JSR $FFC0
At 0xFFC0 write:
AD 4D 05 LDA $054D ; elapsed time on this level low bit and high bits
1A INC
89 03 BIT #$03
D0 03 BNE :1
38 SEC
E9 04 SBC $#04
:1
60 RTS
02:D86D: ad 4d 05 LDA $054d ; elapsed time on this level low bit and high bits
02:D870: c9 02 CMP #$02 ; <-- change to #$04
02:DC9E: ad 4d 05 LDA $054d ; elapsed time on this level low bit and high bits
02:DCA1: c9 02 CMP #$02 ; <-- change to #$04
But then there is *another* problem I just found, namely that the game can't display more than 159 minutes correctly.
For example, when 160 minutes are left, it thinks 0 minutes are left and displays the seconds counting down.
(It's only a display problem, the time won't expire yet at this point.)
That happens because of how the game converts numbers to decimal:
The ones are on the bottom 4 bits of a byte, and the tens and hundreds are together on the top 4 bits.
This means that the tens and hundreds together can't be above 15.
If you really need more than 159 minutes, I might try and search a solution for this.
Shauing wrote: ↑July 12th, 2020, 5:27 pm
In the US version can't the ticks be reduced to whatever matches an actual minute?
Yeah, I know the EU version will give more time overall, but it plays slower.
In the US version, an in-game minute (425 ticks) is
shorter than an actual minute (450 ticks).
So there its length can be
increased to match an actual minute.
See here:
viewtopic.php?p=24918#p24918
Shauing wrote: ↑July 12th, 2020, 5:27 pm
And how can this be done?
Number of ticks in a minute: Two bytes at 0xE946, 0x15694, 0x15699, 0x15CC3, 0x15CC8. (Default: 0x01A9 = 425)
Number of ticks in a second: Two bytes at 0xE951, 0x156BD, 0x156C2, 0x15CEC, 0x15CF1. (Default: 0x0007 = 7)