comparison lwasm/cycle.c @ 482:9c24336fa76c

Correct cycle counts for W relative indexing modes Actually handle the 6309 specific W relative indexing modes (,W; n,W; ,W++; ,--W) in the cycle count calculation code. These work differently than the regular indexing modes so it's necessary to handle their bit patterns specially. (The bits that would normally select the base register are used instead to select the operation on W.)
author William Astle <lost@l-w.ca>
date Thu, 24 Jan 2019 18:24:03 -0700
parents b9917c4dc6cf
children e545196bf14f
comparison
equal deleted inserted replaced
481:62720ac9e28d 482:9c24336fa76c
622 int pb = cl->pb; 622 int pb = cl->pb;
623 623
624 if ((pb & 0x80) == 0) /* 5 bit offset */ 624 if ((pb & 0x80) == 0) /* 5 bit offset */
625 return 1; 625 return 1;
626 626
627 // These need special handling because the *register* bits determine the specific operation (and, thus, cycle counts)
628 if (!CURPRAGMA(cl, PRAGMA_6809))
629 {
630 switch (pb)
631 {
632 case 0x8f: // ,W
633 return 0;
634 case 0xaf: // n,W (16 bit)
635 return 2;
636 case 0xcf: // ,W++
637 case 0xef: // ,--W
638 return 1;
639 case 0x90: // [,W]
640 return 3;
641 case 0xb0: // [n,W] (16 bit)
642 return 5;
643 case 0xd0: // [,W++]
644 case 0xf0: // [,--W]
645 return 4;
646 }
647 }
648
627 if (pb & 0x10) /* indirect */ 649 if (pb & 0x10) /* indirect */
628 return CURPRAGMA(cl, PRAGMA_6809) ? indtab[pb & 0xf].cycles_6809_indirect : indtab[pb & 0xf].cycles_6309_indirect; 650 return CURPRAGMA(cl, PRAGMA_6809) ? indtab[pb & 0xf].cycles_6809_indirect : indtab[pb & 0xf].cycles_6309_indirect;
629 else 651 else
630 return CURPRAGMA(cl, PRAGMA_6809) ? indtab[pb & 0xf].cycles_6809_indexed : indtab[pb & 0xf].cycles_6309_indexed; 652 return CURPRAGMA(cl, PRAGMA_6809) ? indtab[pb & 0xf].cycles_6809_indexed : indtab[pb & 0xf].cycles_6309_indexed;
631 } 653 }