Simulating IF variable BIT value SET THEN


Senior Member
When stepping through a 20X2 simulation that uses "IF variable BIT value SET THEN" where variable and value are both byte variables, I was surprised that it needs 4 steps to process the IF statement. Is this normal and does it reflect that it takes a long time to process in silicon?

The same simulation has a quite complex statement "IF ang<messtart OR ang>mesend THEN" that only takes one step in the simulator.


Technical Support
Staff member
The multiple steps are likely a result of the IF only allowing "this = that" type conditionals, so the "var BIT value SET" conditions have to be implemented as something, I would guess, like -
temp1 = var
temp2 = value
temp3 = 1 << temp1 And temp2
If temp3 <> 0 Then
When the code is stepped through in simulation it executes those four commands, hence the need for four steps, four mouse clicks.

The number of steps will reflect that the code is doing somewhat more than a simple "this = that" test.