Like all things once you learn how to do things, it looks easy. For the last 2 days I have been teaching myself basic assembly. Bear in mind my knowledge of assembly is almost 0. I will show you the code for the limit break bar in FF7, and explain why I cannot make it fill the needed amount of the graphic I created. I need the bar to be 147 (93) pixels long at limit break time.
Limit Var. Limit variable is the current state of a players limit bar. It is 1 byte long (0-255). 00 is empty, FF is full (limit break). The actual number sent to code below (at 006DD6A3 ) has 00 at the end (2 bytes). So FF becomes FF00.
006DD6A1 - 33 C0 - xor eax,eax
006DD6A3 - 66 8B 44 0A 1A - mov ax,[edx+ecx+1A]
006DD6A8 - 99 - cdq
006DD6A9 - 81 E2 FF030000 - and edx,000003FF
006DD6AF - 03 C2 - add eax,edx
006DD6B1 - C1 F8 0A - sar eax,0A
006DD6B4 - 50 - push eax
006DD6A1 - 33 C0 - xor eax,eax Makes eax equal 0.
006DD6A3 - 66 8B 44 0A 1A - mov ax,[edx+ecx+1A]Retrieves the 3 characters limit vars at each loop from an address created by edx+ecx+1A.
006DD6A8 - 99 - cdq This seems to change a number into 64 bit? But why is it here? See the edit.
006DD6A9 - 81 E2 FF030000 - and edx,000003FFEDX seems to be 0 by this point anyway? (well that might just because I can only see 32 bit addresses with this debugger) I need this explaining too.
006DD6AF - 03 C2 - add eax,edxNo idea what is going on here.
006DD6B1 - C1 F8 09 - sar eax,0AThis is the crunch code. It shifts the bits in eax 10 places to the right. So if a character has FF00 at this point (limit break) it will first look like this:
1111111100000000
which becomes : 00111111 (63). The reason it does this is to correct the limitvar number for use for the BAR GRAPHIC, which is precisely what I am trying to edit. So if a player has a limit break this is what happens>
FF00 becomes 3F, 3F is 63, so bar moves 63 pixels. I assume that is correct.
006DD6B4 - 50 - push eaxReflects changes on the bar graphic.
But here is the key question. How do I program this to make the bar 147 pixels at FF00? Well, you cant without knowing what the f*ck you are doing. And I don't. In a nice high level language you would just multiply limitvar by a nice number like 0.4 to make it around 100 at limit break time.
So... can anyone explain this to me in laymans terms or rewrite the code above so that it will do this?
Thanks
edit:
in fact I can nop 006dd6a8 to 006dd6b0 without anything changing. [l spiro has explained this... it is all just a rounding operation]