### Mnemonic: CSetCLnk

Hex Code: | AJ | MR | SS | XX | 00 | YY | HH | LL | M=1-7, Compare register XX to register YY, indirect set
AJ | MR | SS | XX | KK | KK | HH | LL | M=9-F, Compare register XX to constant KKKK, indirect set
BJ | MR | SS | SS | XX | YY | HH | LL | M=1-7, Compare register XX to register YY, direct set

Action: | The CSetCLnk command performs the compare operation, if the result is true then sets the destination register "R" (byte 1 lower nibble) to the result of the operation "J", listed below, and executes the link. The indirect form uses GPRM or SPRM denoted by "SS" (byte 2) as the source, as allowed by the operation. The direct form uses the constant "SSSS" (bytes 2&3) as the source value, if allowed by the operation.
Order: | The compare operation is performed first, if false the command exits. The set is performed, and then the link is executed.
Comments: | It is possible to make this command unconditional by setting "M" to 0 or 8, but the Set command is better suited for performing a set and link as it allows the full range of link commands. "LL" may be set to 0, changing the command into a conditional set operation. While this command can perform a compare and link, it is limited to one constant for either the set or compare, and the command is limited to the link subset. The related command Set allows the use of seperate registers for set and compare, and also allows the full range of link commands, but cannot combine compare and link in the same command. The related command SetCLnk allows the use of constants for both set and compare, but set and compare share a register, and is limited to the link subset. The related command CSetLnk (conditionally set, unconditionally link) can combine compare and link, does not share registers but is limited to one constant for either set or compare, and is limited to the link subset.

Set operation codes | Source may be
--- | ---
J | Mnemonics | Operation | GPRM | SPRM | constant
0 |  | no set is performed, command becomes conditional link |  |  |
1 | = mov | set destination GPRM to source value |  |  |
2 | <-> swp | swap destination GPRM with source GPRM |  |  |
3 | += add | add source value to destination GPRM |  |  |
4 | -= sub | subtract source value from destination GPRM |  |  |
5 | *= mul | multiply destination GPRM by source value |  |  |
6 | /= div | divide destination GPRM by source value |  |  |
7 | %= mod | set destination GPRM to destination register modulo source value |  |  |
8 | ?= rnd | set destination GPRM to a random value between 1 and the source value |  |  |
9 | &= and | and destination GPRM with source value |  |  |
A | |= or | or destination GPRM with source value |  |  |
B | ^= xor | xor destination GPRM with source value |  |  |

Compare operation codes
register to register | register to constant | Alternate mnemonic | Comments
--- | --- | --- | ---
M | operation | M | operation
1 | RegR & RegY | 9 | RegR & K | BC | Bitwise compare, the two operands are anded, if the result is non-zero the condition is true
2 | RegR == RegY | A | RegR == K | EQ | If the two operands are equal the condition is true
3 | RegR != RegY | B | RegR != K | NE | If the two operands are not equal the condition is true
4 | RegR >= RegY | C | RegR >= K | GE | If RegX is greater than or equal to the right operand the condition is true
5 | RegR > RegY | D | RegR > K | GT | If RegX is greater than the right operand the condition is true
6 | RegR <= RegY | E | RegR <= K | LE | If RegX is less than or equal to the right operand the condition is true
7 | RegR < RegY | F | RegR < K | LT | If RegX is less than the right operand the condition is true

Optional Link Command details
LL | Link Command | Comment
--- | --- | ---
00 | LinkNoLink | use byte 6 as "HH" in these detailed pages, ignore all other values.
01 | LinkTopCell
02 | LinkNextCell
03 | LinkPrevCell
05 | LinkTopPG
06 | LinkNextPG
07 | LinkPrevPG
09 | LinkTopPGC
0A | LinkNextPGC
0B | LinkPrevPGC
0C | LinkGoUpPGC
0D | LinkTailPGC
10 | RSM

Register Codes
0x00 through 0x0F | General Purpose registers 0 to 15 (GPRM)
0x80 through 0x97 | System Parameter registers 0 to 23 (SPRM)
all others | do not use

Numerically | Alphabetically | Index | Alphabetically | Numerically

DVD-Video info home | Copyright © 2001 - 2020 STN Software, all rights reserved.