IF OPERATOR: "E97" EXAMPLES

Back to:
index Intel

Examples of full operators

Here you can see the results of full conditional operators' translation. You may need to look for some details about conditions coding and how assign operator is compiling.

1. IF x<0 THEN s := -1 ELSE s := 1; (DE - address of variable x, DC - s)
Address, codeOperationsPascal comments
000A 01E1
000C 00DE
(DE) ==> R1 Extract x
000E 2401 compare R1 with 0 Is x < 0 ?
0010 2C0D
0012 001E
jump if >=0 Jump to ELSE branch
0014 3111
0016 011E
0018 00DC
-1 ==> R1
R1 ==> (DC)
THEN s := -1;
001A 1C0D
001C 0024
unconditional jump ELSE bypass
001E 2111
0020 011E
0022 00DC
1 ==> R1
R1 ==> (DC)
ELSE s := 1;
0024

2. IF x<0 THEN s := -1; (DE - address of variable x, DC - s)
This short form of IF operator can be easily derived from the previous example by removal of ELSE branch and its bypass:
Address, codeOperationsPascal comments
000A 01E1
000C 00DE
(DE) ==> R1 Extract x
000E 2401 compare R1 with 0 Is x < 0 ?
0010 2C0D
0012 001A
jump if >=0 Jump to next operator
0014 3111
0016 011E
0018 00DC
-1 ==> R1
R1 ==> (DC)
THEN s := -1;
001A

3. IF b THEN c := '0' ELSE c := '1'; (DD - address of BOOLEAN variable b, DC - c)
Address, codeOperationsPascal comments
001C 81E1
001E 00DD
(DD)b ==> R1 Extract b (byte value)
0020 E401 compare R1b with 0b Is b <> 0 (TRUE)?
0022 5C0D
0024 0032
jump if =0 Jump to ELSE branch
if FALSE
0026 81D1
0028 0030
002A C11E
002C 00DC
30b ==> R1

R1b ==> (DC)b
THEN c := '0';
002E 1C0D
0030 003A
unconditional jump ELSE bypass
0032 81D1
0034 0031
0036 011E
0038 00DC
31b ==> R1

R1b ==> (DC)b
ELSE c := '1';
003A



Back to:
index top Intel