On Wednesday 05 October 2005 00:40, Sergey Plis wrote:
> It does seem like a bug to me. Please, help!

Yes, it is. Thanks for creating an example that's easy to reproduce.

That's how to fix it: Go to screen 211 of forth.fb. Change it to the 
following code:

\ fp save and restore                                  05oct05py
Code fpush ( f.. -- )
     fxam  ( fwait )  AX fstsw  $FD # AH and  $41 # AH cmp
     0= IF  0 # -4 BP D) mov  -4 # BP add  Next  THEN
     $B # AX shr  7 # AX and  7 # AX xor   1 AX D) CX lea
     BEGIN  .fx -$C BP D) fstp  $C # BP sub  AX dec  0< UNTIL
     CX -4 BP D) mov  -4 # BP add  Next  end-code
Code fppll ( -- f.. )  R: BP SP mov  S: AX push DX AX mov  R:
     AHEAD  end-code
Code fppi ( -- f.. )  R:  BP SP mov  AHEAD  end-code
Code fppv ( -- f.. )  R:  BP SP mov  lods  THEN  THEN
     CX pop  ?DO  .fx SP ) fld  $C # SP add
                  CX dec  0= UNTIL THEN  BP pop  Next end-code
Code fppf ( -- f.. )  R:  BP SP mov  lods
     CX pop  ?DO  .fx SP ) fld  $C # SP add   1 ST fxch
                  CX dec  0= UNTIL THEN  BP pop  Next end-code

There are only three changes: AX CX mov becomes 1 AX D) CX lea, and the 
two 0< UNTIL become 0= UNTIL. That's it. The reason for the failure is 
that a stack with just one entry wasn't correctly handled (it had the 
same "count" on the return stack as an empty stack).

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://www.jwdt.com/~paysan/

Attachment: pgpe3sPAP6Hi2.pgp
Description: PGP signature

Reply via email to