@@ -269,7 +269,8 @@ mos7360_device::mos7360_device(const machine_config &mconfig, const char *tag, d
269269 m_videoram_space_config(" videoram" , ENDIANNESS_LITTLE , 8 , 16 , 0 , address_map_constructor(FUNC (mos7360_device::mos7360_videoram_map), this)),
270270 m_write_irq(*this ),
271271 m_read_k(*this , 0xff ),
272- m_stream(nullptr )
272+ m_stream(nullptr ),
273+ m_cpu(*this , finder_base::DUMMY_TAG )
273274{
274275}
275276
@@ -422,11 +423,11 @@ TIMER_CALLBACK_MEMBER(mos7360_device::timer_expired)
422423 if (param == TIMER_ID_1 )
423424 {
424425 // proven by digital sound of several intros like eoroidpro
425- m_timer[param]->adjust (clocks_to_attotime (TIMER1 ), param);
426+ m_timer[param]->adjust (attotime::from_ticks (TIMER1 , clock () ), param);
426427 }
427428 else
428429 {
429- m_timer[param]->adjust (clocks_to_attotime (0x10000 ), param);
430+ m_timer[param]->adjust (attotime::from_ticks (0x10000 , clock () ), param);
430431 }
431432
432433 m_timer_active[param] = true ;
@@ -805,22 +806,22 @@ uint8_t mos7360_device::read(offs_t offset, int &cs0, int &cs1)
805806 switch (offset)
806807 {
807808 case 0xff00 :
808- val = attotime_to_clocks (m_timer[0 ]->remaining ()) & 0xff ;
809+ val = m_timer_active[ 0 ] ? (m_timer[0 ]->remaining (). as_ticks ( clock ()) & 0xff ) : m_reg[offset & 0x1f ] ;
809810 break ;
810811 case 0xff01 :
811- val = attotime_to_clocks (m_timer[0 ]->remaining ()) >> 8 ;
812+ val = m_timer_active[ 0 ] ? (m_timer[0 ]->remaining (). as_ticks ( clock ()) >> 8 ) : m_reg[offset & 0x1f ] ;
812813 break ;
813814 case 0xff02 :
814- val = attotime_to_clocks (m_timer[1 ]->remaining ()) & 0xff ;
815+ val = m_timer_active[ 1 ] ? (m_timer[1 ]->remaining (). as_ticks ( clock ()) & 0xff ) : m_reg[offset & 0x1f ] ;
815816 break ;
816817 case 0xff03 :
817- val = attotime_to_clocks (m_timer[1 ]->remaining ()) >> 8 ;
818+ val = m_timer_active[ 1 ] ? (m_timer[1 ]->remaining (). as_ticks ( clock ()) >> 8 ) : m_reg[offset & 0x1f ] ;
818819 break ;
819820 case 0xff04 :
820- val = attotime_to_clocks (m_timer[2 ]->remaining ()) & 0xff ;
821+ val = m_timer_active[ 2 ] ? (m_timer[2 ]->remaining (). as_ticks ( clock ()) & 0xff ) : m_reg[offset & 0x1f ] ;
821822 break ;
822823 case 0xff05 :
823- val = attotime_to_clocks (m_timer[2 ]->remaining ()) >> 8 ;
824+ val = m_timer_active[ 2 ] ? (m_timer[2 ]->remaining (). as_ticks ( clock ()) >> 8 ) : m_reg[offset & 0x1f ] ;
824825 break ;
825826 case 0xff07 :
826827 val = (m_reg[offset & 0x1f ] & ~0x40 );
@@ -904,42 +905,39 @@ void mos7360_device::write(offs_t offset, uint8_t data, int &cs0, int &cs1)
904905
905906 if (m_timer_active[0 ])
906907 {
907- m_reg[1 ] = attotime_to_clocks (m_timer[0 ]->remaining ()) >> 8 ;
908908 m_timer[0 ]->reset ();
909909 m_timer_active[0 ] = false ;
910910 }
911911 break ;
912912 case 0xff01 : /* start timer 1 */
913913 m_reg[offset & 0x1f ] = data;
914- m_timer[0 ]->adjust (clocks_to_attotime (TIMER1 ), TIMER_ID_1 );
914+ m_timer[0 ]->adjust (attotime::from_ticks (TIMER1 , clock () ), TIMER_ID_1 );
915915 m_timer_active[0 ] = true ;
916916 break ;
917917 case 0xff02 : /* stop timer 2 */
918918 m_reg[offset & 0x1f ] = data;
919919 if (m_timer_active[1 ])
920920 {
921- m_reg[3 ] = attotime_to_clocks (m_timer[1 ]->remaining ()) >> 8 ;
922921 m_timer[1 ]->reset ();
923922 m_timer_active[1 ] = false ;
924923 }
925924 break ;
926925 case 0xff03 : /* start timer 2 */
927926 m_reg[offset & 0x1f ] = data;
928- m_timer[1 ]->adjust (clocks_to_attotime (TIMER2 ), TIMER_ID_2 );
927+ m_timer[1 ]->adjust (attotime::from_ticks (TIMER2 , clock () ), TIMER_ID_2 );
929928 m_timer_active[1 ] = true ;
930929 break ;
931930 case 0xff04 : /* stop timer 3 */
932931 m_reg[offset & 0x1f ] = data;
933932 if (m_timer_active[2 ])
934933 {
935- m_reg[5 ] = attotime_to_clocks (m_timer[2 ]->remaining ()) >> 8 ;
936934 m_timer[2 ]->reset ();
937935 m_timer_active[2 ] = false ;
938936 }
939937 break ;
940938 case 0xff05 : /* start timer 3 */
941939 m_reg[offset & 0x1f ] = data;
942- m_timer[2 ]->adjust (clocks_to_attotime (TIMER3 ), TIMER_ID_2 );
940+ m_timer[2 ]->adjust (attotime::from_ticks (TIMER3 , clock ()), TIMER_ID_3 );
943941 m_timer_active[2 ] = true ;
944942 break ;
945943 case 0xff06 :
@@ -1038,6 +1036,10 @@ void mos7360_device::write(offs_t offset, uint8_t data, int &cs0, int &cs1)
10381036 m_reg[offset & 0x1f ] = data;
10391037 m_chargenaddr = CHARGENADDR ;
10401038 DBG_LOG (3 , " port_w" , (" chargen %.4x %s %d\n " , CHARGENADDR , data & 2 ? " " : " doubleclock" , data & 1 ));
1039+ if (BIT (data, 1 ))
1040+ m_cpu->set_clock (clock ());
1041+ else
1042+ m_cpu->set_clock (clock () * 2 );
10411043 }
10421044 break ;
10431045 case 0xff14 :
0 commit comments