News:

The forum has been updated to SMF (2.1.3)!
Please be patient as we work to polish up the place and update features as we can.

Main Menu

Post your GBA ASM Questions here.

Started by Daddy Poi's Oily Gorillas, 03, November, 2010, 06:10:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Daddy Poi's Oily Gorillas

I found GBATEK to be the most useful. It may be easier than you think, I strongly recommend you use the SDL-H version for any assembly hacking you do.

Take note of MOV, LDR, STR, and the Branches (B, BL) - I consider those as being the most basic.

MOV = Simply put a value in a register.
LDR = This is 32-bit, but LDRH is 16-bit, and LDRB is 8-bit. This is for loading a value from an offset into a register.
STR = similar to LDR, it has STRH, and STRB, it is for storing the value of the register into an offset.

B = A simple Jump, no conditions, that's about it, just a jump.
BL = Branch and Link. It is a function call. This is so you can Jump to another function and come back here at the end of that function.

And there are branching with conditionals.. BLE, BEQ, etc.

Ofcourse, all this is THUMB. ARM may have the same stuff as well, and they have much more you can do. (But it's a bit slower.)


So, if anyone needs help in ASM hacking (or has any questions on it) then you are welcome to post here. (My only real practices on this were in M&L:SS, so I might not be the best...)
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Salanewt

ASM is ASM, thanks for posting this here! GBATEK remains one of my favourite sources when studying ASM, and I think it also talks a bit about the DS too, right? I will be sure to ask whenever I have a question, as I am going to start practicing with it soon (instead of just studying).

Have a nice day.
Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Daddy Poi's Oily Gorillas

QuoteASM is ASM
Correct.
Quotethanks for posting this here!
You are welcome. After I saw one of your posts where there was a quote saying that no one knows assembly here..yet, I decided it would be a good idea to post this, since this may also get more people interested in learning it sooner.
QuoteGBATEK remains one of my favourite sources when studying ASM
That's very true, it is a large guide, after all.
Quoteand I think it also talks a bit about the DS too, right?
Correct, again.
QuoteI will be sure to ask whenever I have a question,
That's what this topic is for!
Quoteas I am going to start practicing with it soon (instead of just studying)
Practicing is one of the best ways to learn, so have fun.
QuoteHave a nice day.
You have a nice day as well.
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Atrius (He/Him)

GBATEK = GBA & DS Hacking Bible

I'd also like to point out that v0.3 does give you the capability to do hex level ASM hacking on map code should you choose to do so.  It's a bit more advanced since you have to break the commands down into their hex equivalents though. This is where cut scenes come in to play, so please do experiment with it.
[sprite=220,4,0]I'm shaking my head in general disapproval of everything[/sprite]

GSeriesFan

Quote from: Atrius on 03, November, 2010, 09:03:57 PM
GBATEK = GBA & DS Hacking Bible

I'd also like to point out that v0.3 does give you the capability to do hex level ASM hacking on map code should you choose to do so.  It's a bit more advanced since you have to break the commands down into their hex equivalents though. This is where cut scenes come in to play, so please do experiment with it.

The ASM viewer in your editor cant be edited and i dunno how to convert it to hex, does this GBATEK teaches everything there is to know about GBA, NDS editing?

Misery

Alright, I wanted to avoid taking that other thread off the rails completely, but I figured I could at least take a moment to think about this so I can reply.

QuoteIf you ever plan on hacking DS, get use to seeing 32-bit code. ; I could go with a long tutorial, but I suppose it wouldn't help much if I didn't know which parts you actually needed help on.
I don't really plan to try hacking DS or any more current systems. For projects where I don't like the limitations of older hardware, I can do them on PC instead. The simplicity of older systems has a certain charm... But yeah, I guess I need to know what I want to learn. Overall I just think I need more general knowledge about the system, which the documentation can provide in abundance, but I'm not going to remember much of it if I never use it. Perhaps I can clarify some stuff here.

Last time I did anything that had to do with ASM, I think I was trying to use a simple branch (with link) - I can't recall if I was following an existing one or trying to stick in my own, but in either case it didn't end up where I expected. I'm completely off the ball with this right now so bear with me, if I look into it again I could post what I'm doing in more detail.

Quote-Find data based on what you are looking for (RAM/VRAM/PALETTE) If the value is to be in RAM (Ex: A Stat number) Use Search for cheats / RAM Search.
I recall having some success with this, but most of the time what I'm looking for isn't in RAM, and addresses holding player related data are pretty well documented in any case, courtesy of people trying to make cheat codes.

Quote-You may want to find out how this data is affected, so you should use a debugger. (VBA-SDL-H) With a breakpoint write if looking for things like party data, etc.
Assuming I even know where to place the breakpoint. For example, if I were looking for a function that writes to a character's attack stat, it would be no problem, but I haven't attempted anything like that. I guess I should start with something simple just to see if I can make it work. I'm also not entirely comfortable with using VBA-SDL-H, but it looks like I'll have to get used to it if I want to get anything done. I can swear I've been able to place a breakpoint with the normal VBA using something in the tools section, but I can't find that option anymore.

Quote-Sometimes, when scanning the code (In the case of breakpoint-write, scroll up), you can just look for ROM pointers, and research what those are if you don't feel like reading the assembly. Make sure not to scroll up too far, though, or you'll be looking at a different function. (Usually functions start with the push opcode, but they don't have to have one if they don't need one.) If you don't see any pointers, then you probably check the parent function. (The function that called the function you are looking at.) ; There are ways of finding the parent function, so it shouldn't be too difficult.
This is where I've probably had the most trouble. How do you identify a pointer? Oh wait, I forget we're talking about disassembled code. But I still don't really know how to see which ones are relevant. How would you find the parent function? How do you tell where one function begins and another ends? If it's very in-depth I don't think I'd gain much from an explanation right now though, so if that's the case... save it for later.

QuotePretty much, when reading the code, you must understand what the variables in the registers of the instruction you are looking at are- before you can understand the purpose of the instruction that is being executed.
Yeah, I pretty much never have any idea of what I'm looking at unless someone explained it already. Like I said, I don't really know where to start...

QuoteSometimes, you may not even need to check the assembly at all to find data that you are looking for. For example, for uncompressed graphics, you can simply search for matching data in a Hex Editor.
Not sure why I'd use a hex editor to find uncompressed graphics when I could just use a tile editor, but when it comes to Golden Sun just about everything seems to be compressed anyway (I've found the element icons and the alphabet uncompressed, possibly some attack effects, but that's all).

Quote
Quotebreaking down hex values to bit level to find out which particular flavor of an instruction I'm looking at
Do you mean you aren't actually looking at the instructions themselves, but trying to convert the hex values instead? That seems to be a long way to go about it. Why not try using the GBA Dissassembler? (Tools => Dissassemble...) I probably should tell you that the map code is at 02008000.
Yes... I suppose I should get used to use a disassembler, as well as something that compiles my own code into hex...

QuoteThe addresses are read with ldr. ldr r#, [$########] (=$########) ; The address in the square brackets [ ] is where the value of the one in parenthesis ( ) is at. The parenthesis value should include the address of a database. And you aren't just limited to ROM pointers. RAM, VRAM, PALETTE, etc. are done the same way. ; Anyway, this puts the address in r#, you can then make any calculations you want to read/write to the specific data in the databases. After the calculations are made, we use another load (ldr/ldrh/ldrb/etc., depending on the datatype) to read the data. (Or if we are writing to RAM, str/strh/strb/etc.)
I was really just asking for the notation syntax, not how addresses are handled program-wise... like, I assume the data in ROM is divided into banks, and the address is something like [bank][address], or there's a number at the start of the address referring to the physical location of the GBA itself... err, like I said, I don't really know how it works, I just know that the addresses I've been seeing don't correspond to the same address in a hex editor. Anyway, after reading through that a few times, that's really helpful, so... thanks.

Well, the more I think about this, the more I realize I could find my answers simply by trying stuff out. I'm going to try to make a psynergy that affects elemental power/resistance someday ahead (there are already functions for this, so it shouldn't be too hard, right?). I'll probably get stuck with it, but then I can at least ask more specific questions. Later on I want to look into code that deals with djinn states, but I figure I'll need a bit deeper understanding before I can get anywhere with that.

Daddy Poi's Oily Gorillas

#6
Quote from: Misery on 24, January, 2013, 06:34:28 PM
Alright, I wanted to avoid taking that other thread off the rails completely, but I figured I could at least take a moment to think about this so I can reply.

QuoteIf you ever plan on hacking DS, get use to seeing 32-bit code. ; I could go with a long tutorial, but I suppose it wouldn't help much if I didn't know which parts you actually needed help on.
I don't really plan to try hacking DS or any more current systems. For projects where I don't like the limitations of older hardware, I can do them on PC instead. The simplicity of older systems has a certain charm... But yeah, I guess I need to know what I want to learn. Overall I just think I need more general knowledge about the system, which the documentation can provide in abundance, but I'm not going to remember much of it if I never use it. Perhaps I can clarify some stuff here.

Last time I did anything that had to do with ASM, I think I was trying to use a simple branch (with link) - I can't recall if I was following an existing one or trying to stick in my own, but in either case it didn't end up where I expected. I'm completely off the ball with this right now so bear with me, if I look into it again I could post what I'm doing in more detail.
I'm interested in knowing what you had. Also, I think branch link's 5 most significant bits on both 16-bits should be done like this 11110*********** 11111*********** (F000 F800) Since I remember having a problem before (long ago) with branch-links and that seemed to be what the problem was.

Quote
Quote-Find data based on what you are looking for (RAM/VRAM/PALETTE) If the value is to be in RAM (Ex: A Stat number) Use Search for cheats / RAM Search.
I recall having some success with this, but most of the time what I'm looking for isn't in RAM, and addresses holding player related data are pretty well documented in any case, courtesy of people trying to make cheat codes.
Yeah, but in the case where they aren't documented.... (Most likely things like room numbers and the currently selected item in menues, etc.) It can still be a huge help. And once you find the data, expect other interesting bits of information to be in the area as well, since it is most likely common for similar things to be grouped together.

Quote
Quote-You may want to find out how this data is affected, so you should use a debugger. (VBA-SDL-H) With a breakpoint write if looking for things like party data, etc.
Assuming I even know where to place the breakpoint. For example, if I were looking for a function that writes to a character's attack stat, it would be no problem, but I haven't attempted anything like that. I guess I should start with something simple just to see if I can make it work. I'm also not entirely comfortable with using VBA-SDL-H, but it looks like I'll have to get used to it if I want to get anything done. I can swear I've been able to place a breakpoint with the normal VBA using something in the tools section, but I can't find that option anymore.
I don't think you can breakpoint with the original VBA, as far as I'm aware.

Quote
Quote-Sometimes, when scanning the code (In the case of breakpoint-write, scroll up), you can just look for ROM pointers, and research what those are if you don't feel like reading the assembly. Make sure not to scroll up too far, though, or you'll be looking at a different function. (Usually functions start with the push opcode, but they don't have to have one if they don't need one.) If you don't see any pointers, then you probably check the parent function. (The function that called the function you are looking at.) ; There are ways of finding the parent function, so it shouldn't be too difficult.
This is where I've probably had the most trouble. How do you identify a pointer? Oh wait, I forget we're talking about disassembled code. But I still don't really know how to see which ones are relevant. How would you find the parent function? How do you tell where one function begins and another ends? If it's very in-depth I don't think I'd gain much from an explanation right now though, so if that's the case... save it for later.
I pointer is just an address written in the data.  @Parent function: If using VBA-SDL-H, you can check lr (r14) or look in the stack (Depending on if r14 changed after the function's start.). For beginners, I recommend just executing the code until you exit the function. (n = execute next instruction; but if there is a lot of code, you may prefer just skipping down to the return. (most likely the bx instruction.) rtt = run to thumb ) I have also included a little tool in Yoshi Magic to find all function calls to a specified function, so that could be even more useful. (Only for Thumb code, though.)

Quote
QuotePretty much, when reading the code, you must understand what the variables in the registers of the instruction you are looking at are- before you can understand the purpose of the instruction that is being executed.
Yeah, I pretty much never have any idea of what I'm looking at unless someone explained it already. Like I said, I don't really know where to start...
I'd start by learning the "easy" data before hand, and then see how it is used in the code. That may help to fill out the rest of the logic puzzle.

Quote
QuoteSometimes, you may not even need to check the assembly at all to find data that you are looking for. For example, for uncompressed graphics, you can simply search for matching data in a Hex Editor.
Not sure why I'd use a hex editor to find uncompressed graphics when I could just use a tile editor, but when it comes to Golden Sun just about everything seems to be compressed anyway (I've found the element icons and the alphabet uncompressed, possibly some attack effects, but that's all).
@Hex Editor, because maybe it is faster than skimming the entire ROM for the graphics you want? Basically, you look at VBA's Tile Viewer, then open up the memory viewer to the VRAM section. (06000000) Match the graphics to the data in the memory viewer and search those. But only if it is uncompressed in the ROM.

Quote
Quote
Quotebreaking down hex values to bit level to find out which particular flavor of an instruction I'm looking at
Do you mean you aren't actually looking at the instructions themselves, but trying to convert the hex values instead? That seems to be a long way to go about it. Why not try using the GBA Dissassembler? (Tools => Dissassemble...) I probably should tell you that the map code is at 02008000.
Yes... I suppose I should get used to use a disassembler, as well as something that compiles my own code into hex...
Unfortunately, I don't know of any compilers at this moment, so I'd probably end up coding my own, most likely into Yoshi Magic or the GS Editor. (Or both?)

Quote
QuoteThe addresses are read with ldr. ldr r#, [$########] (=$########) ; The address in the square brackets [ ] is where the value of the one in parenthesis ( ) is at. The parenthesis value should include the address of a database. And you aren't just limited to ROM pointers. RAM, VRAM, PALETTE, etc. are done the same way. ; Anyway, this puts the address in r#, you can then make any calculations you want to read/write to the specific data in the databases. After the calculations are made, we use another load (ldr/ldrh/ldrb/etc., depending on the datatype) to read the data. (Or if we are writing to RAM, str/strh/strb/etc.)
I was really just asking for the notation syntax, not how addresses are handled program-wise... like, I assume the data in ROM is divided into banks, and the address is something like [bank][address], or there's a number at the start of the address referring to the physical location of the GBA itself... err, like I said, I don't really know how it works, I just know that the addresses I've been seeing don't correspond to the same address in a hex editor. Anyway, after reading through that a few times, that's really helpful, so... thanks.
You mean something like this: READ_BYTE( Database_address + (Entry_Number * Num_of_bytes_in_entry) + Byte_num_in_entry )

QuoteI just know that the addresses I've been seeing don't correspond to the same address in a hex editor.
Also, do note, only the ROM section will appear in a hex editor, as that is read-only memory.  so 0x08000000 in VBA's memory viewer is 0x00000000 in a Hex Editor.

QuoteWell, the more I think about this, the more I realize I could find my answers simply by trying stuff out. I'm going to try to make a psynergy that affects elemental power/resistance someday ahead (there are already functions for this, so it shouldn't be too hard, right?). I'll probably get stuck with it, but then I can at least ask more specific questions. Later on I want to look into code that deals with djinn states, but I figure I'll need a bit deeper understanding before I can get anywhere with that.
Umm... not sure. I know that items can do stuff with elemental stats, though. Djinn states? Hmm...
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Misery

QuoteI'm interested in knowing what you had. Also, I think branch link's 5 most significant bits on both 16-bits should be done like this 11110*********** 11111*********** (F000 F800) Since I remember having a problem before (long ago) with branch-links and that seemed to be what the problem was.
This was a while ago so I don't exactly remember it all, but I was looking at the code you posted that is used to distribute djinn to Isaac's party at the start of the game. Since the amount of djinn to distribute can't be reduced to zero, I was looking for a way to bypass the routine completely. I must simply have been looking in the wrong location though, because the hex code I was looking at didn't match that specific bit configuration... I'm still not completely sure though, because I clearly remember that command being in the value range for branches.

QuoteI don't think you can breakpoint with the original VBA, as far as I'm aware.
I don't think so either, I must be remembering incorrectly.

Quote@Parent function: If using VBA-SDL-H, you can check lr (r14) or look in the stack (Depending on if r14 changed after the function's start.). For beginners, I recommend just executing the code until you exit the function. (n = execute next instruction; but if there is a lot of code, you may prefer just skipping down to the return. (most likely the bx instruction.) rtt = run to thumb ) I have also included a little tool in Yoshi Magic to find all function calls to a specified function, so that could be even more useful. (Only for Thumb code, though.)
Argh, yes of course it stores the return address for functions! *smacks self* :P
Even if I had thought of that though, I probably wouldn't have known how to put it to use. A tool for finding function calls? Isn't that just searching for a specific hex string? (BL + address of the function)

Quote@Hex Editor, because maybe it is faster than skimming the entire ROM for the graphics you want? Basically, you look at VBA's Tile Viewer, then open up the memory viewer to the VRAM section. (06000000) Match the graphics to the data in the memory viewer and search those. But only if it is uncompressed in the ROM.
Oh, that would actually be pretty useful... I hadn't thought about that. Not that it will help me with Golden Sun, but perhaps with other games.

QuoteUnfortunately, I don't know of any compilers at this moment, so I'd probably end up coding my own, most likely into Yoshi Magic or the GS Editor. (Or both?)
Oh, hehehe... that must be why I hadn't found one. I was sure I had been looking for one.

Coding a compiler for GBA ASM sounds like a huge project, so best of luck to you if you're planning to do that. I'd recommend you try to make it work as a standalone application so it can be of benefit to people trying to hack other games than M&L or GS.

QuoteYou mean something like this: READ_BYTE( Database_address + (Entry_Number * Num_of_bytes_in_entry) + Byte_num_in_entry )
To be honest... I have no idea what this refers to.

QuoteAlso, do note, only the ROM section will appear in a hex editor, as that is read-only memory.  so 0x08000000 in VBA's memory viewer is 0x00000000 in a Hex Editor.
Oh, right... it makes sense now. Just had a look at the GBA memory map... guess I should've done that before asking this.

QuoteUmm... not sure. I know that items can do stuff with elemental stats, though. Djinn states? Hmm...
The in-battle player data has space reserved for a "status effect" that increases elemental power, I think. Remember when you use a summon, it increases elemental power? I was planning to try to access that. Anyway, on second thought I don't think there's anything like that for element-specific resistance, but I'm only really interested in elemental power.

Just to be clear, what I mean with djinn states is whether they are set, standby or recovering.

Daddy Poi's Oily Gorillas

QuoteThis was a while ago so I don't exactly remember it all, but I was looking at the code you posted that is used to distribute djinn to Isaac's party at the start of the game. Since the amount of djinn to distribute can't be reduced to zero, I was looking for a way to bypass the routine completely. I must simply have been looking in the wrong location though, because the hex code I was looking at didn't match that specific bit configuration... I'm still not completely sure though, because I clearly remember that command being in the value range for branches.
The unconditional branch command (b) is used to jump to another location in the code, perhaps that could be of use? (Ofcourse, you could replace what you don't want with 0000s, however, the code would still be executed,... lsl r0, r0, #0x0 doesn't make any noticeable changes that you should worry about.)

QuoteA tool for finding function calls? Isn't that just searching for a specific hex string? (BL + address of the function)
Pretty much. The branches are done with relative addressing, so the value would be based off of the distance from the call to the actual function.



QuoteYou mean something like this: READ_BYTE( Database_address + (Entry_Number * Num_of_bytes_in_entry) + Byte_num_in_entry )
To be honest... I have no idea what this refers to.

Think of "Database_address" As one of the sub-editors in the editor.
Think of "Entry_Number" as one of the items in the main list of a sub-editor.
Num_of_byte_in_entry could be based off everything that is editable for a partically item.
Byte_num_in_entry would be the actual attribute you are dealing with for the particular item. (Like when you go to edit a stat, or other value in the editor, or something.)
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Misery

Quote from: Teawater on 27, January, 2013, 10:37:16 AM
The unconditional branch command (b) is used to jump to another location in the code, perhaps that could be of use? (Ofcourse, you could replace what you don't want with 0000s, however, the code would still be executed,... lsl r0, r0, #0x0 doesn't make any noticeable changes that you should worry about.)
Actually, the plan was to use an unconditional branch to skip that entire block of code... but to know where to jump, I still need to figure out what the rest of the code does, to make sure I'm not skipping anything critical. Which led to me trying to follow an existing BL. Which led to me getting stuck.

Quote
QuoteA tool for finding function calls? Isn't that just searching for a specific hex string? (BL + address of the function)
Pretty much. The branches are done with relative addressing, so the value would be based off of the distance from the call to the actual function.
Oh, I just assumed it used absolute addressing. It makes a lot more sense to have a tool when each function call uses a different value (which is the case, apparently).

QuoteThink of "Database_address" As one of the sub-editors in the editor.
Think of "Entry_Number" as one of the items in the main list of a sub-editor.
Num_of_byte_in_entry could be based off everything that is editable for a partically item.
Byte_num_in_entry would be the actual attribute you are dealing with for the particular item. (Like when you go to edit a stat, or other value in the editor, or something.)
Ok, I get it. This doesn't lead to the address being written differently though, so it's not really what I was asking about (you already cleared up my confusion, thank you very much), but I suppose it's the best method to calculate the address of a byte within a given data structure.

That should be all, I need to take some time and figure stuff out on my own if I'm going to get anywhere with this. But I think I'm more likely to ask questions about using VBA-SDL-H to begin with than actual ASM questions (I hope that's still relevant to this topic).

Daddy Poi's Oily Gorillas

#10
Well the entire image here: http://forum.goldensunhacking.net/index.php?action=dlattach;topic=1421.0;attach=915;image is djinn related, so I suppose you could put the branch at 080AE8D4 or 080AE8e8 depending on if you want Flint and Fizz, and point the branch to 080AE9A4? (Maybe.) I'm not sure what is outside of the area the image shows at the moment, though. (Since I haven't really looked.)

*Looks at the start of the function and sees a read_flag(x800)* This should be the Flint flag for Isaac's party... Hmm... If on, jump to end of function? (This is before you are giving Flint, in the code.) ; It may be possible that you want to skip the entire function itself.


All branches seem to be done relatively, except for when you load a pointer into a register.


Okay...
Okay.
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Misery

#11
Quote from: Misery on 27, January, 2013, 12:51:32 PM
I think I'm more likely to ask questions about using VBA-SDL-H to begin with than actual ASM questions (I hope that's still relevant to this topic).
Looks like I was right about this...

How do I place a breakpoint write in VBA-SDL-H? The manual mentions how to place breakpoints for when an address is read from, and "execution" breakpoints, which if I've understood them correctly take effect when the instruction at a certain address is executed. But I can't find anything for when an address is written to.

And... did I really write that in January? Man, a year sure goes by quickly...

EDIT: lol nevermind, I found it. And it was mentioned in the same section as read breakpoints too... >.<

Daddy Poi's Oily Gorillas

#12
Some info if you need it...

There is a VBA-SDL-H2 version I found on pokecommunity once, but didn't see a way to do breakpoint read or write.

Anyway, for SDL-H, the main commands you need to know are these:

bpr = Breakpoint Read
bpw = Breakpoint Write
bt = Breakpoint Thumb (I think there is a bug for this one in SDL-H, so I often like to use rtt instead. Which I forget if it too includes the bug or not.)(ba/rta? for Arm)
n = Execute next instruction
c = Continue execution

There are some other useful commands as well, but I wanted to say that the No$gba NDS debugger works a bit different. For one, it's not a command prompt, and you use [address]! for writes (only works when the value is actually changed, I thin, unlike SDL-H), and you use [address]? for reads...


So what are you trying to do in SDL-H anyway?
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Thunder-squall

Did a google search for "GBATEK," and scanned this thread.  Still can't follow much.  While I can't ask that you guys make tutorials for noobs, I'd say you're not doing yourselves any favors in terms of recruitment.  In your OP, could you link to an index of acronyms, and perhaps to some starter sites?

Side question:  From reading above, it seems that the main changes people are making are with parameters (attack, defense, etc).  Have you been able to add and take away djinn from the game?  Or give enemy attacks to players?  It might even be neat to come across a bunch of enemies who, at the time of battle, have the exact same stats and abilities as the players.  Are these things which are ultimately possible through hacking?

Daddy Poi's Oily Gorillas

#14
GBATEK is one of them documents that would be hard to understand at-first, until you understand. (Which may take a long time.) And when you do understand, it's the GBA/DS Hacking Bible. Useful for anything concerning GBA and DS hardware. (As well as externals like e-Reader, Action Replay, Gameshark, etc.) The CPU - Thumb Instructions Set might be notable for people wanting to learn thumb assembly. Although, I recommend actually using SDL-H in the process, so one can see how the operations work in real-time.

Giving people djinn and removing them from the party is done in Map Code, where they call a function with arguments/parameters for the djinn. (Or you could just go and edit the RAM values for the djinn themselves if you did it manually.)

Giving enemy attacks to players is done in Classes and Abilities tables.

Would any enemy have the EXACT same stats AND abilities? That sounds mostly illogical unless you had a clone for an enemy, maybe.
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Misery

Quote from: Thunder-squall on 01, January, 2014, 10:29:35 PM
Still can't follow much.  While I can't ask that you guys make tutorials for noobs, I'd say you're not doing yourselves any favors in terms of recruitment.
The point of the GS editor is that people won't have to learn this stuff, but it's still at a stage where it's pretty limited without it. Still, I think this thread is more aimed at people who are already familiar with ASM but trying to learn it.

Quote from: Thunder-squall on 01, January, 2014, 10:29:35 PM
Side question:  From reading above, it seems that the main changes people are making are with parameters (attack, defense, etc).  Have you been able to add and take away djinn from the game?  Or give enemy attacks to players?  It might even be neat to come across a bunch of enemies who, at the time of battle, have the exact same stats and abilities as the players.  Are these things which are ultimately possible through hacking?
I recommend at least trying out the editor and see what it can do. Even if you're not looking to make your own GS hack, most of these questions would have already been answered if you had tried opening a GS ROM in it.

Quote from: Teawater on 01, January, 2014, 08:16:17 PM
Some info if you need it...

There is a VBA-SDL-H2 version I found on pokecommunity once, but didn't see a way to do breakpoint read or write.

Anyway, for SDL-H, the main commands you need to know are these:

bpr = Breakpoint Read
bpw = Breakpoint Write
bt = Breakpoint Thumb (I think there is a bug for this one in SDL-H, so I often like to use rtt instead. Which I forget if it too includes the bug or not.)(ba/rta? for Arm)
n = Execute next instruction
c = Continue execution

There are some other useful commands as well, but I wanted to say that the No$gba NDS debugger works a bit different. For one, it's not a command prompt, and you use [address]! for writes (only works when the value is actually changed, I thin, unlike SDL-H), and you use [address]? for reads...


So what are you trying to do in SDL-H anyway?
Hehe, thanks. Well, as for what I'm trying to do... I had taken another look at the exit editing tutorial and decided to see if I could use it to skip the whole intro when starting a new game in TLA, as well as setting the starting location. It seems like the entrance number can be used to initiate events, for example, the summary of the previous game is entrance 8 in room 0 (title), while the opening scene with Jenna, Kraden and Alex is initiated by going into entrance 99 of room... was it 5? It's the interior of Venus Lighthouse...

Anyway, I guess I also need to do the thing where the game changes the party leader to Felix, as playing through the game with Jenna causes some problems (and also is not what I wanted). Do you happen to know when/how this occurs?

Daddy Poi's Oily Gorillas

#16
@Point of GS Editor: In my opinion, even if you do know all the game data, having an editor could still be very useful. (When considering many things, including what Atrius's editor does not have.... Clearly, we all know that uncompressing data, and compressing data is too time consuming to do manually. Other useful concepts could be finding all function calls to a function, being able to reallocate space in the middle of data while keeping everything in order. (May require a scan to all code to update pointers.) And whatever else.


The intro scene in Venus Lighthouse is done in the Initialization section of Map Code, I believe, so you could zero out the entire cutscene if you wanted to. That would also give you plenty of space to turn on the debug mode freely, and call the function that switches your party leadeer to Felix.

From my Hacking Documentation. (The one posted here back in August.)

080ADDF0 = Party initialization?
080ADEF6 = Adds Felix
080ADEFC = Adds Jenna
080ADF02 = Innate Psynergies

080AE0DC = Set leader to Jenna.
080AE0E4 = This sets Jenna as the leader while in Venus Lighthouse (during title screen, but is reset again shortly after this)

080AE0F0 = Set leader to Felix, add Felix to party, remove Jenna and Sheba.
080AE0FA = This sets Felix as the leader while on Idejima (during title screen)
080AE0FE = This adds Felix to your party while on Idejima
080AE104 = This removes Jenna from your party
080AE10A = This removes Sheba from your party
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Thunder-squall

yup, cloning's the idea.  Like fighting Dittos (the pokemon).

Misery

Damn, why didn't I check the documentation right away? I'll keep that in mind from now on.

So, I found the following:
080D2AC0: Store r0 to 02000420 (room) (r0 = 00 at time of execution)
080D2AC8: Store r1 to 02000422 (entrance) (r1 = 08 at time of execution)

This takes the player to the prologue. But how do I find where these values are set in their respective registers? I can't execute instructions backwards...

Also, looked in r14 for the return address like you suggested earlier.
020086A5.
Looked in the GS map editor.
Instructions end at 020086A4.
Grrr... clearly, I must be missing something.

Daddy Poi's Oily Gorillas

#19
That's warping to Room 0, Door 8, yes. And the function you are looking at is the Warp To function as listed in the Hacking Documentation. All it does is set three RAM values. (Including those two) There may be other similar functions as well, but anyway.. This function is, ofcourse, called in Map Code, as you have shown. The arguments should be at 0200869C (r0=0) and 0200869E (r1=8) ...

When in the middle of a function, don't always rely on r14 giving you your insisted return address all the time, since when functions call other functions, functions usually push their return address into the stack. (And there are some functions that can use r14 as a normal variable, but it's not very common.)
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)