Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
1 user currently in Rom Hacking: hukka | 2 guests
Acmlm's Board - I2 Archive - Rom Hacking - ASM Hacking Question - Controller Presses | |
Pages: 1 2Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
Dish

Spiny
Level: 38

Posts: 330/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 04-09-05 04:55 AM Link | Quote
Originally posted by eb_h4x0r
Is it possible to ASM hack other games for the controller thing?


Umm... what are you talking about?
Gavin

Fuzzy
Rhinoceruses don't play games. They fucking charge your ass.
Level: 43

Posts: 617/799
EXP: 551711
For next: 13335

Since: 03-15-04
From: IL, USA

Since last post: 13 hours
Last activity: 13 hours
Posted on 04-09-05 05:12 AM Link | Quote
if you are asking if it is possible to analyze and alter the game's controller handling code in the assembler programming language, then yes. however you must understand that video games are created just like any other piece of software, just because it's an NES game doesn't automatically mean there is some sort of "NES template" that the games are created out of or that all games developed uesd a uniform developement library.

there are certain predictable elements, however. if a game wants to work with a controller (as in like every game created for the NES) and it wants to use all buttons on the controller, there will be 8 reads to $4016, and the controller hardware will be initialized (all that "half-strobe" nonesense aside). Though how a game goes about that differ. There can be, as in the case of FF1, a decrementing loop that rotates each button status bit into a single memory address. It didn't have to do that though. The game could have loaded each button status bit manually, with 8 reads to $4016, it could have stored the button status bits into 8 separate memory addresses.... get the point? there are many many ways to handle the same operation, it depends on what the game needs and whatever the programming felt like doing at the time, and that can vary. and just as the actual reading and storing of the information can vary, obviously the handling of button presses can be different depending on what the game needs. if it needs to know if the current button was also the previous button pressed, blah blahblah, it's going to have different routines and therefore you're going to have to hack the game differenty.

the moral of the story is that with any game hacking on the level of assembler, it's generally a very good idea to have a more intiment understanding of the game you're working on.
iamhiro1112

Armos
Level: 35

Posts: 365/487
EXP: 259927
For next: 20009

Since: 03-27-04
From: sd

Since last post: 18 days
Last activity: 7 days
Posted on 04-09-05 08:10 AM Link | Quote
My questions weren't neccesarily a do it for me question. But I was curious if anyone had wanted to fix those problems. I am currently hacking the graphics part of Super Mario World NES and was hoping to see this games many issues resolved. But I am perfectly willing to try and tackle the issue myself. I don't have the knowledge to do it yet, but I'm sure theres enough faqs out there for me to learn.

Anyway, I'll try to keep on topic from now on.
Gavin

Fuzzy
Rhinoceruses don't play games. They fucking charge your ass.
Level: 43

Posts: 618/799
EXP: 551711
For next: 13335

Since: 03-15-04
From: IL, USA

Since last post: 13 hours
Last activity: 13 hours
Posted on 04-09-05 08:37 AM Link | Quote
Originally posted by iamhiro1112
My questions weren't neccesarily a do it for me question. But I was curious if anyone had wanted to fix those problems. I am currently hacking the graphics part of Super Mario World NES and was hoping to see this games many issues resolved. But I am perfectly willing to try and tackle the issue myself. I don't have the knowledge to do it yet, but I'm sure theres enough faqs out there for me to learn.

Anyway, I'll try to keep on topic from now on.


my most recent comment just above this one applies equally to your question, iamhiro.


the moral of the story is that with any game hacking on the level of assembler, it's generally a very good idea to have a more intiment understanding of the game you're working on.


so really it depends on what the game's controller processes look like. as DD and Parastye and whomever else has said, you'll want to be using the game's built in controller functions. Start by locating where and how the game stores button status info, then look for reads to that ram address using an advanced debugger (such as FCEUXD) and go from there.
Rockman

Flurry
Level: 26

Posts: 177/250
EXP: 96387
For next: 5888

Since: 03-17-04

Since last post: 18 days
Last activity: 16 days
Posted on 04-10-05 11:30 PM Link | Quote
I need help with something.

BEQ means Branch on Result Zero.

Does this mean to branch to that location if the result is false?

If that is true, then BNE means Branch if Result is Not Zero, meaning, branch if result is true?

Right now, I'm trying to make an ASM hack to Mega Man.

What I'm trying to do is make it so if you hold down the fire button, Mega Man can rapid fire. I actually wanted to do this a very long time ago, but couldn't because of lack of knowledge. Now, I feel ready enough to tackle it.

The address for buttons that are just pressed is $18, just like it is in SMB3.

So, I set a read of $18, and press Run 17 times to get to the code I'm looking for.

$9538:A5 18 LDA $18 = #$00
$953A:29 02 AND #$02
$953C:F0 05 BEQ $9543
$953E:20 1E A7 JSR $A71E
$9541: D0 00 BNE $9543
$9543:AD 80 06 LDA $0680 = #$FF
$9546:30 29 BMI $9571
$9548:20 C4 9B JSR $9BC4
$954B:B0 09 BCS $9556
$954D:A5 14 LDA $14 = #$00
$954F:29 01 AND #$01
$9551:F0 06 BEQ $9559
$9553:4C 29 96 JMP $9629
$9556:4C 33 96 JMP $9633
$9559:AD 80 06 LDA $0680 = #$FF
$955C:30 10 BMI $956E
$955E:C9 01 CMP #$01
$9560:90 0C BCC $956E
$9562:F0 0A BEQ $956E
$9564:A9 01 LDA #$01
$9566:8D 80 06 STA $0680 = #$FF

The fire button, which I'm pretty sure is the B Button, is #$02, which is shown above. First, I want to work with the JUST PRESSED button ($18), before I go into the HELD DOWN button ($16). But, I need help. I don't know where the code for firing the bullets are. I highlighted the beginning of the code. Could somebody explain what that BEQ does?
Dish

Spiny
Level: 38

Posts: 333/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 04-10-05 11:34 PM Link | Quote
Originally posted by Rockman
I need help with something.

BEQ means Branch on Result Zero.

Does this mean to branch to that location if the result is false?



Technically... all it means is "Branch if the Z flag is set". How the Z flag is set depends on the previous instruction(s). Typically, the Z flag is set when the last instruction resulted in an output of Zero (and is cleared otherwise). For example:



LDA #$00 ; this will set the Z flag
LDA #$01 ; this will clear it (nonzero)

SEC
SBC #$01 ; This will subtract 1 from A, making it zero -- so the Z flag will be set

LDA #$0E
CMP #$0E ; CMP internally does subtraction to set flags. 0E - 0E = 0, so Z will be set
CMP #$0D ; However, 0E - 0D = 1, so Z will be clear here




BNE is the inverse -- all it means is "Branch if Z flag is clear".



edit:

To further clarify your bolded section:

$9538:A5 18 LDA $18 = #$00
$953A:29 02 AND #$02
$953C:F0 05 BEQ $9543


That BEQ will branch... since the previous instruction (AND) will produce a result of zero, setting the Z flag. If $18 had the B button pressed ($02), the AND would produce a nonzero result, clearing the Z flag -- and the branch would not occur.


(edited by Disch on 04-10-05 06:34 AM)
(edited by Disch on 04-10-05 06:40 AM)
Rockman

Flurry
Level: 26

Posts: 178/250
EXP: 96387
For next: 5888

Since: 03-17-04

Since last post: 18 days
Last activity: 16 days
Posted on 04-11-05 08:18 AM Link | Quote
Well, I managed to do it!



You can't really tell from the screenshot, but Mega Man can now rapid fire. I was actually able to do it in a lot simpler way than I thought. It just hit me!

It was so simple to do, that its not worthy of a patch. Here's how to do it:

- Set a Breakpoint of Read to Address $18.
- Press run 17 times to get to the LDA $18 and AND #02.
- What you want to do, is change that $18 to a $16.

Basically, changing that allows you to hold down the button to fire rapidly. Then, all that is left to do is change how many bullets come out of your cannon.

Do a Cheat Search for the hex value, 04. The value is at the bottom of the list (don't remember which one). You can figure out the rest.

The only thing I didn't get to yet, is being able to rapid fire while you are on a ladder. I'll do that later.

But anyway, I really appreciate your help Disch. I would buy you dinner if I could.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 4160/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 04-12-05 03:33 AM Link | Quote
You should at least post the addresses.
Rockman

Flurry
Level: 26

Posts: 179/250
EXP: 96387
For next: 5888

Since: 03-17-04

Since last post: 18 days
Last activity: 16 days
Posted on 04-12-05 03:44 AM Link | Quote
I didn't post the address because I didn't remember it at the time. All it takes is a simple cheat search to find it. And I already told you the value to search for. Its 4. In fact, you don't even need to look for it. Just changing that $18 to a $16 will suffice. There are multiple ways to do things. This is a very simple way, which happens to work. Just change that one byte for rapid fire.

And no HyperHacker, I shouldn't at least post the addresses. If you don't know how to test cheat addresses even after I gave you the value to search for, then this isn't for you. If you need documentation on how to use FCEUD, read this:

http://desnet.fobby.net/doc/fceud_tutor1.txt


(edited by Rockman on 04-11-05 10:45 AM)
Pages: 1 2Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Rom Hacking - ASM Hacking Question - Controller Presses | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.019 seconds.