X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=rtl%2FSYSTEM.java;h=ce1b50621e447042154ad9d70dc11136278673ff;hb=7b7ff82e330bd4c42a9987709839251c5ac69089;hp=68f82bd0983c3ee348507e7903023dc63318cf8c;hpb=75d0fd92a5342358f37ed9369ccce9355273e51a;p=dsw-obn.git diff --git a/rtl/SYSTEM.java b/rtl/SYSTEM.java index 68f82bd..ce1b506 100644 --- a/rtl/SYSTEM.java +++ b/rtl/SYSTEM.java @@ -17,18 +17,24 @@ public class SYSTEM return i; } + public static String STRING(byte[] x) + { + return new String(x, 0, LEN(x)); + } + public static void COPY(byte[] x, byte[] v) { - int len_x = LEN(x); - int len_v = v.length - 1; + int ix = LEN(x); + int iv = v.length - 1; - int len = (len_x < len_v) ? (len_x) : (len_v); - for(int i = 0; i < len; i++) + int i = 0; + int len = (ix < iv) ? (ix) : (iv); + while(i < len) { v[i] = x[i]; + i += 1; } - - v[len] = 0; + v[i] = 0; } public static int STRCMP(byte[] a, byte[] b) @@ -66,6 +72,10 @@ public class SYSTEM { throw new RuntimeException("WITH TRAP"); } + else if(n == -3) + { + throw new RuntimeException("NOT IMPLEMENTED"); + } else { throw new RuntimeException("TRAP CODE " + n);