Previous 199869 Revisions Next

r35015 Saturday 14th February, 2015 at 04:02:56 UTC by Robbbert
(MESS) mbee : fixed printer (nw)
[src/mess/drivers]mbee.c
[src/mess/includes]mbee.h
[src/mess/machine]mbee.c

trunk/src/mess/drivers/mbee.c
r243526r243527
5151    These early colour computers have a PROM to create the foreground palette.
5252
5353    Notes about the printer:
54    - When computer turned on, defaults to 1200 baud serial printer
55    - Change it to parallel by entering OUTL#1
56    - After you mount/create a printfile, you can LPRINT and LLIST.
54    - Older models default to a 1200 baud serial printer, which we do not support.
55    - You need to change it to parallel by entering OUTL#1 while in Basic.
56    - After you mount/create a printfile, you can LPRINT and LLIST in Basic,
57      or by using the printing option in other apps.
5758
5859    Notes about Telcom:
5960    - On the older models, Telcom is called up by entering NET from within Basic. Models
r243526r243527
9192
9293    TODO/not working:
9394
94    - Printer needs to be understood and fixed.
95
9695    - 256tc: Paste ignores shift key
9796    - All others: Paste drops most characters, shift operates randomly.
9897
9998    - various fdc issues:
100        - B drive doesn't work.
99        - B drive doesn't work with most disks.
101100        - some disks cause MESS to freeze.
102101        - ENMF pin missing from wd_fdc.
103102        - incorrect timing for track register causes 256tc failure to boot a disk.
r243526r243527
287286   AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x10) AM_READWRITE(m6545_status_r, m6545_index_w)
288287   AM_RANGE(0x0d, 0x0d) AM_MIRROR(0x10) AM_READWRITE(m6545_data_r, m6545_data_w)
289288   AM_RANGE(0x44, 0x47) AM_DEVREADWRITE("fdc", wd2793_t, read, write)
290   AM_RANGE(0x48, 0x4f) AM_READWRITE(mbee_fdc_status_r, mbee_fdc_motor_w)
289   AM_RANGE(0x48, 0x4f) AM_READWRITE(fdc_status_r, fdc_motor_w)
291290ADDRESS_MAP_END
292291
293292static ADDRESS_MAP_START(mbee128_io, AS_IO, 8, mbee_state)
r243526r243527
303302   AM_RANGE(0x0d, 0x0d) AM_READWRITE(m6545_data_r, m6545_data_w)
304303   AM_RANGE(0x1c, 0x1f) AM_READWRITE(mbeeppc_1c_r, mbee256_1c_w)
305304   AM_RANGE(0x44, 0x47) AM_DEVREADWRITE("fdc", wd2793_t, read, write)
306   AM_RANGE(0x48, 0x4f) AM_READWRITE(mbee_fdc_status_r, mbee_fdc_motor_w)
305   AM_RANGE(0x48, 0x4f) AM_READWRITE(fdc_status_r, fdc_motor_w)
307306   AM_RANGE(0x50, 0x57) AM_WRITE(mbee128_50_w)
308307ADDRESS_MAP_END
309308
r243526r243527
323322   AM_RANGE(0x0018, 0x001b) AM_MIRROR(0xff00) AM_READ(mbee256_18_r)
324323   AM_RANGE(0x001c, 0x001f) AM_MIRROR(0xff00) AM_READWRITE(mbeeppc_1c_r, mbee256_1c_w)
325324   AM_RANGE(0x0044, 0x0047) AM_MIRROR(0xff00) AM_DEVREADWRITE("fdc", wd2793_t, read, write)
326   AM_RANGE(0x0048, 0x004f) AM_MIRROR(0xff00) AM_READWRITE(mbee_fdc_status_r, mbee_fdc_motor_w)
325   AM_RANGE(0x0048, 0x004f) AM_MIRROR(0xff00) AM_READWRITE(fdc_status_r, fdc_motor_w)
327326   AM_RANGE(0x0050, 0x0057) AM_MIRROR(0xff00) AM_WRITE(mbee256_50_w)
328327   // AM_RANGE(0x0058, 0x005f) AM_MIRROR(0xff00) External options: floppy drive, hard drive and keyboard
329328   // AM_RANGE(0x0060, 0x0067) AM_MIRROR(0xff00) Reserved for file server selection (unused)
r243526r243527
635634
636635   MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_12MHz / 6)
637636   MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
638   MCFG_Z80PIO_OUT_PA_CB(WRITE8(mbee_state, pio_port_a_w))
637   MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write))
639638   MCFG_Z80PIO_OUT_ARDY_CB(WRITELINE(mbee_state, pio_ardy))
640639   MCFG_Z80PIO_IN_PB_CB(READ8(mbee_state, pio_port_b_r))
641640   MCFG_Z80PIO_OUT_PB_CB(WRITE8(mbee_state, pio_port_b_w))
r243526r243527
671670   MCFG_QUICKLOAD_ADD("quickload2", mbee_state, mbee_z80bin, "bin", 2)
672671
673672   MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer")
673   MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("z80pio", z80pio_device, strobe_a))
674674
675675   MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
676676
r243526r243527
691691
692692   MCFG_DEVICE_ADD("z80pio", Z80PIO, 3375000)
693693   MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
694   MCFG_Z80PIO_OUT_PA_CB(WRITE8(mbee_state, pio_port_a_w))
694   MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write))
695695   MCFG_Z80PIO_OUT_ARDY_CB(WRITELINE(mbee_state, pio_ardy))
696696   MCFG_Z80PIO_IN_PB_CB(READ8(mbee_state, pio_port_b_r))
697697   MCFG_Z80PIO_OUT_PB_CB(WRITE8(mbee_state, pio_port_b_w))
r243526r243527
729729   MCFG_QUICKLOAD_ADD("quickload2", mbee_state, mbee_z80bin, "bin", 2)
730730
731731   MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer")
732   MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("z80pio", z80pio_device, strobe_a))
732733
733734   MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
734735
trunk/src/mess/includes/mbee.h
r243526r243527
1818#include "sound/speaker.h"
1919#include "cpu/z80/z80.h"
2020#include "cpu/z80/z80daisy.h"
21#include "machine/mc146818.h"
2221#include "sound/wave.h"
2322#include "machine/wd_fdc.h"
2423
r243526r243527
2827public:
2928   enum
3029   {
31      TIMER_MBEE256_KBD,
30      TIMER_MBEE_NEWKB,
3231      TIMER_MBEE_RTC_IRQ,
33      TIMER_MBEE_RESET
32      TIMER_MBEE_BOOT
3433   };
3534
3635   mbee_state(const machine_config &mconfig, device_type type, const char *tag)
r243526r243527
6968   DECLARE_READ8_MEMBER(mbee256_speed_low_r);
7069   DECLARE_READ8_MEMBER(mbee256_speed_high_r);
7170   DECLARE_READ8_MEMBER(mbee256_18_r);
72   DECLARE_WRITE8_MEMBER(mbee64_50_w);
7371   DECLARE_WRITE8_MEMBER(mbee128_50_w);
7472   DECLARE_WRITE8_MEMBER(mbee256_50_w);
7573   DECLARE_READ8_MEMBER(m6545_status_r);
r243526r243527
9391   DECLARE_READ8_MEMBER(mbeeppc_high_r);
9492   DECLARE_WRITE8_MEMBER(mbeeppc_high_w);
9593   DECLARE_WRITE8_MEMBER(mbeeppc_low_w);
96   DECLARE_WRITE8_MEMBER(pio_port_a_w);
9794   DECLARE_WRITE8_MEMBER(pio_port_b_w);
9895   DECLARE_READ8_MEMBER(pio_port_b_r);
9996   DECLARE_WRITE_LINE_MEMBER(pio_ardy);
10097   DECLARE_WRITE_LINE_MEMBER(crtc_vs);
101   DECLARE_READ8_MEMBER(mbee_fdc_status_r);
102   DECLARE_WRITE8_MEMBER(mbee_fdc_motor_w);
98   DECLARE_READ8_MEMBER(fdc_status_r);
99   DECLARE_WRITE8_MEMBER(fdc_motor_w);
103100   DECLARE_DRIVER_INIT(mbeepc85);
104101   DECLARE_DRIVER_INIT(mbee256);
105102   DECLARE_DRIVER_INIT(mbee56);
r243526r243527
121118   DECLARE_MACHINE_RESET(mbee256);
122119   DECLARE_MACHINE_RESET(mbeett);
123120   UINT32 screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
124   INTERRUPT_GEN_MEMBER(mbee_interrupt);
125   TIMER_CALLBACK_MEMBER(mbee256_kbd);
126   TIMER_CALLBACK_MEMBER(mbee_rtc_irq);
127   TIMER_CALLBACK_MEMBER(mbee_reset);
121   TIMER_CALLBACK_MEMBER(timer_newkb);
122   TIMER_CALLBACK_MEMBER(timer_rtc_irq);
123   TIMER_CALLBACK_MEMBER(timer_boot);
128124   DECLARE_QUICKLOAD_LOAD_MEMBER(mbee);
129125   DECLARE_QUICKLOAD_LOAD_MEMBER(mbee_z80bin);
130126   WRITE_LINE_MEMBER(fdc_intrq_w);
r243526r243527
151147   bool m_b7_rtc;
152148   bool m_b7_vs;
153149   bool m_b2;
150   bool m_is_mbeett;
154151   UINT8 m_mbee256_was_pressed[15];
155152   UINT8 m_mbee256_q[20];
156153   UINT8 m_mbee256_q_pos;
trunk/src/mess/machine/mbee.c
r243526r243527
55    machine driver
66    Juergen Buchmueller <pullmoll@t-online.de>, Jan 2000
77
8    Rewritten by Robbbert
89
910****************************************************************************/
1011
r243526r243527
1617{
1718   switch (id)
1819   {
19   case TIMER_MBEE256_KBD:
20      mbee256_kbd(ptr, param);
20   case TIMER_MBEE_NEWKB:
21      timer_newkb(ptr, param);
2122      break;
2223   case TIMER_MBEE_RTC_IRQ:
23      mbee_rtc_irq(ptr, param);
24      timer_rtc_irq(ptr, param);
2425      break;
25   case TIMER_MBEE_RESET:
26      mbee_reset(ptr, param);
26   case TIMER_MBEE_BOOT:
27      timer_boot(ptr, param);
2728      break;
2829   default:
2930      assert_always(FALSE, "Unknown id in mbee_state::device_timer");
r243526r243527
4243   m_centronics->write_strobe((state) ? 0 : 1);
4344}
4445
45WRITE8_MEMBER( mbee_state::pio_port_a_w )
46{
47   /* hardware strobe driven by PIO ARDY, bit 7..0 = data */
48   m_pio->strobe_a(1); /* needed - otherwise nothing prints */
49   m_cent_data_out->write(space, 0, data);
50};
51
5246WRITE8_MEMBER( mbee_state::pio_port_b_w )
5347{
5448/*  PIO port B - d5..d2 not emulated
r243526r243527
7266
7367   if (m_cassette->input() > 0.03) data |= 1;
7468
75   switch (m_io_config->read() & 0xc0)
69   data |= 8; // CTS held high via resistor. If low, the disk-based models think a mouse is plugged in.
70
71   if (m_is_mbeett)
7672   {
77      case 0x00:
78         data |= (UINT8)m_b7_vs << 7;
79         break;
80      case 0x40:
81         data |= (UINT8)m_b7_rtc << 7;
82         break;
83      case 0x80:
73      if (m_b2)
74         data |= 0x82;
75      else
8476         data |= 0x80;
85         break;
86      case 0xc0:
87         data |= 0x80; // centronics busy line - FIXME
88         break;
8977   }
78   else
79   {
80      switch (m_io_config->read() & 0xc0)
81      {
82         case 0x00:
83            data |= (UINT8)m_b7_vs << 7;
84            break;
85         case 0x40:
86            data |= (UINT8)m_b7_rtc << 7;
87            break;
88         case 0x80:
89            data |= 0x80;
90            break;
91         case 0xc0:
92            data |= 0x80; // centronics busy line - FIXME
93            break;
94      }
95      data |= (UINT8)m_b2 << 1; // key pressed on new keyboard
96   }
9097
91   data |= (UINT8)m_b2 << 1; // key pressed on new keyboard
92   data |= 8; // CTS held high via resistor. If low, the disk-based models think a mouse is plugged in.
93
9498   return data;
95};
99}
96100
97101/*************************************************************************************
98102
r243526r243527
113117   m_fdc_rq = (m_fdc_rq & 1) | (state << 1);
114118}
115119
116READ8_MEMBER( mbee_state::mbee_fdc_status_r )
120READ8_MEMBER( mbee_state::fdc_status_r )
117121{
118122/*  d7 indicate if IRQ or DRQ is occurring (1=happening)
119123    d6..d0 not used */
r243526r243527
121125   return m_fdc_rq ? 0xff : 0x7f;
122126}
123127
124WRITE8_MEMBER( mbee_state::mbee_fdc_motor_w )
128WRITE8_MEMBER( mbee_state::fdc_motor_w )
125129{
126130/*  d7..d4 not used
127131    d3 density (1=MFM)
r243526r243527
152156************************************************************/
153157
154158
155TIMER_CALLBACK_MEMBER(mbee_state::mbee256_kbd)
159TIMER_CALLBACK_MEMBER( mbee_state::timer_newkb )
156160{
157161   /* Keyboard scanner is a Mostek M3870 chip. Its speed of operation is determined by a 15k resistor on
158162   pin 2 (XTL2) and is therefore 2MHz. If a key change is detected (up or down), the /strobe
r243526r243527
179183            if (BIT(pressed^m_mbee256_was_pressed[i], j))
180184            {
181185               // put it in the queue
182               m_mbee256_q[m_mbee256_q_pos] = (i << 3) | j | (BIT(pressed, j) ? 0x80 : 0);
186               UINT8 code = (i << 3) | j | (BIT(pressed, j) ? 0x80 : 0);
187               m_mbee256_q[m_mbee256_q_pos] = code;
183188               if (m_mbee256_q_pos < 19) m_mbee256_q_pos++;
184189            }
185190         }
r243526r243527
194199      //breaks keyboard m_pio->port_b_write(pio_port_b_r(generic_space(),0,0xff));
195200   }
196201
197   timer_set(attotime::from_hz(25), TIMER_MBEE256_KBD);
202   timer_set(attotime::from_hz(25), TIMER_MBEE_NEWKB);
198203}
199204
200205READ8_MEMBER( mbee_state::mbee256_18_r )
r243526r243527
254259}
255260
256261// This doesn't seem to do anything; the time works without it.
257TIMER_CALLBACK_MEMBER( mbee_state::mbee_rtc_irq )
262TIMER_CALLBACK_MEMBER( mbee_state::timer_rtc_irq )
258263{
259264   if (!m_rtc)
260265      return;
r243526r243527
467472
468473
469474/* after the first 4 bytes have been read from ROM, switch the ram back in */
470TIMER_CALLBACK_MEMBER( mbee_state::mbee_reset )
475TIMER_CALLBACK_MEMBER( mbee_state::timer_boot )
471476{
472477   m_boot->set_entry(0);
473478}
r243526r243527
480485MACHINE_RESET_MEMBER( mbee_state, mbee )
481486{
482487   m_boot->set_entry(1);
483   timer_set(attotime::from_usec(4), TIMER_MBEE_RESET);
488   timer_set(attotime::from_usec(4), TIMER_MBEE_BOOT);
484489}
485490
486491MACHINE_RESET_MEMBER( mbee_state, mbee56 )
487492{
488493   machine_reset_common_disk();
489494   m_boot->set_entry(1);
490   timer_set(attotime::from_usec(4), TIMER_MBEE_RESET);
495   timer_set(attotime::from_usec(4), TIMER_MBEE_BOOT);
491496}
492497
493498MACHINE_RESET_MEMBER( mbee_state, mbee128 )
r243526r243527
513518   for (i = 0; i < 15; i++) m_mbee256_was_pressed[i] = 0;
514519   m_mbee256_q_pos = 0;
515520   m_boot->set_entry(1);
516   timer_set(attotime::from_usec(4), TIMER_MBEE_RESET);
521   timer_set(attotime::from_usec(4), TIMER_MBEE_BOOT);
517522}
518523
519INTERRUPT_GEN_MEMBER( mbee_state::mbee_interrupt )
520{
521// Due to the uncertainly and hackage here, this is commented out for now - Robbbert - 05-Oct-2010
522#if 0
523
524   //address_space &space = m_maincpu->space(AS_PROGRAM);
525   /* The printer status connects to the pio ASTB pin, and the printer changing to not
526       busy should signal an interrupt routine at B61C, (next line) but this doesn't work.
527       The line below does what the interrupt should be doing. */
528   /* But it would break any program loaded to that area of memory, such as CP/M programs */
529
530   //m_z80pio->strobe_a(centronics_busy_r(m_centronics)); /* signal int when not busy (L->H) */
531   //space.write_byte(0x109, centronics_busy_r(m_centronics));
532
533
534   /* once per frame, pulse the PIO B bit 7 - it is in the schematic as an option,
535   but need to find out what it does */
536   m_b7_busy = 0x80;
537   irq0_line_hold(device);
538
539#endif
540}
541
542524DRIVER_INIT_MEMBER( mbee_state, mbee )
543525{
544526   UINT8 *RAM = memregion("maincpu")->base();
545527   m_boot->configure_entries(0, 2, &RAM[0x0000], 0x8000);
546528   m_size = 0x4000;
547529   m_has_oldkb = 1;
530   m_is_mbeett = 0;
548531}
549532
550533DRIVER_INIT_MEMBER( mbee_state, mbeeic )
r243526r243527
558541   m_pak->set_entry(0);
559542   m_size = 0x8000;
560543   m_has_oldkb = 1;
544   m_is_mbeett = 0;
561545}
562546
563547DRIVER_INIT_MEMBER( mbee_state, mbeepc )
r243526r243527
575559   m_telcom->set_entry(0);
576560   m_size = 0x8000;
577561   m_has_oldkb = 1;
562   m_is_mbeett = 0;
578563}
579564
580565DRIVER_INIT_MEMBER( mbee_state, mbeepc85 )
r243526r243527
592577   m_telcom->set_entry(0);
593578   m_size = 0x8000;
594579   m_has_oldkb = 1;
580   m_is_mbeett = 0;
595581}
596582
597583DRIVER_INIT_MEMBER( mbee_state, mbeeppc )
r243526r243527
614600   m_basic->set_entry(0);
615601   m_size = 0x8000;
616602   m_has_oldkb = 1;
603   m_is_mbeett = 0;
617604}
618605
619606DRIVER_INIT_MEMBER( mbee_state, mbee56 )
r243526r243527
622609   m_boot->configure_entries(0, 2, &RAM[0x0000], 0xe000);
623610   m_size = 0xe000;
624611   m_has_oldkb = 1;
612   m_is_mbeett = 0;
625613}
626614
627615DRIVER_INIT_MEMBER( mbee_state, mbee128 )
r243526r243527
645633
646634   m_size = 0x8000;
647635   m_has_oldkb = 1;
636   m_is_mbeett = 0;
648637}
649638
650639DRIVER_INIT_MEMBER( mbee_state, mbee256 )
r243526r243527
665654   }
666655
667656   timer_set(attotime::from_hz(1), TIMER_MBEE_RTC_IRQ);   /* timer for rtc */
668   timer_set(attotime::from_hz(50), TIMER_MBEE256_KBD);   /* timer for kbd */
657   timer_set(attotime::from_hz(25), TIMER_MBEE_NEWKB);   /* timer for kbd */
669658
670659   m_size = 0x8000;
671660   m_has_oldkb = 0;
661   m_is_mbeett = 0;
672662}
673663
674664DRIVER_INIT_MEMBER( mbee_state, mbeett )
r243526r243527
686676   m_telcom->set_entry(0);
687677
688678   timer_set(attotime::from_hz(1), TIMER_MBEE_RTC_IRQ);   /* timer for rtc */
689   timer_set(attotime::from_hz(25), TIMER_MBEE256_KBD);   /* timer for kbd */
679   timer_set(attotime::from_hz(25), TIMER_MBEE_NEWKB);   /* timer for kbd */
690680
691681   m_size = 0x8000;
692682   m_has_oldkb = 0;
683   m_is_mbeett = 1;
693684}
694685
695686


Previous 199869 Revisions Next


© 1997-2024 The MAME Team