Previous 199869 Revisions Next

r26304 Wednesday 20th November, 2013 at 15:25:29 UTC by Curt Coder
(MESS) tiki100: Added RS-232, Centronics and cassette. [Curt Coder]
[src/mess/drivers]tiki100.c
[src/mess/includes]tiki100.h

trunk/src/mess/includes/tiki100.h
r26303r26304
77
88
99#include "emu.h"
10#include "bus/centronics/ctronics.h"
1011#include "cpu/z80/z80.h"
1112#include "cpu/z80/z80daisy.h"
1213#include "formats/tiki100_dsk.h"
14#include "imagedev/cassette.h"
1315#include "machine/ram.h"
16#include "machine/serial.h"
1417#include "machine/z80ctc.h"
1518#include "machine/z80dart.h"
1619#include "machine/z80pio.h"
1720#include "machine/wd_fdc.h"
1821#include "sound/ay8910.h"
1922
20#define SCREEN_TAG      "screen"
2123#define Z80_TAG         "z80"
2224#define Z80DART_TAG     "z80dart"
2325#define Z80PIO_TAG      "z80pio"
2426#define Z80CTC_TAG      "z80ctc"
2527#define FD1797_TAG      "fd1797"
2628#define AY8912_TAG      "ay8912"
29#define RS232_A_TAG     "rs232a"
30#define RS232_B_TAG     "rs232b"
31#define CASSETTE_TAG    "cassette"
32#define CENTRONICS_TAG  "centronics"
33#define SCREEN_TAG      "screen"
2734
2835#define TIKI100_VIDEORAM_SIZE   0x8000
2936#define TIKI100_VIDEORAM_MASK   0x7fff
r26303r26304
4047         m_maincpu(*this, Z80_TAG),
4148         m_ctc(*this, Z80CTC_TAG),
4249         m_fdc(*this, FD1797_TAG),
50         m_pio(*this, Z80PIO_TAG),
51         m_dart(*this, Z80DART_TAG),
4352         m_ram(*this, RAM_TAG),
4453         m_floppy0(*this, FD1797_TAG":0"),
4554         m_floppy1(*this, FD1797_TAG":1"),
55         m_cassette(*this, CASSETTE_TAG),
56         m_centronics(*this, CENTRONICS_TAG),
4657         m_rom(*this, Z80_TAG),
4758         m_video_ram(*this, "video_ram"),
4859         m_y1(*this, "Y1"),
r26303r26304
6273   required_device<cpu_device> m_maincpu;
6374   required_device<z80ctc_device> m_ctc;
6475   required_device<fd1797_t> m_fdc;
76   required_device<z80pio_device> m_pio;
77   required_device<z80dart_device> m_dart;
6578   required_device<ram_device> m_ram;
6679   required_device<floppy_connector> m_floppy0;
6780   required_device<floppy_connector> m_floppy1;
81   required_device<cassette_image_device> m_cassette;
82   required_device<centronics_device> m_centronics;
6883   required_memory_region m_rom;
6984   optional_shared_ptr<UINT8> m_video_ram;
7085   required_ioport m_y1;
r26303r26304
8196   required_ioport m_y12;
8297
8398   virtual void machine_start();
99   virtual void machine_reset();
84100
85101   UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
86102
r26303r26304
91107   DECLARE_WRITE8_MEMBER( video_mode_w );
92108   DECLARE_WRITE8_MEMBER( palette_w );
93109   DECLARE_WRITE8_MEMBER( system_w );
94   DECLARE_WRITE_LINE_MEMBER( ctc_z1_w );
110   DECLARE_WRITE_LINE_MEMBER( ctc_z0_w );
111   DECLARE_WRITE_LINE_MEMBER( ctc_z2_w );
95112   DECLARE_WRITE8_MEMBER( video_scroll_w );
113
114   DECLARE_READ8_MEMBER( pio_pb_r );
115   DECLARE_WRITE8_MEMBER( pio_pb_w );
116
96117   DECLARE_FLOPPY_FORMATS( floppy_formats );
97118
98119   void bankswitch();
r26303r26304
107128   UINT8 m_palette;
108129
109130   /* keyboard state */
110   ioport_port* m_key_row[12];
111131   int m_keylatch;
112   TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick);
132
133   TIMER_DEVICE_CALLBACK_MEMBER( ctc_tick );
134   TIMER_DEVICE_CALLBACK_MEMBER( tape_tick );
113135};
114136
115137#endif
trunk/src/mess/drivers/tiki100.c
r26303r26304
1414
1515    TODO:
1616
17   - 3 expansion slots
1718    - palette RAM should be written during HBLANK
1819    - DART clocks
1920    - winchester hard disk
r26303r26304
9697
9798READ8_MEMBER( tiki100_state::keyboard_r )
9899{
99   UINT8 data = m_key_row[m_keylatch]->read();
100   UINT8 data = 0xff;
100101
102   switch (m_keylatch)
103   {
104   case 0: data = m_y1->read(); break;
105   case 1: data = m_y2->read(); break;
106   case 2: data = m_y3->read(); break;
107   case 3: data = m_y4->read(); break;
108   case 4: data = m_y5->read(); break;
109   case 5: data = m_y6->read(); break;
110   case 6: data = m_y7->read(); break;
111   case 7: data = m_y8->read(); break;
112   case 8: data = m_y9->read(); break;
113   case 9: data = m_y10->read(); break;
114   case 10: data = m_y11->read(); break;
115   case 11: data = m_y12->read(); break;
116   }
117
101118   m_keylatch++;
102
103119   if (m_keylatch == 12) m_keylatch = 0;
104120
105121   return data;
r26303r26304
450466
451467static Z80DART_INTERFACE( dart_intf )
452468{
453   0,
454   0,
455   0,
456   0,
469   0, 0, 0, 0,
470
471   DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, serial_port_device, rx),
472   DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, serial_port_device, tx),
473   DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, rs232_port_device, dtr_w),
474   DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, rs232_port_device, rts_w),
457475   DEVCB_NULL,
458476   DEVCB_NULL,
477
478   DEVCB_DEVICE_LINE_MEMBER(RS232_B_TAG, serial_port_device, rx),
479   DEVCB_DEVICE_LINE_MEMBER(RS232_B_TAG, serial_port_device, tx),
480   DEVCB_DEVICE_LINE_MEMBER(RS232_B_TAG, rs232_port_device, dtr_w),
481   DEVCB_DEVICE_LINE_MEMBER(RS232_B_TAG, rs232_port_device, rts_w),
459482   DEVCB_NULL,
483
460484   DEVCB_NULL,
461   DEVCB_NULL,
462   DEVCB_NULL,
463   DEVCB_NULL,
464   DEVCB_NULL,
465   DEVCB_NULL,
466   DEVCB_NULL,
467   DEVCB_NULL,
468   DEVCB_NULL,
469485   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0)
470486};
471487
472488/* Z80-PIO Interface */
473489
490READ8_MEMBER( tiki100_state::pio_pb_r )
491{
492   /*
493   
494       bit     description
495   
496       0       
497       1       
498       2       
499       3       
500       4       ACK
501       5       BUSY
502       6       NO PAPER
503       7       UNIT SELECT, tape in
504   
505   */
506
507   UINT8 data = 0;
508
509   // centronics
510   data |= m_centronics->ack_r() << 4;
511   data |= m_centronics->busy_r() << 5;
512   data |= m_centronics->pe_r() << 6;
513
514   // cassette
515   data |= (m_cassette->input() > 0.0) << 7;
516
517   return data;
518}
519
520WRITE8_MEMBER( tiki100_state::pio_pb_w )
521{
522   /*
523   
524       bit     description
525   
526       0       STRB
527       1       
528       2       
529       3       
530       4       
531       5       
532       6       tape out
533       7       
534   
535   */
536
537   // centronics
538   m_centronics->strobe_w(BIT(data, 0));
539
540   // cassette
541   m_cassette->output(BIT(data, 6) ? -1 : 1);
542}
543
474544static Z80PIO_INTERFACE( pio_intf )
475545{
476   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0), /* callback when change interrupt status */
477   DEVCB_NULL,                     /* port A read callback */
478   DEVCB_NULL,                     /* port A write callback */
479   DEVCB_NULL,                     /* portA ready active callback */
480   DEVCB_NULL,                     /* port B read callback */
481   DEVCB_NULL,                     /* port B write callback */
482   DEVCB_NULL                      /* portB ready active callback */
546   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0),
547   DEVCB_DEVICE_MEMBER(CENTRONICS_TAG, centronics_device, read),
548   DEVCB_DEVICE_MEMBER(CENTRONICS_TAG, centronics_device, write),
549   DEVCB_NULL,
550   DEVCB_DRIVER_MEMBER(tiki100_state, pio_pb_r),
551   DEVCB_DRIVER_MEMBER(tiki100_state, pio_pb_w),
552   DEVCB_NULL
483553};
484554
485555/* Z80-CTC Interface */
r26303r26304
493563   m_ctc->trg1(0);
494564}
495565
496WRITE_LINE_MEMBER( tiki100_state::ctc_z1_w )
566WRITE_LINE_MEMBER( tiki100_state::ctc_z0_w )
497567{
568   m_ctc->trg2(state);
569
570   m_dart->rxca_w(state);
571   m_dart->txca_w(state);
498572}
499573
574WRITE_LINE_MEMBER( tiki100_state::ctc_z2_w )
575{
576   m_ctc->trg3(state);
577}
578
500579static Z80CTC_INTERFACE( ctc_intf )
501580{
502   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0), /* interrupt handler */
503   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF, z80ctc_device, trg2), /* ZC/TO0 callback */
504   DEVCB_DRIVER_LINE_MEMBER(tiki100_state, ctc_z1_w),      /* ZC/TO1 callback */
505   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF, z80ctc_device, trg3)  /* ZC/TO2 callback */
581   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0),
582   DEVCB_DRIVER_LINE_MEMBER(tiki100_state, ctc_z0_w),
583   DEVCB_DEVICE_LINE_MEMBER(Z80DART_TAG, z80dart_device, rxtxcb_w),
584   DEVCB_DRIVER_LINE_MEMBER(tiki100_state, ctc_z2_w),
506585};
507586
508587/* FD1797 Interface */
r26303r26304
544623   { NULL }
545624};
546625
626//-------------------------------------------------
627//  rs232_port_interface rs232_intf
628//-------------------------------------------------
629
630static const rs232_port_interface rs232_intf =
631{
632   DEVCB_NULL,
633   DEVCB_NULL,
634   DEVCB_NULL,
635   DEVCB_NULL,
636   DEVCB_NULL
637};
638
639
640//-------------------------------------------------
641//  cassette_interface cassette_intf
642//-------------------------------------------------
643
644TIMER_DEVICE_CALLBACK_MEMBER( tiki100_state::tape_tick )
645{
646   m_pio->port_b_write((m_cassette->input() > 0.0) << 7);
647}
648
649static const cassette_interface cassette_intf =
650{
651   cassette_default_formats,
652   NULL,
653   (cassette_state)(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED),
654   NULL,
655   NULL
656};
657
547658/* Machine Start */
548659
549660void tiki100_state::machine_start()
r26303r26304
565676
566677   bankswitch();
567678
568   // find keyboard rows
569   m_key_row[0] = m_y1;
570   m_key_row[1] = m_y2;
571   m_key_row[2] = m_y3;
572   m_key_row[3] = m_y4;
573   m_key_row[4] = m_y5;
574   m_key_row[5] = m_y6;
575   m_key_row[6] = m_y7;
576   m_key_row[7] = m_y8;
577   m_key_row[8] = m_y9;
578   m_key_row[9] = m_y10;
579   m_key_row[10] = m_y11;
580   m_key_row[11] = m_y12;
581
582679   /* register for state saving */
583680   save_item(NAME(m_rome));
584681   save_item(NAME(m_vire));
r26303r26304
588685   save_item(NAME(m_keylatch));
589686}
590687
688void tiki100_state::machine_reset()
689{
690   address_space &space = m_maincpu->space(AS_PROGRAM);
691
692   system_w(space, 0, 0);
693}
694
591695/* Machine Driver */
592696
593697static MACHINE_CONFIG_START( tiki100, tiki100_state )
r26303r26304
616720   MCFG_FD1797x_ADD(FD1797_TAG, XTAL_8MHz/8) // FD1767PL-02 or FD1797-PL
617721   MCFG_FLOPPY_DRIVE_ADD(FD1797_TAG":0", tiki100_floppies, "525qd", tiki100_state::floppy_formats)
618722   MCFG_FLOPPY_DRIVE_ADD(FD1797_TAG":1", tiki100_floppies, "525qd", tiki100_state::floppy_formats)
723   MCFG_RS232_PORT_ADD(RS232_A_TAG, rs232_intf, default_rs232_devices, NULL)
724   MCFG_RS232_PORT_ADD(RS232_B_TAG, rs232_intf, default_rs232_devices, NULL)
725   MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, standard_centronics)
726   MCFG_CASSETTE_ADD(CASSETTE_TAG, cassette_intf)
727   MCFG_TIMER_DRIVER_ADD_PERIODIC("tape", tiki100_state, tape_tick, attotime::from_hz(44100))
619728
620729   /* sound hardware */
621730   MCFG_SPEAKER_STANDARD_MONO("mono")

Previous 199869 Revisions Next


© 1997-2024 The MAME Team