Quick Question - Size of level

Share and discuss all facets of DKC ROM hacking...

Quick Question - Size of level

Postby Cyclone » December 17th, 2020, 9:26 am

Hi,
just wondering where in the Rom code that the size of the level is determined.

In my program I want the user to be able set the location of an object in the level but stay within the bounds of the level.

Thanks
Expedition Leader
Bananas received 559
Posts: 1211
Joined: 2008

Re: Quick Question - Size of level

Postby rainbowsprinklez » December 20th, 2020, 7:30 am

Spoiler!
Code: Select all

         //$BC / B052 A5 3E         LDA $3E[$00:003E]       A: 0000 X: 0400 Y: 0108 P: eNvmxdIzc
         //$BC / B054 0A            ASL A                      A:0016 X: 0400 Y: 0108 P: envmxdIzc
         //$BC / B055 AA            TAX                        A: 002C X:0400 Y: 0108 P: envmxdIzc
         //$BC / B056 BF 00 80 BC   LDA $BC8000,x[$BC: 802C] A: 002C X:002C Y:0108 P: envmxdIzc
         //$BC / B05A AA            TAX                        A: 957E X: 002C Y:0108 P: eNvmxdIzc
         //$BC / B05B CA            DEX                        A: 957E X: 957E Y: 0108 P: eNvmxdIzc
         //$BC / B05C CA            DEX                        A: 957E X: 957D Y: 0108 P: eNvmxdIzc
         //$BC / B05D CA            DEX                        A: 957E X: 957C Y:0108 P: eNvmxdIzc
         //$BC / B05E CA            DEX                        A: 957E X: 957B Y:0108 P: eNvmxdIzc
         //$BC / B05F BF 02 00 BC   LDA $BC0002,x[$BC: 957C] A: 957E X: 957A Y:0108 P: eNvmxdIzc
         //$BC / B063 A8            TAY                        A: 1400 X: 957A Y:0108 P: envmxdIzc
         //$BC / B064 BF 00 00 BC   LDA $BC0000,x[$BC: 957A] A: 1400 X: 957A Y:1400 P: envmxdIzc
         //$BC / B068 6B            RTL                        A: 0000 X: 957A Y:1400 P: envmxdIZc


The start of the level bounds are in A, the end - 0x100 is in y. Have fun with ram. The start is stored in $1b23 and the end - 0x100 in $1b25.

For this you need level codes. In dkc1, each entrance is its own unique level code

https://docs.google.com/spreadsheets/d/ ... 1276703849

How are you dealing with object ordering? In dkc1, some strange (and cool) effects can happen with out-of-order objects. I.e. objects not in order of x position. Effects could include things spawning out of order.

***EDIT***
You have 2 options, as I see it. Learn the coding way or manually find each using those ram values... you said you aren't really a coder so I propose option 2.

You may be wondering why - 0x100. This is because those bounds are from the left side of the screen. 1 screen = 0x100 (256) pixels wide.
Veteran Venturer
Bananas received 108
Posts: 568
Joined: 2016

Re: Quick Question - Size of level

Postby Cyclone » December 30th, 2020, 6:09 pm

rainbowsprinklez wrote:
Spoiler!
Code: Select all

         //$BC / B052 A5 3E         LDA $3E[$00:003E]       A: 0000 X: 0400 Y: 0108 P: eNvmxdIzc
         //$BC / B054 0A            ASL A                      A:0016 X: 0400 Y: 0108 P: envmxdIzc
         //$BC / B055 AA            TAX                        A: 002C X:0400 Y: 0108 P: envmxdIzc
         //$BC / B056 BF 00 80 BC   LDA $BC8000,x[$BC: 802C] A: 002C X:002C Y:0108 P: envmxdIzc
         //$BC / B05A AA            TAX                        A: 957E X: 002C Y:0108 P: eNvmxdIzc
         //$BC / B05B CA            DEX                        A: 957E X: 957E Y: 0108 P: eNvmxdIzc
         //$BC / B05C CA            DEX                        A: 957E X: 957D Y: 0108 P: eNvmxdIzc
         //$BC / B05D CA            DEX                        A: 957E X: 957C Y:0108 P: eNvmxdIzc
         //$BC / B05E CA            DEX                        A: 957E X: 957B Y:0108 P: eNvmxdIzc
         //$BC / B05F BF 02 00 BC   LDA $BC0002,x[$BC: 957C] A: 957E X: 957A Y:0108 P: eNvmxdIzc
         //$BC / B063 A8            TAY                        A: 1400 X: 957A Y:0108 P: envmxdIzc
         //$BC / B064 BF 00 00 BC   LDA $BC0000,x[$BC: 957A] A: 1400 X: 957A Y:1400 P: envmxdIzc
         //$BC / B068 6B            RTL                        A: 0000 X: 957A Y:1400 P: envmxdIZc


The start of the level bounds are in A, the end - 0x100 is in y. Have fun with ram. The start is stored in $1b23 and the end - 0x100 in $1b25.

For this you need level codes. In dkc1, each entrance is its own unique level code



I'm not sure what you mean. could you elaborate / walk me through it? I'm sorry I don't understand assembly code that well. I don't know which "A" and "Y" you are referring to in that code block and where that $1b23 is.

Thanks a bunch.

Edit
"The start is stored in $1b23 and the end - 0x100 in $1b25."

Are those RAM addresses?
Expedition Leader
Bananas received 559
Posts: 1211
Joined: 2008

Re: Quick Question - Size of level

Postby rainbowsprinklez » December 31st, 2020, 12:11 pm

Cyclone wrote:I'm not sure what you mean. could you elaborate / walk me through it? I'm sorry I don't understand assembly code that well. I don't know which "A" and "Y" you are referring to in that code block and where that $1b23 is.

Thanks a bunch.



Forget all that assembly code.

Edit
"The start is stored in $1b23 and the end - 0x100 in $1b25."

Are those RAM addresses?


Yes, both of those are RAM address the game uses. Question. How are you going to handle object ordering? How are you going to deal with changing objects?
Veteran Venturer
Bananas received 108
Posts: 568
Joined: 2016


Return to ROM Hacking

Who is online

Users browsing this forum: No registered users and 6 guests