{ t49_strcmp_lit: string comparison where one or both operands are a LITERAL. A string literal has no storage, and the .COM image carries no initialised data (globals are left to the loader's zero fill), so TP3 emits the literal inline in the CODE stream - a JMP over its bytes, then - and takes its address with the LEA that follows. So this pins PushStrAddr's inline path (the jump, the length byte, the address) as well as the compare itself, in both operand positions and with both operands literal. The empty literal '' is the length-0 case of that path, and it also drives cmpstr's JCXZ arm, where min(lenL,lenR) is 0 and the loop never runs. } program t49_strcmp_lit (input, output); var s : string[8]; n : integer; begin s := 'abc'; n := 0; if s = 'abc' then n := n + 1; { literal on the RIGHT } if s <> 'abc' then n := n + 2; if s < 'abd' then n := n + 4; if s > 'abb' then n := n + 8; if s <= 'abc' then n := n + 16; if s >= 'abc' then n := n + 32; writeln(n); { 61: =, <, >, <=, >= } n := 0; { literal on the LEFT } if 'abc' = s then n := n + 1; if 'abd' > s then n := n + 2; if 'abb' < s then n := n + 4; writeln(n); { 7 } n := 0; { BOTH operands literal. Note '' is the empty STRING while 'a' would be a CHAR, so only string literals may appear here (see t50 for the CHAR case). } if 'abc' = 'abc' then n := n + 1; if 'abc' <> 'abd' then n := n + 2; if '' < 'ab' then n := n + 4; if '' = '' then n := n + 8; writeln(n); { 15 } s := 'ab'; { and all four as VALUES } writeln(s < 'abc', ' ', s > 'abc', ' ', 'ab' < 'abc', ' ', '' < 'ab') end.