MCPcopy Create free account
hub / github.com/TASEmulators/fceux / evaluate

Function evaluate

src/debug.cpp:403–477  ·  view source on GitHub ↗

Evaluates a condition

Source from the content-addressed store, hash-verified

401
402// Evaluates a condition
403int evaluate(Condition* c)
404{
405 int f = 0;
406
407 int value1, value2;
408
409 if (c->lhs)
410 {
411 value1 = evaluate(c->lhs);
412 }
413 else
414 {
415 switch(c->type1)
416 {
417 case TYPE_ADDR: // This is intended to not break, and use the TYPE_NUM code
418 case TYPE_NUM: value1 = c->value1; break;
419 default: value1 = getValue(c->value1); break;
420 }
421 }
422
423 switch(c->type1)
424 {
425 case TYPE_ADDR: value1 = GetMem(value1); break;
426 case TYPE_PC_BANK: value1 = getBank(_PC); break;
427 case TYPE_DATA_BANK: value1 = getBank(debugLastAddress); break;
428 case TYPE_VALUE_READ: value1 = GetMem(debugLastAddress); break;
429 case TYPE_VALUE_WRITE: value1 = evaluateWrite(debugLastOpcode, debugLastAddress); break;
430 }
431
432 f = value1;
433
434 if (c->op)
435 {
436 if (c->rhs)
437 {
438 value2 = evaluate(c->rhs);
439 }
440 else
441 {
442 switch(c->type2)
443 {
444 case TYPE_ADDR: // This is intended to not break, and use the TYPE_NUM code
445 case TYPE_NUM: value2 = c->value2; break;
446 default: value2 = getValue(c->type2); break;
447 }
448 }
449
450 switch(c->type2)
451 {
452 case TYPE_ADDR: value2 = GetMem(value2); break;
453 case TYPE_PC_BANK: value2 = getBank(_PC); break;
454 case TYPE_DATA_BANK: value2 = getBank(debugLastAddress); break;
455 case TYPE_VALUE_READ: value2 = GetMem(debugLastAddress); break;
456 case TYPE_VALUE_WRITE: value2 = evaluateWrite(debugLastOpcode, debugLastAddress); break;
457 }
458
459 switch (c->op)
460 {

Callers 1

conditionFunction · 0.85

Calls 4

getValueFunction · 0.85
GetMemFunction · 0.85
getBankFunction · 0.85
evaluateWriteFunction · 0.85

Tested by

no test coverage detected