1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
##############################################################################
##### All behind a '#' on the same line is a comment and ignored. #####
##### See https://szs.wiimm.de/doc/kcl/flagfile for more details. #####
##############################################################################
# function f()
# First, we define a flag function named f().
# This allows us to define type and variant as 2 values.
@function f # (type,variant)
@return $1 & 0x1f | $2 << 5
@endfunction
##############################################################################
# function a()
# Here we define function a() to support the flag variant type A.
# For details see http://wiimm.de/r/ctw/KCL_flag
@function a # (type,w,x,y,z)
@return $1 & 0x1f # type (5 bits)
> | ( $2 & 7 ) << 13 # W (3 bits)
> | ( $3 & 3 ) << 11 # X (2 bits)
> | ( $4 & 7 ) << 8 # Y (3 bits)
> | ( $5 & 7 ) << 5 # Z (3 bits)
@endfunction
##############################################################################
# function i()
# The function i() supports fall boundaries.
@function i # (type,z,index)
@return $1 & 0x1f # type (5 bits)
> | ( $2 & 7 ) << 5 # Z (3 bits)
> | ( $3 & 0xff ) << 8 # index (8 bits)
@endfunction
##############################################################################
# table
#-----------------------------------------------------------------------------
# group_name = flag_or_expression
# = f(type,variant)
# = a(type,w,x,y,z)
# = i(type,z,index)
#-----------------------------------------------------------------------------
|