Previous 15994 Revisions Next

r5589 Saturday 5th September, 2009 at 07:08:23 UTC by Roberto Zandonà
[C64] same implementation of mame: different TOD implementation for cia6526 (c64) and cia8520 (amiga)
[src/emu/machine]6526cia.c

src/emu/machine/6526cia.c
r5588r5589
701701      case CIA_TOD1:
702702      case CIA_TOD2:
703703      case CIA_TOD3:
704         if (offset == CIA_TOD2)
704         if (device->type == CIA8520)
705705         {
706            cia->tod_latch = cia->tod;
707            cia->tod_latched = TRUE;
706            if (offset == CIA_TOD2)
707            {
708               cia->tod_latch = cia->tod;
709               cia->tod_latched = TRUE;
710            }
708711         }
709         else if (offset == CIA_TOD0)
712         else
713         {
714            if (offset == CIA_TOD3)
715            {
716               cia->tod_latch = cia->tod;
717               cia->tod_latched = TRUE;
718            }
719         }
720         if (offset == CIA_TOD0)
710721            cia->tod_latched = FALSE;
711722
712723         if (cia->tod_latched)
r5588r5589
734745         data = timer->mode;
735746         break;
736747   }
748
737749   return data;
738750}
739751
r5588r5589
806818      case CIA_TOD0:
807819      case CIA_TOD1:
808820      case CIA_TOD2:
821      case CIA_TOD3:
809822         shift = 8 * ((offset - CIA_TOD0));
810823
811824         /* alarm setting mode? */
812825         if (cia->timer[1].mode & 0x80)
813826            cia->alarm = (cia->alarm & ~(0xff << shift)) | (data << shift);
814
815827         /* counter setting mode */
816828         else
817         {
818829            cia->tod = (cia->tod & ~(0xff << shift)) | (data << shift);
819830
820            /* only enable the TOD once the LSB is written */
821            cia->tod_running = (shift == 0);
831         if (device->type == CIA8520)
832         {
833            if (offset == CIA_TOD2)
834               cia->tod_running = FALSE;
822835         }
836         else
837         {
838            if (offset == CIA_TOD3)
839               cia->tod_running = FALSE;
840         }
841         if (offset == CIA_TOD0)
842            cia->tod_running = TRUE;
823843         break;
824844
825845      /* serial data ready */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team