Previous 199869 Revisions Next

r23734 Sunday 16th June, 2013 at 06:35:45 UTC by Robbbert
(MESS) MEK6800D2 : Added cassette interface, system listed as WORKING [Robbbert]
[src/mess/drivers]mekd2.c

trunk/src/mess/drivers/mekd2.c
r23733r23734
44
55    system driver
66
7    Juergen Buchmueller <pullmoll@t-online.de>, Jan 2000
7    Juergen Buchmueller, Jan 2000
8    2013-06-16 Working driver [Robbbert]
89
910    memory map
1011
r23733r23734
2425    e000-e3ff   ROM     JBUG monitor program
2526    e400-ffff   -/-     mirrors of monitor rom
2627
28
29Enter the 4 digit address then the command key:
30
31  - M : Examine and Change Memory (example: E000M, then G to skip to next, ESC to exit)
32  - E : Escape (abort) operation (ESC key in our emulation)
33  - R : Examine Registers
34  - G : Begin execution at specified address
35  - P : Punch data from memory to magnetic tape
36  - L : Load memory from magnetic tape
37  - N : Trace one instruction
38  - V : Set (and remove) breakpoints
39
40The keys are laid out as:
41
42  P L N V
43
44  7 8 9 A  M
45  4 5 6 B  E
46  1 2 3 C  R
47  0 F E D  G
48
49
2750Pasting:
2851        0-F : as is
2952        NEXT : ^
r23733r23734
3861        program that you need to enter in step 1:
3962        H0020=8E^00^FF^4F^C6^04^CE^00^10^AB^00^08^5A^26^FA^97^15^3F^H
4063
64        Save the above program to tape:
65        HA002=00^20^00^32^HP (A002 has start address, A004 has end address, big endian)
66
4167TODO
42        Cassette (it is extremely complex, with approx 10 chips)
68        Display should go blank during cassette operations
4369
4470
4571******************************************************************************/
r23733r23734
6591
6692   mekd2_state(const machine_config &mconfig, device_type type, const char *tag)
6793      : driver_device(mconfig, type, tag),
68   m_maincpu(*this, "maincpu"),
69   m_pia_s(*this, "pia_s"),
70   m_pia_u(*this, "pia_u"),
71   m_acia(*this, "acia")
94      m_maincpu(*this, "maincpu"),
95      m_pia_s(*this, "pia_s"),
96      m_pia_u(*this, "pia_u"),
97      m_acia(*this, "acia"),
98      m_cass(*this, "cassette")
7299   { }
73100
101   DECLARE_READ_LINE_MEMBER(mekd2_key40_r);
102   DECLARE_READ8_MEMBER(mekd2_key_r);
103   DECLARE_WRITE_LINE_MEMBER(mekd2_nmi_w);
104   DECLARE_WRITE8_MEMBER(mekd2_digit_w);
105   DECLARE_WRITE8_MEMBER(mekd2_segment_w);
106   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(mekd2_cart);
107   DECLARE_READ_LINE_MEMBER(cass_r);
108   DECLARE_WRITE_LINE_MEMBER(cass_w);
109   TIMER_DEVICE_CALLBACK_MEMBER(mekd2_c);
110   TIMER_DEVICE_CALLBACK_MEMBER(mekd2_p);
111
112protected:
113   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
114
115private:
116   UINT8 m_cass_data[4];
117   UINT8 m_segment;
118   UINT8 m_digit;
119   UINT8 m_keydata;
120   bool m_cass_state;
74121   required_device<cpu_device> m_maincpu;
75122   required_device<pia6821_device> m_pia_s;
76123   required_device<pia6821_device> m_pia_u;
77124   required_device<acia6850_device> m_acia;
78   DECLARE_READ_LINE_MEMBER( mekd2_key40_r );
79   DECLARE_READ8_MEMBER( mekd2_key_r );
80   DECLARE_WRITE_LINE_MEMBER( mekd2_nmi_w );
81   DECLARE_WRITE8_MEMBER( mekd2_digit_w );
82   DECLARE_WRITE8_MEMBER( mekd2_segment_w );
83   UINT8 m_segment;
84   UINT8 m_digit;
85   UINT8 m_keydata;
86   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(mekd2_cart);
87
88protected:
89   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
125   required_device<cassette_image_device> m_cass;
90126};
91127
92128
r23733r23734
113149
114150************************************************************/
115151
116/*
117
118Enter the 4 digit address then the command key:
119
120  - M : Examine and Change Memory (example: E000M, then G to skip to next, H to exit)
121  - E : Escape (abort) operation (H key in our emulation)
122  - R : Examine Registers
123  - G : Begin execution at specified address
124  - P : Punch data from memory to magnetic tape
125  - L : Load memory from magnetic tape
126  - N : Trace one instruction
127  - V : Set (and remove) breakpoints
128
129The keys are laid out as:
130
131  P L N V
132
133  7 8 9 A  M
134  4 5 6 B  E
135  1 2 3 C  R
136  0 F E D  G
137
138 */
139152static INPUT_PORTS_START( mekd2 )
140153   PORT_START("X0")
141154   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0')
r23733r23734
312325   DEVCB_CPU_INPUT_LINE("maincpu", M6800_IRQ_LINE)     /* IRQB output */
313326};
314327
328READ_LINE_MEMBER( mekd2_state::cass_r )
329{
330   return (bool)m_cass_data[2];
331}
332
333WRITE_LINE_MEMBER( mekd2_state::cass_w )
334{
335   m_cass_state = state;
336}
337
315338static ACIA6850_INTERFACE( mekd2_acia_intf )
316339{
317   XTAL_MEKD2 / 256,   //connected to cassette circuit /* tx clock 4800Hz */
318   XTAL_MEKD2 / 256,   //connected to cassette circuit /* rx clock varies, controlled by cassette circuit */
319   DEVCB_NULL,//LINE(cass),//connected to cassette circuit /* in rxd func */
320   DEVCB_NULL,//LINE(cass),//connected to cassette circuit /* out txd func */
321   DEVCB_NULL,                     /* in cts func */
322   DEVCB_NULL,     //connected to cassette circuit /* out rts func */
323   DEVCB_NULL,                     /* in dcd func */
324   DEVCB_NULL                      /* out irq func */
340   XTAL_MEKD2 / 256, /* tx clock 4800Hz */
341   300,     /* rx clock line, toggled by cassette circuit */
342   DEVCB_DRIVER_LINE_MEMBER(mekd2_state, cass_r), /* in rxd func */
343   DEVCB_DRIVER_LINE_MEMBER(mekd2_state, cass_w), /* out txd func */
344   DEVCB_NULL, /* in cts func */
345   DEVCB_NULL, /* out rts func */
346   DEVCB_NULL, /* in dcd func */
347   DEVCB_NULL  /* out irq func NOT USED */
325348};
326349
327350DEVICE_IMAGE_LOAD_MEMBER( mekd2_state,mekd2_cart )
r23733r23734
349372   return IMAGE_INIT_PASS;
350373}
351374
375TIMER_DEVICE_CALLBACK_MEMBER(mekd2_state::mekd2_c)
376{
377   m_cass_data[3]++;
378
379   if (m_cass_state)
380      m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz
381   else
382      m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz
383}
384
385TIMER_DEVICE_CALLBACK_MEMBER(mekd2_state::mekd2_p)
386{
387   /* cassette - turn 1200/2400Hz to a bit */
388   m_cass_data[1]++;
389   UINT8 cass_ws = (m_cass->input() > +0.03) ? 1 : 0;
390
391   if (cass_ws != m_cass_data[0])
392   {
393      m_cass_data[0] = cass_ws;
394      m_cass_data[2] = ((m_cass_data[1] < 12) ? 1 : 0);
395      m_cass_data[1] = 0;
396   }
397}
398
352399/***********************************************************
353400
354401    Machine
r23733r23734
379426   MCFG_PIA6821_ADD("pia_s", mekd2_s_mc6821_intf)
380427   MCFG_PIA6821_ADD("pia_u", mekd2_u_mc6821_intf)
381428   MCFG_ACIA6850_ADD("acia", mekd2_acia_intf)
429   MCFG_TIMER_DRIVER_ADD_PERIODIC("mekd2_c", mekd2_state, mekd2_c, attotime::from_hz(4800))
430   MCFG_TIMER_DRIVER_ADD_PERIODIC("mekd2_p", mekd2_state, mekd2_p, attotime::from_hz(40000))
382431MACHINE_CONFIG_END
383432
384433/***********************************************************
r23733r23734
398447
399448***************************************************************************/
400449
401/*    YEAR  NAME    PARENT  COMPAT  MACHINE   INPUT     INIT    COMPANY     FULLNAME */
402CONS( 1977, mekd2,  0,  0,  mekd2,    mekd2, driver_device, 0,  "Motorola", "MEK6800D2" , GAME_NOT_WORKING )
450/*    YEAR  NAME    PARENT  COMPAT  MACHINE   INPUT  CLASS        INIT    COMPANY     FULLNAME   FLAGS */
451CONS( 1977, mekd2,  0,      0,      mekd2,    mekd2, driver_device, 0,  "Motorola", "MEK6800D2" , 0 )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team