From b55e8df45b44366cd173d6d6b3be75298abad422 Mon Sep 17 00:00:00 2001 From: Koichi Nakamura Date: Mon, 11 Jan 2021 08:09:25 +0900 Subject: [PATCH] Add +loop --- bootstrap.fs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/bootstrap.fs b/bootstrap.fs index 64d60d6..9a3dfc7 100644 --- a/bootstrap.fs +++ b/bootstrap.fs @@ -1468,6 +1468,24 @@ do-stack 16 cells + do-sp ! compile rdrop ; immediate +: +loop + compile r> + compile r> + compile rot + compile over + compile + + compile >r + compile over + compile >r + compile = + compile 0branch + here cell + backpatch-leave \ leave jumps to here + do> drop \ do-mark + do> here - , + compile rdrop + compile rdrop +; immediate + : i 2 rpick ; : j 4 rpick ; : k 6 rpick ; @@ -2459,7 +2477,7 @@ need-defined (read) if else then unless begin until again while repeat recurse case of rangeof endof endcase - do loop leave i j k + do loop +loop leave i j k char [char] key .s . .r u. u.r dec. hex. type