Under construction. Contain SPOILER. Last Update: 2010/11/01 22:35 +0900
Here is a top-view of his map.
3 steps.
1. Look at the alcove. A green gem is at alcove. |
|
2. Push a button next to the alcove. | |
3. Check the alcove now. It is transformed to a worm round! |
At first, check the map structure and misc. parameters.
Yellow block means Floor.
Blue block means Wall.
DSA … location of DSA actuator. |
Look at his DSA program. It is the program which you are interested in.
S0: "L0 LA L1 &NEG L1984 F &DUP L0 &SWAP &<
?JC0"
C0: "&TYPE L0 LB L8 L1984 F &TYPE &= ?JT0"
T0: "L1 LA L0 LB L2 L1984 F &ADD L0 LA L1 &NEG L1984 F LA
&DEL"
Scan at the alcove to find an Misc Item. If there is an Misc Item, go to the state "C0". Otherwise, DSA program finishes.
The following sections are to explain meaning of every code bit.
DSA uses "stack" algorithm to store temporary variables. CSBwin built-in features also use stack to interact with DSA program.
DSA's stack only stores "integer value" such as 1, 2, 0, -1. It won't store any of decimal/text/pictures/etc.
Finally the code "L0 LA L1 &NEG L1984
"
pushes 4 values at stack.
Code explanation.
L0
" pushes a value 0 at top of stack.LA
" pushes a value of "Parameter
A" of DSA actuator.L1
" pushes a value 1 at top of stack.&NEG
" changes the sign of a value.
Target value is always at top of stack.L1984
" pushes a value 1984 at top of
stack.Frankly speaking, next code "F" pops 4 values from stack, then pushes a value to stack.
More about "F", look at the reference of "F".
In this case, we assume that a greem gem is at alcove:
F
"
popped 4 values because they were scan options."&DUP
" duplicates a value at top of
stack.
Look at the reference of "&DUP".
L0
" pushes a value 0.&SWAP
" swapped 2 values at top of
stack.4 is greater than 0. The criterion is satisfied, thus 1 is pushed, otherwise 0 is pushed.
In this case, there was a Misc Item (green gem) at alcove.
Remember, we assumed an green gem is at alcove. And "
|
In this case, there was no Misc Item at alcove.
If there is no item at alcove then, " "-1" is less than "0", thus "0" will be pushed.
|
"?" is the operation to branch the running program. See reference of "IfElse".
Separate to 3 parts.
Part | Meaning |
---|---|
? | IfElse operation |
J | If xxx is satisfied, jump to ... |
C0 | column C0 |
IfElse is very easy to understand.
Generic IfElse consideration | ?JC0 case |
After "?" operation code, you specify "J" or "G", or ommit it.
Type of branch | Working |
---|---|
JUMP | Next run is at other column. (Such as S0/T0/C0) |
GOSUB | Next run is at other column. However if you finish at branched office, you'll return here to continue rest DSA program. |
CONTINUE | No-branch occurs. Continue rest DSA program. |
To understand what is "Yes" and "No", look at following figures.
In this case, the Misc Item (green gem) is at alcove. |
In this case, there is no Misc Item at alcove. |
Verify the item at the alcove is a green gem. If surved item is a green gem, then go to state "T0". Otherwise, program finishes.
For example, if you surved a worm round, then program finishes.
...
Location is always represented as Integer.
The absolute location is "level=6, x=15, y=18".
This would be an integer "498"?
You can convert the values between Binary and Integer. Use windows CALC.
⇔ |