dumpHeader static method

String dumpHeader()

Implementation

static String dumpHeader() {
  if (!Z.isLoaded) return '<<< Machine Not Loaded >>>\n';

  var s = StringBuffer();

  s.write('(Story contains ${Z.engine.mem.size} bytes.)\n');
  s.write('\n');
  s.write('------- START HEADER -------\n');
  s.write('Z-Machine Version: ${Z.engine.version}\n');
  s.write(
      'Flags1(binary): 0b${Z.engine.mem.loadw(Header.flags1).toRadixString(2)}\n');
  // word after flags1 is used by Inform
  s.write(
      'Abbreviations Location: 0x${Z.engine.mem.abbrAddress.toRadixString(16)}\n');
  s.write(
      'Object Table Location: 0x${Z.engine.mem.objectsAddress.toRadixString(16)}\n');
  s.write(
      'Global Variables Location: 0x${Z.engine.mem.globalVarsAddress.toRadixString(16)}\n');
  s.write(
      'Static Memory Start: 0x${Z.engine.mem.staticMemAddress.toRadixString(16)}\n');
  s.write(
      'Dictionary Location: 0x${Z.engine.mem.dictionaryAddress!.toRadixString(16)}\n');
  s.write(
      'High Memory Start: 0x${Z.engine.mem.highMemAddress.toRadixString(16)}\n');
  s.write(
      'Program Counter Start: 0x${Z.engine.mem.programStart!.toRadixString(16)}\n');
  s.write(
      'Flags2(binary): 0b${Z.engine.mem.loadb(Header.flags2).toRadixString(2)}\n');
  s.write(
      'Length Of File: ${Z.engine.mem.loadw(Header.lengthOfFile) * Z.engine.fileLengthMultiplier()}\n');
  s.write(
      'Checksum Of File: ${Z.engine.mem.loadw(Header.checkSumOfFile)}\n');
  //TODO v4+ header stuff here
  s.write(
      'Standard Revision: ${Z.engine.mem.loadw(Header.revisionNumberN)}\n');
  s.write('-------- END HEADER ---------\n');

  //s.write('main Routine: ${Z.machine.mem.getRange(Z.pc - 4, 10)}');

  s.write('\n');
  return s.toString();
}