ASM Sleep Command

Started by live2play, April 17, 2010, 07:00:49 PM

Previous topic - Next topic

live2play

How would you create a sleep/wait in your ASM code?  I want to be able to wait a certain amount of time before my next ASM instruction is executed.  I have a button activated C2 code that has two commands.  The first changes one line of assembly to a new value and then the second changes that line immediately back to its original value.  Unfortunately, this renders the hack useless as the original assembly code is always executed.  So, if there were a way to delay my second C2 command's execution, that would be great.

dcx2

How are you doing your button activator?  Is it an if-equals code before the C2, or did you write assembly that loads/compares/branches based on the buttons?

I think what you're looking for is a counter of some sort.  There's an if code type with a built-in counter (CT5, CST4-7), you might be able to use that, but since you're using a C2 code, you might want to write some assembly that loads a counter from unused memory (like a Gecko Register).  Load the counter with a value, decrease that value by 1 each frame, compare to 0, if 0 then reset counter to max value and activate your second code.

You could also activating your first code if a button is down, and activating your second code if the button is up.

live2play

Can you show me the syntax for activating a code when a button is down and activating another code when it's up?

wiiztec

If you mean with ASM IDK but with ram writes it's

28LLLLLY 0000XXXX
code
28LLLLLZ NNNN0000
anticode
E0000000 80008000

L = button read address
Y = same as L
Z = (Y+1)
X = button combination
N = 2's complement negative of button combination
If there's any code at all that you want to be button activated, or even able to toggle on & off, and I have the game, just PM me and I'll make it happen

live2play

So, I could put C2 code after the 28LLLLLY 0000XXXX and 28LLLLLZ NNNN0000 codes, right?  Also if I'm using the wiimote 2 button with is 0000100, what would the 2's complement be for the NNNN section?  Would it be FEFF?

dcx2

code = your C2 code

anticode = the instruction your C2 code is replacing

Actually, it's not the 2's complement, it's the regular complement (flip the bits).  the 2's complement deals with signed integers (flip the bits and add 1).

That said, you are correct, 0100 -> FEFF is what you should use.  This way, when the button is held down, the first if is true, and your C2 code is executed.  When the button is not held down, the second if is true, and the original instruction replaces the C2 code, as if your code was never there.

live2play