- Joined: 25 Feb 2013
- Posts: 384
- Location: Osaka
|
Flicky tries to write $73A3-$74A2
Posted: Fri May 21, 2021 9:01 am
|
If you let the demo play, and then start the game, flicky for sg-1000 tries to write in the range $73A3-$74A2 (at $040D).
Did anyone ever disassembly it and know what kind of bug/removed feature it is?
|
- Joined: 08 Dec 2005
- Posts: 488
- Location: Melbourne, Australia
|
Posted: Sat May 22, 2021 8:04 am
|
It's a bug. It's present in both Flicky v0 and v1, but these addresses refer to v1.
After the demo, these game makes these calls:
046a: call 7395
046d: call 0408
0470: call 0173
The function at 7395 silences the PSG by writing $9f, $bf, $df, $ff to it:
silence_psg: ld hl,739Fh
ld c,7Fh
ld b,04h
otir
ret
The second call is intended to clear the copy of the Sprite Attribute Table kept in RAM, before the third call uses that table:
clear_sat: ld hl,C0ECh
bit 5,(hl)
ret nz
ld hl,C1A1h
ld b,80h
clear_sat_loop: ld a,b
and 03h
jr nz,+
ld (hl),E0h
jr ++
+: ld (hl),00h
++: inc hl
djnz clear_sat_loop
ret
However, $0408 isn't the address of `clear_sat`, it's the address of `clear_sat_loop`. So the loop runs but without first initializing `hl` and `b`, which retain their values from the end of `silence_psg` - $73a3 and $00 respectively. Therefore instead of clearing $c1a1 - $c220, the loop tries to clear $73a3 - $74a2.
|
- Joined: 25 Feb 2013
- Posts: 384
- Location: Osaka
|
Posted: Sun May 23, 2021 11:38 pm
|
Thank you so much for this wonderful analysis!
|