Next: , Previous: , Up: CCL   [Contents][Index]


66.7.3 CCL Expressions

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.

NameOperatorCodeC-like Description
CCL_PLUS+0x00X = Y + Z
CCL_MINUS-0x01X = Y - Z
CCL_MUL*0x02X = Y * Z
CCL_DIV/0x03X = Y / Z
CCL_MOD%0x04X = Y % Z
CCL_AND&0x05X = Y & Z
CCL_OR|0x06X = Y | Z
CCL_XOR^0x07X = Y ^ Z
CCL_LSH<<0x08X = Y << Z
CCL_RSH>>0x09X = Y >> Z
CCL_LSH8<80x0AX = (Y << 8) | Z
CCL_RSH8>80x0BX = Y >> 8, r[7] = Y & 0xFF
CCL_DIVMOD//0x0CX = Y / Z, r[7] = Y % Z
CCL_LS<0x10X = (X < Y)
CCL_GT>0x11X = (X > Y)
CCL_EQ==0x12X = (X == Y)
CCL_LE<=0x13X = (X <= Y)
CCL_GE>=0x14X = (X >= Y)
CCL_NE!=0x15X = (X != Y)
CCL_ENCODE_SJISen-sjis0x16X = HIGHER_BYTE (SJIS (Y, Z))
r[7] = LOWER_BYTE (SJIS (Y, Z)
CCL_DECODE_SJISde-sjis0x17X = 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: , Previous: , Up: CCL   [Contents][Index]