private static void AddCommentsInTestsParametersTable(int address, SpectrumMemoryMap memory, CharDecoder decoder, Program program) { bool isFlagTests = address == 0x822B; string testType = isFlagTests ? "FLAGS" : "MEMPTR"; int testCounter = 0; int paramAddress = address; int targetAddress = 0; while ((targetAddress = memory.MemoryCells[address++] + memory.MemoryCells[address++] * 256) > 0) { program.DefineWordData(address - 2); program.CommentStringChars(address, decoder.DecodeChar, Program.StringTerminationType.SpecialChar, 0, 0xFF); StringBuilder testName = new StringBuilder(); for (; memory.MemoryCells[address] != 0xFF; address++) { testName.Append(SpectrumCharSet.GetSpectrumChar(memory.MemoryCells[address]).Text); } testCounter++; string testDescription = testType + " test " + testCounter.ToString("D2") + " : " + testName.ToString(); string testLabel = testType + "_TEST_" + testCounter.ToString("D2"); program.InsertCommentAboveProgramLine(paramAddress, "Params for " + testDescription); program.InsertCommentAboveProgramLine(targetAddress, "Launcher for " + testDescription); program.PrefixLabelToProgramLine(targetAddress, testLabel + "_LAUNCH", true); if ((isFlagTests && (testCounter <= 29)) || !isFlagTests) { program.InsertCommentAboveProgramLine(targetAddress + 9, "Code executed for " + testDescription); program.PrefixLabelToProgramLine(targetAddress + 9, testLabel + "_EXEC", true); } address++; paramAddress = address; } }
public string DecodeChar(byte charCode) { if (atCounter == 0) { // AT control code - 2 bytes following : line / column if (charCode == 22) { atCounter = 2; } return(SpectrumCharSet.GetSpectrumChar(charCode).Text); } else { atCounter--; return(charCode.ToString()); } }