How can one instruction give eight or more different branch targets? Use no tables or aligned routines -- I mean to use one instruction to set the flags and then branch with JCC instructions, but you have to explain how it works - the answer is not enough. There are many answers, so don't think it that hard.
{The idea is not to use POPF/LAHF either - that is no fun ;)}
* As a bonus tell us how the most Jcc can be used for the most targets, from the setting of the flags by one instruction?
Example:
{The idea is not to use POPF/LAHF either - that is no fun ;)}
* As a bonus tell us how the most Jcc can be used for the most targets, from the setting of the flags by one instruction?
Example:
bt eax, 1
jc Target_2
Target_1:
...
Target_2:
There are only two target from the one BT instruction - how can you use other instructions to set the flags and JCC as many times as you can?
shl eax, 1 ;Here is the flag-setting instruction
jp pp
mp:
js mpps
mpms:
jc mpmspc
mpmsmc:
jmp Target1
mpmspc:
jmp Target2
mpps:
jc mppspc
mppsmc:
jmp Target3
mppspc:
jmp Target4
pp:
js ppps
ppms:
jc ppmspc
ppmsmc:
jmp Target5
ppmspc:
jmp Target6
ppps:
jc pppspc
pppsmc:
jmp Target7
pppspc:
jmp Target8
Proof:
0x00000001 shl 1 = Target1
0x80000001 shl 1 = Target2
0x40000001 shl 1 = Target3
0xC0000001 shl 1 = Target4
0x00000000 shl 1 = Target5
0x80000000 shl 1 = Target6
0x40000000 shl 1 = Target7
0xC0000000 shl 1 = Target8
With 3 flags set, you have a 3-bit number with 8 possible values, each corresponding to a different
target. You can't just have jc Target1, jnc Target2 because that gets rid of all of the other possibilites.
You have to put your jumps into a tree form that jumps to a different spot for all 8 values of the 3 flags.
Note: You could get a few extra targets using the zero flag, but not twice as many since i.e the parity flag
will never be set when the zero flag is.
evwr, nice work! :)