• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
April 16, 2024, 01:51:40 pm

News:

Don't be hasty to start your own mod; all our FFT modding projects are greatly understaffed! Find out how you can help in the Recruitment section or our Discord!


ASM Lessons

Started by LastingDawn, December 12, 2008, 08:08:10 am

LastingDawn

December 12, 2008, 08:08:10 am Last Edit: December 22, 2008, 02:06:57 am by LastingDawn
Zodiac taught me the bare bone basics of ASM the other night, but... I can't say how well my ramblings will help in this matter...

Quote[06:12] <Zodiac> o hi thar
[06:12] <Zodiac> ASM Class #0
[06:12] <Lasting_Dawn> Thank you very much Zodiac, hopefully I haven't reached the apex of my "skills" already, well, we're about to find out.
[06:12] <Zodiac> Bitwise operands
[06:12] <Lasting_Dawn> A term long known to me, but one I know next to nothing about.
[06:12] <Zodiac> ahahah
[06:12] <Zodiac> it's not really complicated
[06:12] <Zodiac> you just have to get the hang of binary
[06:12] <Zodiac> can you convert binary to decimal or hex and vice versa?
[06:12] <Lasting_Dawn> Binary is where it's only 0 and 1, right?
[06:12] <Zodiac> yeah
[06:12] <Lasting_Dawn> With... a calculator, certainly.
[06:12] <Zodiac> no, you have to be able to do it manually else you won't be able to code asm
[06:12] <Lasting_Dawn> Oh, alright, let's see this then...
[06:12] <Zodiac> understanding is the key
[06:12] <Lasting_Dawn> Currently looking at a tutorial, I fear to say I never got this far in school.
[06:12] <Zodiac> each bit starting from the left can be worth the double the amount of the previous one
[06:12] <Lasting_Dawn> So... 11101 is...
[06:12] <Zodiac> like in ABCD (let's say this is a binary array) A = 8 or 0 (1;TRUE or 0;FALSE), B = 4/0, C = 2/0 and D = 1/0
[06:12] <Zodiac> of course now I'm converting to decimal ;o
[06:12] <Lasting_Dawn> B = 4 or 0, C = 2 or 0? Is that what you mean?
[06:12] <Zodiac> yeah, just shorter to type
[06:12] <Lasting_Dawn> Alright, I think I understand that part.
[06:12] <Zodiac> I forgot a slash meant "divide" ;o
[06:12] <Zodiac> okay then convert manually this 1101 1001
[06:12] <Lasting_Dawn> The split is important, right?
[06:12] <Zodiac> each set of 4 represents a nibble
[06:12] <Zodiac> the split is only for readability
[06:12] <Lasting_Dawn> Ah, alright, let's see here then...
[06:12] <Zodiac> just as in hex editor you see each byte separately
[06:12] <Lasting_Dawn> 1 = 1, 0 = 0, 0 =0, and 1 = 8?
[06:12] <Lasting_Dawn> Or... vice versa, in this case, as it may be?
[06:12] <Lasting_Dawn> All in all, that makes it 9?
[06:12] <Zodiac> you only calculated the first part
[06:12] <Lasting_Dawn> Alright, second part then.
[06:12] <Zodiac> this is a byte, continue with the other one
[06:12] <Lasting_Dawn> 1 + 4 + 8 = 13 which is... C?
[06:12] <Lasting_Dawn> Or is it D... that always throws me off.
[06:12] <Zodiac> it's C but I never asked for the answer in hex
[06:12] <Lasting_Dawn> Oh, I see. Alright, so just add them 9 + 13?
[06:12] <Zodiac> nope
[06:12] <Lasting_Dawn> Oh, still continue on, I see.
[06:12] <Lasting_Dawn> So the split doesn't split the equation, sorry about that.
[06:12] <Zodiac> only for readability
[06:12] <Zodiac> just like the decimal system: $3,140,599.95
[06:12] <Lasting_Dawn> Yep, just calculating it now.
[06:12] <Lasting_Dawn> 1 + 8 + 16 + 64 + 128 = 217?
[06:12] <Zodiac> yep
[06:12] <Lasting_Dawn> Phew, this is quite simple!
[06:12] <Zodiac> and can you quickly give me the answer in hex?
[06:12] <Zodiac> you already calculated the nibbles earlier
[06:12] <Lasting_Dawn> Not quickly, definitely not quickly, took me long enough to find it earlier.
[06:12] <Zodiac> I was considering the fact you already found C and 9
[06:12] <Lasting_Dawn> Oh, it doesn't come to C9 does it? That's a bit too low for...
[06:12] <Zodiac> wait it's a D
[06:12] <Lasting_Dawn> D9? That makes more sense.
[06:12] <Zodiac> lol anyway, we should be able to start with the bitwise operands now
[06:12] <Lasting_Dawn> So, finding parts of the nibbles, will give you the answer in hex?
[06:12] <Lasting_Dawn> So this is what Hex is based off of? These combined Binaries?
[06:12] <Zodiac> ya
[06:12] <Lasting_Dawn> Well I have to say... that answers a lot of questions at once.
[06:12] <Zodiac> hex is binary easier and faster to read for humans
[06:12] <Zodiac> as is octal
[06:12] <Lasting_Dawn> It makes good sense, I can see why you embrace it so.
[06:12] <Zodiac> but hex is more logical since each character uses 4 (2x2) bits
[06:12] <Lasting_Dawn> And that finally all makes sense to me, heh.
[06:12] <Zodiac> octal uses 3 bits, so characters range from 0-7 :/
[06:12] <Lasting_Dawn> Hmm, I've never heard of Octal used in video games, as far as I'm aware.
[06:12] <Zodiac> Ok so to proceed further on you'll need the Almighty... OPCODE FILEEEEEEEZZZ!!! http://zodiac.ffhacktics.com/PSX-INST.txt
[06:12] <Lasting_Dawn> Oh... very nice.
[06:12] <Lasting_Dawn> Alright, I knew a few of these, but the other's are brand new to me.
[06:12] <Zodiac> rd = register(destination); rs = register(source); rt = register (temp, used as source too); immed. = immediate
[06:12] <Zodiac> to be honest I don't think I know more than 2/3
[06:12] <Zodiac> and only a few are used commonly
[07:12] <Lasting_Dawn> Alright, so rd is basically where the data goes, rs is the source of the data and rt, only temporarily stores things?
[07:12] <Lasting_Dawn> No, rd is where the data Ends up?
[07:12] <Zodiac> rt is the same as rs
[07:12] <Zodiac> ADD rd, rs, rt
[07:12] <Zodiac> rd = rs+rt
[07:12] <Lasting_Dawn> Addword, is adding four bytes to a specified location?
[07:12] <Zodiac> addword!?
[07:12] <Zodiac> ADD means ADDITION
[07:12] <Lasting_Dawn> Oh, heh, my mistake...
[07:12] <Zodiac> do you know what is an immediate?
[07:12] <Lasting_Dawn> Something that takes place... immediately?
[07:12] <Zodiac> well that's good for starters
[07:12] <Lasting_Dawn> Or has first priority?
[07:12] <Zodiac> in asm it is simply a value set in the opcode itself and that isn't loaded from a register
[07:12] <Zodiac> ADDI rt, rs, immed
[07:12] <Zodiac> ADDITION IMMEDIATE
[07:12] <Zodiac> an example of this would be r2, r3, 0x0001
[07:12] <Zodiac> r2 = r3+1
[07:12] <Lasting_Dawn> Ah, alright, that makes sense, whenever I saw r2, r3, I thought they were different storage areas.
[07:12] <Lasting_Dawn> Seems I was quite wrong.
[07:12] <Zodiac> you can freely use 32 registers
[07:12] <Zodiac> r0 to r31
[07:12] <Zodiac> half exception to this is r0 , which is ALWAYS 0
[07:12] <Lasting_Dawn> And what is the functions of the registers? To move data around the ram?
[07:12] <Zodiac> with the help of opcodes it controls everything
[07:12] <Lasting_Dawn> opcodes are the main functions of the game, allowing everything to work in unison?
[07:12] <Zodiac> registers hold the values set and modified by the opcodes
[07:12] <Zodiac> like the game would load the unit's PA in r2, and load the Weapon's WP in r3
[07:12] <Lasting_Dawn> Only one register per function?
[07:12] <Zodiac> no
[07:12] <Zodiac> there can be up to 1 destination register and 2 source registers per opcode
[07:12] <Zodiac> ADD is an example of this
[07:12] <Zodiac> ADD rd, rs, rt
[07:12] <Zodiac> rd = destination; rs/rt = source
07:12] <Lasting_Dawn> The three you just mentioned then?
[07:12] <Zodiac> yeah...
[07:12] <Lasting_Dawn> That didn't come out right, but I can't recall my original thought.
[07:12] <Zodiac> to go back with my example  r2 = 0000000A (10PA) and r3 = 0x0000000F (15WP) then it would use MULT r2, r3 (MULTIPLY)
[07:12] <Lasting_Dawn> Oh, for the normal weapon attack of a sword, for instance?
[07:12] <Zodiac> then it would use MFLO r2 (I'll explain this later, it means move from low where the result is stored)
[07:12] <Zodiac> yeah
[07:12] <Lasting_Dawn> Alright, I think I understand that.
[07:12] <Zodiac> so after those 2 opcodes r2 = 0x00000096
[07:12] <Zodiac> r3 = 0x0000000F because nothing was written there in the process
[07:12] <Zodiac> the value in that register was only read
[07:12] <Lasting_Dawn> Read, but nothing was written.
[07:12] <Zodiac> well exxcept of coruse when it loaded the byte for WP
[07:12] <Zodiac> typo x2*
[07:12] <Lasting_Dawn> Ah, true. I think I understand that, so the WP would still stay loaded, as long as r3 hasn't been rewritten too?
[07:12] <Zodiac> immediates are simple word values (2 bytes) that holds static values, it can be used for counters and loads of other things
[07:12] <Zodiac> yes
[07:12] <Lasting_Dawn> For instance, it's what the game is loading for the WP and PA of character's and the like? Is that the reason that stats (except HP) don't change in the actual battle itself?
[07:12] <Zodiac> most of the registers still hold values of previous routines even after the current one is completed
[07:12] <Lasting_Dawn> Ah, is there any reason why this is?
[07:12] <Zodiac> well yes, sometimes you want to carry over the values
[07:12] <Zodiac> and anywaythe game doesn't know what is a routine
[07:12] <Zodiac> it simple follows the code
[07:12] <Lasting_Dawn> So best to just keep that data loaded in case the game needs it again?
[07:12] <Zodiac> we only call a routine a segment  of code that is called in different circustances
[07:12] <Zodiac> yes precisely
[07:12] <Lasting_Dawn> I think I undersand that now.
[07:12] <Lasting_Dawn> understand*
[07:12] <Zodiac> registers are d-words or integer(as soul would say)
[07:12] <Lasting_Dawn> Ah, so that's what integers are... I only knew them as double words, which is... 8 bytes?
[07:12] <Zodiac> they can hold values of 4 bytes and depending of the opcodes the value can be signed or unsigned
[07:12] <Lasting_Dawn> 64 bits?
[07:12] <Lasting_Dawn> Oh, so they're four bytes and 32 bits?
[07:12] <Zodiac> yeah
[07:12] <Zodiac> a word is 2 bytes
[07:12] <Lasting_Dawn> Oh right... heh, my mistake.
[07:12] <Zodiac> LB      Load Byte         LB      rt, off(base)   rt = memory[base+off] 8 bit
[07:12] <Zodiac> LBU      Load Byte Unsigned      LBU      rt, off(base)   rt = memory[base+off] 8 bit
[07:12] <Zodiac> LB loads values in the register signed as default
[07:12] <Zodiac> as a register is a d-word, -1 is represented as 0xFFFFFFFF
[07:12] <Zodiac> for a byte, it's the same 0xFF
[07:12] <Lasting_Dawn> So only with d-words, can they're be negatives?
[07:12] <Lasting_Dawn> there*
[07:12] <Zodiac> technically speaking you could say that as only opcodes determine if the data will be loaded as signed or unsigned
[07:12] <Zodiac> so let me should you the difference, for a byte holding 0xF0
[07:12] <Zodiac> LBU would become 0x000000F0
[07:12] <Zodiac> on the other hand LB would become 0xFFFFFFF0
[07:12] <Lasting_Dawn> So if it's unsigned, it's always negative?
[07:12] <Lasting_Dawn> No, that seems wrong...
[07:12] <Zodiac> 0xF0 is either worth 240 or -15 depending if it's loaded as sgiedn or unsigned
[07:12] <Lasting_Dawn> unsigned reverses the order?
[07:12] <Zodiac> signed = half values are positives and other half are negative
[07:12] <Zodiac> unsigned = all values are positive
[07:12] <Lasting_Dawn> So, values far beyond 65,535 are possible?
[07:12] <Zodiac> 4,294,967,299 possible values
[07:12] <Lasting_Dawn> Hah, well that's quite a bit...
[07:12] <Zodiac> 4,294,967,296*
[07:12] <Zodiac> 65536*65536 ;o
[07:12] <Lasting_Dawn> So if it's signed, the first word is negative, the second word is positive?
[07:12] <Lasting_Dawn> If it's not signed, they're all positive?
[07:12] <Zodiac> wrong for signed
[07:12] <Zodiac> there is only one word
[07:12] <Lasting_Dawn> Right, right, 4 bytes = one word?
[07:12] <Zodiac> for a word if the value is on the first half, 0x0000 to 0x7FFF, then the value will always be positive no matter what
[07:12] <Zodiac> 2 bytes = word
[07:12] <Lasting_Dawn> But, what you posted has 4 bytes, if I'm not mistaken...
[07:12] <Zodiac> yes, I posted them loaded into registers
[07:12] <Lasting_Dawn> Oh, I see.
[07:12] <Zodiac> with LW and LWU for a word of 0x7FFF, both registers will become 0x00007FFF
[07:12] <Zodiac> as 0x7FFF is a positive value signed, as well as unsigned
[07:12] <Lasting_Dawn> So, regardless of any case, it wouldn't matter if it were signed or unsigned?
[07:12] <Zodiac> exactly
[07:12] <Lasting_Dawn> Ah, alright.
[07:12] <Zodiac> whoever 0x8000 is the start of the other half
[07:12] <Zodiac> while 0x7FFF is the highest positive value of a signed word,
[07:12] <Zodiac> 0x8000 is the lowest negative one
[07:12] <Zodiac> 0x7FFFF = 32767 and 0x8000 = -32768
[07:12] <Lasting_Dawn> So it is -65,536?
[07:12] <Lasting_Dawn> Oh, only half of that.
[07:12] <Lasting_Dawn> I see.
[07:12] <Zodiac> yes, no matterr waht a word can only hold 65536 values :P
[07:12] <Lasting_Dawn> Heh, sorry for that dumb spell.
[07:12] <Lasting_Dawn> So what does this mean? Did those three bytes mean anything?
[07:12] <Lasting_Dawn> Or was it just a test?
[07:12] <Zodiac> just to see if you understood
[07:12] <Zodiac> because you have to understand, phailure is not tolerated
[07:12] <Lasting_Dawn> I think I do now... for the most part.
[07:12] <Zodiac> AND      And            AND      rd, rs, rt
[07:12] <Zodiac> bitwise operand #1! AND
[07:12] <Zodiac> and compares two values (two registers in the case of AND) and stores the value in the destination register
[08:12] <Lasting_Dawn> Which value does it store?
[08:12] <Lasting_Dawn> Both of them?
[08:12] <Zodiac> it compares each bit of each value in pairs and if both bits are TRUE, the result is TRUE
[08:12] <Zodiac> else, FALSE
[08:12] <Zodiac> rd = rs AND rt
[08:12] <Lasting_Dawn> Ah, so IF it does not equal it THEN false?
[08:12] <Zodiac> it compares bits one by one
[08:12] <Zodiac> not the whole values
[08:12] <Lasting_Dawn> So anything with a 00 is automatically false, while anything with 01 or 11, or 10 is true?
[08:12] <Zodiac> I'll show you a small example
[08:12] <Zodiac> 1001 AND 1110
[08:12] <Lasting_Dawn> They're both true, right?
[08:12] <Zodiac> the answer isn't just TRUE or FALSE
[08:12] <Zodiac> if we take the first column of bits, they're 1/1
[08:12] <Zodiac> the result is TRUE (1)
[08:12] <Zodiac> then the second one
[08:12] <Lasting_Dawn> Ah, one is true, one is false?
[08:12] <Zodiac> 0/1, only one is TRUE, therefore the result is FALSE
[08:12] <Zodiac> same for the third one and the last one is 0/0
[08:12] <Zodiac> 1001 AND 1110 = 1000
[08:12] <Lasting_Dawn> False, True, False, False?
[08:12] <Zodiac> true, false, false, false
[08:12] <Lasting_Dawn> But how does it equal that? Does true just automatically go to the front?
[08:12] <Zodiac> no
[08:12] <Lasting_Dawn> Oh, right, combined...
[08:12] <Lasting_Dawn> I see now.
[08:12] <Zodiac> when it compares the fith bit, it will compare each 5th bit
[08:12] <Zodiac> and store the answer in the 5th bit
[08:12] <Zodiac> so try this one 1110 AND 1011
[08:12] <Lasting_Dawn> True, False, False, True (if read from right to left) making it... 0110?
[08:12] <Zodiac> nope
[08:12] <Zodiac> explain how you did it
[08:12] <Lasting_Dawn> Well, the fifth bit was True, but the sixth was False, thereby making it false. the seventh bit was true and so was the eighth, which would make it true,  the first bit is true and so is the second, making that pair true, but third and fourth bit are false, thereby making them false. Since you saiid the answer is stored in the fifth bit, and since the pair was false, that would make a 0, the second part of that sequence would... oh, I see where I went wrong.
[08:12] <Lasting_Dawn> No wait... no I don't. the second part of the sequence would be false., the third sequence is true, making it...
[08:12] <Lasting_Dawn> 1010
[08:12] <Zodiac> ya
[08:12] <Zodiac> break time, 10min
[08:12] <Lasting_Dawn> Ah, alright. I see how that goes now.
[08:12] <Lasting_Dawn> Alright.
[08:12] <Zodiac> resume?
[08:12] <Lasting_Dawn> Alright.
[08:12] <Lasting_Dawn> Took the time to copy and paste the whole of our conversation into a notepad, thus far.
[08:12] <Zodiac> don't copy this line X_X (Voldemort is gay)
[08:12] <Lasting_Dawn> I can't promise anything... heh.
[08:12] <Zodiac> anyway it's been 10min so do it AGAIN: 1001 0111 AND 0011 0110
[08:12] <Lasting_Dawn> Alright, the first one is 0100 the second one is 0001?
[08:12] <Zodiac> not even close
[08:12] <Lasting_Dawn> Wow, I've degraded in the past ten minutes, let me not try to rush...
[08:12] <Zodiac> 1001 0111
[08:12] <Zodiac> 0011 0110
[08:12] <Zodiac> does that help?
[08:12] <Lasting_Dawn> A bit.
[08:12] <Lasting_Dawn> Rigt forgot to reverse... I see where I went wrong.
[08:12] <Zodiac> reverse? you can do it just directly
[08:12] <Lasting_Dawn> Wow, I must have some mental problem or something... this should be 1000 and... 0010?
[08:12] <Zodiac> not at all
[08:12] <Zodiac> so what are you doing?
[08:12] <Lasting_Dawn> Oy... what am I doing wrong here? Fifth bit is false, sixth bit is true, thereby false... seventh and eight are true, thereby true... first is true, second is false, thereby false, third is false and fourth is true, thereby false...
[08:12] <Lasting_Dawn> False, False, True, False... hmm...
[08:12] <Lasting_Dawn> 0010, for the first one...?
[08:12] <Lasting_Dawn> Oy, combining the two...
[08:12] <Lasting_Dawn> False, True, False, False, it's 0100... as far as I can figure.
[08:12] <Zodiac> I'm not even sure what you're doing but I can tell it's wrong
[08:12] <Lasting_Dawn> Oh, did you want me to add them up, or give you the decimal numbers?
[08:12] <Zodiac> 1001 0111
[08:12] <Zodiac> 0011 0110
[08:12] <Zodiac> 0001 0110
[08:12] <Zodiac> last line is the result
[08:12] <Zodiac> if the bits in each value are TRUE, the result is TRUE, else FALSE
[08:12] <Lasting_Dawn> Yes, I have that much... what was I doing wrong?
[08:12] <Zodiac> what were you doing to begin with?
[08:12] <Lasting_Dawn> Oh, I see... what was I reading? I was starting from the fifth bit and onwards.
[08:12] <Zodiac> huh?
[08:12] <Lasting_Dawn> That I started with 0 false, 1 true, = 0 false, then to seven and eight, which was true, and true, which was true.
[08:12] <Lasting_Dawn> I forgot to just read them straight. I'm really not sure what I was thinking.
[08:12] <Zodiac> can you try this one? 1101 1010 AND 0010 0111
[08:12] <Lasting_Dawn> 1000 and 0001?
[08:12] <Zodiac> there is ONE answer
[08:12] <Zodiac> stop splitting
[08:12] <Lasting_Dawn> Bah! Right, I completely forgot about that step... I'm really not sure what I was thinking.
[08:12] <Zodiac> step? there is only one thing to do AFAIK :/
[08:12] <Lasting_Dawn> So the answer is 0001?
[08:12] <Lasting_Dawn> No, wait...
[08:12] <Lasting_Dawn> One is true, one is false, thereby false, both of the other's are false, thereby false, and the second set is false as well as the fourth...
[08:12] <Lasting_Dawn> 0000?
[08:12] <Zodiac> I gave you 2 sets of 8 bits, the answer should be 8bits
[08:12] <Lasting_Dawn> 10000001?
[08:12] <Lasting_Dawn> So... this isn't a decimal answer?
[08:12] <Zodiac> wrong again, okay, what is the first bit of each set?
[08:12] <Lasting_Dawn> 1 and 0
[08:12] <Zodiac> I,ve only posted in binary when it related to binary stuff yet
[08:12] <Zodiac> so FALSE, next bits?
[08:12] <Lasting_Dawn> Oh, I do apologize, I had thought this was a review, I hadn't realized this part was new, sorry I think I have it.
[08:12] <Zodiac> it isn,t new :/
[08:12] <Lasting_Dawn> 00000010
[08:12] <Lasting_Dawn> Wrong, no doubt, hmm...
[08:12] <Zodiac> why? it's the right answer
[08:12] <Lasting_Dawn> Oh, alright. So I understand that part now.
[08:12] <Lasting_Dawn> At first I thought we were just doing before the break,
[08:12] <Lasting_Dawn> Understand, that answer I gave before the break was given through misconstrued means, just a lucky "guess" based on incorrect reasoning.
[08:12] <Zodiac> ah
[08:12] <Lasting_Dawn> Heh, eh well. confusion gone.
[08:12] <Lasting_Dawn> I should be able to proceed.
[08:12] <Zodiac> 1110 1011
[08:12] <Zodiac> 0101 0101
[08:12] <Zodiac> last one
[08:12] <Lasting_Dawn> 10100101?
[08:12] <Zodiac> not at all
[08:12] <Lasting_Dawn> Wow, I feel like a dunce...
[08:12] <Zodiac> the first line is the first value and the second one is the second value
[09:12] <Zodiac> I think you,re comparing the 4 first bits on the line with the 4 last ones
[09:12] <Lasting_Dawn> Oh, I see.
[09:12] <Lasting_Dawn> 01000001?
[09:12] <Zodiac> yeah
[09:12] <Lasting_Dawn> Alright, that makes sense now.
[09:12] <Lasting_Dawn> Of course... I just said that...
[09:12] <Lasting_Dawn> And ended up...
[09:12] <Lasting_Dawn> Screwing up, heh.
[09:12] <Zodiac> heh
[09:12] <Zodiac> and you should try putting spaces every 4 bits
[09:12] <Zodiac> just as you should put 0x or $ before hex numbers
[09:12] <Lasting_Dawn> Alright, I''ll keep that in mind.
[09:12] <Lasting_Dawn> $?
[09:12] <Lasting_Dawn> Any difference from 0s?
[09:12] <Lasting_Dawn> 0x*
[09:12] <Zodiac> in most programming languages it is used to design hex numbers
[09:12] <Lasting_Dawn> Ah, well so all $ this means is ox?
[09:12] <Lasting_Dawn> 0x*
[09:12] <Zodiac> it's a zero, not a o
[09:12] <Lasting_Dawn> Yes, I know, that's a common mistake of mine.
[09:12] <Zodiac> makes me wonder who's the retard that made 0 a number and O a letter
[09:12] <Zodiac> 1 and l are too similar as well
[09:12] <Lasting_Dawn> They are... exactly alike on paper, except 0's a little more oval looking.
[09:12] <Lasting_Dawn> I have to say, I never noticed the similarity between l and 1... until you just mentioned it.
[09:12] <Zodiac> with some fonts there is no difference
[09:12] <Lasting_Dawn> Hah...
[09:12] <Zodiac> as for me I always put more detail into my ones, a habit
[09:12] <Lasting_Dawn> Into l?
[09:12] <Zodiac> 1
[09:12] <Zodiac> I draw the base and the little thingy at the top
[09:12] <Lasting_Dawn> Ah, definitely an odd habit.
[09:12] <Zodiac> let's move to OR
[09:12] <Lasting_Dawn> Certainly, I'm ready.
[09:12] <Lasting_Dawn> Or... hmm, always wondered how this works.
[09:12] <Zodiac> with AND; 1/1 = 1 else 0
[09:12] <Lasting_Dawn> Same case with OR?
[09:12] <Zodiac> with OR; 0/0 = 0 else 1
[09:12] <Lasting_Dawn> Ah.
[09:12] <Lasting_Dawn> Alright.
[09:12] <Zodiac> the opposite
[09:12] <Zodiac> or in other terms, as long as there is one bit true, the answer is true
[09:12] <Lasting_Dawn> Understood.
[09:12] <Zodiac> think you can give it a shot right now?
[09:12] <Lasting_Dawn> Yep.
[09:12] <Zodiac> 1110 1011
[09:12] <Zodiac> 0101 0101
[09:12] <Zodiac> same as last :P
[09:12] <Lasting_Dawn> Ah, but there is a Jump Return, isn't there?
[09:12] <Lasting_Dawn> Nope, there is not... not on this list anyhow.
[09:12] <Zodiac> then MOST of the time, to end routine a JR r31 will be there
[09:12] <Lasting_Dawn> So ending a routine requires using r31?
[09:12] <Zodiac> yes because JAL stores the current position in r31 before moving to the routine
[09:12] <Lasting_Dawn> Alright, I think I understand that part.
[09:12] <Zodiac> now that you know what JAL does, DON'T USE IT
[09:12] <Lasting_Dawn> Oh?
[09:12] <Zodiac> chances are, you're already in a routine, and that would mean r31 already has a return offset
[09:12] <Lasting_Dawn> Therefore it would screw something up?
[09:12] <Zodiac> if you were to use JAL, it would overwrite it with the current location
[09:12] <Zodiac> and it would never go back from where it came
[09:12] <Lasting_Dawn> Ouch... reload at that point?
[09:12] <Zodiac> chances of freezing are almost guaranteed
[09:12] <Zodiac> yeah maybe reload, that's quite rare with me though lol
[09:12] <Lasting_Dawn> Hmm, so avoid using JAL for most cases.
[09:12] <Zodiac> I get about 60% freeze, 30% crash, 10% resert
[09:12] <Zodiac> reset*
[09:12] <Lasting_Dawn> That's right.. the game sometimes resets itself?
[09:12] <Zodiac> yeah
[09:12] <Zodiac> pretty rare though
[09:12] <Zodiac> I hate when it crashes
[09:12] <Zodiac> have to reload the emulator and the debugger :/
[09:12] <Lasting_Dawn> That requires shutting out of the sys... yeah.
[09:12] <Zodiac> so... if you didn't guess it already JUMP just, well JUMPS
[09:12] <Lasting_Dawn> Yep, jumps to a point somewhere in the 256 MB range?
[09:12] <Zodiac> well the only problem is...
[09:12] <Zodiac> the PSX has 2mb RAM
[09:12] <Zodiac> not 256
[09:12] <Zodiac> it will probably just crash if you try to go that far :D
[10:12] <Souylsin> There's different types of branches
[10:12] <Souylsin> theres
[10:12] <Souylsin> BNE
[10:12] <Souylsin> which is
[10:12] <Souylsin> Branch not Equal
[10:12] <Souylsin> so
[10:12] <Souylsin> BNE T2,T3,target
[10:12] <Lasting_Dawn> If t2 doesn't equal t3, then...?
[10:12] <Souylsin> IF T2 doesnt equal T3 then jump to targt
[10:12] <Souylsin> target*
[10:12] <Souylsin> Yes!
[10:12] <Souylsin> Exactly that
[10:12] * Cadet19 is now known as Kokojo
[10:12] <Souylsin> simple, right?
[10:12] <Lasting_Dawn> Ah, alright. but there must be quite a few minutae that use that for many, many things?
[10:12] <Souylsin> yeah
[10:12] <Lasting_Dawn> I'll keep that in mind, it is pretty simple.
[10:12] <Kokojo> hey souylsin, sorry if thats totally random, but is it some sort of choice ? (yes, i din't follow, but i want to know something about choices in FFT)
[10:12] <Souylsin> wut
[10:12] <Souylsin> ok
[10:12] <Souylsin> Generally all branches are just IF statements/commands
[10:12] <Souylsin> in asm form
[10:12] <Souylsin> :D
[10:12] <Souylsin> ZODIAC HOW ARE THOSE HARD TO TEACH
[10:12] <Lasting_Dawn> Alright I think I have those.
[10:12] * Souylsin facepalmfacepalmfacepalmfacepalm
[10:12] <Zodiac> not my fault if the others understands everything but branches and it's the exact opposite with LD
[10:12] <Souylsin> ku bad teacherz
[10:12] <Souylsin> btw i recommend n64 opcode listz
[10:12] <Souylsin> fo u zodiac
[10:12] <Zodiac> Souylsin NOT cool NOR awesome
[10:12] <Lasting_Dawn> Heh... I did a bit of experiementing with them (unknowingly...) in my Zelda hacking days, so I know a slight bit about them, therefore it came easy.
[10:12] <Cheetah> are you saving all this stuff too LD?
[10:12] <Lasting_Dawn> On here...? I probably should.
[10:12] <Zodiac> ya do it
[10:12] <Souylsin> Zodiac: gogogo http://www.zophar.net/fileuploads/2/106 ... 4ops03.txt
[10:12] <Souylsin> syscall gogogo
[10:12] <Souylsin> what im interested in is how it allocates space for stuff
[10:12] <Lasting_Dawn> Oh it is right here, very nice.
[10:12] <Cheetah> yeah, plus those two links, and then upload it all in a new ASM thread
[10:12] <Lasting_Dawn> Alright, I'll do that then.
[10:12] <Souylsin> CACHE    op,offset(base)  CACHE <--- looks cool
[10:12] <Lasting_Dawn> CACHE? I don't recall that...
[10:12] <Lasting_Dawn> Not in the PSX version.
[10:12] <Souylsin> probably isnt in it
[10:12] <Lasting_Dawn> of... wait... I thought N64 and PSX had the same ASM?
[10:12] <Souylsin> probably n64 specific
[10:12] <Zodiac> cuz PSX is OUTDATED
[10:12] <Souylsin> OH ZODIAC
[10:12] <Souylsin> Have you taught floating point instructions
[10:12] <Souylsin> yety
[10:12] <Souylsin> yet&
[10:12] <Zodiac> no
[10:12] <Zodiac> never used them
[10:12] <Souylsin> LOL GOOD LUCK
"Moment's anger can revert to joy,
sadness can be turned to delight.
A nation destroyed cannot be restored,
the dead brought back to life."

Art of War

Beta & Gretchen Forever!!!!

Vanya

December 12, 2008, 12:53:20 pm #1 Last Edit: December 31, 1969, 07:00:00 pm by Vanya
Thanks for posting this, LD! ^_^
I only read the first half, but I learned a lot already.
To be honest it's just what expected from MIPS.
Much more complex than 6502 ASM. I only get 2 registers on the NES. =P
On the other hand it allows the programmer to do a lot more. ^_^
I Hope you post more of these.
The more ppl we have working on the ASM problems we come up with the better!
  • Modding version: Other/Unknown
¯\(°_0)/¯

DarthPaul

December 12, 2008, 12:58:16 pm #2 Last Edit: December 31, 1969, 07:00:00 pm by darthpaul
This will definitely help people......then again I already understood 85% of it lol :)
Oh pitiful shadow lost in the darkness, bringing torment and pain to others. Oh damned soul wallowing in your sin, perhaps...it is time to die

Vanya

December 12, 2008, 01:07:14 pm #3 Last Edit: December 31, 1969, 07:00:00 pm by Vanya
I wish I did already. I only consider myself 60% good at 6502. I've got a ways to go yet. Fucked up part is I could recreate most of the FFT engine in like a week if I did it in GameMaker with GML only. =P
  • Modding version: Other/Unknown
¯\(°_0)/¯

DarthPaul

December 12, 2008, 01:09:18 pm #4 Last Edit: December 31, 1969, 07:00:00 pm by darthpaul
I don't think I could do it in a timely manner so you beat me there Vanya, but I did learn from this so it was a worth while read despite its length.
Oh pitiful shadow lost in the darkness, bringing torment and pain to others. Oh damned soul wallowing in your sin, perhaps...it is time to die

Vanya

December 12, 2008, 01:20:00 pm #5 Last Edit: December 31, 1969, 07:00:00 pm by Vanya
I agree. ^_^
  • Modding version: Other/Unknown
¯\(°_0)/¯

Xifanie

December 12, 2008, 03:33:29 pm #6 Last Edit: December 31, 1969, 07:00:00 pm by Xifanie
Class #0 was about learning the ASM basics. The few things I didn't have time to explain will be explained in the next class.

Class #1 will focus mainly on learning on how to use the tools provided and Class #2 will be hax0ring.

Stay tuned biatchez.
  • Modding version: PSX
Love what you're seeing? https://supportus.ffhacktics.com/ 💜 it's really appreciated

Anything is possible as long as it is within the hardware's limits. (ie. disc space, RAM, Video RAM, processor, etc.)
<R999> My target market is not FFT mod players
<Raijinili> remember that? it was awful

DarthPaul

December 12, 2008, 04:00:42 pm #7 Last Edit: December 31, 1969, 07:00:00 pm by darthpaul
Can't wait for class 2 so I can see where my hax0ring is going wrong.
Oh pitiful shadow lost in the darkness, bringing torment and pain to others. Oh damned soul wallowing in your sin, perhaps...it is time to die

Vanya

December 12, 2008, 04:32:47 pm #8 Last Edit: December 31, 1969, 07:00:00 pm by Vanya
Me, too. I really want to lend a hand in all this and so few ppl are willing to teach. Much props to you 1337 haxx0r z0D14k!! ^_^
  • Modding version: Other/Unknown
¯\(°_0)/¯

nates1984

December 12, 2008, 07:23:04 pm #9 Last Edit: December 31, 1969, 07:00:00 pm by nates1984
Begin random question in ASM topic:

Some registries are assigned to sprites, that's why there's a limitation on how many different ones can be included in each battle.

The fix would be to rewrite everything, formulas or whatever else is stored into registries, so that say registry 6, or 6-12 (whatever) isn't used anymore, then it could be assigned to a sprite. Then you could increase the number of sprites allowed in a battle by sacrificing something somewhere else.

In short: time consuming and never gonna happen?

Is this win? Y/N

I have heard the sprite limitation is due to the RAM, so you're basically working within a system where the amount of space is determined beforehand. Registries are basically there to say what to load into the RAM, what to do with it, ect? You could increase the RAM, but you'd have to increase the amount of allowable registries to take advantage of it?

Or am I totally off base on all counts?

During a battle, some registries are used for character sprites, map files, ect. So the formulas for damage and what-not are going in and out of certain registries, as are animation instructions and other things.

Do formulas use shared values? Like is there information there for PA, and multiple formulas call that same PA piece for use? Or, I should say, each characters PA is stored in the registers in a fight. Then a formula will call for that characters PA, but doing it using the same PA value instruction, so changing the PA value to MA would make more then just that one formula use MA instead of PA?

Cheetah

December 12, 2008, 07:54:47 pm #10 Last Edit: December 31, 1969, 07:00:00 pm by Cheetah
So sweet, keep posting these please :).
Current Projects:

Vanya

December 13, 2008, 01:05:48 am #11 Last Edit: December 31, 1969, 07:00:00 pm by Vanya
Quote from: "nates1984"Begin random question in ASM topic:

Some registries are assigned to sprites, that's why there's a limitation on how many different ones can be included in each battle.

ok. i'M DRUNK OFF OF WODKA, BUT i KNOE THIS MUCH1 YOUR FISRT STATEMENT IS ERRONEOUS.

sPRITES ARE HELD IN ram NOT REGISTRIES. tHE LIMIT OF THE NUMBER OF SPRITES HAS TO DO WITH THE pLAYSTATIONS'S LIMITED VIDEO ram. PPL CRITISIZED THE SYSTEM FOR IT'S LIMITED VIDEO RAM FOR A LONG TIME. iT HAD LESS VIDEO RAM THAN THE snes, Iirc.

sO. TO GO BEYOND IT'S LIMITED VIDEO ram YOU'D HAVE TO PROGRAM A SPECIAL emulator to use more video RAM.

^_^
  • Modding version: Other/Unknown
¯\(°_0)/¯

The Damned

December 13, 2008, 01:34:06 am #12 Last Edit: December 31, 1969, 07:00:00 pm by The Damned
Thank you very much, both LastingDawn and Zodiac. As the latter knows, I had been meaning to learn this in an attempt to help out with it.

I pretty much understood everything up to the base 2 and base 16 part, but after that, I got lost, maybe because I didn't click on the link. Oh well, it's probably better for me to read it tomorrow anyway since I just got back from work and I've been tired all day.
"Sorrow cannot be abolished. It is meaningless to try." - FFX's Yunalesca

"Good and evil are relative, but being a dick cannot be allowed." - Oglaf's Thaumaturge in "The Abyss"

"Well, see, the real magic isn't believing in yourself. The real magic is manipulating people by telling them to believe in themselves. The more you believe, the less you check facts."  - Oglaf's Vanka in "Conviction"

Vanya

December 13, 2008, 02:16:23 am #13 Last Edit: December 31, 1969, 07:00:00 pm by Vanya
thee tutorils have the potential to boost the community into a golden age. They are very appreciated!! ^_^
  • Modding version: Other/Unknown
¯\(°_0)/¯

BeoulveBlack

December 13, 2008, 12:08:46 pm #14 Last Edit: December 31, 1969, 07:00:00 pm by BeoulveBlack
oh boy.... my head's spinning after the first half. i'll finish reading it when i get back from work; i'm excited about the next class though. i really would rather not bother people (SB) about ASM stuff if i can learn it myself.

DarthPaul

December 13, 2008, 01:46:48 pm #15 Last Edit: December 31, 1969, 07:00:00 pm by darthpaul
Vanya you know posting when your drunk gives us all the laugh of a lifetime.
Oh pitiful shadow lost in the darkness, bringing torment and pain to others. Oh damned soul wallowing in your sin, perhaps...it is time to die

Xifanie

December 13, 2008, 11:13:05 pm #16 Last Edit: December 31, 1969, 07:00:00 pm by Xifanie
LD Where are you, it's time for the next class you...!!
  • Modding version: PSX
Love what you're seeing? https://supportus.ffhacktics.com/ 💜 it's really appreciated

Anything is possible as long as it is within the hardware's limits. (ie. disc space, RAM, Video RAM, processor, etc.)
<R999> My target market is not FFT mod players
<Raijinili> remember that? it was awful

Vanya

December 14, 2008, 01:28:31 pm #17 Last Edit: December 31, 1969, 07:00:00 pm by Vanya
I live to bring joy to others... and make a small profit if possible. ^_^
  • Modding version: Other/Unknown
¯\(°_0)/¯

LastingDawn

December 15, 2008, 08:22:29 pm #18 Last Edit: December 31, 1969, 07:00:00 pm by LastingDawn
Sorry about that, I was at my brother's for a couple of days, three day weekend and I hardly get to see them anymore. But yes, whenever you're ready to teach, I'll be around.
"Moment's anger can revert to joy,
sadness can be turned to delight.
A nation destroyed cannot be restored,
the dead brought back to life."

Art of War

Beta & Gretchen Forever!!!!

LastingDawn

December 16, 2008, 08:59:09 am #19 Last Edit: December 31, 1969, 07:00:00 pm by LastingDawn
Part 2 of Basics
Part 1 of Tools

Quote[08:12] <Zodiac> o hi thar
[08:12] <Zodiac> ASM Class #1
[08:12] <Lasting_Dawn> Ready and waiting. As always, thank you.
[08:12] <Zodiac> loading/storing and...
[08:12] <Zodiac> multiply/divide
[08:12] <Lasting_Dawn> Aie, division... well this should be interesting.
[08:12] <Zodiac> Soul explained to you all the stuff with branches right&
[08:12] <Lasting_Dawn> Indeed.
[08:12] <Zodiac> ANd I think you forgot to put your conversation with soul in the topic
[08:12] <Lasting_Dawn> Did I? I thought I got that part? At the very end?
[08:12] <Zodiac> oh right
[08:12] <Zodiac> anyway which do you wanna start with?
[08:12] <Lasting_Dawn> LEt's see... loading/storing
[08:12] <Lasting_Dawn> Let's*
[08:12] <Zodiac> the processor can load/store bytes/words/d-words
[08:12] <Lasting_Dawn> And it stores them in registers?
[08:12] <Zodiac> store means taking the value in a register and write it in the ram
[08:12] <Zodiac> the opposite of loading
[08:12] <Lasting_Dawn> So it takes a value in a register,  and writes it, effectively storing it somewhere in RAM?
[08:12] <Zodiac> maybe my idea of a word was wrong all this time? http://zodiac.ffhacktics.com/PSX-INST.txt says a "half-word" is 16bit, a word is 32bit and a d-word is 64bit :/
[08:12] <Lasting_Dawn> So... I was right, last time then?
[08:12] <Zodiac> mmm Delphi's help says I'm right though
[08:12] <Zodiac> Byte   0..255   unsigned 8-bit
[08:12] <Zodiac> Word   0..65535   unsigned 16-bit
[08:12] <Zodiac> Longword   0..4294967295   unsigned 32-bit
[08:12] <Zodiac> anyway a "half-word" sounds pretty stupid if you ask me
[08:12] <Lasting_Dawn> Well, I have to admit, I was taught that a word was 4 bytes, a half word, 2 bytes and a d-word was 8 bytes.
[08:12] <Zodiac> where?
[08:12] <Lasting_Dawn> From the folks at ZSO.
[08:12] <Zodiac> huh..
[08:12] <Lasting_Dawn> Though the majority were squabbling power hungry fools, some of them actually knew what they were talking about, I never doubted their skills and knowledge, just their characters...
[08:12] <Zodiac> now I see, this is rather stupid... the length of "words" vary depending on the processor
[08:12] <Lasting_Dawn> Hah! Well... that clears that up, but makes explanations oh so confusing...
[08:12] <Zodiac> definitely, I'd rather all "words" have the same length
[08:12] <Lasting_Dawn> In any case, that covered Storing, but what of Loading?
[08:12] <Zodiac> well I guess I'll have to adapt
[08:12] <Lasting_Dawn> And is there anything we missed with Storing?
[08:12] <Zodiac> lb = load byte; lh = load half word; lw = load word
[08:12] <Zodiac> they all got store versions of course and the first two have unsigned versions
[08:12] <Zodiac> to load or store you need a memory address in a register
[08:12] <Lasting_Dawn> Ah, this will tell what format is the data you are looking for, I believe?
[08:12] <Zodiac> yeah well there is no point in loading 4 bytes when you only need one
[08:12] <Lasting_Dawn> If you see an LB instruction it will be pointing towards a single byte?
[08:12] <Zodiac> yeah
[08:12] <Lasting_Dawn> Alright, I understand that, so that's it for Storing and Loading?
[08:12] <Zodiac> no,
[08:12] <Zodiac> you ahve to be able to create a memory address
[08:12] <Zodiac> you need at least lui in order to do so
[08:12] <Lasting_Dawn> Oh? Please explain.
[08:12] <Zodiac> it resets the register and writes the immediate in the upper part of the register
[08:12] <Zodiac> hence "load upper immediate"
[08:12] <Lasting_Dawn> For loading, this applies to?
[08:12] <Lasting_Dawn> But if I recall, you haven't taught me about the upper and lower parts of a "register" yet.
[08:12] <Zodiac> like if you want to load cure's JP cost which has a memory address of 0x8005EBF8
[08:12] <Zodiac> the upper part is simply the 2 highest bytes
[08:12] <Zodiac> out of 4
[08:12] <Zodiac> so loading that one would be rather simple
[08:12] <Lasting_Dawn> So when you load higher it's just two bytes and lower is the later two bytes?
[08:12] <Zodiac> lui r2, 0x8005
[08:12] <Zodiac> lhu r2, 0xEBF8(r2)
[08:12] <Zodiac> yes
[08:12] <Zodiac> this is the fastest way to load a single value
[08:12] <Lasting_Dawn> Ah, that clears up quite a bit.
[08:12] <Zodiac> if you need many values in the same range, you can use addiu r2, r2, 0xEBF8
[08:12] <Lasting_Dawn> add immediate upper, register 2, register 2?
[08:12] <Zodiac> then load like this lhu r3, 0x0000(r2)
[08:12] <Zodiac> lhu r4, 0x0001(r2)
[08:12] <Zodiac> lhu r5, 0x0002(r2)
[08:12] <Zodiac> errr u = unsigned
[08:12] <Lasting_Dawn> Oh right, heh...
[08:12] <Zodiac> whenever you see a register in parenthesis, it means it will load/store at from the location in the register PLUS the specified immediate
[08:12] <Lasting_Dawn> load or store, or load and store, in this case?
[08:12] <Zodiac> lhu r5, 0x0002(r2) would load r2: 0x8005EBF8, and add 0x0002 for location 0x8005EBFA
[08:12] <Zodiac> or
[08:12] <Zodiac> since when can a slash mean and? did I miss something O_O
[08:12] <Lasting_Dawn> True, true, good point.
[08:12] <Zodiac> if you need to use the register again, I'd recommand leaving it with the memory address so you don't have to write it again in order for it to store the new value
[08:12] <Zodiac> use other registers instead
[08:12] <Lasting_Dawn> But what decides where these are written to in RAM? I noticed you put memory addresses, but I can't see how they were logically conceived, in this case.
[08:12] <Zodiac> GS codes use memory address
[08:12] <Zodiac> asm code does as well
[08:12] <Zodiac> j 0x801924B8 means jumping to that memory address
[08:12] <Lasting_Dawn> Ah? Sometimes they are simply displayed where it is in the memory?
[08:12] <Zodiac> asm is just hex, 4 bytes each
[08:12] <Zodiac> I'm not sure what you were trying to say
[08:12] <Lasting_Dawn> I understand that, yes. But in a few of the instructions there are actual memory addresses put? Such as the one you put there.
[08:12] <Lasting_Dawn> 0x801924BB
[08:12] <Zodiac> yes
[09:12] <Lasting_Dawn> And that helps us identify where things lead and the like?
[09:12] <Zodiac> yeah well jumps are related more to asm code itself where concerning our storing/loading the memory address is in a register itself
[09:12] <Lasting_Dawn> Ah, I see where my confusion arises, just one minute.
[09:12] <Lasting_Dawn> lhu r5, 0x0002(r2) would load r2: 0x8005EBF8, and add 0x0002 for location 0x8005EBFA
[09:12] <Lasting_Dawn> What is in this that says to load 0x8005EBF8?
[09:12] <Zodiac> with lui r2, 0x8005
[09:12] <Zodiac> lhu r2, 0xEBF8(r2)
[09:12] <Zodiac> r2 = 0x8005EBF8
[09:12] <Zodiac> wait wtf
[09:12] <Zodiac> woops this should be more like this:
[09:12] <Zodiac> lui r2, 0x8005
[09:12] <Zodiac> addiu r2, r2, 0xEBF8
[09:12] <Zodiac> sorry
[09:12] <Lasting_Dawn> Ah, that makes more sense, thank.
[09:12] <Zodiac> then it would take  0x8005EBF8 in r2, add 0x0002 because of the immediate and load in r5 from 0x8005EBFA
[09:12] <Lasting_Dawn> Perfect! I understaodd that word for word.
[09:12] <Lasting_Dawn> understood*
[09:12] <Zodiac> alright, we'll jump to multiply/divide
[09:12] <Lasting_Dawn> Alright.
[09:12] <Zodiac> to avoid confusion I'm the first one I'll start division before multiply
[09:12] <Lasting_Dawn> Sounds fine to me.
[09:12] <Zodiac> do you know what a remainder is?
[09:12] <Lasting_Dawn> What is left of an imperfect division?
[09:12] <Zodiac> yeah
[09:12] <Lasting_Dawn> Indeed.
[09:12] <Zodiac> 19/8 = 2 and 3/8
[09:12] <Zodiac> well it works pretty much like that
[09:12] <Zodiac> there are two special registers concerning mult and div
[09:12] <Zodiac> HI and LO
[09:12] <Zodiac> div 19, 8 would store 2 in LO and 3 in HI
[09:12] <Zodiac> because there are two different results this is why you cannot specify a target register with div and mult
[09:12] <Lasting_Dawn> Ah, therefore it's not the best idea to search for specifics using them?
[09:12] <Zodiac> div rs, rt
[09:12] <Zodiac> specifics? like what
[09:12] <Lasting_Dawn> A target, as you just said.
[09:12] <Zodiac> as they are special register you can't directly read/write them
[09:12] <Zodiac> div/mult writes to them and mflo/mfhi reads them and stores the value in the target register
[09:12] <Lasting_Dawn> Doesn't that mean they can't be altered them?
[09:12] <Zodiac> mflo stands for move from low
[09:12] <Zodiac> if you want to use them, you need to pull themm out of the LO/HI registers
[09:12] <Zodiac> and if you don't want you wouldn't have used mult/div to begin with :(
[09:12] <Lasting_Dawn> Heh, I've always remained well knowing in subjects that interest me, FFT, Zelda 64, and History are basically those three.
[09:12] <Lasting_Dawn> Oh yes, spelling of words as well.
[09:12] <Zodiac> I'm getting a bit trouble with that in French, probably a lack of pratice because I type, type, then hit enter and notice my grammatical mistakes at the same instant
[09:12] <Zodiac> but gravity and cinetic energy pullls so hard and then, too late; message sent ;(
[09:12] <Lasting_Dawn> Well I normally try to look over my messages before I send them, though sometimes, I screw up as well.
[09:12] <Zodiac> well I guess that sums it for divide
[09:12] <Zodiac> mult is a two registers opcode too
[09:12] <Lasting_Dawn> That wasn't as complicated as I thought, it's mainly used in those formulas then?
[09:12] <Zodiac> yeah mainly
[09:12] <Lasting_Dawn> Multiplying though is used for nearly every formula though, isn't it?
[09:12] <Zodiac> yep
[09:12] <Lasting_Dawn> So that will show up much more often? But it will follow the same rules as division with a HI and LO?
[09:12] <Zodiac> now why the heck is there no target register again?
[09:12] <Lasting_Dawn> Because there could be different results?
[09:12] <Zodiac> LOW holds the low 32 bits of the multiply, HI holds the high 32 bits of the multiply.
[09:12] <Zodiac> not really necessary IMHO
[09:12] <Zodiac> I'd rather have a target register
[09:12] <Lasting_Dawn> So is it that they don't have a target register, or is it that it's more difficult to find?
[09:12] <Zodiac> plus it's pretty hard to use a value of 64bit when registers are only 32bit
[09:12] <Zodiac> like huh what? it doesn,t have a target register because it stores the higher result in HI and the other part in LO
[09:12] <Lasting_Dawn> Ah, that's the part I wasn't understanding, alright I see it now.
[09:12] <Lasting_Dawn> So HI and LO are reserved ffor Multiplying and Dividing?
[09:12] <Zodiac> and unless you need to calculate a number over 4294967296 you'll never use HI
[09:12] <Zodiac> yeah
[09:12] <Lasting_Dawn> Oh, but the game uses HI for the CT in Math Skills, does it not?
[09:12] <Zodiac> we're still talking about multiplications
[09:12] <Lasting_Dawn> Oh, good.
[09:12] <Zodiac> don't take division into account now ;o
[09:12] <Zodiac> HI mult = never used
[09:12] <Lasting_Dawn> So you'll only need LO mult?
[09:12] <Zodiac> basically yeah
[09:12] <Lasting_Dawn> Alright, that clears that.
[09:12] <Zodiac> unless you,re gonna do HUGE ass multiplications HI will always be 0
[09:12] <Zodiac> well that sums it for the basics!
[09:12] <Lasting_Dawn> Ah? Well that all wasn't too difficult, I was admittedly a bit frightened with multiplication and dividing.
[09:12] <Lasting_Dawn> But it doesn't seem that complicated at all.
[09:12] <Lasting_Dawn> It seems the important part to remember is HI and LO when dealing with these?
[09:12] <Zodiac> if you know what result they hold, you'll remember

Quote[09:12] <Zodiac> Second part of the class: TOOLS
[09:12] <Zodiac> - pSX 1.13 debugger http://psxemulator.gazaxian.com/pSX_1_13.rar (just for other people reading); the emulator we'll use
[09:12] <Lasting_Dawn> Hehe, alright. A good idea.
[09:12] <Zodiac> - Renegade 64 http://zodiac.ffhacktics.com/renegade64v169.rar
[09:12] <Lasting_Dawn> Currently copying the first part to keep it seperate from the second.
[09:12] <Zodiac> - A memory editor of your choice (I recommand Cheat Engine: http://www.heijnen1.demon.nl/CheatEngine54.exe)
[09:12] <Zodiac> - A hex editor
[09:12] <Zodiac> - FFTPatcher
[09:12] <Zodiac> - Windows Calc
[09:12] <Lasting_Dawn> Ah, Renegade can use PS1 games?
[09:12] <Zodiac> r3000 and r4000 are VERY similar
[09:12] <Zodiac> In fact, I have no idea what new instructions the r4000 got
[09:12] <Lasting_Dawn> Didn't it get that syscall or whatever Souylsin was referring to?
[09:12] <Zodiac> mmm I'm not sure if the PSX got that or not
[09:12] <Zodiac> anyway tell me when you got everything
[10:12] <Lasting_Dawn> Let me check that Renegade version.
[10:12] <Lasting_Dawn> Hmm... I have RenegadeEx100, their newest version, I think.
[10:12] <Lasting_Dawn> Should I use that one?
[10:12] <Zodiac> don't know I'd need to try out Ex100 but I can,t find it
[10:12] <Lasting_Dawn> Oh, I'll put it in my FTP.
[10:12] <Lasting_Dawn> Should be there now.
[10:12] <Zodiac> nope, that version won't do
[10:12] <Lasting_Dawn> Alright, I'll use the one in the link then.
[10:12] <Zodiac> because the one you have cannot assemble code
[10:12] <Lasting_Dawn> Ah, that is a problem...
[10:12] <Zodiac> and I couldn't make it support pSX anyway
[10:12] <Lasting_Dawn> Souylsin was wrong then, eh well... it happens.
[10:12] <Lasting_Dawn> Alright. Done.
[10:12] <Zodiac> got everything in the list?
[10:12] <Lasting_Dawn> Everything besides a Windows Calculator.
[10:12] <Lasting_Dawn> Can I use one on an internet page?
[10:12] <Zodiac> huh... sure
[10:12] <Zodiac> it's just to add/subtract 0x02B0 anyway
[10:12] <Lasting_Dawn> Alright, that's everything then.
[10:12] <Zodiac> well you know how to use a memory editor I suppose?
[10:12] <Lasting_Dawn> I know my way around one, slightly.
[10:12] <Zodiac> can you find ramza's HP in battle easily?
[10:12] <Lasting_Dawn> Definitely not, I honestly had no idea that Renegade could attach to a PSX!
[10:12] <Lasting_Dawn> But Renegade is a memory editor I have some slight experience with, but I can't make heads or tails of Cheat Engine.
[10:12] <Zodiac> I never talked about renegade
[10:12] <Zodiac> well first of all you need to attach Cheat Engine to pSX
[10:12] <Zodiac> click the flashy icon and select pSX's process
[10:12] <Lasting_Dawn> Alright, that should take but a second.
[10:12] <Lasting_Dawn> Attached.
[10:12] <Zodiac> ok load savestate with ramza in battle or anyone else
[10:12] <Lasting_Dawn> Has to be savestate?
[10:12] <Lasting_Dawn> Oh well, done.
[10:12] <Zodiac> no jsut way faster :/
[10:12] <Zodiac> ok what's your current HP
[10:12] <Lasting_Dawn> Alright, well I do happen to have one, when I was testing out an Ability for Mercenaries, let's see here...
[10:12] <Lasting_Dawn> 429
[10:12] <Zodiac> and what integer type is HP?
[10:12] <Lasting_Dawn> Two bytes, or a half word?
[10:12] <Zodiac> yep
[10:12] <Lasting_Dawn> So search for 429 in hex?
[10:12] <Zodiac> does the game displays HP in decimal on in hex on your screen?
[10:12] <Zodiac> or in hex*
[10:12] <Lasting_Dawn> Haha! Of course, of course.
[10:12] <Lasting_Dawn> 429 turns to 1AD
[10:12] <Lasting_Dawn> So search AD01?
[10:12] <Zodiac> why bother so much
[10:12] <Zodiac> you see the checkbox on the left?
[10:12] <Lasting_Dawn> Of cheat engine?
[10:12] <Zodiac> left of the value fiedl
[10:12] <Lasting_Dawn> Hex, right...
[10:12] <Lasting_Dawn> Heh, how did I miss that.
[10:12] <Lasting_Dawn> Just search 429 then...
[10:12] <Zodiac> exactly
[10:12] <Lasting_Dawn> Quite a few results.
[10:12] <Zodiac> well that's what next search is for
[10:12] <Zodiac> now ALTER your HP
[10:12] <Zodiac> and search for it's new value
[10:12] <Zodiac> given HP is two bytes, only once should be enough
[10:12] <Lasting_Dawn> AlrighAlright 429 to 259
[10:12] <Lasting_Dawn> Should I run a search for 259 now?
[10:12] <Zodiac> yes but using next search
[10:12] <Zodiac> next scan*
[10:12] <Lasting_Dawn> Alright, I get a lot of results.
[10:12] <Zodiac> that stuff was taking me 30sec-2mins on my old computer
[10:12] <Zodiac> now barely 1 second lol
[10:12] <Lasting_Dawn> Haha, all you need now is a better internet, and you'll be set!
[10:12] <Zodiac> yeah, but taht won't happen here. I'm gonna leave for Japan way before we can get high speed.
[10:12] <Lasting_Dawn> Haha! Wow... that's... a long time.
[10:12] <Zodiac> how much results do you have right now?
[10:12] <Lasting_Dawn> For 259?
[10:12] <Zodiac> ya
[10:12] <Lasting_Dawn> A ton.
[10:12] <Lasting_Dawn> 1222
[10:12] <Zodiac> that's impoossible you didn't click NEXT SCAN
[10:12] <Zodiac> you clicked New Scan
[10:12] <Lasting_Dawn> Ah, sorry about that, what's the difference, if I may ask?
[10:12] <Zodiac> when you start a new scan, it will memorize the location of all bytes/halfwords/words or whatever that has the value you specified
[10:12] <Zodiac> when you use thex search, it checks only those values  and list again but only those with the new values
[10:12] <Lasting_Dawn> Ah, I see! that's convenient!
[10:12] <Zodiac> and if you ever do a mistake you can undo scan; but only once
[10:12] <Lasting_Dawn> Odd, I reset the whole thing, New Scanned 429 then next scanned my current HP and didn't get a result it looks.
[10:12] <Zodiac> it usually doesn't take many searches to find the right offset anyway
[10:12] <Zodiac> if you new searched for 429 HP when ramza DIDN'T have 429 HP you can't find the HP
[10:12] <Lasting_Dawn> Ah! Got it!
[10:12] <Zodiac> because it was not part of the original search to begin with
[10:12] <Lasting_Dawn> Went to a different savestate and restarted, hurt Ramza 14 and I have one result.
[10:12] <Lasting_Dawn> 0204D064
[10:12] <Zodiac> you can double click it and it will go in the editable list
[10:12] <Lasting_Dawn> Haha! I feel so dumb not knowing this all this time!
[10:12] <Zodiac> change the value to 999 and go check ramza's HP
[10:12] <Zodiac> you can make it higher too for the lulz
[10:12] <Lasting_Dawn> FFFF apparently makes his HP bar read 0, but he still has the same amount according to the game.
[10:12] <Lasting_Dawn> But that couldn't be further from the truth.
[10:12] <Zodiac> if you don't change the max HP as well (which are the 2 next bytes right after the current HP btw)
[10:12] <Zodiac> if you don't change the max HP as well (which are the 2 next bytes right after the current HP btw)
[10:12] <Zodiac> it will reset back to Max HP
[10:12] <Lasting_Dawn> Yes, it did, interesting...
[10:12] <Zodiac> 65535/400 > 400/400
[10:12] <Lasting_Dawn> Wow, that made his HP jump off the map! The bar is literally off screen!
[10:12] <Zodiac> hehe
[10:12] <Zodiac> that happens
[10:12] <Lasting_Dawn> Odd, but that reset as well, when I left that menu.
[10:12] <Zodiac> huh weird
[10:12] <Zodiac> ok so now you can handle the memory editor properly?
[10:12] <Lasting_Dawn> Yep, I think I can.
[10:12] <Zodiac> sadly you can't use 0204D064 as a memory address
[10:12] <Lasting_Dawn> Hmm?
[10:12] <Zodiac> because this is a proccess memory address and not the PSX's in the emulator
[10:12] <Lasting_Dawn> That does explain a few things...
[10:12] <Zodiac> there are two ways to convert it
[10:12] <Zodiac> subtract from it a specific value, or search for the surrounding values in the savestate
[10:12] <Zodiac> for the first one you need to the the second one a first time anyway
[10:12] <Lasting_Dawn> Those are the only two ways? Doesn't that leave our options rather limited then? I've seen an absolute ton outside of the range.
[10:12] <Zodiac> right click on the row with the HP value/offset and stuff
[10:12] <Zodiac> nah not really much ways
[10:12] <Zodiac> and click browse memory editor
[10:12] <Zodiac> browse this memory region*
[11:12] <Lasting_Dawn> Crash, my fault...
[11:12] <Lasting_Dawn> Forgot I took out Card.out to see what it did...
[11:12] <Lasting_Dawn> Well, I found out what it does, heh...
[11:12] <Zodiac> and what does it do?
[11:12] <Lasting_Dawn> It's used to show the Job Scroll in battle.
[11:12] <Zodiac> :O
[11:12] <Zodiac> weird
[11:12] <Lasting_Dawn> Indeed... but there's seperate text in there as well, which is very odd, since I know changing it in other files loads it as appropriate (for once...)
[11:12] <Lasting_Dawn> In any case... now where were we?
[11:12] <Zodiac> right click browse memory region
[11:12] <Lasting_Dawn> Done.
[11:12] <Zodiac> now the first 2 bytes are you HP, the 2 next one are you max HP afterwards lots of other stats
[11:12] <Zodiac> but this hardly matter, right now make a savestate and load it in your hex editor
[11:12] <Lasting_Dawn> Load a savestate in my hex editor...? I've... never done this before.
[11:12] <Zodiac> take 4-8 bytes on that line and search for them in the savestate
[11:12] <Zodiac> what? lol!
[11:12] <Zodiac> I've been hacking savestates for a LONG time
[11:12] <Lasting_Dawn> I've never hacked a... savestate,
[11:12] <Zodiac> well can you at least search hex with your hex editor?
[11:12] <Lasting_Dawn> Of course.
[11:12] <Zodiac> then search for those bytes
[11:12] <Zodiac> 4-8 is a good amount depending on the amount of 0x00
[11:12] <Lasting_Dawn> So I just open the savestate with any hex editor?
[11:12] <Zodiac> yeah
[11:12] <Lasting_Dawn> I feel idiotic... heh, alright, but a minute.
[11:12] <Lasting_Dawn> Found it.
[11:12] <Zodiac> what address?
[11:12] <Lasting_Dawn> 14D2FD
[11:12] <Zodiac> continue search, that's the world map stats
[11:12] <Lasting_Dawn> I only had one result, and it seems that was it...?
[11:12] <Zodiac> ;o
[11:12] <Zodiac> well huh... okay change the value to something else and reload the savestate
[11:12] <Lasting_Dawn> I see the HP went down when I reload it, but the change is only temporal.
[11:12] <Lasting_Dawn> When something happens regarding HP Ramza's HP resets.
[11:12] <Zodiac> you only found 1 result with the memory editor?
[11:12] <Lasting_Dawn> That's correct. And when I reloaded the effect changed only exists for as long as the game doesn't take into account his Actual HP.
[11:12] <Zodiac> you only changed his displayed HP then
[11:12] <Lasting_Dawn> Well, none of the numbers changed.
[11:12] <Lasting_Dawn> It was just the bar.
[11:12] <Zodiac> that's rather weird though, search for the HP again
[11:12] <Lasting_Dawn> Hmm...Same area.
[11:12] <Zodiac> mmm don't know...
[11:12] <Zodiac> when exactly are you searching for both values?
[11:12] <Lasting_Dawn> Load savestate, full HP. 467
[11:12] <Lasting_Dawn> Hit with X-Potion -14 or -127
[11:12] <Lasting_Dawn> I search for either 452 or 326
[11:12] <Zodiac> alchemist potion?
[11:12] <Lasting_Dawn> I see the byte I have marked as "Ramza's HP" change each time, they are hit.
[11:12] <Lasting_Dawn> Just a test.
[11:12] <Lasting_Dawn> An... old test at that.
[11:12] <Zodiac> were those numbers random? because 467-14 =/= 452 and 467-127 =/= 326
[11:12] <Lasting_Dawn> 452*
[11:12] <Lasting_Dawn> Ahem...
[11:12] <Lasting_Dawn> 453*
[11:12] <Lasting_Dawn> Wait, you're right...
[11:12] <Lasting_Dawn> I am horrible at math, hehe...
[11:12] <Zodiac> you can just use value decreased by...
[11:12] <Lasting_Dawn> Of course! I'll try that then.
[11:12] <Lasting_Dawn> Is this after I use it?
[11:12] <Zodiac> you can't have a decreased value if you don,t have a value to start with
[11:12] <Zodiac> don,t you agree?
[11:12] <Lasting_Dawn> True, but I've now tried that method and haven't had anything happen.
[11:12] <Lasting_Dawn> No results.
[11:12] <Zodiac> you searched exact 467 then searched decreased value by 14/127 and nothing?
[11:12] <Lasting_Dawn> Nothing that I could find, no.
[11:12] <Zodiac> if only I could easily see what you,re ding exactly...
[11:12] <Lasting_Dawn> That would probably work better.
[11:12] <Zodiac> you,re doing*
[11:12] <Zodiac> you're*
[11:12] <Lasting_Dawn> 467 First Scan
[11:12] <Lasting_Dawn> Decreased Value by 14
[11:12] <Lasting_Dawn> Next Scan, after using the X-Potion
[11:12] <Lasting_Dawn> No results.
[11:12] <Zodiac> and your HP is now 453?
[11:12] <Lasting_Dawn> Indeed, that gives one result by that point.
[11:12] <Zodiac> you,re doing new scan when you start over right?
[11:12] <Lasting_Dawn> Indeed.
[11:12] <Zodiac> well well, what the heck
[11:12] <Zodiac> could you make a screenshot of your cheatengine?
[11:12] <Zodiac> I'll check the parameter
[11:12] <Lasting_Dawn> Alright, it might have something to do with that savestate, using another one now.
[11:12] <Zodiac> parameters*
[11:12] <Lasting_Dawn> Hmm... alright, I'll send it your way, I'm nearly convinced I'm doing something wrong
[11:12] <Lasting_Dawn> What do you need to see?
[11:12] <Zodiac> whole cheat engine
[11:12] <Lasting_Dawn> At what point? Anything specific?
[11:12] <Zodiac> I'm pretty sure too because if you found something with exact value and not with decreased it doesn't make any sense
[11:12] <Zodiac> all the window
[11:12] <Lasting_Dawn> http://img385.imageshack.us/my.php?imag ... ineps3.png
[11:12] <Lasting_Dawn> Did I really... oh my.
[11:12] <Lasting_Dawn> Heh... just one second...
[11:12] <Zodiac> ................................
[11:12] <Zodiac> ....................................................
[11:12] <Zodiac> you dummy
[11:12] <Lasting_Dawn> Very much so.
[11:12] <Lasting_Dawn> Oh? Did I do something wrong, other then the picture>?
[11:12] <Zodiac> you searched 4 bytes for a 2 bytes value? :/
[11:12] <Lasting_Dawn> Tick...
[11:12] <Lasting_Dawn> Tock...
[11:12] <Lasting_Dawn> Whoops.
[11:12] <Lasting_Dawn> Well, that might explain where I've gone wrong every step of the way,
[11:12] <Lasting_Dawn> 469 results for 429 now.
[11:12] <Zodiac> alter, next scan
[11:12] <Lasting_Dawn> Done.
[11:12] <Lasting_Dawn> That worked...
[11:12] <Lasting_Dawn> Heh...
[11:12] <Lasting_Dawn> Heh...
[11:12] <Lasting_Dawn> Hmm...
[11:12] <Zodiac> no wonder..
[11:12] <Lasting_Dawn> That only took a chunk of about 40 minutes.
[11:12] <Lasting_Dawn> So what I found earlier was... the bar'?
[11:12] <Zodiac> ya
[11:12] <Lasting_Dawn> Interesting...
[11:12] <Zodiac> the bar is either 4 bytes or the two next bytes remained 0 the whole time
[11:12] <Lasting_Dawn> That they did.
[12:12] <Zodiac> End of class
[12:12] <Lasting_Dawn> 12:00 AM...
[12:12] <Lasting_Dawn> Boy did I screw up tonight, eh well... I learned a lot!
[12:12] <Lasting_Dawn> As always, thank you Zodiac, and next time I'll try not to be such a dunce.
[12:12] <Lasting_Dawn> Copying, pasting, then calling it a night.
[12:12] <Lasting_Dawn> Have a nice night, Zodiac.
"Moment's anger can revert to joy,
sadness can be turned to delight.
A nation destroyed cannot be restored,
the dead brought back to life."

Art of War

Beta & Gretchen Forever!!!!