- function ChoixS(PremierChoix:Boolean; Choix1,Choix2:ShortString):ShortString; Assembler;
- Asm
- // If PremierChoix then Result:=Choix1 else Result:=Choix2;
- //=- original version was 34 asm lines and 2 external procs by Delphi compiler ;) now it's 14 lines -=
- push esi
- push edi
- test al,al
- jz @@NotTrue
- mov esi,Choix1
- jmp @@End
- @@NotTrue:
- mov esi,Choix2
- @@End:
- mov edi,@Result
- xor ecx,ecx
- mov cl,[esi]
- inc cl
- rep movsb
- pop edi
- pop esi
- End;
-
- function ChoixL(PremierChoix:Boolean; Choix1,Choix2:LongInt):LongInt; Assembler;
- Asm
- // If PremierChoix then Result:=Choix1 else Result:=Choix2;
- test al,al
- jz @@NotTrue
- mov eax,edx // it's true so put the first parameter into the result
- ret
- @@NotTrue:
- mov eax,ecx // it's false, put second parameter into result
- End;
-
- function ChoixB(PremierChoix:Boolean; Choix1,Choix2:Boolean):Boolean; Assembler;
- Asm
- // If PremierChoix then Result:=Choix1 else Result:=Choix2;
- test al,al
- jz @@NotTrue
- mov eax,edx // it's true so put the first parameter into the result
- ret
- @@NotTrue:
- mov eax,ecx // it's false, put second parameter into result
- End;
function ChoixS(PremierChoix:Boolean; Choix1,Choix2:ShortString):ShortString; Assembler;
Asm
// If PremierChoix then Result:=Choix1 else Result:=Choix2;
//=- original version was 34 asm lines and 2 external procs by Delphi compiler ;) now it's 14 lines -=
push esi
push edi
test al,al
jz @@NotTrue
mov esi,Choix1
jmp @@End
@@NotTrue:
mov esi,Choix2
@@End:
mov edi,@Result
xor ecx,ecx
mov cl,[esi]
inc cl
rep movsb
pop edi
pop esi
End;
function ChoixL(PremierChoix:Boolean; Choix1,Choix2:LongInt):LongInt; Assembler;
Asm
// If PremierChoix then Result:=Choix1 else Result:=Choix2;
test al,al
jz @@NotTrue
mov eax,edx // it's true so put the first parameter into the result
ret
@@NotTrue:
mov eax,ecx // it's false, put second parameter into result
End;
function ChoixB(PremierChoix:Boolean; Choix1,Choix2:Boolean):Boolean; Assembler;
Asm
// If PremierChoix then Result:=Choix1 else Result:=Choix2;
test al,al
jz @@NotTrue
mov eax,edx // it's true so put the first parameter into the result
ret
@@NotTrue:
mov eax,ecx // it's false, put second parameter into result
End;