visitOperandsVar method
Implementation
List<Operand> visitOperandsVar(int howMany, bool isVariable) {
final operands = <Operand>[];
//load operand types
var shiftStart = howMany > 4 ? 14 : 6;
final os = howMany > 4 ? readw() : readb();
while (shiftStart > -2) {
var to = os >> shiftStart; //shift
to &= 3; //mask higher order bits we don't care about
if (to == OperandType.omitted) {
break;
} else {
operands.add(Operand(to));
if (operands.length == howMany) break;
shiftStart -= 2;
}
}
//load values
for (var o in operands) {
assert(o.oType != OperandType.omitted);
o.rawValue = o.oType == OperandType.large ? readw() : readb();
}
// //Debugger.verbose(' ${operands.length} operands:');
// operands.forEach((Operand o) {
// if (o.type == OperandType.VARIABLE){
// if (o.rawValue == 0){
// //Debugger.verbose(' ${OperandType.asString(o.type)}: SP (0x${o.peekValue.toRadixString(16)})');
// }else{
// //Debugger.verbose(' ${OperandType.asString(o.type)}: 0x${o.rawValue.toRadixString(16)} (0x${o.peekValue.toRadixString(16)})');
// }
//
// }else{
// //Debugger.verbose(' ${OperandType.asString(o.type)}: 0x${o.peekValue.toRadixString(16)}');
// }
// });
if (!isVariable && (operands.length != howMany)) {
throw Exception(
'Operand count mismatch. Expected $howMany, found ${operands.length}');
}
return operands;
}