QTU script compiled codes

Although this is purely for my own reference, those with 'hacker' mentality might like to understand a little about the nature of the compiled version of QTU scripts. If you load a sizeable script, such as the uncoupling demo, compile the script and then in Tcc's QTU script window, display the disassembled version. Then look at the machine code (the hex bytes) in conjunction with this table.

This is unsupported information - if you don't understand it don't worry - you don't need to.



Function

length

b7

b6

b5

b4

b3

b2

b1

b0

2nd byte

3rd byte

 

Codes

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Index source

1

0

0

0

0

0

ind

ind

ind

 

 

 

8

Index dest

1

0

0

0

0

1

ind

ind

ind

 

 

 

8

Conditional branch

2

0

0

0

1

0

inv

b

b

offset

 

 

8

Bit Save accumulator

2

0

0

0

1

1

inv

b

b

bit & byte no

 

 

8

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Bit Load from input to accumulator 0

1

0

0

1

ch

ch

b

b

b

 

 

 

32

Bit Save accumulator 0 to Output

1

0

1

0

ch

ch

b

b

b

 

 

 

32

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Bit Load to accumulator

2

0

1

1

0

0

inv

b

b

bit & byte no

 

 

8

Bit AND to accumulator

2

0

1

1

0

1

inv

b

b

bit & byte no

 

 

8

Bit OR to accumulator

2

0

1

1

1

0

inv

b

b

bit & byte no

 

 

8

Bit XOR with accumulator

2

0

1

1

1

1

inv

b

b

bit & byte no

 

 

8

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Spare

1

1

0

0

-

-

-

-

-

 

 

 

32

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Compare byte

1-3

1

0

1

br

n

<

=

>

optional n

optional branch

 

32

Byte Load user Input

1

1

1

0

0

0

in

in

in

 

 

 

8

Byte Save to throttle speed/inertia

1

1

1

0

0

1

sp/in

ch

ch

 

 

 

8

Byte Save conditional

2

1

1

0

1

0

inv

b

b

func+dest byte

 

 

8

Byte Load

2

1

1

0

1

1

0

fn

fn

byte no

 

 

4

Byte Load Literal

2

1

1

0

1

1

1

fn

fn

Literal

 

 

4

Byte copy conditional

3

1

1

1

0

0

inv

b

b

source byte

func+dest byte

 

8

Byte load literal conditional

2

1

1

1

0

1

inv

b

b

Literal

 

 

8

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Load indexed from EEPROM

1

1

1

1

1

0

ind

ind

ind

 

 

 

8

Byte Save

2

1

1

1

1

1

0

0

0

func+dest byte

 

 

1

Byte copy

3

1

1

1

1

1

0

0

1

source byte

func+dest byte

 

1

Byte set literal

3

1

1

1

1

1

0

1

0

Literal

func+dest byte

 

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Centre-zero byte accumulator

1

1

1

1

1

1

0

1

1

 

 

 

1

Bit find first zero

1

1

1

1

1

1

1

0

0

 

 

 

1

Byte load masked

1

1

1

1

1

1

1

0

1

dest, bits, shift

 

 

1

Negate byte accumulator

1

1

1

1

1

1

1

1

0

 

 

 

1

End of expressions

1

1

1

1

1

1

1

1

1

 

 

 

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Analogue functions

 

 

 

 

 

 

 

 

 

 

 

 

256

Plain move

 

0

0

 

 

 

 

 

 

 

 

 

 

Add

 

0

1

 

 

 

 

 

 

 

 

 

 

Subtract

 

1

0

 

 

 

 

 

 

 

 

 

 

Average

 

1

1