Пример #1
0
        public void RunCommand()
        {
            HandleInterrupts();
            if (powerMode == PowerMode.Halt)
            {
                Tick();
                return;
            }

            var code = FetchOpcode();

            if (code == PREFIX_OPCODE)
            {
                RunPrefixedCommand();
            }
            else if (OpCodes.ContainsKey(code))
            {
                var opCode = OpCodes[code];
                opCode.Instruction();
            }
            // TODO: Find more elegant way to always keep lower 4 bits of F zero
            F = (byte)(F & 0xF0);

            if (enableInterruptMasterAfter != -1)
            {
                InterruptMasterEnableFlag = enableInterruptMasterAfter == 0;
                enableInterruptMasterAfter--;
            }
        }
Пример #2
0
 private int GetOpCodeIdByName(string name)
 {
     if (OpCodes.ContainsKey(name))
     {
         return(OpCodes[name].id);
     }
     else
     {
         return(OpCodes["unknown"].id);
     }
 }
Пример #3
0
        private Dictionary <JObject, Block> ConvertToDatabaseBlocks(Dictionary <string, JObject> values)
        {
            Dictionary <JObject, Block> toReturn = new Dictionary <JObject, Block>();

            foreach (JObject o in values.Values)
            {
                Block newBlock = new Block()
                {
                    OpCodeId  = OpCodes.ContainsKey(o.Value <string>("opcode")) ? OpCodes[o.Value <string>("opcode")].id : OpCodes["unknown"].id,
                    Indent    = 0,
                    BlockRank = 0,
                };
                toReturn.Add(o, newBlock);
            }
            return(toReturn);
        }