Opcodes - Final Stretch

  • Thread starter Thread starter Synergy Blades
  • Start date Start date
Status
Not open for further replies.
S

Synergy Blades

Guest
A call to those with opcode knowledge (halkun, Qhimm, whoever else...)

I've done well over 100 opcodes on the Wiki, and with halkun's maths/assignment write-up and Qhimm's RET/REQs I reckon we've got about 90 opcodes left to nail down. I'm not putting anything up with any "unknown" in, and in my view the remainder range from "I'm not 100% sure what this argument does" to "what on Earth is this supposed to do?" I've also done my best to categorise them, though there's still a few left to do.

With a bit of concerted effort I think we can get the unknowns down to below the 20 mark. If you know any that haven't been done then feel free to put them in. I'll write up a few musings I've had with some opcodes I can't 100% document and post it here to see if anyone has any ideas.

Good idea/bad idea?
 
21 TUTOR: Opens the menu and should play a tutorial, but on fields without tutorials, lets you control the menu; quit the menu, and it comes straight back up again. The field file contains the PSX version of the tutorial ("insert a memory card into either slot..."), whereas the flevel LGP contains the PC version. So how are these accessed/referenced?
22 BTMD2: Battle mode: no victory celebration, celebration without music, etc.
28 KAWAI: Why after each KAWAI is there often a WAIT(1) followed by KAWAI(subop, 1)?
31 IFKEYON/32 IFKEYOFF: How do these differ from IFKEY if IFKEY lets you check whether a key is down or up?
3C HMPMAX1/3D HMPMAX2: How do these differ from HMPMAX3? [EDIT] They may not be - HMPMAX1 and HMPMAX2 are not used in the game
5C DMTRA/5D CMTRA: Can't figure out argument usage for DMTRA (only used in blackbg4 anyway); CMTRA not used in the game which doesn't help figuring out args
5E SHAKE: (bank, bank, ?, ?, y-direction?, force, regularity): shakes the screen, but direction specification seems hit and miss
5F NOP: Can we assume this is as per a CPU NOP? Just a no-op command?
6D IDLCK: In some fields, come under an entity called "IDlock"; what IDs are they locking?
6E LSTMP: Often used before accessing a 16-bit value from the temporary bank, such as; LSTMP(6,20) followed by if(<6>[20] == 100)...
7E TLKON: Talk on? Doesn't seem to stop dialogs
7F RDMSD: Random seed?
9D SETX/9E GETX/9F SEARCHX: All unused in the game, and a hefty argument list
B2 MSPED: Second argument is..?
B4 TURNGEN: Generate turn? Differs from other turn opcodes how?
C6 SLIDR: Seems to combine with LADER
D4 SIN/D5 COS: kuro_4 > mover > Script 0 only. (Bank[4]/Bank[4],Bank[4]/Bank[4],?S16,?S16,?S16,?U8)
DA AKAO2/F2 AKAO: Even though they're seperate opcodes do they have different functions within each? Does one/either play sound and if so how does it differ to SOUND?

So those are a few that have been bugging me the most, as for the remainder I might stick up the understood arguments for each remaining opcode on its talk page if there's any demand for them. If you want to take a look at each you might find this little tool helpful as it dumps the locations of each opcode for the entire field set.

Unused opcodes (assuming the two fields my script analyser falls over on don't contain these):

3C HMPMAX1
3D HMPMAX2
55 WROW
56 GWCOL (but 57 SWCOL *is* used)
5D CMTRA
5F NOP
61 SCRLO (on/off? but doesn't seem to stop scrolls)
94 XOR2
9D SETX
9E GETX
9F SEARCHX
D7 SLDR2
D9 PMJMP2
EB STPLS
EC LDPLS
EE RTPAL2
F4 MUSVM
F7 CHMPH


While I'm at it: check "yougan" (or whichever one it is where Yuffie steals your materia). I absolutely cannot find any script that removes the party's materia, and changing a gateway to replay that field and going through the field again removes only a certain subset of materia. Any ideas?

+++EDIT: Halkun+++

CRAP! I edited and accidently deleted this post. I lost the links. Sorry. I'm lame ;_;

EDIT: You are lame. Good thing I'm around. :P /Q
 
Last edited:
31 IFKEYON/32 IFKEYOFF: How do these differ from IFKEY if IFKEY lets you check whether a key is down or up?
Umm, sorry, IFKEY might be wrong, the center argument was always zero. I made the assumption that as buttins only have two states, the center argument has to be what you are checking for.

It might just be "0"
 
A few suggestions/observations to investigate:

BTMD2 - Battle Mode 2; used in the Nibelheim memory sequence with Sephiroth and Cloud. No item or XP after battle.
LSTMP- List Map; Used to find values in Temporary Memory?
IDLCK- ID lock; Used to temporarily "seal" commands out of operation; for instance, bad spins in Battle Arena, 'Berzerk' status, 'toad' status, etc. Operations identified with the ID lock become disabled. (?)
RDMSD- I think your correct that this is Random Seed. Probably used early in the program to generate semi-random numbers. Usually uses the format of RNDSD nnnn with the value being applied to a specific randomising algorithim.
MSPED- Message Speed?
TURNGEN- Used to RET to the top of the Turn OP? Or to start Turn?
SLIDR- Slider; Combined with LADER, provides x,y coordinates for some function (?)
 
Hmm...

Code: [Select]
Code:
0x5F - NOP
It just increases the IP by 1, it's one byte in size, no arguments - so it's equivalent to CPU NOP :P

Cloned opcodes:
Code: [Select]
Code:
0x3C - HMPMAX10x3D - HMPMAX20x3F - HMPMAX3
Are the same

Code: [Select]
Code:
0xA3 - ANIME10xAE - ANIME2
Are the same

Code: [Select]
Code:
0xAF - ANIM!10xBA - ANIM!2
Are the same

Code: [Select]
Code:
0xB0 - CANIM10xBB - CANIM2
Are the same

Code: [Select]
Code:
0xB1 - CANM!10xBC - CANM!2
Are the same

Code: [Select]
Code:
0xD4 - SIN0xD5 - COSOP SID1 SID2 ANGLE MUL BASE RESOP - byte 0xD4 / 0xD5SID1 - source/dest byte for ANGLE and MULSID2 - source/dest byte for BASE and RESANGLE - WORDMUL - WORDBASE - WORDRES - WORDsize - 0x0Ares = (trunc(sin(angle*2*pi/4096)*4096)*mul+base)/4096
Angle is 4096 based because it's not precise enough to store it in radians. Edit: Oh, and it is probably used to calculate the position of clock's hand in Ancient's Temple :)

Rest will come here as I check them :P

Edit:

Code: [Select]
Code:
0x7F - RDMSDOP SEEDOP - byte 0x7FSEED - BYTE
seed = (byte)(seed<<0x04 + 1)
Which is then used when picking the value from an array or "random" numbers.

position = (byte)(position+seed)
random = random_numbers[position]

When changing the seed, you change the leap which is done before each pick up.
 
Last edited:
No, the ANIM opcodes aren't the same, they're as I've documented them. The ones with 1 after them *do* pause script execution; the ones with 2 after them *do not* pause script execution. In addition, the ANIM! ones leave the object in the last frame of animation; the ANIME ones return the object to its initial pose.

RW_66:

BTMD2: Yep, but it's figuring out the arguments and combinations that's the difficult part.
LSTMP: Is it possible to do an if on the 16-bit temp bank without using LSTMP?
MSPED: Yep, not sure what the second arg is though.
SLIDR: I edited one SLIDR that is present on the *up* portion of the ladder. Saw no changes, except when I tried to come back down the ladder, Cloud got stuck at the top.
 
Last edited:
They may work different, but they share the same .text area.

Edit:
I take that back. Now I see that they fork inside the function.
 
Last edited:
SLIDR I think is used in the entrance to Gaia's cave where you have to fall to certain locations. I believe the minigame on the tracks between Costa Del Sol and North Coral <sp> it's used as well (falling minigame?)

Anyhow SLIDR is used where an uncontroled movement happens to the PC.
If for example you change the 'leap onto a ladder' function where I think SLIDR is used you'll end up possibly not being able to move.

of course this is shear speculation .. but you could check those areas for meaningful information on the SLIDR opcode.

if someone could would they insert the information for PMVIE?  I'm curious how movies are setup to run from the script as I had a sudden suspicion the other day :D

Cyb
 
Last edited:
Yuffie's materia theft is carried out by a dedicated game "mode" (accessed through MENU, I believe). Looks like a lot of specific can't-quite-do-in-script actions were hard-coded in this manner.
 
Ah, I mistook that for MENU E (save game menu). I did notice several MENUs in the debug rooms with values >0xF that didn't seem to do anything in other fields so I guess they'll all need to be looked at.
 
DMTRA and CMTRA don't work as someone might think they should. Can't find Qhimm's post about it so:
DMTRA was supposed to Delete Materia. The thing is, it doesn't :)

Arguments:
Code: [Select]
Code:
OP SID1 SID2 B1 B2 B3 B4 UNKNOWNOP - 0x5CSID1 - source/dest byte for B1 and B2SID2 - source/dest byte for B3 and B4B1 - BYTEB2 - BYTEB3 - BYTEB4 - BYTEUNKNOWN - BYTE
B4*16777216 + B3*65536 + B2*256 + B1 is probably a materia with a certain amount of AP (an unknown byte might be a mode, like 1-delete every single materia that matches, 2-ignore APs etc.)

CMTRA was supposed to Check if Materia is in party's possesion (maybe even count them). The checking function isn't implemented (PC version).

Arguments:
Code: [Select]
Code:
OP SID1 SID2 SID3 B1 B2 B3 B4 UNKNOWN RESOP - 0x5DSID1 - source/dest byte for B1 and B2SID2 - source/dest byte for B3 and B4SID3 - source/dest byte for RESB1 - BYTEB2 - BYTEB3 - BYTEB4 - BYTEUNKNOWN - BYTERES - BYTE
Result is always 0.
 
Could the arguments be similar to adding materia? So

DMTRA (00,00,14,FF,FF,FF,63)

Would be deleting all materia with a materia type of 14, and AP 63FFFFFF?
 
Yes, that would be the most logic way :P There is also that unknown byte... You said that it uses it in blackbg4. What are the arguments there? Is it accessible?

Edit:
AP is 24bit, that unknown byte isn't used (I might be wrong again).
 
Last edited:
[EDIT] Oops - wrong, forgot AP was a three-byte value in SMTRA

Well if that is the way it works, then there's no unknown byte, as it'd be:

DMTRA(B/B,B/B,Type,AP,AP,AP,AP)

Then CMTRA would be the same, just with the address to store the result on the end.

Here's the call from blackbg4 > gss > Script 2:

DLITM(0,8F,0,63)
DMTRA(0,0,14,FF,FF,FF,63)
DMTRA(0,0,14,0,0,0,63)

I did test it on another field where it didn't delete anything but forgot that it'd probably need the required AP to be deleted, so I might test it again later. Not entirely sure how to Wiki this pair, I'll probably just add a note on the page about it not being implemented on the PC version.


[EDIT2] Could it be quantity to delete, as per the ITM opcodes? 0x63 = 99.
 
Last edited:
[EDIT2] Could it be quantity to delete, as per the ITM opcodes? 0x63 = 99.
Most likely.

AP == 0 for newborn materia and FFFFFF for mastered one, 14 is W-Summon Materia, 8F is Ultima Weapon. Sounds fishy :P
 
Last edited:
It's the debug room, it does all sorts of odd things.  :-D From there it goes on to change fields with JUMPMAP so I think it's just a check for the field programmers.
 
It's the debug room, it does all sorts of odd things.  :-D
:roll:

Another update:
IFKEY
IFKEYON
IFKEYOFF

Usage is similar:
Code: [Select]
Code:
OP KEY JUMPOP - 0x30/0x31/0x32KEY - WORDJUMP - BYTE
KEY is a key to check for (surprise!), JUMP is a number of bytes to skip if the condition isn't true (IP+3+JUMP).

IFKEY is used to check if the button is being pressed.
IFKEYON is used to check if the button has been pressed (was OFF, became ON)
IFKEYOFF is used to check if the button has been released (was ON, became OFF)

What I don't understand is:
KEY & 0x0200
It's a condition which determines which key status to use (2 statuses for each mode - being pressed/was pressed/was released - they are always the same :/). 0x0200 is probably not a valid key... Help?
 
Here are some extra pointers (can't post details because I'm at work):

MPPAL, STPAL, LDPAL, CPPAL, RTPAL, ADPAL, MPPAL2, STPLS, LDPLS, CPPAL2, RTPAL2 and ADPAL2 involve the manipulation of field palettes. Palettes are manipulated in the script, then uploaded to and downloaded from VRAM as needed (palettes are only "active" when in VRAM, of course). MultiPlyPALette, CoPyPALette, STorePALette, LoaDPALette, RoTatePALette, ADdPALette etc., with the "duplicate" commands working on either the entire palette or a subset of it. Arguments to the various commands are a bit inconsistent, but the last argument typically denotes the size of the palette (0x0F or 0xFF, signifying 16- or 256-sized palettes). The MPPAL opcodes use fixed-point values for the R, G and B coefficients.

BGROL, BGROL2: Compound BGON/BGOFF commands. "Rolls" the set of visible blocks for a certain background, e.g. "if block i is visible, make block i+1 visible next frame". Useful when a number of blocks work together as an animation.

GWCOL and SWCOL: GetWindowCOLors and SetWindowCOLors, respectively. Does exactly what you'd think, setting the colors of the four corners of your regular gradient-adorned message window.

Oh, and RDMSD is very correctly RanDoMSeeD. The lower 4 bits of the argument is used as a seed for the internal 8-bit random number generator.

That's all I can remember off the top of my head, you did a mighty good job at filling out the wiki page for most of the opcodes I know already. Might fill in more details later if there are questions.
 
Status
Not open for further replies.
Back
Top