Previous 199869 Revisions Next

r17663 Wednesday 5th September, 2012 at 20:07:14 UTC by Angelo Salese
(MESS) Preliminary support for cassette images in MZ-2000 [Angelo Salese]
[src/mess/drivers]mz2000.c

trunk/src/mess/drivers/mz2000.c
r17662r17663
3535{
3636public:
3737   mz2000_state(const machine_config &mconfig, device_type type, const char *tag)
38      : driver_device(mconfig, type, tag) { }
38      : driver_device(mconfig, type, tag),
39        m_cass(*this, CASSETTE_TAG)
40      { }
3941
42   required_device<cassette_image_device> m_cass;
43
4044   UINT8 m_ipl_enable;
4145   UINT8 m_tvram_enable;
4246   UINT8 m_gvram_enable;
r17662r17663
273277
274278WRITE8_MEMBER(mz2000_state::mz2000_gvram_bank_w)
275279{
276
277280   m_gvram_bank = data & 3;
278281}
279282
r17662r17663
563566
564567static READ8_DEVICE_HANDLER( mz2000_portb_r )
565568{
569   mz2000_state *state = device->machine().driver_data<mz2000_state>();
566570   /*
567571    x--- ---- break key
568572    -x-- ---- read tape data
r17662r17663
571575    ---- x--- end of tape reached
572576    ---- ---x "blank" control
573577    */
574   UINT8 res = 0xff ^ 0xe0;
578   UINT8 res = 0x80;
575579
576   res |= ((device->machine().device<cassette_image_device>(CASSETTE_TAG))->input() > 0.00) ? 0x40 : 0x00;
577   res |= (((device->machine().device<cassette_image_device>(CASSETTE_TAG))->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY) ? 0x00 : 0x20;
580   res |= (state->m_cass->input() > 0.0038) ? 0x40 : 0x00;
581   res |= ((state->m_cass->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY) ? 0x00 : 0x20;
582   res |= (state->m_cass->get_position() >= state->m_cass->get_length()) ? 0x08 : 0x00;
583   res |= (device->machine().primary_screen->vblank()) ? 0x00 : 0x01;
578584
579   popmessage("%02x",res);
585//   popmessage("%02x",res);
580586
581587   return res;
582588}
r17662r17663
590596static WRITE8_DEVICE_HANDLER( mz2000_porta_w )
591597{
592598   /*
599   TODO: it's likely to be a 0->1 transition
593600    x--- ---- tape "APSS"
594601    -x-- ---- tape "APLAY"
595602    --x- ---- tape "AREW"
r17662r17663
599606    ---- --x- tape ff
600607    ---- ---x tape rewind
601608    */
602   //printf("A W %02x\n",data);
609   mz2000_state *state = device->machine().driver_data<mz2000_state>();
603610
604   // ...
611   if((data & 8) == 0) // stop
612   {
613      state->m_cass->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR);
614      state->m_cass->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE);
615   }
616   if((data & 4) == 0) // play
617   {
618      state->m_cass->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
619      state->m_cass->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE);
620   }
605621}
606622
607623static WRITE8_DEVICE_HANDLER( mz2000_portb_w )
608624{
609   printf("B W %02x\n",data);
625   //printf("B W %02x\n",data);
610626
611627   // ...
612628}
r17662r17663
623639        ---- -x-- beeper state
624640        ---- --x- 0->1 transition = Work RAM reset
625641    */
626   printf("C W %02x\n",data);
642   //printf("C W %02x\n",data);
627643
628644   if(((state->m_old_portc & 8) == 0) && data & 8)
629645      state->m_ipl_enable = 1;
r17662r17663
762778
763779static MACHINE_CONFIG_START( mz2000, mz2000_state )
764780   /* basic machine hardware */
765   MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz)
781   MCFG_CPU_ADD("maincpu",Z80, XTAL_17_73447MHz/5) /* TODO: was 4 MHz, but otherwise cassette won't work */
766782   MCFG_CPU_PROGRAM_MAP(mz2000_map)
767783   MCFG_CPU_IO_MAP(mz2000_io)
768784

Previous 199869 Revisions Next


© 1997-2024 The MAME Team