Users browsing this thread: 1 Guest(s)
Assembly Programming
01-11-2012, 10:46 PM
Alright, thanks for clearing up the confusion, so to sum up, you want me to learn a little bit about the SNES 65816 programming and continue tweaking with those offsets (i.e. figure out EXACTLY what does what)? Should I create a new thread for this?
01-12-2012, 06:31 AM
(01-11-2012, 10:46 PM)the_randomizer Wrote: Alright, thanks for clearing up the confusion, so to sum up, you want me to learn a little bit about the SNES 65816 programming and continue tweaking with those offsets (i.e. figure out EXACTLY what does what)? Should I create a new thread for this?
I don't think a new thread is neccesary but it's up to you. There's already an assembly thread with a book that Angelo posted the link and there are other links in the thread. Check here.
In the same direction, If you really want to understand what the opcode LDA (A9) does as an example, you should probably read a bit about it. The best way I learned the little assembly I know if by checking each command on each line of a function, read about them (to understand what they do) and then I was modifying some values. If you only play with the hex values, you might get some results but it will take a lot longer IMO.
Here's a good summary of SNES opcodes with examples: 65816 Opcodes
You can learn that stuff yourself, but if you have questions about SNES assembly you might not get your answers here, as there is not much assembly expert on this forum. But Angelo is getting good at that stuff.
01-12-2012, 05:24 PM
(01-12-2012, 06:31 AM)Madsiur Wrote: I don't think a new thread is neccesary but it's up to you.
Let's use this thread to discuss opcodes and anything related to assembly. I can quickly change the name of the thread.
(01-12-2012, 06:31 AM)Madsiur Wrote: If you really want to understand what the opcode LDA (A9) does as an example, you should probably read a bit about it. The best way I learned the little assembly I know if by checking each command on each line of a function, read about them (to understand what they do) and then I was modifying some values. If you only play with the hex values, you might get some results but it will take a lot longer IMO.
This is the point I was trying to get across
01-12-2012, 07:27 PM
*Sigh* I guess I tend to let my noobish side show more than I intend to, but I'll keep plugging along despite being new to it, learning a bit of 65816 assembly while messing with hex.
01-12-2012, 08:50 PM
I've changed the title and location of the thread.
No need to feel noobish, I like your attitude better when you're willing to do anything and posting your findings.
No need to feel noobish, I like your attitude better when you're willing to do anything and posting your findings.
01-12-2012, 09:33 PM
Thanks for changing the title, will start delving into 65816 assembly tonight. While my head may get to the point of exploding with cramming that in (along with homework), come hell or high water, I will learn this.
Well I managed to create two list of item bet/won/monster faced for my WOB colosseum and the WOR colosseum. I made a second list at F1/FAA0 to F1/FD9F. Each data for each item bet is 4 bytes long: the first byte is the monster number, second byte is unknown (it's always $40), third byte is the item won and last byte is a flag to mask the item name (like when you face shadow).
The data related to the colosseum is in C3. Normally, there is this code:
It's a jump at C3/B22C to determine the item won/monster to fight.
Now this is what I did:
I jump twice to get to F1 where there is empty space. Then I did this:
I check if we are in the WOR with the event bit 1E94:4 that is set when you start in the WOR. Now the command AND compare bit to bit 2 values. 0 AND 0 = 0, 0 AND 1 = 0, 1 AND 1 = 1. So since the event byte is the 5th bit on the byte, I compared the byte to $10(16). so as an example it could be this: 10010110 AND 00010000. No matter what the event bytes has as value, if bit 4 is set, the result will always be 00010000. If the bit is clear the result will be 00000000.
Depending of the result I branch to F1/FC0C or the game continue reading the code as follow:
Now this is pretty well explained so I won't go through it but the game will load the monster and item won of one of the two lists depending of the prior branching and will return in the previous subroutine to load the colosseum battle screen. What is important is that you can check for event bits using the AND command and branch if the result is equal to 0 (BEQ) or brach if the result is not equal to 0 (BNQ). The commands BEQ, BNQ or BRA need as parameter the number of bytes from after the command up to where you want to branch.
You could even have a third colosseum list if a certain event has occured...There are many possibilities.
The data related to the colosseum is in C3. Normally, there is this code:
Code:
C3/AF46: 202CB2 JSR $B22C (Determine prize and monster based on item bet)
It's a jump at C3/B22C to determine the item won/monster to fight.
Now this is what I did:
Code:
C3/AF46: 2091F0 JSR $F091 (Jump where there is empty space in C3)
C3/F091: 22E0FBF1 JSL $F1FBE0 (Jump where there is even more empty space in F1)
C3/F095: 60 RTS (return to C3/AF49)
I jump twice to get to F1 where there is empty space. Then I did this:
Code:
F1/FBE0: E220 SEP #$20 (8 bit memory/accum.)
F1/FBE2: AF941E7E LDA $7E1E94 (Load event byte containing the WOR event bit (1E94:4))
F1/FBE6: 2910 AND #$10 (check if bit 4 is set)
F1/FBE8: D022 BNQ $FC0C (Branch to F1/FC0C if not equal to 0)
I check if we are in the WOR with the event bit 1E94:4 that is set when you start in the WOR. Now the command AND compare bit to bit 2 values. 0 AND 0 = 0, 0 AND 1 = 0, 1 AND 1 = 1. So since the event byte is the 5th bit on the byte, I compared the byte to $10(16). so as an example it could be this: 10010110 AND 00010000. No matter what the event bytes has as value, if bit 4 is set, the result will always be 00010000. If the bit is clear the result will be 00000000.
Depending of the result I branch to F1/FC0C or the game continue reading the code as follow:
Code:
F1/FBEA: 7B TDC (zero A)
F1/FBEB: AD0502 LDA $0205 (Load item bet)
F1/FBEE: C220 REP #$20 (Set 16 bit memory/accum.)
F1/FBF0: 0A ASL A (multiply by 2 the item number)
F1/FBF1: 0A ASL A (multiply by 2 the item number)
F1/FBF2: AA TAX (Transfer item number to X)
F1/FBF3: E220 SEP #$20 (Set 8 bit memory/accum.)
F1/FBF5: BFA0FAF1 LDA $F1FAA0,X (Load monster to face)
F1/FBF9: 8D0602 STA $0206 (Store monster to face)
F1/FBFC: BFA2FAF1 LDA $F1FAA2,X (Load item to win)
F1/FC00: 8D0702 STA $0207 (Store item to win)
F1/FC03: BFA3FAF1 LDA $F1FAA3,X (Load masked item to win flag)
F1/FC07: 8D0902 STA $0209 (Store masked item to win flag)
F1/FC0A: 8020 BRA $FC3D (branch always to F1/FC3D)
F1/FC0C: 7B TDC (zero A)
F1/FC0D: AD0502 LDA $0205 (Load item bet in A)
F1/FC10: C220 REP #$20 (Set 16 bit memory/accum.)
F1/FC12: 0A ASL A (multiply by 2 the item number)
F1/FC13: 0A ASL A (multiply by 2 the item number)
F1/FC14: AA TAX (Transfer item number to X)
F1/FC15: E220 SEP #$20 (Set 8 bit memory/accum.)
F1/FC17: BF00B6DF LDA $DFB600,X (Load monster to face)
F1/FC1B: 8D0602 STA $0206 (Store monster to face)
F1/FC1F: BF02B6DF LDA $DFB602,X (Load item to win)
F1/FC23: 8D0702 STA $0207 (Store item to win)
F1/FC26: BF03B6DF LDA $DFB603,X (Load masked item to win flag)
F1/FC3A: 8D0902 STA $0209 (Store masked item to win flag)
F1/FC3D: 6B RTL (return to C3/F095)
Now this is pretty well explained so I won't go through it but the game will load the monster and item won of one of the two lists depending of the prior branching and will return in the previous subroutine to load the colosseum battle screen. What is important is that you can check for event bits using the AND command and branch if the result is equal to 0 (BEQ) or brach if the result is not equal to 0 (BNQ). The commands BEQ, BNQ or BRA need as parameter the number of bytes from after the command up to where you want to branch.
You could even have a third colosseum list if a certain event has occured...There are many possibilities.
01-16-2012, 04:40 PM
01-16-2012, 05:32 PM
(01-16-2012, 04:40 PM)JCE3000GT Wrote: So, what exactly does this accomplish? I guess I'm not following the description?
For the same item bet you will have a different prize and/or monster to fight depending if you are in the WOB or WOR. I wanted this setup because I want the WOB colosseum to have WOB items only and to not have the possibility that the player could have amazing equipment via the colosseum if he grinds before the light of judgement.
If I push this concept even more, I could even make some item you get at the colosseum available only when you have recruited all the characters as an example or if any event I want that has an event bit has occured. This would require a 3rd list and I'm not excluding this possibility.
The only thing is you have to edit half of the data manually because FF3usME can't handle a second list.
01-16-2012, 08:17 PM
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)