コード例 #1
0
        public override IEnumerable <TmsCommand> Translate(Z80AssemblyParsing.Commands.UnconditionalCallCommand callCommand)
        {
            if (callCommand.Operand is Z80AssemblyParsing.Operands.LabeledAddressWithoutParenthesisOperand labelOperand)
            {
                var destinationOperand = new Operands.LabeledAddressTmsOperand(labelOperand.Label);
                yield return(new BranchLinkCommand(callCommand, destinationOperand));
            }
            else
            {
                yield return(new UntranslateableComment(callCommand, "can only translate a call command if it is to a labeled address"));

                yield return(new UntranslateableComment(callCommand, callCommand.SourceText));
            }
        }
        public override IEnumerable <TmsCommand> Translate(T addressChangeCommand)
        {
            var             commandString      = addressChangeCommand.OpCode == Z80AssemblyParsing.OpCode.JP ? "jump" : "call";
            Operand         destinationOperand = null;
            MoveByteCommand unifyCommand       = null;

            if (addressChangeCommand.AddressOperand is Z80AssemblyParsing.Operands.LabeledAddressWithoutParenthesisOperand labelOperand)
            {
                destinationOperand = new Operands.LabeledAddressTmsOperand(labelOperand.Label);
            }
            else if (MustUnifyRegisterPairs(addressChangeCommand.AddressOperand, out var copyFromCommand, out var copyToOperand, out var unifiedOperand))
            {
                unifyCommand       = new MoveByteCommand(addressChangeCommand, copyFromCommand, copyToOperand);
                destinationOperand = unifiedOperand;
            }
コード例 #3
0
        public override IEnumerable <TmsCommand> Translate(Z80AssemblyParsing.Commands.UnconditionalJumpCommand callCommand)
        {
            if (callCommand.Operand is Z80AssemblyParsing.Operands.LabeledAddressWithoutParenthesisOperand labelOperand)
            {
                var destinationOperand = new Operands.LabeledAddressTmsOperand(labelOperand.Label);
                yield return(new BranchCommand(callCommand, destinationOperand));
            }
            else if (callCommand.Operand is Z80AssemblyParsing.Operands.IndirectRegisterOperand indirectRegisterOperand)
            {
                var destinationOperand = GetOperand(indirectRegisterOperand, false);
                yield return(new BranchCommand(callCommand, destinationOperand));
            }
            else
            {
                yield return(new UntranslateableComment(callCommand, "cannot translate a jump command if it is to a literal address"));

                yield return(new UntranslateableComment(callCommand, callCommand.SourceText));
            }
        }