From d014418bb4b9ae4441d1b03348cd0fa242f9e266 Mon Sep 17 00:00:00 2001 From: Koichi Nakamura Date: Mon, 11 Jan 2021 10:14:55 +0900 Subject: [PATCH] Fixed +loop --- bootstrap.fs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bootstrap.fs b/bootstrap.fs index c111e1b..e427f9d 100644 --- a/bootstrap.fs +++ b/bootstrap.fs @@ -1473,16 +1473,24 @@ do-stack 16 cells + do-sp ! compile rdrop ; immediate +\ This code is take from Gforth +: crossed-boundary? ( d n i ) + swap - ( d i-n ) + 2dup + ( d i-n i+d-n ) + over xor ( d i-n (i-n)^(i+d-n) ) + >r xor r> ( d^(i-n) (i^n)^(i+d-n) ) + and 0< +; + : +loop compile r> compile r> + compile 3dup compile rot - compile over compile + compile >r - compile over compile >r - compile = + compile crossed-boundary? compile 0branch here cell + backpatch-leave \ leave jumps to here do> drop \ do-mark