Author: blueswirl Date: 2009-02-27 22:04:01 +0100 (Fri, 27 Feb 2009) New Revision: 460
Modified: openbios-devel/forth/device/fcode.fs Log: Fix fcode-offset sign extension problem (Mark Cave-Ayland)
Modified: openbios-devel/forth/device/fcode.fs =================================================================== --- openbios-devel/forth/device/fcode.fs 2009-02-21 17:13:41 UTC (rev 459) +++ openbios-devel/forth/device/fcode.fs 2009-02-27 21:04:01 UTC (rev 460) @@ -80,6 +80,16 @@ fcode-c@ ;
+\ fcode-num8-signed ( -- c ) ( F: c -- ) +\ get 8bit signed from FCode stream + +: fcode-num8-signed + fcode-num8 + dup 80 and 0> if + ff invert or + then + ; + \ fcode-num16 \ get 16bit from FCode stream
@@ -87,6 +97,16 @@ fcode-num8 fcode-num8 swap bwjoin ;
+\ fcode-num16-signed ( -- c ) ( F: c -- ) +\ get 16bit signed from FCode stream + +: fcode-num16-signed + fcode-num16 + dup 8000 and 0> if + ffff invert or + then + ; + \ fcode-num32 \ get 32bit from FCode stream
@@ -111,9 +131,9 @@
: fcode-offset ( -- offset ) ?fcode-offset16 if - fcode-num16 + fcode-num16-signed else - fcode-num8 + fcode-num8-signed then ;