Author Topic: Fieldscript... Again.  (Read 2812 times)

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Fieldscript... Again.
« on: 2006-06-05 22:55:02 »
Ok, I'm decrypting the fieldscript, and I'm havving issues with the memory access system

Ok, after an opcode, the first byte is the source/destination bank. If source is 0 then the data is taken as an argument. (often it replaces the offset in the bank)

But what if the argument is a word in "bank 0" mode, but a normal 8-bit byte when in "offset" mode. What do you do with the extra byte, Ignore it?

Show an example with Plus2, if you could...

Also how does the conditionals work? The script dump doen't make any sense as there is an extra variable that doesn't seem to belong)

if UbyleL (05)[0] != 0 then (00) gotonext c1

I know this is probably being parsed wring the the scriptdumper, but what does "then (00)"  mean...

I know this is vauge. Help will be helpful.


dziugo

  • *
  • Posts: 1470
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
Re: Fieldscript... Again.
« Reply #1 on: 2006-06-06 13:12:15 »
Ok, after an opcode, the first byte is the source/destination bank. If source is 0 then the data is taken as an argument. (often it replaces the offset in the bank)

But what if the argument is a word in "bank 0" mode, but a normal 8-bit byte when in "offset" mode. What do you do with the extra byte, Ignore it?
Well... Yes, but you won't find such an example (probably). There is always an extra opcode (f.e. PLUS2) which takes only word immediate as the second parameter. You can use a SID (source & dest) byte(s) which will tell it to look for a byte/word from the bank, but it should always be a word (higher byte is not used then).

Show an example with Plus2, if you could...
To summarize, PLUS (which is 4 bytes long) is for adding values which are in the banks, PLUS2 (which is 5 bytes long) is for adding immediates to the value in a memory bank.

Edit:
Ok, now I know that it's not true. PLUS is used when adding BYTEs, and PLUS2 is used to add WORDs. PLUS2 is 5-bytes long because it can contain the immediate word value, and only then the higher byte is used.


if UbyleL (05)[0] != 0 then (00) gotonext c1

I know this is probably being parsed wring the the scriptdumper, but what does "then (00)"  mean...
The unknown byte is the relation used in comparison:
Code: [Select]
I could have made a mistake here [Edit: and I did]
0x00 A == B
0x01 A != B
0x02 A > B
0x03 A < B
0x04 A >= B
0x05 A <= B
0x06 A & B
0x07 A ^ B
0x08 A | B
0x09 A & (1<<B)  ;edited
0x0A !( (A & (1<<B)) ) ;edited
Jump is taken if condition is NOT true.

dziugo
« Last Edit: 2006-08-10 09:46:52 by dziugo »