| 388 | //--------------------- |
| 389 | |
| 390 | uint8 evaluateWrite(uint8 opcode, uint16 address) |
| 391 | { |
| 392 | // predicts value written by this opcode |
| 393 | switch (opwrite[opcode]) |
| 394 | { |
| 395 | default: |
| 396 | case 0: return 0; // no write |
| 397 | case 1: return _A; // STA, PHA |
| 398 | case 2: return _X; // STX |
| 399 | case 3: return _Y; // STY |
| 400 | case 4: return _P; // PHP |
| 401 | case 5: return GetMem(address) << 1; // ASL (SLO) |
| 402 | case 6: return GetMem(address) >> 1; // LSR (SRE) |
| 403 | case 7: return (GetMem(address) << 1) | (_P & 1); // ROL (RLA) |
| 404 | case 8: return (GetMem(address) >> 1) | ((_P & 1) << 7); // ROL (RRA) |
| 405 | case 9: return GetMem(address) + 1; // INC (ISC) |
| 406 | case 10: return GetMem(address) - 1; // DEC (DCP) |
| 407 | case 11: return _A & _X; // (SAX) |
| 408 | case 12: return _A&_X&(((address-_Y)>>8)+1); // (AHX) |
| 409 | case 13: return _Y&(((address-_X)>>8)+1); // (SHY) |
| 410 | case 14: return _X&(((address-_Y)>>8)+1); // (SHX) |
| 411 | case 15: return _S& (((address-_Y)>>8)+1); // (TAS) |
| 412 | } |
| 413 | return 0; |
| 414 | } |
| 415 | |
| 416 | // Evaluates a condition |
| 417 | int evaluate(Condition* c) |