What does the 8691 code type do?

Started by spunit262, January 19, 2009, 06:40:08 PM

Previous topic - Next topic

spunit262

I got this PM form a fellow Hacker working on the Brawl+ project, a project in desperate need of code lines.
Quote from: AlmasOkay, so recently I've been going through PW's codes, working on merging some of them since Paprika has gone missing. To be honest it doesn't look too tricky - they do share a LOT in common. Change a few gecko registers, rejig the PO every now and then and it should fit nicely, I think. However, a couple of things have stumped me and I was wondering if you could clear things up. I don't really have direct contact to PW myself.

Firstly, the lagless edges code:


Lagless ledges: Phantom wings (24 lines)
80000000 80623320
80000001 00000000
60000006 00000000
60000003 00000001
4A001000 00000000
4A101001 00000000
36000000 00000032
58010000 00000004
DE000000 80008180
58010000 00000060
DE000000 80008180
92210002 00000014
58010000 0000007C
30000038 00000074
86000002 00000040
86910002 40000000 <---
E2000001 00000000
80100001 00000008
62000000 00000001
E200000F 00000000
80000001 00000000
80100000 00000244
62000000 00000000
E0000000 80008000


I'm not sure at all how this code operates. Every value seems to deal solely with playing around with POs and Registers - I can't find any write codes at all. The only exception is the indicated line, but I'm not sure what it does:

86TY000N XXXXXXXX: Direct value operations
86T0 : grN = (grN ? XXXXXXXX)
86T1 : grN = ([grN] ? XXXXXXXX)
86T2 : grN = (grN ? [XXXXXXXX])
86T3 : grN = ([grN] ? [XXXXXXXX])

? = T :
0 : add (+)
1 : mul (*)
2 : or (|)
3 : and (&)
4 : xor (^)
5 : slw (<<)
6 : srw (>>)
7 : rol (rotate left)
8 : asr (arithmetic shift right)
A : fadds (single float add)
B : fmuls (single float mul)


Ah, the irony.

I was hoping you could shed some light on the situation? Thanks for your help.
I'm just as clueless.
Not active but may still sporadically make codes.
(ooo)
``´´

brkirch

#1
The reason that Almas can't figure out that one line is because of a mistake in the code documentation.  It should be this:
Quote===================================================
= CST3 : Gecko Register / Direct Value operations =
===================================================

86TY000N XXXXXXXX: Direct value operations
86T0 : grN = (grN ? XXXXXXXX)
86T1 : grN = ([grN] ? XXXXXXXX)
86T2 : grN = (grN ? [XXXXXXXX])
86T3 : grN = ([grN] ? [XXXXXXXX])


? = T :
0 : add (+)
1 : mul (*)
2 : or  (|)
3 : and (&)
4 : xor (^)
5 : slw (<<)
6 : srw (>>)
7 : rol (rotate left)
8 : asr (arithmetic shift right)
9 : fadds (single float add)
A : fmuls (single float mul)

As for the code, here is what it appears to be doing:
80000000 80623320 <-- set gr0 to 80623320
80000001 00000000 <-- set gr1 to 00000000
60000006 00000000 <-- repeat begin (6 times, b0)
60000003 00000001 <-- repeat begin (3 times, b1)
4A001000 00000000 <-- po = gr0+00000000
4A101001 00000000 <-- po += gr1+00000000
36000000 00000032 <-- If [po+0000000] lower than 00000032
58010000 00000004 <-- po = [po+00000004]
DE000000 80008180 <-- If po in range 80000000-81800000
58010000 00000060 <-- po = [po+gr0+00000060]
DE000000 80008180 <-- If po in range 80000000-81800000
92210002 00000014 <-- gr2 = 32-bits at [00000014+po]
58010000 0000007C <-- po = [po+0000007C]
30000038 00000074 <-- If [po+0000038] equal to 00000074
86000002 00000040 <-- gr2 += 00000040
86910002 40000000 <-- gr2 = fadds([gr2], 40000000)
E2000001 00000000 <-- endif
80100001 00000008 <-- gr1 += 00000008
62000000 00000001 <-- end repeat (b1)
E200000F 00000000 <-- 15 endifs
80000001 00000000 <-- set gr1 to 00000000
80100000 00000244 <-- gr0 += 00000244
62000000 00000000 <-- end repeat (b0)
E0000000 80008000 <-- code terminator

Almas is right, there don't appear to be any RAM writes in this code.  I tried the code and didn't notice any changes, so I think the code may be missing a line.

Almas

That's the thing - it seems to perform its desired purpose even when ran with no other codes.

(The effect is that the animation for grappling an edge is increased - try bumping the line indicated in the OP to 6-7, then grabbing an edge).

It is truly perplexing.

brkirch

Quote from: Almas on January 19, 2009, 09:46:09 PM
That's the thing - it seems to perform its desired purpose even when ran with no other codes.

(The effect is that the animation for grappling an edge is increased - try bumping the line indicated in the OP to 6-7, then grabbing an edge).

It is truly perplexing.

Well looking into it I found another problem with the documentation which explains how this code is writing to memory (see lines with 86T1 & 86T3):
Quote===================================================
= CST3 : Gecko Register / Direct Value operations =
===================================================

86TY000N XXXXXXXX: Direct value operations
86T0 : grN = (grN ? XXXXXXXX)
86T1 : [grN] = ([grN] ? XXXXXXXX)
86T2 : grN = (grN ? [XXXXXXXX])
86T3 : [grN] = ([grN] ? [XXXXXXXX])


? = T :
0 : add (+)
1 : mul (*)
2 : or  (|)
3 : and (&)
4 : xor (^)
5 : slw (<<)
6 : srw (>>)
7 : rol (rotate left)
8 : asr (arithmetic shift right)
9 : fadds (single float add)
A : fmuls (single float mul)
So apparently the gecko register isn't just dereferenced, the result is also saved to the dereferenced address.

Almas

I'm really glad you could identify the problem. It will help a lot. Thank you =).

Romaap

hmmm.....
what does the fadds do? does it takes an hex value and add it to a floating point number?

Igglyboo

It takes a floating point number and adds it to a floating point number.

paprika_killer

I asked the same question earlier and someone suggested it could be arithmetic shift left, which seems to be missing from the list
[SIGPIC][/SIGPIC]

brkirch

#8
Quote from: paprika_killer on January 20, 2009, 09:36:38 PM
I asked the same question earlier and someone suggested it could be arithmetic shift left, which seems to be missing from the list

Like I said, the code documentation has mistakes, the list I posted has the correct values (based off the code handler source):
Quote? = T :
0 : add (+)
1 : mul (*)
2 : or  (|)
3 : and (&)
4 : xor (^)
5 : slw (<<)
6 : srw (>>)
7 : rol (rotate left)
8 : asr (arithmetic shift right)
9 : fadds (single float add)
A : fmuls (single float mul)
And as Igglyboo already said, fadds does a floating point add operation.