DEADSOFTWARE

Слегка перепилена реализация модуля Files
[dsw-obn.git] / rtl / SYSTEM.java
index 28d8c466df99d528685380520b5429a2248a18e5..20cbe60f2115f1167d1076d32f81b2f7a3040386 100644 (file)
@@ -17,6 +17,11 @@ 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 ix = LEN(x);
@@ -67,9 +72,59 @@ public class SYSTEM
                {
                        throw new RuntimeException("WITH TRAP");
                }
+               else if(n == -3)
+               {
+                       throw new RuntimeException("NOT IMPLEMENTED");
+               }
                else
                {
                        throw new RuntimeException("TRAP CODE " + n);
                }
        }
+
+       public static int ASH(int x, int n)
+       {
+               return (n > 0) ? (x << n) : (x >> Math.abs(n));
+       }
+
+       public static long ASH(long x, long n)
+       {
+               return (n > 0) ? (x << n) : (x >> Math.abs(n));
+       }
+
+       public static int LSH(int x, int n)
+       {
+               return (n > 0) ? (x << n) : (x >>> Math.abs(n));
+       }
+
+       public static long LSH(long x, long n)
+       {
+               return (n > 0) ? (x << n) : (x >>> Math.abs(n));
+       }
+
+       public static int ROT(int x, int n)
+       {
+               if(n > 0)
+               {
+                       return (x << n) | (x >>> (Integer.SIZE - n));
+               }
+               else
+               {
+                       n = Math.abs(n);
+                       return (x >>> n) | (x << (Integer.SIZE - n));
+               }
+       }
+
+       public static long ROT(long x, long n)
+       {
+               if(n > 0)
+               {
+                       return (x << n) | (x >>> (Long.SIZE - n));
+               }
+               else
+               {
+                       n = Math.abs(n);
+                       return (x >>> n) | (x << (Long.SIZE - n));
+               }
+       }
 }