From: Doni Pracner Date: Mon, 20 Jan 2014 21:54:05 +0000 (+0100) Subject: mjc2wsl - shr and shl added X-Git-Tag: v0.1.4~12 X-Git-Url: https://svarog.pmf.uns.ac.rs/gitweb/?a=commitdiff_plain;h=ff725c41ec41c38d0ff51c1f315dc472ac9747d1;p=mjc2wsl.git mjc2wsl - shr and shl added --- 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+";");