Exemplo n.º 1
0
        public void WriteToFile(string filename, int programstart, int datastart)
        {
            if (text.Count == 0)
            {
                throw new Exception("Start before you write!");
            }

            ExecutableFile.Write(filename, text, programstart, data, datastart);
        }
Exemplo n.º 2
0
        int freq; //in KHz, -1 = unlimited

        public Processor(string binfile, uint memsize = 8192, uint pc = 0x0040, int freq = -1)
        {
            memory = new byte[memsize];

            this.pc       = pc;                           // init Programcounter
            registers[29] = registers[28] = (int)memsize; //init Stackpointer and Basepointer

            ExecutableFile ex = ExecutableFile.Read(binfile);

            Array.Copy(ex.TextBytes, 0, memory, ex.ProgramStart, ex.TextBytes.Length);
            Array.Copy(ex.DataBytes, 0, memory, ex.DataStart, ex.DataBytes.Length);

            if (this.pc != ex.ProgramStart)
            {
                throw new Exception("pc != Programstart");
            }

            this.freq = freq;
        }