Game Boy Wars 3:ROM map

Block 1 (000000-004000)

• 15F8-1606 ~ HL = \$D000 + B + C * 64
• 1607-1613 ~ HL = \$1C16 + A * 8
• 291D-294A ~ A = space difference (BC and DE hold comparison coordinates)
• 2960-297D ~ [\$CAAC] (2 bytes) is multiplied by 5 and then 1 is added
• 297E-298E ~ A = ((A % 160) / 10) * 16 + (A % 10), add 1 if A is an even number at least 160
• 298F-2994 ~ A = A or (256 - A) (whichever one is no more than 128)
• 2995-29AC ~ HL = A * B
• 29AD-29BB ~ HL *= 100
• 29BC-29C2 ~ HL += A
• 29C3-29C9 ~ HL -= DE
• 29CA-29D7 ~ Carry Flag active if DE < HL, A = 0 if DE = HL
• 29D8-2A1C ~ HL *= DE (Signed)
• 2A1D-2A20 ~ HL = 0
• 2A21-2A6F ~ DE / BC: DE holds rounded down answer, BC holds remainder
• 2A70-2A78 ~ [HL] -= 1, BC *= -1
• 2A79-2A81 ~ [HL] -= 1, DE *= -1
• 2E9A-2EAD ~ A = [\$D000 + A * 16 + B]
• 2F5F-2F78 ~ set 0, [\$D000 + A * 16] (an even number has 1 added; an odd number is unchanged)
• 3048-3055 ~ HL = \$D000 + A * 16 + B
• 3A93-3A9D ~ HL = [HL + 2A]
• 3A9E-3AC6 ~ HL = [HL + 2 * (# of 0s right of rightmost 1 bit in A)]
• 3AC7-3AD0 ~ A = [HL + (A/8)] AND 2^(A%8)
• 3AD1-3ADB ~ [HL + (A/8)] = [HL + (A/8)] OR 2^(A%8)
• 3AE9-3B05 ~ HL += (A / 8): C holds 2^Remainder, HL holds rounded down answer
• 3B50-3B58 ~ ldi [HL],[DE]; inc DE, dec BC, repeat if BC != 0
• 3B79-3B83 ~ [HL], [HL+1]...[HL+BC] = A
• 3BA5-3BAE ~ ldi [HL],DE; inc HL, dec BC, repeat if BC != 0

Block 12 (02C000-030000)

• 411B-415E ~ establishes starting Gold and Materials
• 415F-416C ~ used Gold bytes carry starting Gold (DE = Starting Gold value, gets multiplied by 1000)
• 416D-4177 ~ used Materials bytes carry starting Materials (DE = Starting Materials value, gets multiplied by 10)
• 4700-4706 ~ set 0, [D000 + [C98D] * 16]
• 4707-4713 ~ A = [18AB + A] (used to determine property's base value or such)
• 4714-4729 ~ A = [D000 + B + C * 64]
• 472A-473F ~ A = [D000 + B + C * 64]
• 4770-4775 ~ A = ([D000 + B + C * 64]%64)
• 4792-4797 ~ A = ([D000 + B + C * 64]%128)
• 5539-555E ~ A = min(Movement Power, Fuel), [CD43] stuff (Movement Costs) is set up
• 59BD-5A0C ~ A = property number value if controlled by active player and within 3 spaces of their Capital; otherwise, A = 0 (BC holds current coordinates)
• 5C1F-5C67 ~ A = 1 if not enough Gold, 2 if not enough Materials, 3 if 50 units are available, or 0 if none of the above
• 7B6F-7B97 ~ adds DE to used Gold bytes, caps at 99999. Narrowly avoids a capping bug: 2 Capitals and 98 Cities provide 30200G Income total at max property strength. Otherwise, the byte allowing funds past 65535G is not forced to be 1, allowing an Income value exceeding 31071G to break the cap badly.
• 7BB0-7BCC ~ Carry Flag toggle by not having enough Gold
• 7BCD-7BDB ~ HL = first used available Gold byte
• 7BDC-7BEB ~ HL = available Materials
• 7BEC-7C12 ~ adds DE to used Materials bytes, caps at 999
• 7CF7-7D23 ~ A = 0 for active player's property, 1 for opposing player's property, 2 for neutral property, or 3 for non-property terrain (A = terrain value)

Block 13 (030000-034000)

• 4861-486C ~ digs up used Cover value
• 486D-4883 ~ Cover values (Null, HQ, City, Ruined City, Factory, Ruined Factory, Airport, Ruined Airport, Simple Airport, Harbor, Ruined Harbor, Communication Tower, Plains, Road, Bridge, ?, Mountain, Forest, Moor, Desert, River, Sea, Beach) (guesses)
• 4991-499C - digs up used Level value
• 499D-49A1 - Level values (Ranks D to A then S)
• 49A2-49CB ~ HL = Attack mutiplier with L using the float portion (A, B, and C use Support, Level, and Flank values respectively)
• 49CC-49FB ~ HL = Defense multiplier with L using the float portion (A, B, and C use Cover, Level, and Flank values respectively and get halved and truncated in the process)
• 49FC-4A20 ~ HL = Stat * HP * Multiplier; Float error results in slight decrease if the intended multiplier doesn't divide by 0.25 into a whole number
• 4A21-4A25 ~ HL = 2 * Stat * HP * Multiplier; Float error results in slight decrease if the intended multiplier doesn't divide by 0.25 into a whole number
• 4A26-4A97 ~ calculates new HP for attacker's unit, rounds up, range from 0 to old HP
• 4A98-4B09 ~ calculates new HP for defender's unit, rounds up, range from 0 to old HP
• Total ATK is calculated with 49FC, multiplier uses 49A2 and Stat is ATK
• Total DEF is calculated with 4A21, multiplier uses 49CC and Stat is DEF
• New HP is (Total DEF - Total ATK) / (2 * DEF)
• Default to 0 and end procedure immediately if result is negative, round up, and then default to Old HP if result exceeds it
• Effective damage formula is as follows: ATK * Attacker's HP * (100 + ATK boosts) / (200 * DEF) - DEF boosts * Defender's HP / 200. Truncation is only done after full damage is calculated.
• 4B0A-4B66 ~ calculates New HP values for both sides using attack order
• 4B18-4B34 ~ Attacker's Focus 10s digit exceeds Defender's
• 4B35-4B51 ~ Defender's Focus 10s digit exceeds Attacker's
• 4B52-4B65 ~ Focus 10s digit is equal for both sides; old HP is used for both players
• 4B67-4BBF ~ hardcodes ammo reductions and participation EXP
• 4BC0-4BD4 ~ hardcodes attacker's Ammo reduction and participation EXP
• 4BD5-4BE9 ~ hardcodes defender's Ammo reduction and participation EXP
• 4BEA-4BFB ~ hardcodes the Ammo reduction from battle
• 4BFC-4C26 ~ hardcodes participation EXP. 2 EXP for (counter)attacking, 1 EXP for defending against an attack.
• 4C27-4CF6 ~ hardcodes damage-related EXP for both sides. Formula is (Damage Done + Kill Coefficient) * Underdog Coefficient. Kill Coefficient is 1 if the opposing unit is defeated, 0 otherwise; Underdog Coefficient is 2 if the opposing unit is defeated AND the victorious unit has lower ATK, 1 otherwise.
• 4E0A-4E11 ~ attack order text pointers (invalid, same time, first, second)
• 4E12-4E25 ~ attack order text (first, second, same time, invalid)

Block 14 (034000-038000)

• 6618-664F ~ establishes player and AI control in [\$C631] and [\$C632]

Block 17 (040000-044000)

• 4BC4-4BD2 ~ if CA94 = 2, load C632; otherwise, load C631

Block 18 (044000-048000)

• 4D3F-4D59 ~ if [C62F] != 1 && [C633]%2 = 1, [C77D + A/16] = [C77D + A/16] OR 2^((A/2)%8)

Block 19 (048000-04C000)

• 4000-401F ~ RAM addresses \$D000~\$D63F set to 0
• 4020-4028 ~ HL = Unit Type's stats starting location (A is Unit Type)
• 4029-4036 ~ HL = Unit's stats starting location (A is Unit #)
• 4037-4042 ~ A = Unit Type's used stat (A is Unit Type, C is used stat)
• 4043-404E ~ DE = Unit Type's used stat (2 bytes) (A is Unit Type, C is used stat)
• 404F-4065 ~ RAM addresses \$CD28~\$CD31 set to hold Unit Type's name
• 4066-4082 ~ A = Unit's used stat (A is Unit #, C is used stat)
• 4083-40A0 ~ DE = Unit's used stat (2 bytes) (A is Unit #, C is used stat)
• 40A1-40BC ~ B -> Unit's used stat (A is Unit #, C is used stat)
• 40BD-40DA ~ DE -> Unit's used stat (2 bytes) (A is Unit #, C is used stat)
• 40DB-40F4 ~ Adding the unit's EXP in, checking for 400 EXP cap (A is Unit #, HL is gained EXP)
• 40F5-4105 ~ A = Unit's Level - 1 (A is Unit #)
• 4106-412A ~ RAM addresses \$CCDD~\$CCED set to hold selected Unit's stats
• 412B-414D ~ selected Unit's stats moved from \$CCDD~\$CCED to \$D000 list
• 41E3-41F6 ~ A = side's current unit count, 41F7 stuff (A is Unit Type, B and C are coordinates)
• 41F7-4240 ~ establishes new unit's stats in HL string, increments side's current unit count (A and D are Unit Type, B and C are coordinates)
• 4241-425B ~ increments side's Built Units by 1 to cap of 65,535 (A's Odd/Even bit determines side)
• 42B2-42F5 ~ decrements side's current unit count, erases defeated unit's stats, increments side's lost unit count to cap of 65,535
• 42F6-4328 ~ A = side's current unit count (A is the given side)
• 4329-4350 ~ A != 0 && Z Flag Set: Loading Valid (A is 1st Unit's #, B is 2nd Unit's #)
• 4351-43B8 ~ A = prevent Supply flag (A is receiving unit, B is giving unit)
• 43F4-4435 ~ list of buyable units for property using 12:4436 (A is terrain type byte)
• 4436-4457 ~ \$CD0B holds available Unit Type count, \$CD0C, etc. holds Unit Type choices for property (B is starting Unit Type, C is number of Unit Types to check)
• 4458-446F ~ Mercenary Unit equivalent of 12:4436
• 4470-447C ~ if unit is buyable, A = 0; else, A = 2 (A is Unit Type)
• 447D-448C ~ if unit is (considered buyable?), A = 0; else, A = 2
• 448D-4497 ~ \$4986 stuff, if unit is (considered buyable?), A sets corresponding bit; else, A = 0
• 4498-44B7 ~ if Unit is at S-Rank, A = promoted Unit Type # * 2 + country bit; else, A = 0 (A is Unit #)
• 44B8-44BF ~ promoted Unit Type #
• 44C0-4509 ~ confirmed promotion procedure
• 4585-4596 ~ Unit's End Turn bit set
• 4741-4757 ~ Unit's 8th stat = Unit Type's Fuel
• 4758-477C ~ Unit's 9th and 10th stats = Unit Type's Ammo (each weapon)
• 477D-479E ~ recover HP
• 479F-47AC ~ A = used Movement Cost
• 47AD-47CD ~ [CD44-CD76] holds selected unit's Movement Costs (A is Movement Type)
• 47CE-4800 ~ [C6A8-C77F] holds units' Types and EXP values; every 4 bytes is set to 255
• 4837-4854 ~ [CD28-CD2F] holds weapon's name (A is Unit Type, C is 14 or 16)
• 4855-4861 ~ A = weapon's used stat value (A is Weapon ID, C is used stat)
• 4986-49A5 ~ pointers for 7 byte families that seem to involve unit buying
• 49A5-4A0E ~
• 4A0F-4A42 ~ promoted Unit Type #
• 4A43-4AAC ~ Unit Type stat pointers
• 4AAD-5255 ~ Unit Type stats
• 0-9 ~ name characters
• A ~ Max HP
• B ~ Max Fuel
• C ~ Movement Power
• D ~ Transport Capacity
• E ~ ?
• 1 ~ Work Car, Supply Truck, Convoy, Rocket Launcher, IFV, Hunter Tank, MB Tank
• 2 ~ AA Tank, Artillery
• 3 - infantry, APC, AA Missile Launcher, Transport Helicopter, Lander, Tanker
• 4 - Humvee, Gunship, Ship Buster, Transport Helicopter+
• 5 - Buggy, Humvee+, Lite Attacker, Transport Plane, Supply Plane, Gunship+, Submarine
• 6 - Buggy+, Lite Fighter, Attacker, Small Aircraft Carrier, Submarine+
• 7 - Fighter, Lite Bomber, Bomber, Large Aircraft Carrier
• 8 - Interceptor, Mercenary Bomber, Aegis Warship
• 9 - Mercenary Ship
• F ~ Fuel Upkeep
• 10, 11 ~ Gold Cost / 100G
• 12, 13 ~ Materials Cost
• 14 ~ Primary Weapon Type
• 15 ~ Primary Weapon Ammo
• 16 ~ Secondary Weapon Type
• 17 ~ Secondary Weapon Ammo
• 18 ~ Unit Family
• 19 ~ Movement Type
• 1A ~ Carrying Type
• 1B, 1C, 1D ~ Carried Type
• 1E-22 ~ DEF values
• 23 ~ Base Focus
• 24 ~ Focus Loss
• 5256-5297 ~ Weapon stat pointers (pointers)
• 5298-54A7 ~ Weapon stats
• 0~7 ~ name characters
• 8 ~ Minimum Range
• 9 ~ Maximum Range
• A-E ~ ATK (Armor, Lite Land, Air, Ship, Sub)
• F ~ Cost per shot
• 54A8-54C5 ~ Movement Cost pointers
• 54C6-561E ~ Movement Costs

Block 20 (04C000-050000)

• 402F-403A ~ [\$C631] = 1
• 4031-403A ~ [(\$C631 + A)] = 1

Block 21 (050000-054000)

• 5F8D-5FBC ~ Medal descriptions pointers
• 5FBD-5FEC ~ Medal names pointers
• 5FED-6148 ~ Medal names
• 6149-6322 ~ Medal descriptions
• 6323-6330 ~ Unobtained Medal description

Block 38 (094000-098000)

• 4000-4059 ~ Campaign Mode slow clear dialogue pointers
• 405A-40B3 ~ Campaign Mode briefing pointers
• 40B4-40B5 ~ Campaign Mode defeat dialogue pointer
• 40B6-410F ~ Campaign Mode fast clear dialogue pointers
• 4BA9-4BC8 ~ Beginner Mode briefing pointers
• 4BC9-4BCA ~ Standard Mode briefing pointer
• 4BCB-5BE8 ~ Beginner Mode briefing dialogue
• 5BE9-5C14 ~ Standard Mode briefing dialogue

Block 41 (0A0000-0A4000)

• 41DC-428F ~ Standard Mode map pointers
• 4290-4292 ~ Demo 02 Map pointer
• 4293-42C2 ~ Beginner Mode map pointers
• 42C3-4349 ~ Campaign Mode map pointers

Map data

Map data

Map data

Block 45 (0B0000-0B4000)

Map data (ends Standard, covers Beginner)

Block 46 (0B4000-0B8000)

Map data (campaign)

Map data

Map data

Block 51 (0C8000-0CC000)

• 58AA-5911 ~ Unit description pointers
• 5912-59B3 ~ Terrain description pointers
• 59BC-6FE2 ~ Unit descriptions
• 6FE3-7B6A ~ Terrain descriptions
• 7B6B-7C92 ~ Fuel discussion
• 7C93-7D21 ~ Focus discussion
• 7D22-7DFC ~ Promotion discussion

Dialogue stuff

Empty (all FFs)

Empty (all FFs)

Empty (all FFs)

Empty (all FFs)

Empty (all FFs)

Empty (all FFs)

Empty (all FFs)

Empty (all FFs)

Empty (all FFs)

Empty (all FFs)

Block 64 (0FC000-100000)

Internal Data for Game Boy Wars 3