| 374 | //--------------------- |
| 375 | |
| 376 | uint8 evaluateWrite(uint8 opcode, uint16 address) |
| 377 | { |
| 378 | // predicts value written by this opcode |
| 379 | switch (opwrite[opcode]) |
| 380 | { |
| 381 | default: |
| 382 | case 0: return 0; // no write |
| 383 | case 1: return _A; // STA, PHA |
| 384 | case 2: return _X; // STX |
| 385 | case 3: return _Y; // STY |
| 386 | case 4: return _P; // PHP |
| 387 | case 5: return GetMem(address) << 1; // ASL (SLO) |
| 388 | case 6: return GetMem(address) >> 1; // LSR (SRE) |
| 389 | case 7: return (GetMem(address) << 1) | (_P & 1); // ROL (RLA) |
| 390 | case 8: return (GetMem(address) >> 1) | ((_P & 1) << 7); // ROL (RRA) |
| 391 | case 9: return GetMem(address) + 1; // INC (ISC) |
| 392 | case 10: return GetMem(address) - 1; // DEC (DCP) |
| 393 | case 11: return _A & _X; // (SAX) |
| 394 | case 12: return _A&_X&(((address-_Y)>>8)+1); // (AHX) |
| 395 | case 13: return _Y&(((address-_X)>>8)+1); // (SHY) |
| 396 | case 14: return _X&(((address-_Y)>>8)+1); // (SHX) |
| 397 | case 15: return _S& (((address-_Y)>>8)+1); // (TAS) |
| 398 | } |
| 399 | return 0; |
| 400 | } |
| 401 | |
| 402 | // Evaluates a condition |
| 403 | int evaluate(Condition* c) |