Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2006-08

ASM Converting from Turbo Pascal

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Rainer Stratmann

Hello,

in fpc you have to tell the compiler which registers are used in asm code.

for example

asm
mov ax,123
end [eax];

Is it possible to make a compilerswitch that the compiler tells that there is every register used in asm code? In this case it woult be possible to port asm code from turbopascal to fpc without any change.

for example

{$asmallregsused+} or something like that

asm
...asmcode...
...asmcode...
...asmcode...
...asmcode...
end; --->>> now every Register used, as set in the compilerswitch;

Rainer

Peter Vreman
to Rainer Stratmann
Show quoted text 25 lines
Hello, in fpc you have to tell the compiler which registers are used in asm code. for example asm mov ax,123 end [eax]; Is it possible to make a compilerswitch that the compiler tells that there is every register used in asm code? In this case it woult be possible to port asm code from turbopascal to fpc without any change. for example {$asmallregsused+} or something like that asm ...asmcode... ...asmcode... ...asmcode... ...asmcode... end; --->>> now every Register used, as set in the compilerswitch;

It is not needed. The registers you need to save/resotre for procedures are now determined by the calling convention just like Delphi. For assembler blocks inside a pascal procedure the default is that all registers are used.

Rainer Stratmann
to Peter Vreman
Peter Vreman wrote 32 lines
> Hello, > > in fpc you have to tell the compiler which registers are used in asm > code. > > for example > > asm > mov ax,123 > end [eax]; > > Is it possible to make a compilerswitch that the compiler tells that > there is > every register used in asm code? In this case it woult be possible to > port asm code from turbopascal to fpc without any change. > > for example > > {$asmallregsused+} or something like that > > asm > ...asmcode... > ...asmcode... > ...asmcode... > ...asmcode... > end; --->>> now every Register used, as set in the compilerswitch; It is not needed. The registers you need to save/resotre for procedures are now determined by the calling convention just like Delphi. For assembler blocks inside a pascal procedure the default is that all registers are used.

Has this something to do whith the Compilerswitch

Code generation -> "Use register-variables"?

It is switched on by default in textmode ide.

_______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal