Page 1 of 1

! InlineAsm and PUSH

Posted: Thu Feb 09, 2006 9:25 pm
by remi_meier
Hi

Code: Select all

Procedure test(a.l, b.l)
	!MOV eax, dword[p.v_a]
	; !p.v_b equ p.v_b + 4
	!PUSH eax
	!MOV ebx, dword[p.v_b]
	CallDebugger
EndProcedure
test(4, 5)
Thanks for the new optimizations, but now we have the problem to manage
it with only 3 registers :lol:
It would be cool if the compiler could check for simple PUSHs and POPs
and adjust the constants for FASM so we could save the regs ourselves.

Workaround:

Code: Select all

; Adjust aliases like this:
!p.v_b equ p.v_b + 4
; this will add 4 to p.v_b, use it for all local vars when using a PUSH
; - 4 for POP ;)

Posted: Thu Feb 09, 2006 9:36 pm
by Fred
you should address it like that: [p.v_b+4]

Posted: Thu Feb 09, 2006 9:36 pm
by freak
Just use [p.v_something+4] once you did a push.
The ! is for direct asm access, which means the compiler leaves it alone.
If you want it to adjust to push and pop, just use the InlineASM option.

[EDIT] Hey Fred! I thought you were eating... how can you still beat me to the posting? :D

Posted: Thu Feb 09, 2006 9:43 pm
by remi_meier
:lol:
Ok, another option then and this means it wont be done... Then I have to
live with it... (InlineAsm option is just too strange in IDE, why not introduce
a CompilerAsm, CompilerEndAsm? At the moment I am not really happy
when I have to tell the others to enable inline asm when they're just using
a little routine)

Posted: Thu Feb 09, 2006 10:13 pm
by Trond
[p.v_something+4] seems ok to me.

Posted: Fri Feb 10, 2006 4:15 am
by va!n
i absolutly agree remi_meier“s idea for CompilerAsm, CompilerEndAsm !!

Posted: Fri Feb 10, 2006 4:21 am
by ts-soft
i agree also
when compiling pbosl-libs in batch, i can't enable inlineasm for one file

Posted: Fri Feb 10, 2006 4:25 am
by Dare2
Yes. Good idea.

Re: ! InlineAsm and PUSH

Posted: Fri Feb 10, 2006 9:38 pm
by jack
remi_meier wrote:Thanks for the new optimizations, but now we have the problem to manage
it with only 3 registers :lol:
which registers are available for use ?

Posted: Sat Feb 11, 2006 3:02 pm
by remi_meier
Eax, Ecx, Edx should be available.

Posted: Sat Feb 11, 2006 4:01 pm
by jack
thanks remi_meier :)

Posted: Sat Feb 11, 2006 5:25 pm
by Fred
you can use more as long you preserve them.