Final Fantasy Legends II/ROM map

From Data Crystal
Jump to navigation Jump to search

Chip tiny.png The following article is a ROM map for Final Fantasy Legends II.

Bank 0

0:06B0

ROM0:06B0 C5               push bc
ROM0:06B1 D5               push de
ROM0:06B2 E5               push hl
ROM0:06B3 21 FF C4         ld   hl,C4FF
ROM0:06B6 34               inc  (hl)             ;frame_counter ++
ROM0:06B7 7E               ld   a,(hl)           ;a = frame_counter
ROM0:06B8 21 00 C0         ld   hl,C000
ROM0:06BB E6 10            and  a,10
ROM0:06BD CB 37            swap a
ROM0:06BF B4               or   h
ROM0:06C0 67               ld   h,a
ROM0:06C1 EA DF C7         ld   (C7DF),a
ROM0:06C4 FA DE C7         ld   a,(C7DE)
ROM0:06C7 A7               and  a
ROM0:06C8 28 26            jr   z,06F0
ROM0:06CA 06 28            ld   b,28
ROM0:06CC F0 96            ld   a,(ff00+96)
ROM0:06CE A7               and  a
ROM0:06CF 28 02            jr   z,06D3
ROM0:06D1 06 24            ld   b,24
ROM0:06D3 0E 5A            ld   c,5A
ROM0:06D5 11 00 CC         ld   de,CC00
ROM0:06D8 2A               ldi  a,(hl)
ROM0:06D9 B9               cp   c
ROM0:06DA 38 01            jr   c,06DD
ROM0:06DC AF               xor  a
ROM0:06DD 12               ld   (de),a
ROM0:06DE 1C               inc  e
ROM0:06DF 2A               ldi  a,(hl)
ROM0:06E0 12               ld   (de),a
ROM0:06E1 1C               inc  e
ROM0:06E2 2A               ldi  a,(hl)
ROM0:06E3 12               ld   (de),a
ROM0:06E4 1C               inc  e
ROM0:06E5 2A               ldi  a,(hl)
ROM0:06E6 12               ld   (de),a
ROM0:06E7 1C               inc  e
ROM0:06E8 05               dec  b
ROM0:06E9 20 ED            jr   nz,06D8
ROM0:06EB 3E CC            ld   a,CC
ROM0:06ED EA DF C7         ld   (C7DF),a
ROM0:06F0 E1               pop  hl
ROM0:06F1 D1               pop  de
ROM0:06F2 C1               pop  bc
ROM0:06F3 C9               ret  

Bank E

E:4006

ROME:4006 F5               push af
ROME:4007 C5               push bc
ROME:4008 D5               push de
ROME:4009 E5               push hl
ROME:400A F0 B1            ld   a,(ff00+B1)
ROME:400C B7               or   a
ROME:400D 28 0F            jr   z,401E
ROME:400F F0 B9            ld   a,(ff00+B9)
ROME:4011 B7               or   a
ROME:4012 28 05            jr   z,4019
ROME:4014 CD 0D 41         call 410D
ROME:4017 18 24            jr   403D
ROME:4019 CD EB 40         call 40EB
ROME:401C 18 1F            jr   403D
ROME:401E F0 B9            ld   a,(ff00+B9)
ROME:4020 B7               or   a
ROME:4021 28 05            jr   z,4028
ROME:4023 CD 1D 41         call 411D
ROME:4026 18 15            jr   403D
ROME:4028 FA 1A CB         ld   a,(CB1A)
ROME:402B B7               or   a
ROME:402C 20 09            jr   nz,4037
ROME:402E F0 B3            ld   a,(ff00+B3)
ROME:4030 47               ld   b,a
ROME:4031 F0 B0            ld   a,(ff00+B0)
ROME:4033 B8               cp   b
ROME:4034 C4 9B 40         call nz,409B
ROME:4037 F0 B2            ld   a,(ff00+B2)
ROME:4039 B7               or   a
ROME:403A C4 20 49         call nz,4920
ROME:403D CD 51 42         call 4251          ;Battle PRNG
ROME:4040 CD 49 49         call 4949
ROME:4043 E1               pop  hl
ROME:4044 D1               pop  de
ROME:4045 C1               pop  bc
ROME:4046 F1               pop  af
ROME:4047 C9               ret  

Battle PRNG

ROME:4251 FA 00 CB         ld   a,(CB00)
ROME:4254 47               ld   b,a
ROME:4255 FA 01 CB         ld   a,(CB01)
ROME:4258 80               add  b
ROME:4259 EA 00 CB         ld   (CB00),a
ROME:425C 30 06            jr   nc,4264
ROME:425E CD 81 42         call 4281
ROME:4261 CD 81 42         call 4281
ROME:4264 F0 B4            ld   a,(ff00+B4)
ROME:4266 3C               inc  a
ROME:4267 FE 03            cp   a,03
ROME:4269 20 01            jr   nz,426C
ROME:426B AF               xor  a
ROME:426C E0 B4            ld   (ff00+B4),a
ROME:426E B7               or   a
ROME:426F CC D3 47         call z,47D3
ROME:4272 F0 B4            ld   a,(ff00+B4)
ROME:4274 FE 01            cp   a,01
ROME:4276 CC 4D 48         call z,484D
ROME:4279 F0 B4            ld   a,(ff00+B4)
ROME:427B FE 02            cp   a,02
ROME:427D CC C7 48         call z,48C7
ROME:4280 C9               ret