Shingen the Ruler/ROM map: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
(Created page with "{{rommap|game=Shingen The Ruler}} <pre> Castle DATA Start Note: Castle data is loaded into RAM at $6150. ROM Data is #$1A(00 - 25) bytes each, but RAM includes other data an...")
 
No edit summary
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{rommap|game=Shingen The Ruler}}
{{rommap|game=Shingen The Ruler}}
<pre>
<pre>
Castle Map IDs:
Add #$14 to Castle ID
Battlefield Map Ids:
Subtract #$01 from castle ID
Castle Ids: Ruler Ids: (Add + #$11 for Heirs)
#$01 Kai #$01 Shingen Takeda        
#$02 Shinano #$02 Ujiyasu Hojo
#$03 Sagami #$03 Kenshin Uesugi
#$04 Musashi #$04 Kiyo Murakami
#$05 Kozuke #$05 Yoshimasa Kiso
#$06 Echigo #$06 Moto Imagawa
#$07 N Shinano #$07 Hiro Matsudaira
#$08 W Shinano #$08 Nobunaga Oda
#$09 Suruga #$09 Dosan Saito
#$0A Totoumi #$0A Yori Anekoji
#$0B Mikawa #$0B Tsuna Hatakeyama
#$0C Owari #$0C General Li
#$0D Mino #$0D The Ikko Sect
#$0E Hida #$0E Takakage Asakura
#$0F Etchu #$0F Hisamasa Asai
#$10 Noto #$10 Haru Kitabatake
#$11 Kaga #$11 Yoshiteru Ashikaga
#$12 Echizen
#$13 Oumi
#$14 Ise
#$15 Yamashiro


Castle DATA Start
Castle DATA Start
Note: Castle data is loaded into RAM at $6150. ROM Data is #$1A(00 - 25) bytes each, but RAM includes other data and is #$38(00 - 55) bytes each.
Note: Castle data is loaded into RAM at $6150. ROM Data is #$1A(00 - 25) bytes each, but RAM includes other data and is #$38(00 - 55) bytes each.
CASTTLE DATA CASTLES BY ORDER: KAI, SHINANO, SAGAMI, MUSASHI, KOZUKE, ECHIGO, N SHINANO, W SHINANO, SURUGA, TOTOUMI, MIKAWA, OWARI, MINO, HIDA, ETCHU, NOTO, KAGA, ECHIZEN, OUMI, ISE, YAMASHIRO.
CASTLE DATA CASTLES BY ORDER: KAI, SHINANO, SAGAMI, MUSASHI, KOZUKE, ECHIGO, N SHINANO, W SHINANO, SURUGA, TOTOUMI, MIKAWA, OWARI, MINO, HIDA, ETCHU, NOTO, KAGA, ECHIZEN, OUMI, ISE, YAMASHIRO.




0x016016 - 0x016237
0x016016 - 0x016237
BYTE #$00 This byte represents a ruler's capital. Ruler's ID (#$01 - #$11/ + #$11 for heirs)  is stored here if it is The ruler's capital, otherwise it is    #$00.
BYTE #$00 This byte represents a ruler's capital. Ruler's ID (#$01 - #$11/ + #$11 for heirs)  is stored here if it is The ruler's capital, otherwise, it is    #$00.
BYTE #$01 Castle controlled (non capital) RULER ID (#$01 - #$11/ + #$11 for heirs)
BYTE #$01 Family controlled: Takeda, Hojo, etc. if right this shouldn't change based on heirs)
BYTE #$02 YIF(YIELD INCREMENTAL FACTOR) This byte directly corresponds to the games FA-Development Command. Castle Yield is subtracted from this value to determine whether or not to add the Castles Rank to the base YI(YIELD INCREMENTAL - see https://gamefaqs.gamespot.com/nes/587609-shingen-the-ruler/faqs/76326 Territory Management Guide by ireant) of 0x03B7BF(#$28/YIELD), 0x3B85D(#$32/WEALTH). Basically any time the castles yield is above this value, the castles rank is added to the price to increase YIELD/WEALTH via the FA-DEVELOPMENT COMMAND. Setting these values to #$64(#100) or above means that the $$ price to increase YIELD/WEALTH via FA_DEVELOPMENT will never increase.
BYTE #$02 YIF(YIELD INCREMENTAL FACTOR) This byte directly corresponds to the game's FA-Development Command. Castle Yield is subtracted from this value to determine whether or not to add the Castles Rank to the base YI(YIELD INCREMENTAL - see https://gamefaqs.gamespot.com/nes/587609-shingen-the-ruler/faqs/76326 Territory Management Guide by ireant) of 0x03B7BF(#$28/YIELD), 0x3B85D(#$32/WEALTH). Basically any time the castles yield is above this value, the castles rank is added to the price to increase YIELD/WEALTH via the FA-DEVELOPMENT COMMAND. Setting these values to #$64(#100) or above means that the $$ price to increase YIELD/WEALTH via FA_DEVELOPMENT will never increase.
BYTE #$03 Castle YIELD
BYTE #$03 Castle YIELD
BYTE #$04 Castle DISASTER
BYTE #$04 Castle DISASTER
Line 19: Line 48:
BYTE #$0A - BYTE #$0B Castle PRODUCT; LOW/HIGH BYTE max #$0F27(#9999)
BYTE #$0A - BYTE #$0B Castle PRODUCT; LOW/HIGH BYTE max #$0F27(#9999)
BYTE #$0C Castle Gold Mines (#00 - #100)
BYTE #$0C Castle Gold Mines (#00 - #100)
BYTE #$0D and BYTE #$0E unknown.
BYTE #$0D       Gold mine depreciation (subtracted from gold mine base success chance)
    BYTE #$0E unknown.
BYTE #$0F Epidemic #$00 = NO / #$01 = YES
BYTE #$0F Epidemic #$00 = NO / #$01 = YES
BYTE #$10 - BYTE #$11 Castle RANK (i think max is #$64(#100), so only the first byte is used)
BYTE #$10 - BYTE #$11 Castle RANK (i think max is #$64(#100), so only the first byte is used)
BYTE #$12 - BYTE #$13 Castle XP; LOW/HIGH BYTE max I think is #$07E3(#999)
BYTE #$12 - BYTE #$13 Castle XP; LOW/HIGH BYTE max I think is #$07E3(#999)
BYTE #$14 - BYTE #$19 # of troops 1 BYTE each (max #$FF) for each of HQ(headquarters). CAV(Cavalry), RM(Riflemen), AR(Archer), LNC(Lancer), INF(Infantry)
BYTE #$14 - BYTE #$19 # of troops 1 BYTE each (max #$FF) for each of HQ(headquarters). CAV(Cavalry), RM(Riflemen), AR(Archer), LNC(Lancer), INF(Infantry)
<b>INCREMENTALS (Price Per Point Increase):</b>
0x03B7BF #$28($$40 YIELD) FA-DEVELOPMENT COMMAND
0x03A3A8 #$1E($$30 DISASTER) FC COMMAND
0x03B0A9 #$1E($$30 CULTURE) CA COMMAND
0x03B917 #$11($$17 LOYALTY) FA-AID COMMAND
0x03B85D #$32($$50 WEALTH) FA-DEVELOPMENT COMMAND
0x03B9B2 #$11($$17 WEALTH) FA-AID COMMAND
MERCHANT Buy/Sell Prices
Note: this is base buy and selll prices w/o statistical modifiers from castle YIELD, WEALTH etc:
Buy/Sell prices are loaded into $0346 - $034E in order of PRD, HQ, CAV, RM, AR, LNC (HQ, CAV, and RM are given a high byte, though I've never seen the prices even remotely close to #$FF(#255).
Buy and sell prices are directly related. Product Buy Prices are based off of YIELD/#$0D + $6176 (address is + #$38/ castle) EX: 2nd castle is YIELD/#$0D + $61AE
$6176 is given a random value each month determined by $005A (its not completely random and I think it ranges from 1-3 from what little I tested and browsing the code) regardless the Product buy price is maxxed at #$0A by a few bytes at 0x03A8BE (that compares the buy price at $0346 with #$0A and caps it #$0A).
Product sell prices are half the buy prices rounded down via a LSR at 0x03AA7B (if you were to remove this LSR Product sell prices would equal Product buy prices).
Exception is that the minimum Buy/Sell prices is $$1
Because Buy/Sell prices are calculated using the same base values Buy prices will always be 4x that of sell prices, and sell prices will always be 1/4(25%) that of Buy prices rounded down (exception is PRD where the buy price is 2x the sell prices).
Troop unit Buy/Sell prices HQ, CAV, RM, AR, LNC.
Base Prices:
0x03A927 #$28 - HQ                      Side note: I seem to have just noticed that it looks like all the prices have a cap. I'm not going to bother listing
0x03A976 #$0F - CAV     here atm. They seem of little importance.
0x03A9C5 #$14 - RM
0x03AA14 #$0A - AR
0x03AA62 #$04 - LNC  
Buy Prices are determined via a routine at 0x03A47C - 0x03A487. that doubles the base price by loading each value from $034E - $0346 and performing an ASL then storing the new value. 
Sell Prices are determined via a routine at 0x03AA78 - 0x03AAA7. I will list the LSR's replacing them with ASL's(excluding PRD) would result in Sell Prices equal to buy prices. 
0x03AA7B PRD Price LSR
0x03AA87 HQ Price LSR
0x03AA8E CAV Price LSR
0x03AA95 RM Price LSR
0x03AA9C AR Price LSR
0x03AAA3 LNC Price LSR
   
<b style="font-size:24px;">Commonly Used Routines:</b>
{|class="wikitable"
|-
!OFFSET!!Routine
|-
|0x03C92C ($C91C)||Addition: Adds a 2 Byte value in $40 - $41+A. Result in $40 - $41.
|-
|0x03C938 ($C928)||Addition Adds a 2 Byte Value in $40 - $41+Y(Low Byte), X(High Byte) Result in $40 - $41.
|-
|0x03C992 ($C982)||Multiplication: Multiplies a 2 byte value in $40 - $41xA. Result in $40 - $41
|-
|0x03CA2D ($CA1D)||Division: Divides a 2 byte value in $40 - $41/A. Result in $40 - $41
  Y = Remainder (Low Byte)
  X = Remainder (High Byte)                             
|-
|0x03CA70($CA60)||Division: Divides a 2 byte value in $40 - $41/ by a 2 byte value in X Y. Result in $40 - $41
  Y = Divisor(Low Byte)
  X = Divisor(High Byte)                             
|-
|0x0391B7 ($91A7)||Division: Divides a 2 byte value in $75 - $76 into an exact printable (decimal)value for rendering, across $79 - $7C. The values
                                                correspond to the cursor scroll:
                                                                3 digit wide values = $79(hundreds), $7A(tens), $7B(Ones).
4 digit wide values = $79(thousands), $7A(hundreds), $7B(Tens), $7C(Ones)
|-
|0x039215 ($9205)||Multiplication: This is the exact opposite of ($91A7). It takes rendered (decimal)values in $79 - $7C multiples them into
                                                        (hexadecimal)values, and stores them in $75 - $76.
|-
|0x03BF0B ($BEFB)||Pointer Generator: Creates a 2 Byte CDP(Castle Data Pointer), to the start of "Active Castles" Castle Data. And stores the pointer in
                                                                $7E - $7F
|-
|0x03CD3F ($CD2F)||Pointer Generator: Creates a 2 Byte CDP(Castle Data Pointer), Requires X loaded with CIP(Castle ID Pointer).
|-
|0x03C010($C000)||Bank Swap
|}

Latest revision as of 06:12, 29 July 2024

Chip tiny.png The following article is a ROM map for Shingen the Ruler.


Castle Map IDs:
Add #$14 to Castle ID

Battlefield Map Ids:
Subtract #$01 from castle ID

Castle Ids:				Ruler Ids:	(Add + #$11 for Heirs)	
#$01	Kai				#$01		Shingen Takeda		        
#$02	Shinano				#$02		Ujiyasu Hojo					
#$03	Sagami				#$03		Kenshin Uesugi
#$04	Musashi				#$04		Kiyo Murakami
#$05	Kozuke				#$05		Yoshimasa Kiso
#$06	Echigo				#$06		Moto	Imagawa
#$07	N Shinano			#$07		Hiro Matsudaira
#$08	W Shinano			#$08		Nobunaga Oda
#$09	Suruga				#$09		Dosan Saito
#$0A	Totoumi				#$0A		Yori Anekoji									
#$0B	Mikawa				#$0B		Tsuna Hatakeyama
#$0C	Owari				#$0C		General Li		
#$0D	Mino				#$0D		The Ikko Sect
#$0E	Hida				#$0E		Takakage Asakura
#$0F	Etchu				#$0F		Hisamasa Asai
#$10	Noto				#$10		Haru Kitabatake
#$11	Kaga				#$11		Yoshiteru Ashikaga
#$12	Echizen
#$13	Oumi
#$14	Ise
#$15	Yamashiro

Castle DATA Start
	Note: Castle data is loaded into RAM at $6150. ROM Data is #$1A(00 - 25) bytes each, but RAM includes other data and is #$38(00 - 55) bytes each.
	CASTLE DATA CASTLES BY ORDER: KAI, SHINANO, SAGAMI, MUSASHI, KOZUKE, ECHIGO, N SHINANO, W SHINANO, SURUGA, TOTOUMI, MIKAWA, OWARI, MINO, HIDA, ETCHU, NOTO, KAGA, ECHIZEN, OUMI, ISE, YAMASHIRO.


0x016016 - 0x016237	
	BYTE #$00		This byte represents a ruler's capital. Ruler's ID (#$01 - #$11/ + #$11 for heirs)  is stored here if it is The ruler's capital, otherwise, it is     #$00.
	BYTE #$01		Family controlled: Takeda, Hojo, etc. if right this shouldn't change based on heirs)
	BYTE #$02		YIF(YIELD INCREMENTAL FACTOR) This byte directly corresponds to the game's FA-Development Command. Castle Yield is subtracted from this value to determine whether or not to add the Castles Rank to the base YI(YIELD INCREMENTAL - see https://gamefaqs.gamespot.com/nes/587609-shingen-the-ruler/faqs/76326 Territory Management Guide by ireant) of 0x03B7BF(#$28/YIELD), 0x3B85D(#$32/WEALTH). Basically any time the castles yield is above this value, the castles rank is added to the price to increase YIELD/WEALTH via the FA-DEVELOPMENT COMMAND. Setting these values to #$64(#100) or above means that the $$ price to increase YIELD/WEALTH via FA_DEVELOPMENT will never increase.
	BYTE #$03		Castle YIELD
	BYTE #$04		Castle DISASTER
	BYTE #$05		Castle CULTURE
	BYTE #$06		Castle LOYALTY
	BYTE #$07		Castle WEALTH
	BYTE #$08 - BYTE #$09 	Castle $$(money) LOW/HIGH BYTE max #$0F27(#9999)
	BYTE #$0A - BYTE #$0B		Castle PRODUCT; LOW/HIGH BYTE max #$0F27(#9999)
	BYTE #$0C		Castle Gold Mines (#00 - #100)
	BYTE #$0D       Gold mine depreciation (subtracted from gold mine base success chance)
    BYTE #$0E	unknown.
	BYTE #$0F		Epidemic #$00 = NO / #$01 = YES
	BYTE #$10 - BYTE #$11 	Castle RANK (i think max is #$64(#100), so only the first byte is used)
	BYTE #$12 - BYTE #$13		Castle XP; LOW/HIGH BYTE max I think is #$07E3(#999)
	BYTE #$14 - BYTE #$19		# of troops 1 BYTE each (max #$FF) for each of HQ(headquarters). CAV(Cavalry), RM(Riflemen), AR(Archer), LNC(Lancer), INF(Infantry)


	INCREMENTALS (Price Per Point Increase):
0x03B7BF	#$28($$40 YIELD)	FA-DEVELOPMENT COMMAND
0x03A3A8	#$1E($$30 DISASTER)	FC COMMAND
0x03B0A9	#$1E($$30 CULTURE)	CA COMMAND
0x03B917	#$11($$17 LOYALTY)	FA-AID COMMAND
0x03B85D	#$32($$50 WEALTH)	FA-DEVELOPMENT COMMAND
0x03B9B2	#$11($$17 WEALTH)	FA-AID COMMAND


	MERCHANT Buy/Sell Prices
	
	Note: this is base buy and selll prices w/o statistical modifiers from castle YIELD, WEALTH etc:

	Buy/Sell prices are loaded into $0346 - $034E in order of PRD, HQ, CAV, RM, AR, LNC (HQ, CAV, and RM are given a high byte, though I've never seen the prices even remotely close to #$FF(#255).

	Buy and sell prices are directly related. Product Buy Prices are based off of YIELD/#$0D + $6176 (address is + #$38/ castle) EX: 2nd castle is YIELD/#$0D + $61AE

	$6176 is given a random value each month determined by $005A (its not completely random and I think it ranges from 1-3 from what little I tested and browsing the code) regardless the Product buy price is maxxed at #$0A by a few bytes at 0x03A8BE (that compares the buy price at $0346 with #$0A and caps it #$0A). 
	Product sell prices are half the buy prices rounded down via a LSR at 0x03AA7B (if you were to remove this LSR Product sell prices would equal Product buy prices).
	Exception is that the minimum Buy/Sell prices is $$1

	Because Buy/Sell prices are calculated using the same base values Buy prices will always be 4x that of sell prices, and sell prices will always be 1/4(25%) that of Buy prices rounded down (exception is PRD where the buy price is 2x the sell prices).
	
	Troop unit Buy/Sell prices		HQ, CAV, RM, AR, LNC. 

	Base Prices:
	0x03A927		#$28 - HQ                      Side note: I seem to have just noticed that it looks like all the prices have a cap. I'm not going to bother listing 
	0x03A976		#$0F - CAV				    here atm. They seem of little importance.	
	0x03A9C5		#$14 - RM
	0x03AA14		#$0A - AR
	0x03AA62		#$04 - LNC	  	

	Buy Prices are determined via a routine at 0x03A47C - 0x03A487. that doubles the base price by loading each value from $034E - $0346 and performing an ASL then storing the new value.  

	Sell Prices are determined via a routine at 0x03AA78 - 0x03AAA7. I will list the LSR's replacing them with ASL's(excluding PRD) would result in Sell Prices equal to buy prices.  
	0x03AA7B	PRD Price LSR
	0x03AA87	HQ Price LSR
	0x03AA8E	CAV Price LSR
	0x03AA95	RM Price LSR
	0x03AA9C	AR Price LSR
	0x03AAA3	LNC Price LSR

    
Commonly Used Routines:
OFFSET Routine
0x03C92C ($C91C) Addition: Adds a 2 Byte value in $40 - $41+A. Result in $40 - $41.
0x03C938 ($C928) Addition Adds a 2 Byte Value in $40 - $41+Y(Low Byte), X(High Byte) Result in $40 - $41.
0x03C992 ($C982) Multiplication: Multiplies a 2 byte value in $40 - $41xA. Result in $40 - $41
0x03CA2D ($CA1D) Division: Divides a 2 byte value in $40 - $41/A. Result in $40 - $41 Y = Remainder (Low Byte) X = Remainder (High Byte)
0x03CA70($CA60) Division: Divides a 2 byte value in $40 - $41/ by a 2 byte value in X Y. Result in $40 - $41 Y = Divisor(Low Byte) X = Divisor(High Byte)
0x0391B7 ($91A7) Division: Divides a 2 byte value in $75 - $76 into an exact printable (decimal)value for rendering, across $79 - $7C. The values correspond to the cursor scroll: 3 digit wide values = $79(hundreds), $7A(tens), $7B(Ones). 4 digit wide values = $79(thousands), $7A(hundreds), $7B(Tens), $7C(Ones)
0x039215 ($9205) Multiplication: This is the exact opposite of ($91A7). It takes rendered (decimal)values in $79 - $7C multiples them into (hexadecimal)values, and stores them in $75 - $76.
0x03BF0B ($BEFB) Pointer Generator: Creates a 2 Byte CDP(Castle Data Pointer), to the start of "Active Castles" Castle Data. And stores the pointer in $7E - $7F
0x03CD3F ($CD2F) Pointer Generator: Creates a 2 Byte CDP(Castle Data Pointer), Requires X loaded with CIP(Castle ID Pointer).
0x03C010($C000) Bank Swap