Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.

L'Empereur/ROM map: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
No edit summary
No edit summary
Line 7: Line 7:
A list of these operations is located [[L%27Empereur/Jump_Table_Operations|here]]. This same system seems to be used by the other MMC5 Koei games.
A list of these operations is located [[L%27Empereur/Jump_Table_Operations|here]]. This same system seems to be used by the other MMC5 Koei games.


==Page E0 ($A000-$BFFF)==
ROM location: 0x00010-0x0200F
===E0:A03A===
Prints graphic (5) to tile coordinates (1),(3)
===E0:A2CC===
Checks if City 1 (1/2) can sail to City 2 (3/4). (5) = whether sea control matters
===E0:A327===
Checks if it's safe to sail from City (1/2). Returns 0 if city is landlocked or sea is controlled by a hostile nation; otherwise, returns 1.
===E0:A39C===
Checks if officer (1/2) is player-controlled.
===E0:A3E0===
Checks if commander of city (1/2) is player-controlled.
===E0:A425===
Checks if city (1/2) is adjacent to city (3/4) [by either land or sea]
===E0:A805===
Check if nation (3/4) exists. (Parameter 1/2 serves no function?)
===E0:A8A0===
Verifies checksum when loading game(?)
===E0:A99D===
Erase sprites #(1) to #(1)+(3)
===E0:BC7E===
Determines which nation has control of sea (1/2).
00 = Baltic, 01 = North, 02 = Atlantic, 03 = Mediterranean
==Page E1 ($8000-$9FFF)==
ROM location: 0x02010-0x0400F
==Page E2 ($A000-$BFFF)==
ROM location: 0x04010-0x0600F
==Page E3 ($A000-$BFFF)==
ROM location: 0x06010-0x0800F
==Page E4 ($A000-$BFFF)==
ROM location: 0x08010-0x0A00F
==Page E5 ($A000-$BFFF)==
ROM location: 0x0A010-0x0C00F
==Page E6 ($A000-$BFFF)==
ROM location: 0x0C010-0x0E00F
==Page E7 ($A000-$BFFF)==
ROM location: 0x0E010-0x1000F
==Page E8 ($A000-$BFFF)==
==Page E8 ($A000-$BFFF)==
ROM location: 0x10010-0x1200F
ROM location: 0x10010-0x1200F


===E8:A8DF===
Contains functions pertaining to CPU actions during the city phase.
 


===E8:A8DF=== 
Main function for all CPU city actions.
Main function for all CPU city actions.



Revision as of 04:47, 4 January 2019

Chip tiny.png The following article is a ROM map for L'Empereur.

Note that most functions in this game are essentially written in a higher-level computer language than 6502. By using a jump table, more complex operations are able to be identified by single hex codes. These functions are prefaced by "20 09 E5 ## ##" (JSR $E509) and terminated by the operation "CF". (## ## indicates how many memory spaces need to be dedicated to the new function, written as an inverse. A function that requires no new memory space will say "00 00", while one that requires 16 spaces will say "F0 FF".

Sometimes one of these functions will jump to a subroutine which is written "normally" (without upper-level operations). These routines are prefaced by "20 E3 E2 ## ## ##" (JSR $E2E3).

A list of these operations is located here. This same system seems to be used by the other MMC5 Koei games.

Page E0 ($A000-$BFFF)

ROM location: 0x00010-0x0200F

E0:A03A

Prints graphic (5) to tile coordinates (1),(3)

E0:A2CC

Checks if City 1 (1/2) can sail to City 2 (3/4). (5) = whether sea control matters

E0:A327

Checks if it's safe to sail from City (1/2). Returns 0 if city is landlocked or sea is controlled by a hostile nation; otherwise, returns 1.

E0:A39C

Checks if officer (1/2) is player-controlled.

E0:A3E0

Checks if commander of city (1/2) is player-controlled.

E0:A425

Checks if city (1/2) is adjacent to city (3/4) [by either land or sea]

E0:A805

Check if nation (3/4) exists. (Parameter 1/2 serves no function?)

E0:A8A0

Verifies checksum when loading game(?)

E0:A99D

Erase sprites #(1) to #(1)+(3)

E0:BC7E

Determines which nation has control of sea (1/2).

00 = Baltic, 01 = North, 02 = Atlantic, 03 = Mediterranean

Page E1 ($8000-$9FFF)

ROM location: 0x02010-0x0400F

Page E2 ($A000-$BFFF)

ROM location: 0x04010-0x0600F

Page E3 ($A000-$BFFF)

ROM location: 0x06010-0x0800F

Page E4 ($A000-$BFFF)

ROM location: 0x08010-0x0A00F

Page E5 ($A000-$BFFF)

ROM location: 0x0A010-0x0C00F

Page E6 ($A000-$BFFF)

ROM location: 0x0C010-0x0E00F

Page E7 ($A000-$BFFF)

ROM location: 0x0E010-0x1000F

Page E8 ($A000-$BFFF)

ROM location: 0x10010-0x1200F

Contains functions pertaining to CPU actions during the city phase.

E8:A8DF

Main function for all CPU city actions.

A8E4 AA D1 7C    / Push $7CD1/$7CD2 to stack / (+2) Active city
A8E7 E9 DB BA 02 / Run function $BADB        / (-2)
...

E8:BADB

Page FA ($A000-$BFFF)

FA:A004

Table of Nations

$A004 + #$0A x (Nation code) = Beginning of nation data starting with name and ending with hidden stat.

FA:A09A

Table of Cities

$A09A + #$20 x (City code) = Beginning of city data starting with name and ending with hidden stat.

FA:A650

Table of Officers

$A650 + #$11 x (Officer code) = Beginning of officer data starting with name and ending with hidden stat.

See Notes for more detail on hidden stats.

Page FE ($C000-$DFFF)

ROM location: 0x3C010-0x3E00F

FE:C003

Main game loop. Executes all game functions then waits until interrupt

C008 61          / Push #$01 to stack           / (+2)
C009 E9 6F CF 02 / Run function $CF6F           / (-2)
C00D 8D 1F       / Push #$1F to stack           / (+2)
C00F 60          / Push #$00 to stack           / (+2)
C010 E9 C9 CF 04 / Run function $CFC9           / (-4)
C014 8D 14       / Push #$14 to stack           / (+2)
C016 67          / Push #$07 to stack           / (+2)
C017 E9 BC C3 04 / Run function $C3BC           / (-4)
C01B AA 00 60    / Push $6000/$6001 to stack    / (+2)
C01E 8E 16 DF    / Push #$DF16 to stack         / (+2)
C021 E9 27 C6 04 / Run function $C627           / (-4)
C025 61          / Push #$01 to stack           / (+2)
C026 64          / Push #$04 to stack           / (+2)
C027 E9 1E EF 04 / Run function $EF1E           / (-4)
C02B B3          / Push M8 to stack             / (+2)
C02C 8E 22 DF    / Push #$DF22 to stack         / (+2)
C02F E9 27 C6 04 / Run function $C627           / (-4)
C033 62          / Push #$02 to stack           / (+2)
C034 64          / Push #$04 to stack           / (+2)
C035 E9 1E EF 04 / Run function $EF1E           / (-4)
C039 B3          / Push M8 to stack             / (+2)
C03A 8E 2A DF    / Push #$DF2A to stack         / (+2)
C03D E9 27 C6 04 / Run function $C627           / (-4)
C041 D6 41 C0    / Jump to $C041                / Stall until interrupt
C042 CF          / Exit

FE:C232

Officer gains 1 EXP.

Parameter 1/2 = Officer address

C237 0C          / Store parameter 1/2 to M8    / Officer address
C238 76          / Add #$06 to M8               / Officer exp address
C239 2B          / Store M8 to storage 1/2      
C23A 0B          / Store storage 1/2 to M8      
C23B B3          / Push M8 to stack             / (+2)
C23C D3          / Replace M8 with 1-byte value / Officer exp (old)
C23D D0          / Increment M8                 / +1 exp
C23E D4          / Pull 2 meta, store $0008     / (-2) Update exp
C23F 0B          / Store meta 01/02 to M8 
C240 D3          / Replace M8 with 1-byte val   / Officer exp (new)
C241 8B 64       / Store #$64 to MC             
C243 C9          / Check if M8 >= MC            / Check if 100+
C244 D8 4F C2    / Jump to $C24F if not         / Exit
C247 3B          / Push storage 1/2 to stack    / (+2)
C248 40          / Store #$00 to M8
C249 D4          / Pull 2 meta, store $0008     / (-2) Roll EXP over to 00
C24A 3C          / Push params 1/2 to stack     / (+2)
C24B E9 D6 C1 02 / Run function $C1D6           / (-2) Officer Levels Up
C24F CF          / Exit

Page FF ($E000-$FFFF)

FF:E2E3

Prep for assembly functions.

FF:E509

Prep for higher-level functions.