Пример #1
0
        public static void MakeMacros()
        {
            List <OpcodeCompiler.Op> ops       = OpcodeCompiler.GenerateOpcodes(OpcodesPath);
            Dictionary <string, int> registers = OpcodeCompiler.Generate_Registers(Config);
            Dictionary <string, int> constants = OpcodeCompiler.Generate_Constants(Config);
            Dictionary <string, KeyValuePair <int, string> > scancodes  = OpcodeCompiler.Generate_Scancodes(Config);
            Dictionary <string, KeyValuePair <int, string> > interrupts = OpcodeCompiler.Generate_Interrupts(Config);

            System.IO.File.WriteAllText(OpcodesInc, OpcodeCompiler.MakeMacros(ops, registers, constants, interrupts, scancodes));
            Debug.LogFormat("Wrote {0} macros to {1}", ops.Count, OpcodesInc);
        }
Пример #2
0
        public static void ScanCodesToCStringArray()
        {
            Dictionary <string, KeyValuePair <int, string> > scancodes = OpcodeCompiler.Generate_Scancodes(Config);
            StringBuilder sb = new StringBuilder();

            foreach (var sc in scancodes)
            {
                sb.AppendFormat("\"{0}\",", ToLiteral(sc.Value.Value));
                sb.AppendLine();
            }
            Debug.Log(sb.ToString());
        }
Пример #3
0
        public static void MakeRegisters()
        {
            Dictionary <string, int> registers = OpcodeCompiler.Generate_Registers(Config);
            Dictionary <string, int> constants = OpcodeCompiler.Generate_Constants(Config);
            Dictionary <string, KeyValuePair <int, string> > scancodes  = OpcodeCompiler.Generate_Scancodes(Config);
            Dictionary <string, KeyValuePair <int, string> > interrupts = OpcodeCompiler.Generate_Interrupts(Config);

            System.IO.File.WriteAllText(Registers, OpcodeCompiler.MakeRegisters(registers));
            System.IO.File.WriteAllText(Constants, OpcodeCompiler.MakeConstants(constants));
            System.IO.File.WriteAllText(Interrupts, OpcodeCompiler.MakeInterrupts(interrupts));
            System.IO.File.WriteAllText(Scancodes, OpcodeCompiler.MakeScancodes(scancodes));

            Debug.Log("Wrote dx__??.inc");
        }
Пример #4
0
        public static void MakeSDK()
        {
            List <OpcodeCompiler.Op> ops       = OpcodeCompiler.GenerateOpcodes(OpcodesPath);
            Dictionary <string, int> registers = OpcodeCompiler.Generate_Registers(Config);
            Dictionary <string, int> constants = OpcodeCompiler.Generate_Constants(Config);
            Dictionary <string, KeyValuePair <int, string> > scancodes  = OpcodeCompiler.Generate_Scancodes(Config);
            Dictionary <string, KeyValuePair <int, string> > interrupts = OpcodeCompiler.Generate_Interrupts(Config);

            System.IO.File.WriteAllText(SdkCpuPath, OpcodeCompiler.MakeMacros(ops, null, null, null, null));
            Debug.LogFormat("Wrote {0} instructions to {1}", ops.Count, SdkCpuPath);

            System.IO.File.WriteAllText(SdkKeyboardPath, OpcodeCompiler.MakeMacros(null, null, null, null, scancodes));
            Debug.LogFormat("Wrote {0} keyboards to {1}", scancodes.Count, SdkKeyboardPath);

            System.IO.File.WriteAllText(SdkRegistersPath, OpcodeCompiler.MakeMacros(null, registers, constants, null, null));
            Debug.LogFormat("Wrote {0} registers/constants to {1}", registers.Count + constants.Count, SdkRegistersPath);
        }
Пример #5
0
        public static void ScanCodesToAssemblyDbArray()
        {
            Dictionary <string, KeyValuePair <int, string> > scancodes = OpcodeCompiler.Generate_Scancodes(Config);
            StringBuilder sb = new StringBuilder();

            foreach (var sc in scancodes)
            {
                char m = sc.Value.Value[0];
                int  n = 0x7F;

                if (m != '^')
                {
                    n = (int)m;
                }

                sb.AppendFormat("db ${0:X2} ; ${1:X2} {2}", n, sc.Value.Key, sc.Key);
                sb.AppendLine();
            }
            Debug.Log(sb.ToString());
        }
Пример #6
0
        public static void GenerateApi()
        {
            Dictionary <string, KeyValuePair <int, string> > scancodes = OpcodeCompiler.Generate_Scancodes(Config);

            System.IO.File.WriteAllText(ApiCsPath, OpcodeCompiler.GenerateCsApi(ApiPath, scancodes));
        }