Lines Matching +full:cpu +full:- +full:1
38 * Command-line entry point.
52 if (!a.StartsWith("-")) { in Main()
56 if (a == "--") { in Main()
65 while (a.StartsWith("-")) { in Main()
66 a = a.Substring(1); in Main()
74 pval2 = (i + 1) < args.Length in Main()
75 ? args[i + 1] : null; in Main()
79 pval = a.Substring(j + 1); in Main()
151 .GetManifestResourceStream("t0-kernel"))) in Main()
164 Environment.Exit(1); in Main()
175 " -o file use 'file' as base for output file name (default: 't0out')"); in Usage()
177 " -r name use 'name' as base for run function (default: same as output)"); in Usage()
179 " -m name[,name...]"); in Usage()
183 " -nf disable flow analysis"); in Usage()
184 Environment.Exit(1); in Usage()
194 * value -(y+1).
212 * string-sensitive; for better reproducibility, the map is sorted
306 * add-cc: in T0Comp()
310 AddNative("add-cc:", false, SType.BLANK, cpu => { in T0Comp()
330 AddNative("cc:", false, SType.BLANK, cpu => { in T0Comp()
338 "C-only word: " + tt); in T0Comp()
354 AddNative("preamble", false, SType.BLANK, cpu => { in T0Comp()
363 AddNative("postamble", false, SType.BLANK, cpu => { in T0Comp()
368 * make-CX in T0Comp()
372 * (min-max, inclusive). in T0Comp()
374 AddNative("make-CX", false, new SType(3, 1), cpu => { in T0Comp()
375 TValue c = cpu.Pop(); in T0Comp()
380 int max = cpu.Pop(); in T0Comp()
381 int min = cpu.Pop(); in T0Comp()
384 cpu.Push(tv); in T0Comp()
393 * range (min-max, inclusive) of the C expression when in T0Comp()
396 AddNative("CX", true, cpu => { in T0Comp()
417 cpu.Push(tv); in T0Comp()
426 AddNative("co", false, SType.BLANK, cpu => { in T0Comp()
438 AddNative(":", false, cpu => { in T0Comp()
479 AddNative("define-word", false, cpu => { in T0Comp()
480 int dout = cpu.Pop(); in T0Comp()
481 int din = cpu.Pop(); in T0Comp()
482 TValue s = cpu.Pop(); in T0Comp()
503 AddNative(";", true, cpu => { in T0Comp()
527 AddNative("immediate", false, cpu => { in T0Comp()
540 WordNative wliteral = AddNative("literal", true, cpu => { in T0Comp()
542 wordBuilder.Literal(cpu.Pop()); in T0Comp()
551 WordNative wcompile = AddNative("compile", false, cpu => { in T0Comp()
553 wordBuilder.Call(cpu.Pop().ToXT()); in T0Comp()
562 AddNative("postpone", true, cpu => { in T0Comp()
598 AddNative("exitvm", false, cpu => { in T0Comp()
606 AddNative("new-data-block", false, cpu => { in T0Comp()
608 cpu.Push(new TValue(0, new TPointerBlob(dataBlock))); in T0Comp()
615 AddNative("define-data-word", false, cpu => { in T0Comp()
616 string name = cpu.Pop().ToString(); in T0Comp()
617 TValue va = cpu.Pop(); in T0Comp()
637 AddNative("current-data", false, cpu => { in T0Comp()
642 cpu.Push(new TValue(dataBlock.Length, in T0Comp()
649 AddNative("data-add8", false, cpu => { in T0Comp()
654 int v = cpu.Pop(); in T0Comp()
665 AddNative("data-set8", false, cpu => { in T0Comp()
666 TValue va = cpu.Pop(); in T0Comp()
672 int v = cpu.Pop(); in T0Comp()
683 AddNative("data-get8", false, new SType(1, 1), cpu => { in T0Comp()
684 TValue va = cpu.Pop(); in T0Comp()
691 cpu.Push(v); in T0Comp()
697 AddNative("compile-local-read", false, cpu => { in T0Comp()
699 wordBuilder.GetLocal(cpu.Pop().ToString()); in T0Comp()
701 AddNative("compile-local-write", false, cpu => { in T0Comp()
703 wordBuilder.PutLocal(cpu.Pop().ToString()); in T0Comp()
706 AddNative("ahead", true, cpu => { in T0Comp()
710 AddNative("begin", true, cpu => { in T0Comp()
714 AddNative("again", true, cpu => { in T0Comp()
718 AddNative("until", true, cpu => { in T0Comp()
722 AddNative("untilnot", true, cpu => { in T0Comp()
726 AddNative("if", true, cpu => { in T0Comp()
730 AddNative("ifnot", true, cpu => { in T0Comp()
734 AddNative("then", true, cpu => { in T0Comp()
738 AddNative("cs-pick", false, cpu => { in T0Comp()
740 wordBuilder.CSPick(cpu.Pop()); in T0Comp()
742 AddNative("cs-roll", false, cpu => { in T0Comp()
744 wordBuilder.CSRoll(cpu.Pop()); in T0Comp()
746 AddNative("next-word", false, cpu => { in T0Comp()
751 cpu.Push(StringToBlob(s)); in T0Comp()
753 AddNative("parse", false, cpu => { in T0Comp()
754 int d = cpu.Pop(); in T0Comp()
756 cpu.Push(StringToBlob(s)); in T0Comp()
758 AddNative("char", false, cpu => { in T0Comp()
763 cpu.Push(c); in T0Comp()
765 AddNative("'", false, cpu => { in T0Comp()
767 cpu.Push(new TValue(0, new TPointerXT(name))); in T0Comp()
775 AddNative("execute", false, cpu => { in T0Comp()
776 cpu.Pop().Execute(this, cpu); in T0Comp()
779 AddNative("[", true, cpu => { in T0Comp()
783 AddNative("]", false, cpu => { in T0Comp()
786 AddNative("(local)", false, cpu => { in T0Comp()
788 wordBuilder.DefLocal(cpu.Pop().ToString()); in T0Comp()
790 AddNative("ret", true, cpu => { in T0Comp()
795 AddNative("drop", false, new SType(1, 0), cpu => { in T0Comp()
796 cpu.Pop(); in T0Comp()
798 AddNative("dup", false, new SType(1, 2), cpu => { in T0Comp()
799 cpu.Push(cpu.Peek(0)); in T0Comp()
801 AddNative("swap", false, new SType(2, 2), cpu => { in T0Comp()
802 cpu.Rot(1); in T0Comp()
804 AddNative("over", false, new SType(2, 3), cpu => { in T0Comp()
805 cpu.Push(cpu.Peek(1)); in T0Comp()
807 AddNative("rot", false, new SType(3, 3), cpu => { in T0Comp()
808 cpu.Rot(2); in T0Comp()
810 AddNative("-rot", false, new SType(3, 3), cpu => { in T0Comp()
811 cpu.NRot(2); in T0Comp()
822 AddNative("roll", false, new SType(1, 0), cpu => { in T0Comp()
823 cpu.Rot(cpu.Pop()); in T0Comp()
825 AddNative("pick", false, new SType(1, 1), cpu => { in T0Comp()
826 cpu.Push(cpu.Peek(cpu.Pop())); in T0Comp()
829 AddNative("+", false, new SType(2, 1), cpu => { in T0Comp()
830 TValue b = cpu.Pop(); in T0Comp()
831 TValue a = cpu.Pop(); in T0Comp()
834 cpu.Push(a); in T0Comp()
838 cpu.Push(StringToBlob( in T0Comp()
842 "Cannot add '{0}' to '{1}'", b, a)); in T0Comp()
845 AddNative("-", false, new SType(2, 1), cpu => { in T0Comp()
852 TValue b = cpu.Pop(); in T0Comp()
853 TValue a = cpu.Pop(); in T0Comp()
857 cpu.Push(new TValue(a.x - b.x)); in T0Comp()
861 a.x -= bx; in T0Comp()
862 cpu.Push(a); in T0Comp()
864 AddNative("neg", false, new SType(1, 1), cpu => { in T0Comp()
865 int ax = cpu.Pop(); in T0Comp()
866 cpu.Push(-ax); in T0Comp()
868 AddNative("*", false, new SType(2, 1), cpu => { in T0Comp()
869 int bx = cpu.Pop(); in T0Comp()
870 int ax = cpu.Pop(); in T0Comp()
871 cpu.Push(ax * bx); in T0Comp()
873 AddNative("/", false, new SType(2, 1), cpu => { in T0Comp()
874 int bx = cpu.Pop(); in T0Comp()
875 int ax = cpu.Pop(); in T0Comp()
876 cpu.Push(ax / bx); in T0Comp()
878 AddNative("u/", false, new SType(2, 1), cpu => { in T0Comp()
879 uint bx = cpu.Pop(); in T0Comp()
880 uint ax = cpu.Pop(); in T0Comp()
881 cpu.Push(ax / bx); in T0Comp()
883 AddNative("%", false, new SType(2, 1), cpu => { in T0Comp()
884 int bx = cpu.Pop(); in T0Comp()
885 int ax = cpu.Pop(); in T0Comp()
886 cpu.Push(ax % bx); in T0Comp()
888 AddNative("u%", false, new SType(2, 1), cpu => { in T0Comp()
889 uint bx = cpu.Pop(); in T0Comp()
890 uint ax = cpu.Pop(); in T0Comp()
891 cpu.Push(ax % bx); in T0Comp()
893 AddNative("<", false, new SType(2, 1), cpu => { in T0Comp()
894 int bx = cpu.Pop(); in T0Comp()
895 int ax = cpu.Pop(); in T0Comp()
896 cpu.Push(ax < bx); in T0Comp()
898 AddNative("<=", false, new SType(2, 1), cpu => { in T0Comp()
899 int bx = cpu.Pop(); in T0Comp()
900 int ax = cpu.Pop(); in T0Comp()
901 cpu.Push(ax <= bx); in T0Comp()
903 AddNative(">", false, new SType(2, 1), cpu => { in T0Comp()
904 int bx = cpu.Pop(); in T0Comp()
905 int ax = cpu.Pop(); in T0Comp()
906 cpu.Push(ax > bx); in T0Comp()
908 AddNative(">=", false, new SType(2, 1), cpu => { in T0Comp()
909 int bx = cpu.Pop(); in T0Comp()
910 int ax = cpu.Pop(); in T0Comp()
911 cpu.Push(ax >= bx); in T0Comp()
913 AddNative("=", false, new SType(2, 1), cpu => { in T0Comp()
914 TValue b = cpu.Pop(); in T0Comp()
915 TValue a = cpu.Pop(); in T0Comp()
916 cpu.Push(a.Equals(b)); in T0Comp()
918 AddNative("<>", false, new SType(2, 1), cpu => { in T0Comp()
919 TValue b = cpu.Pop(); in T0Comp()
920 TValue a = cpu.Pop(); in T0Comp()
921 cpu.Push(!a.Equals(b)); in T0Comp()
923 AddNative("u<", false, new SType(2, 1), cpu => { in T0Comp()
924 uint bx = cpu.Pop().UInt; in T0Comp()
925 uint ax = cpu.Pop().UInt; in T0Comp()
926 cpu.Push(new TValue(ax < bx)); in T0Comp()
928 AddNative("u<=", false, new SType(2, 1), cpu => { in T0Comp()
929 uint bx = cpu.Pop().UInt; in T0Comp()
930 uint ax = cpu.Pop().UInt; in T0Comp()
931 cpu.Push(new TValue(ax <= bx)); in T0Comp()
933 AddNative("u>", false, new SType(2, 1), cpu => { in T0Comp()
934 uint bx = cpu.Pop().UInt; in T0Comp()
935 uint ax = cpu.Pop().UInt; in T0Comp()
936 cpu.Push(new TValue(ax > bx)); in T0Comp()
938 AddNative("u>=", false, new SType(2, 1), cpu => { in T0Comp()
939 uint bx = cpu.Pop(); in T0Comp()
940 uint ax = cpu.Pop(); in T0Comp()
941 cpu.Push(ax >= bx); in T0Comp()
943 AddNative("and", false, new SType(2, 1), cpu => { in T0Comp()
944 uint bx = cpu.Pop(); in T0Comp()
945 uint ax = cpu.Pop(); in T0Comp()
946 cpu.Push(ax & bx); in T0Comp()
948 AddNative("or", false, new SType(2, 1), cpu => { in T0Comp()
949 uint bx = cpu.Pop(); in T0Comp()
950 uint ax = cpu.Pop(); in T0Comp()
951 cpu.Push(ax | bx); in T0Comp()
953 AddNative("xor", false, new SType(2, 1), cpu => { in T0Comp()
954 uint bx = cpu.Pop(); in T0Comp()
955 uint ax = cpu.Pop(); in T0Comp()
956 cpu.Push(ax ^ bx); in T0Comp()
958 AddNative("not", false, new SType(1, 1), cpu => { in T0Comp()
959 uint ax = cpu.Pop(); in T0Comp()
960 cpu.Push(~ax); in T0Comp()
962 AddNative("<<", false, new SType(2, 1), cpu => { in T0Comp()
963 int count = cpu.Pop(); in T0Comp()
967 uint ax = cpu.Pop(); in T0Comp()
968 cpu.Push(ax << count); in T0Comp()
970 AddNative(">>", false, new SType(2, 1), cpu => { in T0Comp()
971 int count = cpu.Pop(); in T0Comp()
975 int ax = cpu.Pop(); in T0Comp()
976 cpu.Push(ax >> count); in T0Comp()
978 AddNative("u>>", false, new SType(2, 1), cpu => { in T0Comp()
979 int count = cpu.Pop(); in T0Comp()
983 uint ax = cpu.Pop(); in T0Comp()
984 cpu.Push(ax >> count); in T0Comp()
987 AddNative(".", false, new SType(1, 0), cpu => { in T0Comp()
988 Console.Write(" {0}", cpu.Pop().ToString()); in T0Comp()
990 AddNative(".s", false, SType.BLANK, cpu => { in T0Comp()
991 int n = cpu.Depth; in T0Comp()
992 for (int i = n - 1; i >= 0; i --) { in T0Comp()
993 Console.Write(" {0}", cpu.Peek(i).ToString()); in T0Comp()
996 AddNative("putc", false, new SType(1, 0), cpu => { in T0Comp()
997 Console.Write((char)cpu.Pop()); in T0Comp()
999 AddNative("puts", false, new SType(1, 0), cpu => { in T0Comp()
1000 Console.Write("{0}", cpu.Pop().ToString()); in T0Comp()
1002 AddNative("cr", false, SType.BLANK, cpu => { in T0Comp()
1005 AddNative("eqstr", false, new SType(2, 1), cpu => { in T0Comp()
1006 string s2 = cpu.Pop().ToString(); in T0Comp()
1007 string s1 = cpu.Pop().ToString(); in T0Comp()
1008 cpu.Push(s1 == s2); in T0Comp()
1043 delayedChar = -(c + 1); in NextChar()
1064 * Un-read the character value 'c'. That value MUST be the one
1081 delayedChar = -(delayedChar + 1); in Unread()
1163 int count = 1; in ParseCCodeNF()
1174 if (-- count == 0) { in ParseCCodeNF()
1198 if (t == "--") { in ParseStackEffectNF()
1205 if (seenBang && dout == 1) { in ParseStackEffectNF()
1206 dout = -1; in ParseStackEffectNF()
1246 if (-- hexNum == 0) { in ParseString()
1294 * start of next line, then a double-quote character).
1320 if (t.Length == 1 && t[0] != '\\') { in DecodeCharConst()
1324 switch (t[1]) { in DecodeCharConst()
1343 return SingleCharEscape(t[1]); in DecodeCharConst()
1357 return -1; in DecHex()
1367 return c - '0'; in HexVal()
1369 return c - ('A' - 10); in HexVal()
1371 return c - ('a' - 10); in HexVal()
1373 return -1; in HexVal()
1401 delayedChar = -1; in ProcessInput()
1404 CPU cpu = new CPU(); in ProcessInput()
1407 new OpcodeJumpUncond(-2) in ProcessInput()
1410 cpu.Enter(code, 0); in ProcessInput()
1415 Opcode op = cpu.ipBuf[cpu.ipOff ++]; in ProcessInput()
1416 op.Run(cpu); in ProcessInput()
1420 void CompileStep(CPU cpu) in CompileStep() argument
1443 w.Run(cpu); in CompileStep()
1452 cpu.Push(v); in CompileStep()
1454 w.Run(cpu); in CompileStep()
1508 Console.WriteLine("{0}: ds={1} rs={2}", in Generate()
1535 int dataLen = 1; in Generate()
1549 * 1 const signed value in Generate()
1557 * encoded in 7-bit chunk, with big-endian signed in Generate()
1558 * convention. Each 7-bit chunk is encoded over one byte; in Generate()
1559 * the upper bit is 1 for all chunks except the last one. in Generate()
1615 int numInterpreted = curSlot - slotInterpreted; in Generate()
1623 "Non-interpreted entry point"); in Generate()
1640 interpretedEntry[w.Slot - slotInterpreted] = in Generate()
1647 * interpreted) then we can use "one-byte code" which is in Generate()
1663 int totalLen = -1; in Generate()
1722 neg = ((**p) >> 6) & 1; in Generate()
1723 x = (uint32_t)-neg; in Generate()
1731 return -(int32_t)~x - 1; in Generate()
1758 tw.WriteLine("void {0}_init_{1}(void *t0ctx);", in Generate()
1778 bw = new BlobWriter(tw, 78, 1); in Generate()
1789 bw = new BlobWriter(tw, 78, 1); in Generate()
1816 t0_newip = &t0_codeblock[t0_caddr[(slot) - T0_INTERPRETED]]; \ in Generate()
1819 *((rp) ++) = (uint32_t)((ip) - &t0_codeblock[0]) + (t0_lnum << 16); \ in Generate()
1829 t0ctx->ip = &t0_codeblock[0]; \ in Generate()
1830 T0_ENTER(t0ctx->ip, t0ctx->rp, slot); \ in Generate()
1835 tw.WriteLine("T0_DEFENTRY({0}, {1})", in Generate()
1855 #define T0_LOCAL(x) (*(rp - 2 - (x))) in Generate()
1856 #define T0_POP() (*-- dp) in Generate()
1857 #define T0_POPi() (*(int32_t *)(-- dp)) in Generate()
1858 #define T0_PEEK(x) (*(dp - 1 - (x))) in Generate()
1859 #define T0_PEEKi(x) (*(int32_t *)(dp - 1 - (x))) in Generate()
1862 #define T0_RPOP() (*-- rp) in Generate()
1863 #define T0_RPOPi() (*(int32_t *)(-- rp)) in Generate()
1868 uint32_t t0tmp = *(dp - 1 - t0len); \ in Generate()
1869 memmove(dp - t0len - 1, dp - t0len, t0len * sizeof *dp); \ in Generate()
1870 *(dp - 1) = t0tmp; \ in Generate()
1873 uint32_t t0tmp = *(dp - 2); \ in Generate()
1874 *(dp - 2) = *(dp - 1); \ in Generate()
1875 *(dp - 1) = t0tmp; \ in Generate()
1878 uint32_t t0tmp = *(dp - 3); \ in Generate()
1879 *(dp - 3) = *(dp - 2); \ in Generate()
1880 *(dp - 2) = *(dp - 1); \ in Generate()
1881 *(dp - 1) = t0tmp; \ in Generate()
1884 uint32_t t0tmp = *(dp - 1); \ in Generate()
1885 *(dp - 1) = *(dp - 2); \ in Generate()
1886 *(dp - 2) = *(dp - 3); \ in Generate()
1887 *(dp - 3) = t0tmp; \ in Generate()
1898 dp = ((t0_context *)t0ctx)->dp; in Generate()
1899 rp = ((t0_context *)t0ctx)->rp; in Generate()
1900 ip = ((t0_context *)t0ctx)->ip; in Generate()
1913 rp -= (t0x >> 16); in Generate()
1921 case 1: /* literal constant */ in Generate()
1955 /* {1} */ in Generate()
1969 ((t0_context *)t0ctx)->dp = dp; in Generate()
1970 ((t0_context *)t0ctx)->rp = rp; in Generate()
1971 ((t0_context *)t0ctx)->ip = ip; in Generate()
2000 Console.WriteLine("total words: {0} (interpreted: {1})", in Generate()
2029 tv = StringToBlob(tt.Substring(1)); in TryParseLiteral()
2033 tv = DecodeCharConst(tt.Substring(1)); in TryParseLiteral()
2037 if (tt.StartsWith("-")) { in TryParseLiteral()
2039 tt = tt.Substring(1); in TryParseLiteral()
2041 tt = tt.Substring(1); in TryParseLiteral()
2066 if ((uint)d > uint.MaxValue - acc) { in TryParseLiteral()
2076 x = -x; in TryParseLiteral()