toSigned static method
Converts a game 16-bit 'word' val
into a signed Dart int.
Z-Machine Spec Reference
ref(2.2)
Implementation
static int toSigned(int val) {
//if (val == 0) return val;
// game 16-bit word is always positive number to Dart
assert(val >= 0);
// convert to signed if 16-bit MSB is set
return (val & 0x8000) == 0x8000 ? -(65536 - val) : val;
}