コード例 #1
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Int16Bang(Forth f)
 {
     long offset = f.PopInt64();
     long value = f.PopInt64();
     f.byteMemory.WriteInt16(checked((int)offset), unchecked((short)value));
 }
コード例 #2
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void At(Forth f)
 {
     long index = f.PopInt64();
     f.dStack.Push(f.memory[(int)index]);
 }
コード例 #3
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Off(Forth f)
 {
     long index = f.PopInt64();
     f.memory[(int)index] = 0L;
 }
コード例 #4
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Modulus(Forth f)
 {
     long b = f.PopInt64();
     long a = f.PopInt64();
     f.PushInt64(unchecked(a % b));
 }
コード例 #5
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void IsNotGreaterThan(Forth f)
 {
     long b = f.PopInt64();
     long a = f.PopInt64();
     f.PushBool(a <= b);
 }
コード例 #6
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Add(Forth f)
 {
     long b = f.PopInt64();
     long a = f.PopInt64();
     f.PushInt64(unchecked(a + b));
 }
コード例 #7
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Multiply(Forth f)
 {
     long b = f.PopInt64();
     long a = f.PopInt64();
     f.PushInt64(unchecked(a * b));
 }
コード例 #8
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void ByteHereReset(Forth f)
 {
     long l = f.PopInt64();
     f.byteHere = l;
 }
コード例 #9
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Max(Forth f)
 {
     long b = f.PopInt64();
     long a = f.PopInt64();
     f.PushInt64((a > b) ? a : b);
 }
コード例 #10
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Int32Comma(Forth f)
 {
     long value = f.PopInt64();
     f.byteMemory.WriteInt32(f.byteHere, unchecked((int)value));
     f.byteHere += 4;
 }
コード例 #11
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Int64Comma(Forth f)
 {
     long value = f.PopInt64();
     f.byteMemory.WriteInt64(f.byteHere, value);
     f.byteHere += 8;
 }
コード例 #12
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Int16Comma(Forth f)
 {
     long value = f.PopInt64();
     f.byteMemory.WriteInt16(f.byteHere, unchecked((short)value));
     f.byteHere+=2;
 }
コード例 #13
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void ByteComma(Forth f)
 {
     long value = f.PopInt64();
     f.byteMemory[f.byteHere] = unchecked((byte)value);
     f.byteHere++;
 }
コード例 #14
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Int64Bang(Forth f)
 {
     long offset = f.PopInt64();
     long value = f.PopInt64();
     f.byteMemory.WriteInt64(checked((int)offset), value);
 }
コード例 #15
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void AuxPickBang(Forth f)
 {
     long pos = f.PopInt64();
     if (pos >= 256 || pos < 0) throw new ArgumentException("apick! too far");
     object v = f.dStack.Pop();
     f.aStack[(int)pos] = v;
 }
コード例 #16
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Dump(Forth f)
 {
     long len = f.PopInt64();
     long offset = f.PopInt64();
     Dump(f.byteMemory, checked((int)offset), checked((int)len));
 }
コード例 #17
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Negate(Forth f)
 {
     long l = f.PopInt64();
     f.PushInt64(unchecked(-l));
 }
コード例 #18
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void DumpArray(Forth f)
 {
     byte[] array = (byte[])(f.dStack.Pop());
     long len = f.PopInt64();
     long offset = f.PopInt64();
     Dump(new ByteArrayWrapper(array), checked((int)offset), checked((int)len));
 }
コード例 #19
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Subtract(Forth f)
 {
     long b = f.PopInt64();
     long a = f.PopInt64();
     f.PushInt64(unchecked(a - b));
 }
コード例 #20
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void OnePlus(Forth f)
 {
     long x = f.PopInt64();
     f.PushInt64(x + 1L);
 }
コード例 #21
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Divide(Forth f)
 {
     long b = f.PopInt64();
     long a = f.PopInt64();
     f.PushInt64(unchecked(a / b));
 }
コード例 #22
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void OneMinus(Forth f)
 {
     long x = f.PopInt64();
     f.PushInt64(x - 1L);
 }
コード例 #23
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Within(Forth f)
 {
     long end = f.PopInt64();
     long begin = f.PopInt64();
     long mid = f.PopInt64();
     f.PushBool(Within(begin, mid, end));
 }
コード例 #24
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Alloc(Forth f)
 {
     long count = f.PopInt64();
     if (count > 256 || count < 0) throw new ArgumentException("alloc too much");
     f.dStack.Alloc((int)count);
 }
コード例 #25
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void IsNotLessThan(Forth f)
 {
     long b = f.PopInt64();
     long a = f.PopInt64();
     f.PushBool(a >= b);
 }
コード例 #26
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void AuxFree(Forth f)
 {
     long count = f.PopInt64();
     if (count > 256 || count < 0) throw new ArgumentException("afree too much");
     f.aStack.Free((int)count);
 }
コード例 #27
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Bang(Forth f)
 {
     long index = f.PopInt64();
     object v = f.dStack.Pop();
     f.memory[(int)index] = v;
 }
コード例 #28
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void AuxPick(Forth f)
 {
     long pos = f.PopInt64();
     if (pos >= 256 || pos < 0) throw new ArgumentException("apick too far");
     f.dStack.Push(f.aStack[(int)pos]);
 }
コード例 #29
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void Allot(Forth f)
 {
     long amt = f.PopInt64();
     if (amt > (long)(f.memory.Length - f.here)) throw new ArgumentOutOfRangeException("Attempt to allot more memory than is available");
     f.here += (int)amt;
 }
コード例 #30
0
ファイル: Forth.cs プロジェクト: Sunlighter/SimpleForth
 public static void ByteBang(Forth f)
 {
     long offset = f.PopInt64();
     long value = f.PopInt64();
     f.byteMemory[checked((int)offset)] = unchecked((byte)value);
 }