Posts: 183
Threads: 122
Joined: Mar 2018
Reputation:
36
08-11-2018, 03:44 PM
(This post was last modified: 04-03-2019, 08:17 PM by Star.)
(08-11-2018, 03:23 AM)420 Matt Wrote: I have a question regarding the C2 codetype. So do I need to end every C2 code with "60000000 00000000"? Or can I put the default RAM value for the first part of the last line? I know most C2 codes end in 60000000, but I have seen some ASM codes that don't end like that. EG: Bully's Invincibility hack.
All C2 codes end in 00000000. If there are an odd number of instructions, the final line of the code will be the last instruction and 00000000.
Example:
li r0, 0
C2000000 00000001
38000000 00000000
If there are an even number of instructions in the code, the final line of the code will be 60000000 00000000.
Example:
li r0, 0
li r0, 1
C2000000 00000002
38000000 38000001
60000000 00000000
This is done because the code handler replaces the 00000000 with a branch instruction going back to the next instruction you left off at. The nop is just a filler to properly align everything in memory, all it does is wait one CPU cycle (do nothing).
However, the ASM <-> WiiRD Converter will handle all of this for you.
Posts: 27
Threads: 1
Joined: Aug 2018
Reputation:
0
08-12-2018, 06:15 AM
(This post was last modified: 12-18-2019, 03:15 PM by Vega.)
Well, I guess you can say that I am making my own. Or at the least, just to see how working ASM codes function in the game. I know I may seem more experienced with codemaking than you think, but I am somewhat experienced overall. Like for example, I know how to make simple byte, halfword, and word RAM writes. With more advanced stuff like making sure a C2 code will work properly, is what I am unfamiliar with. I apologize if my noobness at this is annoying you. I feel like I have potential to make some great codes if I have the knowledge of this settled in.
Btw, I am replying to Vega. Sorry if this causes any confusion.
(08-11-2018, 03:44 PM)Star Wrote: (08-11-2018, 03:23 AM)420 Matt Wrote: I have a question regarding the C2 codetype. So do I need to end every C2 code with "60000000 00000000"? Or can I put the default RAM value for the first part of the last line? I know most C2 codes end in 60000000, but I have seen some ASM codes that don't end like that. EG: Bully's Invincibility hack.
A C2 code will end in 00000000 if there are an odd number of lines in the code.
Example:
li r0, 0
C2000000 00000001
38000000 00000000
If there are an even number of lines in the code, it will end in 60000000 00000000.
Example:
li r0, 0
li r0, 1
C2000000 00000002
38000000 38000001
60000000 00000000
This is done because the 00000000 instruction tells the code handler to branch back from where you came from. The nop is just a filler to tell the CPU to wait a cycle (do nothing).
However, the ASM <-> WiiRD Converter will do all of that for you.
Ah. I see. Makes more sense to me now. 1 last question, do I need to have the default RAM value as the last instruction? Before I add the nop or not, depending on the total amount of instructions my ASM code has.
Please note that I have read and studied how the gecko codetypes and PowerPC instructions work. Everything logically makes sense to me, but sometimes the small specifics of them get me confused.
Posts: 4,282
Threads: 901
Joined: Feb 2018
Reputation:
98
08-12-2018, 07:34 PM
(This post was last modified: 05-12-2019, 06:30 PM by Vega.)
No need to apologize about your 'noobness'. Everyone use to be a noob at one point. All we care about is that you take the time to read up any needed documentation and not be afraid to ask questions.
In regards to the default RAM value-- In MOST codes, it is needed. It all depends on what you are trying to accomplish with your ASM. If the game's original ASM function on said address is not needed for your code to execute correctly, then its not needed.
Last night I completed typing up this tutorial - http://mkwii.com/showthread.php?tid=830
It's still in rough draft/beta form. You will see lots of typos. When I get time, I will fix all the grammatical errors and add in screenshots as well.
Posts: 27
Threads: 1
Joined: Aug 2018
Reputation:
0
08-14-2018, 12:24 AM
(This post was last modified: 12-18-2019, 03:16 PM by Vega.)
(08-12-2018, 07:34 PM)Vega Wrote: No need to apologize about your 'noobness'. Everyone use to be a noob at one point. All we care about is that you take the time to read up any needed documentation and not be afraid to ask questions.
In regards to the default RAM value-- In MOST codes, it is needed. It all depends on what you are trying to accomplish with your ASM. If the game's original ASM function on said address is not needed for your code to execute correctly, then its not needed.
Last night I completed typing up this tutorial - http://mkwii.com/showthread.php?tid=830
It's still in rough draft/beta form. You will see lots of typos. When I get time, I will fix all the grammatical errors and add in screenshots as well.
Thanks for understanding and answering my question. I saw the tutorial actually. Seems easy to understand for me. The process just takes a while and is tedious, especially if you are trying this for the first time. Plus you need to be careful to make sure no mistakes are present. Otherwise 1 small hiccup could mess the whole thing up.
Posts: 32
Threads: 5
Joined: Aug 2018
Reputation:
0
So insert ASM codes don't count as lines of the code section above it? Just making sure.
Posts: 4,282
Threads: 901
Joined: Feb 2018
Reputation:
98
(10-30-2018, 02:41 PM)xXCrazySniperXx Wrote: So insert ASM codes don't count as lines of the code section above it? Just making sure.
The top line of an ASM code (C2/C0 line) doesn't count for the total lines of code designated by the code itself.
Example:
C2000000 0000000 4
39E00001 39C0000A
7C571378 7D107214
3FC08000 63DE1500
7FB8C850 00000000
The 4 means 0x4 amount of lines underneath. Number value is always in Hex. So 10 lines would show as 00000000A.
You never need to worry about this though when compiling ASM. The compiler does this for you. Don't even attempt ASM until you are seasoned enough with the gecko code documentation, and messing around with RAM fill/writes. Reread the Make Codes on Dolphin guide. Specifically Chapter 1.
Posts: 32
Threads: 5
Joined: Aug 2018
Reputation:
0
So.... does a nop just cancel a value out, or...?
Posts: 4,282
Threads: 901
Joined: Feb 2018
Reputation:
98
Posts: 4,282
Threads: 901
Joined: Feb 2018
Reputation:
98
Completely revamped the OP. Much much cleaner.
Posts: 32
Threads: 5
Joined: Aug 2018
Reputation:
0
11-07-2018, 03:35 PM
(This post was last modified: 12-18-2019, 03:16 PM by Vega.)
(11-06-2018, 05:35 PM)Vega Wrote: Completely revamped the OP. Much much cleaner.
yeah it looks so much better now. it looked good before though as well.
|