lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lightning] Working with floating point values and the stack


From: Ludovic Courtès
Subject: Re: [Lightning] Working with floating point values and the stack
Date: Thu, 13 Oct 2005 09:02:22 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

Hi,

Manuel Mohr <address@hidden> writes:

> I want to write a function plotter using GNU lightning. Due to its
> recursive descent parser it makes heavy use of the push and pop
> commands. If I use integers, the program works flawlessly.
> However, I want to use floating point arithmetics. The following code
> does not print "10" as excepted by me, but it prints "4.4". Pushing and
> popping floating point values does not seem to work properly.

According to the manual, `pushr' and `popr' do not seem to be usable
with floating point registers (there is no `f' listed here):

     pushr                     i  ui  l  ul  p   push O1 on the stack
     popr                      i  ui  l  ul  p   pop O1 off the stack

Instead of pushing things, can't you just reserve space for those two
values on the stack (by subtracting 8 bytes to `JIT_SP') and then
storing each one of these values there using `stx'/`ldx'?

Note that this requires keeping track of some sort of a frame pointer in
a V register.  I.e., right before modifying SP, you have to copy its
value to V?, and then restore it just before returning from the
function.  Within the body of the function, you'll make all your
`stx'/`ldx' instructions relative to what's stored in that V? register.

Hope this helps,
Ludovic.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]