[CLOSED]Trying to understand the Address for speed

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

gukingofheart
Posts: 44
Joined: Tue Dec 04, 2018 2:28 pm

[CLOSED]Trying to understand the Address for speed

Post by gukingofheart »

For educational purposes to help me figure out how to maybe modify the speed for other nes games, I'm trying to figure out why the gamegenie modifies the bike speed and how.

Mega turbo speed on 'A' button - EVUKGEAP + TESGPALA
https://datacrystal.romhacking.net/wiki ... ke:RAM_map

----------------------------
EVUKGEAP
----------------------------
C0BC cmp: 18 v: E0 (GG converted)
----------------------------
00:C0BC:E0 3F CPX #$3F (with GG activated)
00:C0BC:18 CLC (Without GG activated)
----------------------------
0x00F3 speed starting at 0, maxes at 46/47. pressing B gets you there faster (increments by 2, where A adds just one), but 47/49 seems the max speed. seems to be a cap somewhere, poking it higher doesnt give you more speed. (datacrystal info)
---------------------------

I did some searching and found the ram map (I believe) to be 00F3.. and this part of the code affects speed.
Why doesn't he move with 00F3 Val: 0E
?


TESGPALA What's the purpose of this part of the code?
----------------------------
C0D1 cmp: 03 v: 06
----------------------------
00:C0D1:06 03 ASL $0003 = #$22 (With GG activated)
00:C0D1:03 UNDEFINED (without GG activated)
----------------------------
Last edited by gukingofheart on Sun Dec 16, 2018 4:35 pm, edited 1 time in total.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Trying to understand the Address for speed, ExciteBike

Post by lidnariq »

I'm pretty certain that isn't code. It might instead be changing the first entry in a table that holds accelerations...

Clever-disasm finds that that's a 5 byte data table containing the values $18, $3F, $28, $20, $28; and is followed by another table.
gukingofheart
Posts: 44
Joined: Tue Dec 04, 2018 2:28 pm

Re: Trying to understand the Address for speed, ExciteBike

Post by gukingofheart »

Not code? You referring to the debug info? (I could of took a screenshot)
How is it changing it?, and what does "TESGPALA" even do?
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Trying to understand the Address for speed, ExciteBike

Post by lidnariq »

The CPU can access memory and treat it as something for the CPU to do: "code"; or can instead work with it as numbers: "data".

I'm about 90% certain that every single byte in the range of $C000 through $C183 is data.

I find that the best way to figure out how changing these constants affects things is to play in a debugging emulator and see what happens with the value.
gukingofheart
Posts: 44
Joined: Tue Dec 04, 2018 2:28 pm

Re: Trying to understand the Address for speed, ExciteBike

Post by gukingofheart »

access memory?
Is there a bunch of CLC & CPX examples around? I don't get how to use these exactly.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Trying to understand the Address for speed, ExciteBike

Post by lidnariq »

My point is that that's not CLC, it's just the number $18 = 24. Similarly it's not CPX, it's just the number $E0 = 224.
gukingofheart
Posts: 44
Joined: Tue Dec 04, 2018 2:28 pm

Re: Trying to understand the Address for speed, ExciteBike

Post by gukingofheart »

Not sure how to play around though. Let's switch games then to my goal. "Marble madness"
Trying to give the marble increased speed. From what I can tell, there's an X speed and Y speed.. will start just with the X for now.

In this case, I have to work with SBC? Sec? and maybe LDA.
Which value do I even try to mess with? and do I change the SBC to something else, or the Sec to something else?
Attachments
marble_speed_research1.png
gukingofheart
Posts: 44
Joined: Tue Dec 04, 2018 2:28 pm

Re: Trying to understand the Address for speed, ExciteBike

Post by gukingofheart »

My next idea, is to look up a bunch of different speed codes from different NES games.. because even though I believe your trying, I'm not understanding your advice.. I think it's made for people who created a bunch of gamegenie codes already.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Trying to understand the Address for speed, ExciteBike

Post by lidnariq »

Do you want higher maximum velocities or higher acceleration? Either way, it'll basically involve tracing through execution. If there isn't already a complete memory map, it probably will require finding what holds position, from that figuring out what holds velocity, (possibly from that figuring out what holds acceleration,) and then stepping and/or using breakpoints to figure out how what code affects things.

It's a lot of little steps, and while a good debugger will make it a lot quicker, it still requires being able to generate a mental model of how they built things.
gukingofheart
Posts: 44
Joined: Tue Dec 04, 2018 2:28 pm

Re: Trying to understand the Address for speed, ExciteBike

Post by gukingofheart »

Right now, I'm trying to "Hold A" to make the marble move much faster.
(Using fceux btw)

If for some reason I get this, I'd try to find a way to "Hold A" to make the marble jump.. but I figure, one step at a time.

I have no clue what I should do with CPX, CLC, SBC? SEC?
In excitebike a CPX was changed to a CLC.. but why.
Do things like this always need to be swapped to another function.. and how does one figure out what to even swap something to.
There's a lot of option.. doing a complete guessing game for every single possibility would take months if you don't have a general idea on what to even try.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Trying to understand the Address for speed, ExciteBike

Post by rainwarrior »

gukingofheart wrote:In excitebike a CPX was changed to a CLC.. but why.
Don't call it an instruction unless it's actually executed as one. These aren't instructions, they're just numbers stored in RAM.

Don't use the disassembler to inspect RAM variables like this. Use the hex memory view, or RAM watch, etc. The disassembly view is for tracing out the code parts, not looking at variables in RAM.
gukingofheart
Posts: 44
Joined: Tue Dec 04, 2018 2:28 pm

Re: Trying to understand the Address for speed, ExciteBike

Post by gukingofheart »

Hex or disassembly, it still converts to the same thing.
CLC (CLear Carry) $18
Immediate CPX #$44 $E0 2 2

Calling it CLC/CPX $18/$E0 shouldn't make a difference.
So let me rephrase. Why was it changed from $18 to $E0?
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Trying to understand the Address for speed, ExciteBike

Post by rainwarrior »

Er, sorry, I misunderstood. I thought you were looking at the speed variable in RAM, didn't realize you were referring to a game genie code that affects a change in ROM.

Still, this is not code, so there is no meaningful way to answer "why CPX instead of CLC", because it is not used as either of those instructions. You do have to rephrase your question to just be about the numbers before it can even be approached.

If you want to see how that value is used, create a new breakpoint for CPU memory read of $C0BC and you will find the code that uses that value. Then you can look at the code where that breakpoint hits and see how it affects things.
gukingofheart
Posts: 44
Joined: Tue Dec 04, 2018 2:28 pm

Re: Trying to understand the Address for speed, ExciteBike

Post by gukingofheart »

Telling me to use "read breakpoint" is at least new info.. but what this new info tell me/us? Is it, just always use a hex higher then $18? If so, that's a good answer.. if not, then hmmmm.

00:CE2D:B9 BC C0 LDA $C0BC,Y @ $C0BC = #$18 (Without GG) | 4C D0 18 B9 BC C0
00:CE2D:B9 BC C0 LDA $C0BC,Y @ $C0BC = #$E0 (With GG) | 4C D0 18 B9 BC C0

Ok.. now we have a matching data and the hex is unchanged for CE2A to CE2F
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Trying to understand the Address for speed, ExciteBike

Post by rainwarrior »

So you hit that breakpoint. Your value is loaded into A with a LDA. Use the step button to continue a few instructions from there until something happens with the value in A. Maybe it will immediately get stored somewhere (STA) or maybe it will go through some arithmetic/logic first.
Post Reply