Q-Code User Manual
Ver. 7.0 2021/11/30
131
P4: PlayV(ch0, $V2)
4.2.1 Comparison
Operator
Definition
Example
Var1 = Var2
Equal to
R0 = 2 ?TRUE, X0 = R1 ?TRUE, R0.0 = 1 ? True
Var != Var
Not equal to
R0 != R1?TRUE ; R0 != 3 ?TRUE ; PA.0 = 1 ?TRUE
Var >= Var
Greater than or equal to Vol >= R1?TRUE ; R0 >= 3 ?TRUE
Var > Var
Greater than
Random > 128 ?TRUE ; R0 > 5 ?TRUE
Var <= Var
Less than or equal to
R0 <= R1?TRUE ; R0 <= 5 ?TRUE
Var < Var
Less than
R0 < R1 ?TRUE ; R0 = 7, R0 < 5 ?TRUE
Q-Code
support the comparison of variables, the variables could be:
1-bit operator: Ri.n / Xi.n / Px.n
4-bit operator: Ri / Px
8-bit operator: Xi
Varaibles defined in
[Variable]
System variables
Note: The available system variables are listed below.
No.
Name
Descriptions
Example
1
Vol
Volume
Vol = R1 + 2
2
V_Chx_Vol The channel volume of voice
V_Ch0_Vol = X0
3
M_Chx_Vol The individual channel volume of Melody
M_Ch10_Vol = R0
4
SPIVol
The channel volume of SPIPlay
SPIVol = R0
5
Px
IO Port
PA = R0 ^ 0x9
6
PxM
Input / Output mode of IO port
PAM = PFM | 0x1
7
PxM.n
Input / Output mode of IO pin
PAM.0 = PFM.0
8
RandomL
Low nibble of random number
Read only, do not use at the left side of “=”
R0 = RandomL ^ 0x5
9
RandomH
Hight nibble of random number
Read only, do not use at the left side of “=”
R0 = RandomH | 0x9
10 Random
Random number
Read only, do not use at the left side of “=”
X0 = Random ^ 0x33
4.2.2 Px = data?Path
Jump to Path when the value of Px is equal to data.
Ex.
PA = 3? Path
; Jump to Path if the value of PA is 3.