Need of an explanation of Breakpoints and ASM

Started by ricky23i, December 24, 2008, 12:47:01 AM

Previous topic - Next topic

ricky23i

What are they and how do i use them

Thanks! xwink

Igglyboo

A breakpoint pauses the cpu when an action is triggered and displays the registers and the dissasembly .
ASM is a low level programming language.
Breakpoints are fairly easy to use but ASM is extremely complicated.

There are 4 types of breakpoints.
Read, Write, Read/Write, and Execute.

Read will trigger when the address is being read from
Write will trigger when the address is being written to
Read/Write will trigger when the address is being read from or written to
Execute will trigger when the address runs as ASM

ricky23i

Quote from: Igglyboo on December 24, 2008, 12:54:41 AM
A breakpoint pauses the cpu when an action is triggered and displays the registers and the dissasembly .
ASM is a low level programming language.
Breakpoints are fairly easy to use but ASM is extremely complicated.

There are 4 types of breakpoints.
Read, Write, Read/Write, and Execute.

Read will trigger when the address is being read from
Write will trigger when the address is being written to
Read/Write will trigger when the address is being read from or written to
Execute will trigger when the address runs as ASM
Can you point me to a tutorial, thanks a lot. I am mostly interested in ASM

Igglyboo

Not really many tutorials out there, especially for PPC asm(ASM is processor specific, different languages for different processors).
I would suggest learning a language such as C or C++ before trying to tackle this(don't underestimate ASM, it is no easy feat).


brkirch

#5
Quote from: Romaap on December 24, 2008, 01:38:27 PM
http://wiird.l0nk.org/forum/index.php?topic=1454.0
http://wiird.l0nk.org/forum/index.php?topic=1505.0
Nothing against Black_Wolf, but these examples aren't very good ones.  The reason I say that is because the examples not only have not been tested and don't actually work, but are also very space inefficient and don't demonstrate a real situation (you can't just use whatever registers you want).  I'm also not sure how many people have this misconception, but safe registers to use are NOT registers that are equal to 00000000, they are registers that aren't read by any future ASM instructions before they are overwritten (you have to be able to determine with certainty that altering the register won't affect any subsequent instructions).

I would recommend these links though:
Quote from: kenobi on August 22, 2008, 06:18:05 PMAnd if you wanna learn asm, you can check :
http://hpcf.nersc.gov/vendor_docs/ibm/asm/alangref02.htm#wq2793
http://class.ee.iastate.edu/cpre211/labs/quickrefPPC.html
http://www.freescale.com/files/product/doc/MPCFPE32B.pdf


(and also here if you wanna start write your asm :
http://www.ibm.com/chips/techlib/techlib.nsf/techdocs/852569B20050FF77852569970071B0D6/$file/eabi_app.pdf)

Romaap

Yeah, but those tutorials helped me out a lot.

shadowofchaos

I was reading some of those ASM links and have gained a little understanding of how to use it...

However, how do you determine which registers are safe to use?

brkirch

Quote from: shadowofchaos on December 27, 2008, 11:26:42 AM
I was reading some of those ASM links and have gained a little understanding of how to use it...

However, how do you determine which registers are safe to use?

I already explained that:
Quote from: brkirch on December 24, 2008, 05:59:40 PM...they are registers that aren't read by any future ASM instructions before they are overwritten (you have to be able to determine with certainty that altering the register won't affect any subsequent instructions).

shadowofchaos

Sorry, I kind of didn't understand the first time I read it...

Basically, you have to determine that it won't be read twice? As in the instructions don't get read again by another ASM instance? (Sorry, I just need it in "laman's terms"... lol)

If that happens... you get a freeze?

Romaap

#10
you just have to make sure that no other ASM instruction will read that register between the moment you set it and the moment another ASM instruction will write to it again. (thanks brkirch)

It won't always freeze, it's a possibility though. It could just read the wrong value and weird things might happen.

brkirch

#11
Quote from: Romaap on December 27, 2008, 05:52:20 PM
you just have to make sure that no other ASM instruction will read that register between the moment you set it and the moment another ASM instruction will read it again.

It won't always freeze, it's a possibility though. It could just read the wrong value and weird things might happen.
Should be write to it.  If a register value is used for a register operation after you have changed it, bad things could happen, and those bad things can range from a freeze, to data corruption, or even the bricking of your Wii (not likely but possible).  Glitching is actually not that likely unless you mess up the floating point registers.

If you use a register rD, you want to make sure that the next instruction that follows your code and includes rD is using it as a destination register and not a source register (i.e. something like "xor rD,rA,rB" is okay, something like "xor rD,rA,rD" or "xor rB,rA,rD" is not because rD is one of the source registers for the operation).  For instructions with two or more operands (most of them) the destination register is the one on the left and the source register(s) are on the right. (and for store instructions such as stw, sth, and stb, both registers used are source registers)