public string OutputRegister() { StringBuilder sb = new StringBuilder(); StringWriter tw = new StringWriter(sb); int unsigned_ouput = BinConverter.Bin8ToInt(OPort1); int signed_output = 0; if (OPort1 != null) { if (OPort1.StartsWith('1')) { signed_output = -1 * (255 - unsigned_ouput + 1); } else { signed_output = unsigned_ouput; } } if (string.IsNullOrEmpty(OPort1)) { OPort1 = "00000000"; } tw.WriteLine($"************************************************************");//60 tw.WriteLine($"* Output: {OPort1}".PadRight(47) + "*"); tw.WriteLine("************************************************************"); tw.Flush(); return(sb.ToString()); }
public override string ToString() { StringBuilder sb = new StringBuilder(); StringWriter tw = new StringWriter(sb); int unsigned_ouput = BinConverter.Bin8ToInt(OPort1); int signed_output = 0; if (OPort1 != null) { if (OPort1.StartsWith('1')) { signed_output = -1 * (255 - unsigned_ouput + 1); } else { signed_output = unsigned_ouput; } } tw.WriteLine($"***********************************************************************************");//82 tw.WriteLine($"* Instruction: {InstructionData.OpCode} TState: {TState}".PadRight(82) + "*"); tw.WriteLine($"***********************************************************************************"); tw.WriteLine($"* Input 1: {IPort1}".PadRight(35) + $"A Register: {AReg}".PadRight(47) + "*"); tw.WriteLine($"* Input 2: {IPort2}".PadRight(35) + $"ALU: {ALU} Flags: {Flags}".PadRight(47) + "*"); tw.WriteLine($"* PC: {PC}".PadRight(35) + $"Temp Register: {TReg}".PadRight(47) + "*"); tw.WriteLine($"* MAR: {MAR}".PadRight(35) + $"B Register: {BReg}".PadRight(47) + "*"); tw.WriteLine($"* RAM: {RAM_Reg}".PadRight(35) + $"C Register: {CReg}".PadRight(47) + "*"); tw.WriteLine($"* MDR: {MDR}".PadRight(35) + $"Output 3: {OPort1} Display: 0x{HexadecimalDisplay}".PadRight(47) + "*"); tw.WriteLine($"* I Register: {IReg}".PadRight(35) + $"Output 4: {OPort2}".PadRight(47) + "*"); tw.WriteLine($"* Sequencer: {SEQ} ".PadRight(82) + "*"); tw.WriteLine($"* BUS: {WBus} ".PadRight(82) + "*"); tw.WriteLine($"***********************************************************************************"); tw.WriteLine($"* Output Unsigned: {unsigned_ouput}".PadRight(82) + "*"); tw.WriteLine($"* Output Signed: {signed_output}".PadRight(82) + "*"); tw.WriteLine($"***********************************************************************************"); tw.Flush(); return(sb.ToString()); }