Skip to content

Commit

Permalink
suppressed debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
atebitftw committed May 20, 2012
1 parent 326562f commit b74435d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
6 changes: 3 additions & 3 deletions console_player/ZConsole.dart
Expand Up @@ -42,13 +42,13 @@ void main() {
}

//Z.IOConfig = new ConsoleProvider();
//Z.IOConfig = new DebugProvider.with('s.e.open window.enter.take all.w.take all.move rug.open trapdoor.down.turn lantern on');
Z.IOConfig = new DebugProvider.with('s.e.open window.enter.take all.w.take all.move rug.open trapdoor.down.turn lantern on');

//Z.IOConfig = new DebugProvider.with('s.e.open window.enter.take all.w.take all.move rug');
Z.IOConfig = new DebugProvider.with('');
//Z.IOConfig = new DebugProvider.with('');

//enableDebug enables the other flags (verbose, trace, breakpoints, etc)
Debugger.enableDebug = true;
Debugger.enableDebug = false;
Debugger.enableVerbose = true;
Debugger.enableTrace = false;
Debugger.enableStackTrace = false;
Expand Down
6 changes: 3 additions & 3 deletions lib/Dictionary.dart
Expand Up @@ -51,7 +51,7 @@ class Dictionary {

int wordAddress(int index) {
var addr = _address + separators.length + 4 + (index * wordSize);
Debugger.debug('>>> ${ZSCII.readZStringAndPop(addr)}');
Debugger.verbose('>>> ${ZSCII.readZStringAndPop(addr)}');
return addr;
}
int lastIndex = 0;
Expand All @@ -66,15 +66,15 @@ class Dictionary {

if (idx != -1){
var addr = wordAddress(idx);
Debugger.debug(' (found word: "${t}" in dictionary as "${entries[idx]}" at address 0x${addr.toRadixString(16)})');
Debugger.verbose(' (found word: "${t}" in dictionary as "${entries[idx]}" at address 0x${addr.toRadixString(16)})');
parseTable.add((addr >> 8) & 0xff);
parseTable.add(addr & 0xff);

//word length
parseTable.add(t.length);

}else{
Debugger.debug(' (word: ${t} not found in dictionary)');
Debugger.verbose(' (word: ${t} not found in dictionary)');
parseTable.add(0);
parseTable.add(0);
parseTable.add(t.length);
Expand Down
42 changes: 20 additions & 22 deletions lib/machines/Machine.dart
Expand Up @@ -408,13 +408,13 @@ class Machine

if (range < 0){
r = new DRandom.withSeed(range);
Debugger.debug(' (set RNG to seed: $range)');
Debugger.verbose(' (set RNG to seed: $range)');
}else if(range == 0){
r = new DRandom.withSeed(new Date.now().milliseconds);
Debugger.debug(' (set RNG to random seed)');
Debugger.verbose(' (set RNG to random seed)');
}else{
result = r.NextFromMax(range) + 1;
Debugger.debug(' (Rolled [1 - $range] number: $result)');
Debugger.verbose(' (Rolled [1 - $range] number: $result)');
}

writeVariable(resultTo, result);
Expand Down Expand Up @@ -555,7 +555,7 @@ class Machine
var bitmap = operands[0].value;
var flags = operands[1].value;

Debugger.debug('+++ [0x${pp.toRadixString(16)}] testing bitmap($branchOn) "${bitmap.toRadixString(2)}" against "${flags.toRadixString(2)}" ${(bitmap & flags) == flags}');
Debugger.verbose(' [0x${pp.toRadixString(16)}] testing bitmap($branchOn) "${bitmap.toRadixString(2)}" against "${flags.toRadixString(2)}" ${(bitmap & flags) == flags}');

branch((bitmap & flags) == flags);
}
Expand Down Expand Up @@ -594,7 +594,6 @@ class Machine
// var value = toSigned(readVariable(operands[0].rawValue)) + 1;
var varValue = readVariable(operands[0].rawValue);

Debugger.debug(' var value: $varValue');
var value = toSigned(readVariable(operands[0].rawValue)) + 1;

//(ref http://www.gnelson.demon.co.uk/zspec/sect14.html notes #5)
Expand All @@ -610,7 +609,7 @@ class Machine

GameObjectV3 obj = new GameObjectV3(operands[0].value);

Debugger.debug('(test Attribute) >>> object: ${obj.shortName}(${obj.id}) ${operands[1].value}: ${obj.isFlagBitSet(operands[1].value)}');
Debugger.verbose(' (test Attribute) >>> object: ${obj.shortName}(${obj.id}) ${operands[1].value}: ${obj.isFlagBitSet(operands[1].value)}');
branch(obj.isFlagBitSet(operands[1].value));
}

Expand Down Expand Up @@ -727,7 +726,7 @@ class Machine

var str = ZSCII.readZStringAndPop(addr);

print('${pcHex()} "$str"');
//print('${pcHex()} "$str"');

Z.sbuff.add(str);
}
Expand All @@ -741,7 +740,7 @@ class Machine

var str = ZSCII.readZStringAndPop(addr);

print('${pcHex()} "$str"');
//print('${pcHex()} "$str"');

Z.sbuff.add(str);
}
Expand Down Expand Up @@ -775,7 +774,7 @@ class Machine

Z.sbuff.add('${str}\n');

print('${pcHex()} "$str"');
// print('${pcHex()} "$str"');

callStack.push(Machine.TRUE);

Expand All @@ -789,7 +788,6 @@ class Machine
Z.sbuff.add(str);

pc = callStack.pop();
print('${pcHex()} "$str"');
}

void insertObj(){
Expand Down Expand Up @@ -884,7 +882,7 @@ class Machine
GameObjectV3 obj = new GameObjectV3(operands[0].value);

obj.unsetFlagBit(operands[1].value);
Debugger.debug('(clear Attribute) >>> object: ${obj.shortName}(${obj.id}) ${operands[1].value}: ${obj.isFlagBitSet(operands[1].value)}');
Debugger.verbose(' (clear Attribute) >>> object: ${obj.shortName}(${obj.id}) ${operands[1].value}: ${obj.isFlagBitSet(operands[1].value)}');
}

void set_attr(){
Expand All @@ -894,7 +892,7 @@ class Machine
GameObjectV3 obj = new GameObjectV3(operands[0].value);

obj.setFlagBit(operands[1].value);
Debugger.debug('(set Attribute) >>> object: ${obj.shortName}(${obj.id}) ${operands[1].value}: ${obj.isFlagBitSet(operands[1].value)}');
Debugger.verbose(' (set Attribute) >>> object: ${obj.shortName}(${obj.id}) ${operands[1].value}: ${obj.isFlagBitSet(operands[1].value)}');
}

void andV(){
Expand Down Expand Up @@ -942,7 +940,7 @@ class Machine
var resultTo = readb();

var result = toSigned(operands[0].value) - toSigned(operands[1].value);
Debugger.debug('>>> (sub ${pc.toRadixString(16)}) ${operands[0].value}(${toSigned(operands[0].value)}) - ${operands[1].value}(${toSigned(operands[1].value)}) = $result');
Debugger.verbose(' >>> (sub ${pc.toRadixString(16)}) ${operands[0].value}(${toSigned(operands[0].value)}) - ${operands[1].value}(${toSigned(operands[1].value)}) = $result');
writeVariable(resultTo, result);
}

Expand All @@ -953,7 +951,7 @@ class Machine

var result = toSigned(operands[0].value) + toSigned(operands[1].value);

Debugger.debug('>>> (add ${pc.toRadixString(16)}) ${operands[0].value}(${toSigned(operands[0].value)}) + ${operands[1].value}(${toSigned(operands[1].value)}) = $result');
Debugger.verbose(' >>> (add ${pc.toRadixString(16)}) ${operands[0].value}(${toSigned(operands[0].value)}) + ${operands[1].value}(${toSigned(operands[1].value)}) = $result');

writeVariable(resultTo, result);
}
Expand All @@ -965,7 +963,7 @@ class Machine

var result = toSigned(operands[0].value) * toSigned(operands[1].value);

Debugger.debug('>>> (mul ${pc.toRadixString(16)}) ${operands[0].value}(${toSigned(operands[0].value)}) * ${operands[1].value}(${toSigned(operands[1].value)}) = $result');
Debugger.verbose(' >>> (mul ${pc.toRadixString(16)}) ${operands[0].value}(${toSigned(operands[0].value)}) * ${operands[1].value}(${toSigned(operands[1].value)}) = $result');

writeVariable(resultTo, result);
}
Expand All @@ -981,7 +979,7 @@ class Machine

var result = (toSigned(operands[0].value) / toSigned(operands[1].value)).floor().toInt();

Debugger.debug('>>> (div ${pc.toRadixString(16)}) ${operands[0].value}(${toSigned(operands[0].value)}) / ${operands[1].value}(${toSigned(operands[1].value)}) = $result');
Debugger.verbose(' >>> (div ${pc.toRadixString(16)}) ${operands[0].value}(${toSigned(operands[0].value)}) / ${operands[1].value}(${toSigned(operands[1].value)}) = $result');

// if (result < 0){
// result = -(result.abs().floor());
Expand All @@ -1008,7 +1006,7 @@ class Machine
var result = x.abs() % y.abs();
if (x < 0) result = -result;

Debugger.debug('>>> (mod ${pc.toRadixString(16)}) ${operands[0].value}(${toSigned(operands[0].value)}) % ${operands[1].value}(${toSigned(operands[1].value)}) = $result');
Debugger.verbose(' >>> (mod ${pc.toRadixString(16)}) ${operands[0].value}(${toSigned(operands[0].value)}) % ${operands[1].value}(${toSigned(operands[1].value)}) = $result');

writeVariable(resultTo, result);
}
Expand All @@ -1020,7 +1018,7 @@ class Machine
var resultTo = readb();

var propLen = GameObjectV3.propertyLength(operand.value - 1);
Debugger.debug('(${pc.toRadixString(16)}) property length: $propLen , addr: 0x${operand.value.toRadixString(16)}');
Debugger.verbose(' (${pcHex()}) property length: $propLen , addr: 0x${operand.value.toRadixString(16)}');
writeVariable(resultTo, propLen);
}

Expand All @@ -1033,7 +1031,7 @@ class Machine
var obj = new GameObjectV3(operands[0].value);

var nextProp = obj.getNextProperty(operands[1].value);
Debugger.debug('(${pc.toRadixString(16)}) [${obj.id}] prop: ${operands[1].value} next prop: ${nextProp}');
Debugger.verbose(' (${pcHex()}) [${obj.id}] prop: ${operands[1].value} next prop: ${nextProp}');
writeVariable(resultTo, nextProp);
}

Expand All @@ -1047,7 +1045,7 @@ class Machine

var addr = obj.getPropertyAddress(operands[1].value);

Debugger.debug('(${pc.toRadixString(16)}) [${obj.id}] propAddr(${operands[1].value}): ${addr.toRadixString(16)}');
Debugger.verbose(' (${pc.toRadixString(16)}) [${obj.id}] propAddr(${operands[1].value}): ${addr.toRadixString(16)}');

writeVariable(resultTo, addr);
}
Expand All @@ -1062,7 +1060,7 @@ class Machine

var value = obj.getPropertyValue(operands[1].value);

Debugger.debug('(${pc.toRadixString(16)}) [${obj.id}] getPropValue(${operands[1].value}): ${value.toRadixString(16)}');
Debugger.verbose(' (${pc.toRadixString(16)}) [${obj.id}] getPropValue(${operands[1].value}): ${value.toRadixString(16)}');

writeVariable(resultTo, value);
}
Expand All @@ -1074,7 +1072,7 @@ class Machine

var obj = new GameObjectV3(operands[0].value);

Debugger.debug('(${pc.toRadixString(16)}) [${obj.id}] putProp(${operands[1].value}): ${operands[2].value.toRadixString(16)}');
Debugger.verbose(' (${pc.toRadixString(16)}) [${obj.id}] putProp(${operands[1].value}): ${operands[2].value.toRadixString(16)}');

obj.setPropertyValue(operands[1].value, operands[2].value);
}
Expand Down

0 comments on commit b74435d

Please sign in to comment.