Delphi Inline Assembler
2005-12-19 16:49
344 查看
program Project1; {$APPTYPE CONSOLE} uses SysUtils; var str: string; { Result := x + y } function add1(x, y: Integer): Integer; begin asm mov eax, x add eax, y mov @Result, eax end; end; { for I := 0 to Length(s) do s[i] := lower(s[i]) } function test2(s: PChar): PChar; begin { nest asm stmts inside a normal delphi proc then registers and flag are handled by delphi } asm mov ebx, s xor esi, esi @lab1: cmp byte ptr [ebx + esi], 0 jz @lab2 or byte ptr [ebx + esi], $20 add esi, 1 jmp @lab1 @lab2: mov @Result, ebx end; end; begin str := 'dO yOu kNoWn wHaT i MeAn?'; { TODO -oUser -cConsole Main : Insert code here } WriteLn(add1($FFFFFFFF, 2)); WriteLn(test2(PChar(str))); end.
相关文章推荐
- Inline Assembler in Delphi (IV) Records
- Inline Assembler in Delphi (III) Static Arrays
- Inline Assembler in Delphi (V) An Introdunction to Objects
- Inline Assembler in Delphi (II) ANSI strings
- Inline Assembler in Delphi (VI) Calling external procedures
- Inline Assembler in Delphi (I) Introduction
- Inline Assembler in Delphi (III)
- Inline Assembler Cookbook
- ARM GCC Inline Assembler Cookbook
- 解决wxutil .cpp(626) : error C2400: inline assembler syntax error in 'opcode'; found 'newline'
- 【C语言常识】mdk:Inline assembler rules for compiler keywords __asm and asm
- codewarrior中SP debug info incorrect because of optimization or inline assembler的解决方法
- 编译原子哥的SYSTEM出现错误 Inline assembler not permitted when generating Thumb code
- 使用CodeWarrior编译时出现Warning:C12056 SP debug info incorrect because of optimization or inline assembler
- MDK4版本3.80编译正点原子的SYSTEM出现错误 Inline assembler not permitted when generating Thumb code
- ARM GCC Inline Assembler Cookbook
- ARM GCC的内联汇编详解 (ARM GCC Inline Assembler Cookbook)
- ARM GCC Inline Assembler Cookbook
- 使用CodeWarrior编译时出现Warning:C12056 SP debug info incorrect because of optimization or inline assembler
- ARM GCC Inline Assembler Cookbook