Skip to content

Commit

Permalink
Minor refactoring in Call and Goto classes
Browse files Browse the repository at this point in the history
  • Loading branch information
fredimachado committed Nov 2, 2016
1 parent 0e3d507 commit def9130
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
14 changes: 2 additions & 12 deletions src/PICHexDisassembler/Instructions/Call.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
using System;

namespace PICHexDisassembler.Instructions
namespace PICHexDisassembler.Instructions
{
public class Call : Instruction
public class Call : Goto
{
private string address;

public Call(string data) : base(data)
{
address = data.Substring(3);
}

public override string ToString()
{
return "CALL 0x" + Convert.ToInt32(address, 2).ToString("X2");
}
}
}
4 changes: 2 additions & 2 deletions src/PICHexDisassembler/Instructions/Goto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace PICHexDisassembler.Instructions
{
public class Goto : Instruction
{
private string address;
private readonly string address;

public Goto(string data) : base(data)
{
Expand All @@ -13,7 +13,7 @@ public Goto(string data) : base(data)

public override string ToString()
{
return "GOTO 0x" + Convert.ToInt32(address, 2).ToString("X2");
return GetType().Name.ToUpper() + " 0x" + Convert.ToInt32(address, 2).ToString("X2");
}
}
}

0 comments on commit def9130

Please sign in to comment.