Beispiel #1
0
        private IEnumerable <TmsCommand> GetTmsCommands(Z80Command sourceCommand)
        {
            var sourceCommandType = sourceCommand.GetType();

            if (_commandToTranslatorDictionary.ContainsKey(sourceCommandType))
            {
                var translatorType     = _commandToTranslatorDictionary[sourceCommandType];
                var translatorInstance = Activator.CreateInstance(translatorType, new object [] { _mapCollection, LabelHighlighter });
                var method             = translatorType.GetMethod("Translate");
                return((IEnumerable <TmsCommand>)method.Invoke(translatorInstance, new object[1] {
                    sourceCommand
                }));
            }
            if (_unsupportedZ80Opcodes.Contains(sourceCommand.OpCode))
            {
                return(new UntranslatableTranslator(_mapCollection, LabelHighlighter).Translate(sourceCommand));
            }
            else
            {
                throw new Exception("This command has not been implemented yet.");
            }
        }