trunk/src/mess/drivers/mekd2.c
r23733 | r23734 | |
4 | 4 | |
5 | 5 | system driver |
6 | 6 | |
7 | | Juergen Buchmueller <pullmoll@t-online.de>, Jan 2000 |
| 7 | Juergen Buchmueller, Jan 2000 |
| 8 | 2013-06-16 Working driver [Robbbert] |
8 | 9 | |
9 | 10 | memory map |
10 | 11 | |
r23733 | r23734 | |
24 | 25 | e000-e3ff ROM JBUG monitor program |
25 | 26 | e400-ffff -/- mirrors of monitor rom |
26 | 27 | |
| 28 | |
| 29 | Enter 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 | |
| 40 | The 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 | |
27 | 50 | Pasting: |
28 | 51 | 0-F : as is |
29 | 52 | NEXT : ^ |
r23733 | r23734 | |
38 | 61 | program that you need to enter in step 1: |
39 | 62 | H0020=8E^00^FF^4F^C6^04^CE^00^10^AB^00^08^5A^26^FA^97^15^3F^H |
40 | 63 | |
| 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 | |
41 | 67 | TODO |
42 | | Cassette (it is extremely complex, with approx 10 chips) |
| 68 | Display should go blank during cassette operations |
43 | 69 | |
44 | 70 | |
45 | 71 | ******************************************************************************/ |
r23733 | r23734 | |
65 | 91 | |
66 | 92 | mekd2_state(const machine_config &mconfig, device_type type, const char *tag) |
67 | 93 | : 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") |
72 | 99 | { } |
73 | 100 | |
| 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 | |
| 112 | protected: |
| 113 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 114 | |
| 115 | private: |
| 116 | UINT8 m_cass_data[4]; |
| 117 | UINT8 m_segment; |
| 118 | UINT8 m_digit; |
| 119 | UINT8 m_keydata; |
| 120 | bool m_cass_state; |
74 | 121 | required_device<cpu_device> m_maincpu; |
75 | 122 | required_device<pia6821_device> m_pia_s; |
76 | 123 | required_device<pia6821_device> m_pia_u; |
77 | 124 | 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 | | |
88 | | protected: |
89 | | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 125 | required_device<cassette_image_device> m_cass; |
90 | 126 | }; |
91 | 127 | |
92 | 128 | |
r23733 | r23734 | |
113 | 149 | |
114 | 150 | ************************************************************/ |
115 | 151 | |
116 | | /* |
117 | | |
118 | | Enter 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 | | |
129 | | The 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 | | */ |
139 | 152 | static INPUT_PORTS_START( mekd2 ) |
140 | 153 | PORT_START("X0") |
141 | 154 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
r23733 | r23734 | |
312 | 325 | DEVCB_CPU_INPUT_LINE("maincpu", M6800_IRQ_LINE) /* IRQB output */ |
313 | 326 | }; |
314 | 327 | |
| 328 | READ_LINE_MEMBER( mekd2_state::cass_r ) |
| 329 | { |
| 330 | return (bool)m_cass_data[2]; |
| 331 | } |
| 332 | |
| 333 | WRITE_LINE_MEMBER( mekd2_state::cass_w ) |
| 334 | { |
| 335 | m_cass_state = state; |
| 336 | } |
| 337 | |
315 | 338 | static ACIA6850_INTERFACE( mekd2_acia_intf ) |
316 | 339 | { |
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 */ |
325 | 348 | }; |
326 | 349 | |
327 | 350 | DEVICE_IMAGE_LOAD_MEMBER( mekd2_state,mekd2_cart ) |
r23733 | r23734 | |
349 | 372 | return IMAGE_INIT_PASS; |
350 | 373 | } |
351 | 374 | |
| 375 | TIMER_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 | |
| 385 | TIMER_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 | |
352 | 399 | /*********************************************************** |
353 | 400 | |
354 | 401 | Machine |
r23733 | r23734 | |
379 | 426 | MCFG_PIA6821_ADD("pia_s", mekd2_s_mc6821_intf) |
380 | 427 | MCFG_PIA6821_ADD("pia_u", mekd2_u_mc6821_intf) |
381 | 428 | 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)) |
382 | 431 | MACHINE_CONFIG_END |
383 | 432 | |
384 | 433 | /*********************************************************** |
r23733 | r23734 | |
398 | 447 | |
399 | 448 | ***************************************************************************/ |
400 | 449 | |
401 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ |
402 | | CONS( 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 */ |
| 451 | CONS( 1977, mekd2, 0, 0, mekd2, mekd2, driver_device, 0, "Motorola", "MEK6800D2" , 0 ) |