’Cause all games were better on the GBC

You are not logged in.

#1 2013-02-10 00:54:02

New member
Registered: 2013-02-10
Post 1/1

Pokemon Gold RTC to playtime clock

Hello all, new here for the most part though I've been on IRC for a few days. I have come up with some ASM to take values from playtime and turn them into the values usually pulled from RTC. This is due to my flashcart not having an RTC and my desire to play at an accelerated pace. I've completed and found the offending codes for the most part, ommiting the editing of the "mom" scripting to set DST and clock at the start of the game, which is simple enough (changing the calls to 006F and the yes no dialogs to 18 which is a gold silver version check). The last part is finding an elegant solution of keeping a value of 0-60 (0-3C) scrolling through 0-24 (0-18). I've thought about storing a value of 0 or 1 in the now open D1DF, which is the second value for calculating RTC offset, in order to tell if I should add or subtract an extra 12 to make up for the remainder, but executing has been difficult. Here is what i have so far and the offsets at which they are changed.

; 00:0065
ld a,(ff00+70) ; get wram bank
push af ; save value
ld a,01 ; set a to 1
ld (ff00+70),a ; set wram bank
call 0073 ; new fixtime function
pop af ; restore value
ld (ff00+70),a ; set wram bank
; 00:0073
ld a,(D1EF) ; get playtime frames
ld (ff00+9A),a ; store time seconds
ld a,(D1EE) ; get playtime seconds
ld (ff00+98),a ; store time minutes
ld a,(D1ED) ; get playtime minutes
sub a,30 ; sub value by 48
jr nc,008C ; doesn't carry jump
add a,30 ; restore value if carried
sub a,18 ; sub value by 24
jr nc,008C ; doesn't carry jump
add a,18 ; restore value if carried
ld (ff00+96),a ; set time hours
ld a,(ff00+9A) ; get time seconds
cp a,00 ; compare to zero
ret nz ; return if not zero
ld a,(ff00+98) ; get time minutes
cp a,00 ; compare to zero
ret nz ; return if not zero
ld a,(ff00+96) ; get playtime hours
cp a,00 ; compare to zero
ret nz ; return if not zero
ld a,(D1F2) ; get time day of week
inc a ; increment by 1
ld (D1F2),a ; store time day of week
; 00:0147
db 1b ; make rom MBC5 to disable RTC
; 00:0467
nop ; call getclock
nop ; call fixdays
call 0065 ; wram bank and fixtime function
; 00:053D
nop ; getclock and fixdays in bank 05
; 00:0665
nop ; getclock and fixdays in bank 05
; 01:5b2f
nop ; write textbox for RTC date mainscreen
; 01:5b39
nop ; write text for RTC date mainscreen
; 01:5faa
nop ; remove time set dialog on new game

As you can see it is mostly done; if anyone wants to use it go ahead. I'm just looking for some direction in regards to the math problem.


#2 2013-02-11 06:26:08

Idea Killer
Registered: 2011-01-05
Post 320/630

Re: Pokemon Gold RTC to playtime clock

I wouldn't have any idea for how to fix this, but I took the time to rewrite the assembly into something that's compatible with rgbds so that others can try and compile it to help. Make sure you're using my version of rgbds (located here; Windows binaries located here).

The assembly file is rtc.asm, and build.txt contains the list of commands to use in order to build it. You can easily rename build.txt to or build.bat to make it easier to recompile.

@SirNaysayer: If you have any good ideas for the names for Label1, Label2, and .here, that would be good, since I haven't taken the time to read through it all to figure out what it does.

You can try to hide yourself in this world of pretend; when the paper's crumpled up, it can't be perfect again.


Board footer

Powered by FluxBB