Next: Calling CCL, Previous: CCL Statements, Up: CCL [Contents][Index]
CCL, unlike Lisp, uses infix expressions. The simplest CCL expressions
consist of a single operand, either a register (one of r0
,
..., r0
) or an integer. Complex expressions are lists of the
form ( expression operator operand )
. Unlike
C, assignments are not expressions.
In the following table, X is the target resister for a set.
In subexpressions, this is implicitly r7
. This means that
>8
, //
, de-sjis
, and en-sjis
cannot be used
freely in subexpressions, since they return parts of their values in
r7
. Y may be an expression, register, or integer, while
Z must be a register or an integer.
Name | Operator | Code | C-like Description |
CCL_PLUS | + | 0x00 | X = Y + Z |
CCL_MINUS | - | 0x01 | X = Y - Z |
CCL_MUL | * | 0x02 | X = Y * Z |
CCL_DIV | / | 0x03 | X = Y / Z |
CCL_MOD | % | 0x04 | X = Y % Z |
CCL_AND | & | 0x05 | X = Y & Z |
CCL_OR | | | 0x06 | X = Y | Z |
CCL_XOR | ^ | 0x07 | X = Y ^ Z |
CCL_LSH | << | 0x08 | X = Y << Z |
CCL_RSH | >> | 0x09 | X = Y >> Z |
CCL_LSH8 | <8 | 0x0A | X = (Y << 8) | Z |
CCL_RSH8 | >8 | 0x0B | X = Y >> 8, r[7] = Y & 0xFF |
CCL_DIVMOD | // | 0x0C | X = Y / Z, r[7] = Y % Z |
CCL_LS | < | 0x10 | X = (X < Y) |
CCL_GT | > | 0x11 | X = (X > Y) |
CCL_EQ | == | 0x12 | X = (X == Y) |
CCL_LE | <= | 0x13 | X = (X <= Y) |
CCL_GE | >= | 0x14 | X = (X >= Y) |
CCL_NE | != | 0x15 | X = (X != Y) |
CCL_ENCODE_SJIS | en-sjis | 0x16 | X = HIGHER_BYTE (SJIS (Y, Z)) |
r[7] = LOWER_BYTE (SJIS (Y, Z) | |||
CCL_DECODE_SJIS | de-sjis | 0x17 | X = HIGHER_BYTE (DE-SJIS (Y, Z)) |
r[7] = LOWER_BYTE (DE-SJIS (Y, Z)) |
The CCL operators are as in C, with the addition of CCL_LSH8, CCL_RSH8, CCL_DIVMOD, CCL_ENCODE_SJIS, and CCL_DECODE_SJIS. The CCL_ENCODE_SJIS and CCL_DECODE_SJIS treat their first and second bytes as the high and low bytes of a two-byte character code. (SJIS stands for Shift JIS, an encoding of Japanese characters used by Microsoft. CCL_ENCODE_SJIS is a complicated transformation of the Japanese standard JIS encoding to Shift JIS. CCL_DECODE_SJIS is its inverse.) It is somewhat odd to represent the SJIS operations in infix form.
Next: Calling CCL, Previous: CCL Statements, Up: CCL [Contents][Index]