public IEnumerable <string> Def(RegType regType) { // MOVE D2,D0 Def: D0 // MOVE (A2)+,D0 Def: D0, A2 // MOVE (A2)+,A1 Def: A2 // MOVE (A2)+,(A1)- Def: A2,A1 if (Opcode == M68kOpcode.Jsr) { if (regType == RegType.Data) { yield return("D0"); yield return("D1"); } if (regType == RegType.Address) { yield return("A0"); yield return("A1"); } } if (Opcode == M68kOpcode.RegDef) { foreach (var du in DefsUses) { if ((du[0] == 'D' && regType == RegType.Data) || (du[0] == 'A' && regType == RegType.Address)) { yield return(du); } } } if (Opcode == M68kOpcode.Cmp) { yield break; } if (Register2 != null && AddressingMode2 == M68kAddressingMode.Register && Register2.Type == regType) { yield return(Register2.ToString()); } if (Register1 != null && Register1.Type == regType) { switch (AddressingMode1) { case M68kAddressingMode.AddressWithPostIncrement: case M68kAddressingMode.AddressWithPostDecrement: case M68kAddressingMode.AddressWithPreDecrement: case M68kAddressingMode.AddressWithPreIncrement: yield return(Register1.ToString()); break; } } if (Register2 != null && Register2.Type == regType) { switch (AddressingMode2) { case M68kAddressingMode.AddressWithPostIncrement: case M68kAddressingMode.AddressWithPostDecrement: case M68kAddressingMode.AddressWithPreDecrement: case M68kAddressingMode.AddressWithPreIncrement: yield return(Register2.ToString()); break; } } }
public IEnumerable <string> Use(RegType regType) { if (Opcode == M68kOpcode.RegUse) { foreach (var du in DefsUses) { yield return(du); } } if (Opcode == M68kOpcode.Cmp || Opcode == M68kOpcode.Lsr) { if (Register1 != null) { yield return(Register1.ToString()); } yield return(Register2.ToString()); yield break; } if (Register1 != null && Register1.Type == regType) { yield return(Register1.ToString()); } if ((Opcode == M68kOpcode.Add || Opcode == M68kOpcode.Sub || Opcode == M68kOpcode.Adda) && Register2 != null && Register2.Type == regType) { yield return(Register2.ToString()); } if (Register2 != null && Register2.Type == regType) { switch (AddressingMode2) { case M68kAddressingMode.Address: case M68kAddressingMode.AddressWithOffset: case M68kAddressingMode.AddressWithPostIncrement: case M68kAddressingMode.AddressWithPostDecrement: case M68kAddressingMode.AddressWithPreDecrement: case M68kAddressingMode.AddressWithPreIncrement: yield return(Register2.ToString()); break; } } if (Opcode == M68kOpcode.Rts) { if (regType == RegType.Data) { if (FinalRegister1.HasValue) { yield return("D0"); } yield return("D2"); yield return("D3"); yield return("D4"); yield return("D5"); yield return("D6"); yield return("D7"); } if (regType == RegType.Address) { yield return("A2"); yield return("A3"); yield return("A4"); yield return("A5"); yield return("A6"); } } }