From ff725c41ec41c38d0ff51c1f315dc472ac9747d1 Mon Sep 17 00:00:00 2001 From: Doni Pracner Date: Mon, 20 Jan 2014 22:54:05 +0100 Subject: [PATCH] mjc2wsl - shr and shl added --- src/mjc2wsl.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/mjc2wsl.java b/src/mjc2wsl.java index 274bb7e..1682978 100644 --- a/src/mjc2wsl.java +++ b/src/mjc2wsl.java @@ -437,8 +437,24 @@ public class mjc2wsl{ prl(cmdToEStack("-tempa")); break; } - //TODO shl, shr - + + case shl : { + prl(getTopTwo()); + prl("VAR :"); + prl("\tFOR i:=1 TO tempa STEP 1 DO tempres := tempres * 2 OD;"); + prl(cmdToEStack("tempres")); + prl("ENDVAR;"); + break; + } + case shr : { + prl(getTopTwo()); + prl("VAR :"); + prl("\tFOR i:=1 TO tempa STEP 1 DO tempres := tempres DIV 2 OD;"); + prl(cmdToEStack("tempres")); + prl("ENDVAR;"); + break; + } + case inc : { int b1 = get(), b2 = get(); prl(loc(b1)+" := " +loc(b1)+" + "+b2+";"); -- 2.25.1