[fpc-devel] asm offset question

ABorka fpc-devel at aborka.com
Mon Nov 10 19:00:45 CET 2008


True, but if the programs only run on PCs (Windows and Linux on Intel 
processors in this case) it should work. Not everyone who considers 
using FPC/Lazarus wants to run the compiled programs on 15 platforms. 
Sometimes all that is needed is 1 platform.
There are some encrypting/decrypting functions that would be hard to 
write in other than asm, especially if they are already done.

Some projects I just wanted to try to compile strictly on Windows 
without wanting to go to other OS-es. Just to see if it is possible at 
all to move projects over to FPC/Lazarus from Delphi with a reasonable 
amount of work. Until that doesn't work, going to other OS-es is not 
really viable anyway.
Not having a debugger in Lazarus with a properly working watch window 
and CPU window doesn't help either to do these tasks.

The "offset", "aam" and "aad" asm instructions are not working as they 
are in Delphi, but there are workarounds fortunately, until they will be 
fixed in FPC, if ever.

http://bugs.freepascal.org/view.php?id=12595

aam 16 (or aam 8, etc.)
aad 16 (or aad 8, etc.)
Both give compiler errors and points to the wrong source line. Need to 
use "db" instructions to put the machine code there to circumvent it.

move esi, offset variable
Gives compiler error but the functionality can be replaced with the "lea 
esi, variable" instruction instead as a workaround.



Michael Schnell wrote:
> IMHO, it's not a good idea to "port" ASM code to TP (as TP's purpose is 
> platform independence). So at best you should rewrite this in Pascal. 
> Normally with modern PCs the performance decrease is not noticeable.
> 
> -Michael
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 




More information about the fpc-devel mailing list