Thread View: borland.public.delphi.language.basm
8 messages
8 total messages
Started by Andrea Raimondi
Fri, 16 May 2008 10:49
ROL instruction in Delphi 2007
Author: Andrea Raimondi
Date: Fri, 16 May 2008 10:49
Date: Fri, 16 May 2008 10:49
22 lines
1420 bytes
1420 bytes
Hello, I'm using this code: function RotateByte( AByte : Byte;Positions : Byte ) : Byte;assembler; Asm XOR EAX, EAX Mov AL, AByte ROL AL, Byte( Positions ) end; The error says "[DCC Error] SchemaClasses.pas(112): E2116 Invalid combination of opcode and operands" and it's quite some time I am not using BASM, so I'm at loss about how to fix the problem. Please help, Thank you for your time. Andrea Raimondi --- posted by geoForum on http://delphi.newswhat.com
Re: ROL instruction in Delphi 2007
Author: Andrea Raimondi
Date: Fri, 16 May 2008 11:10
Date: Fri, 16 May 2008 11:10
23 lines
1255 bytes
1255 bytes
Changing this: >function RotateByte( AByte : Byte;Positions : Byte ) : Byte;assembler; >Asm > XOR EAX, EAX > Mov AL, AByte > ROL AL, Byte( Positions ) >end; to this: function RotateByte( AByte : Byte;Positions : Byte ) : Byte;assembler; Asm XOR EAX, EAX MOV CL, Positions Mov AL, AByte ROL AL, CL end; Solved the compiler error :-) Andrea Raimondi --- posted by geoForum on http://delphi.newswhat.com
Re: ROL instruction in Delphi 2007
Author: Les Pawelczyk
Date: Fri, 16 May 2008 15:47
Date: Fri, 16 May 2008 15:47
20 lines
1244 bytes
1244 bytes
> function RotateByte( AByte : Byte;Positions : Byte ) : Byte;assembler; > Asm > XOR EAX, EAX > MOV CL, Positions > Mov AL, AByte > ROL AL, CL > end; This is not going to work. Why XOR instruction? It clears AByte to zero. function RotateByteLeft(AByte, Positions: Byte): Byte; register; asm mov cl, dl rol al, cl end; Les.
Re: ROL instruction in Delphi 2007
Author: Qi
Date: Mon, 19 May 2008 15:53
Date: Mon, 19 May 2008 15:53
28 lines
1694 bytes
1694 bytes
Andrea Raimondi wrote: > Hello, > > I'm using this code: > > function RotateByte( AByte : Byte;Positions : Byte ) : Byte;assembler; > Asm > XOR EAX, EAX > Mov AL, AByte > ROL AL, Byte( Positions ) > end; > > The error says "[DCC Error] SchemaClasses.pas(112): E2116 Invalid > combination of opcode and operands" and it's quite some time I am not > using BASM, so I'm at loss about how to fix the problem. I suggest that you learn how Delphi passes parameters to function. Hint: EAX -> AByte EDX -> Positions ECX -> third parameter -- Denomo: memory and resource leak detection tool, free open source CodeHook: Win32 code/API hook for Delphi & C++, free open source http://www.kbasm.com/
Re: ROL instruction in Delphi 2007
Author: Xavier
Date: Fri, 23 May 2008 15:23
Date: Fri, 23 May 2008 15:23
14 lines
1357 bytes
1357 bytes
Les Pawelczyk wrote: > function RotateByteLeft(AByte, Positions: Byte): Byte; register; > asm > mov cl, dl > rol al, cl > end; That may lead to trouble with optimization enabled. Just use DL. function RotateByteLeft(const AByte, Positions: Byte): Byte register; assembler; asm rol al, dl end;
Re: ROL instruction in Delphi 2007
Author: Wolfgang Ehrhardt
Date: Fri, 23 May 2008 18:16
Date: Fri, 23 May 2008 18:16
26 lines
1725 bytes
1725 bytes
On Fri, 23 May 2008 16:23:28 +0100, Xavier <no@spam.com> wrote: >Les Pawelczyk wrote: >> function RotateByteLeft(AByte, Positions: Byte): Byte; register; >> asm >> mov cl, dl >> rol al, cl >> end; > >That may lead to trouble with optimization enabled. Just use DL. > >function RotateByteLeft(const AByte, Positions: Byte): Byte register; >assembler; >asm > rol al, dl >end; This will run in even more trouble because iut will not compile. Perhaps you should read a book on ASM. Wolfgang -- In order to e-mail me a reply to this message, you will have to remove PLEASE.REMOVE from the address shown in the header or get it from http://home.netsurf.de/wolfgang.ehrhardt (Free open source Crypto, AES, CRC, Hash for Pascal/Delphi)
Re: ROL instruction in Delphi 2007
Author: Les Pawelczyk
Date: Mon, 26 May 2008 00:16
Date: Mon, 26 May 2008 00:16
12 lines
1262 bytes
1262 bytes
> That may lead to trouble with optimization enabled. I'm not aware of any optimization issues here. Can you elaborate? > rol al, dl There is no such asm instruction. Les.
Re: ROL instruction in Delphi 2007
Author: Kevin Urben
Date: Tue, 10 Jun 2008 14:35
Date: Tue, 10 Jun 2008 14:35
1 lines
1079 bytes
1079 bytes
Does Delphi pass parameters in registers like that with optimisation off ?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads