Previous 15994 Revisions Next

r5841 Tuesday 22nd September, 2009 at 09:50:58 UTC by Miodrag Milanović
[TUTOR] Centronics interface added
[src/mess/drivers]tutor.c

src/mess/drivers/tutor.c
r5840r5841
165165#include "devices/cartslot.h"
166166#include "devices/cassette.h"
167167#include "sound/sn76496.h"
168#include "machine/ctronics.h"
168169
169
170170/* mapper state */
171171static char cartridge_enable;
172172
r5840r5841
225225   TMS9928A_interrupt(device->machine);
226226}
227227
228static const device_config *printer_fp(running_machine *machine)
229{
230   return image_from_devtype_and_index(machine, IO_PARALLEL, 0);
231}
232
233
234228/*
235229    Keyboard:
236230
r5840r5841
410404}
411405
412406/* memory handlers */
413static  READ8_HANDLER(tutor_printer_r)
407static  READ8_DEVICE_HANDLER(tutor_printer_r)
414408{
415409   int reply;
416410
417411   switch (offset)
418412   {
419413   case 0x20:
420      /* busy */
421      reply = printer_fp(space->machine) ? 0xff : 0x00;
414      /* busy */     
415      reply = centronics_busy_r(device) ? 0x00 : 0xff;
422416      break;
423417
424418   default:
r5840r5841
431425   return reply;
432426}
433427
434static WRITE8_HANDLER(tutor_printer_w)
435{
428static WRITE8_DEVICE_HANDLER(tutor_printer_w)
429{   
436430   switch (offset)
437431   {
438432   case 0x10:
439433      /* data */
440      printer_data = data;
434      centronics_data_w(device, 0, data);
441435      break;
442436
443437   case 0x40:
444438      /* strobe */
445      if (data && ! printer_strobe)
446      {
447         /* strobe is asserted: output data */
448         if (printer_fp(space->machine))
449            image_fwrite(printer_fp(space->machine), & printer_data, 1);
450      }
451      printer_strobe = data != 0;
439      centronics_strobe_w(device, BIT(data, 7));
452440      break;
453441
454442   default:
r5840r5841
511499   AM_RANGE(0xe002, 0xe002) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w)/*VDP status*/
512500   AM_RANGE(0xe100, 0xe1ff) AM_READWRITE(tutor_mapper_r, tutor_mapper_w)   /*cartridge mapper*/
513501   AM_RANGE(0xe200, 0xe200) AM_DEVWRITE("sn76489a", sn76496_w)   /*sound chip*/
514   AM_RANGE(0xe800, 0xe8ff) AM_READWRITE(tutor_printer_r, tutor_printer_w)   /*printer*/
502   AM_RANGE(0xe800, 0xe8ff) AM_DEVREADWRITE("printer",tutor_printer_r, tutor_printer_w)   /*printer*/
515503   AM_RANGE(0xee00, 0xeeff) AM_READWRITE(SMH_NOP, tutor_cassette_w)      /*cassette interface*/
516504
517505   AM_RANGE(0xf000, 0xffff) AM_NOP   /*free for expansion (and internal processor RAM)*/
r5840r5841
689677   MDRV_CARTSLOT_NOT_MANDATORY
690678   MDRV_CARTSLOT_LOAD(tutor_cart)
691679   MDRV_CARTSLOT_UNLOAD(tutor_cart)
680     
681   MDRV_CENTRONICS_ADD("printer", standard_centronics)
692682MACHINE_DRIVER_END
693683
694684
r5840r5841
702692   ROM_LOAD("tutor2.bin", 0x8000, 0x4000, CRC(05f228f5) SHA1(46a14a45f6f9e2c30663a2b87ce60c42768a78d0))      /* BASIC ROM */
703693ROM_END
704694
705static void tutor_parallel_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
706{
707   /* parallel */
708   switch(state)
709   {
710      /* --- the following bits of info are returned as 64-bit signed integers --- */
711      case MESS_DEVINFO_INT_TYPE:                     info->i = IO_PARALLEL; break;
712      case MESS_DEVINFO_INT_READABLE:                  info->i = 0; break;
713      case MESS_DEVINFO_INT_WRITEABLE:                  info->i = 1; break;
714      case MESS_DEVINFO_INT_CREATABLE:                  info->i = 1; break;
715      case MESS_DEVINFO_INT_COUNT:                     info->i = 1; break;
716
717      /* --- the following bits of info are returned as NULL-terminated strings --- */
718      case MESS_DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), ""); break;
719   }
720}
721
722static SYSTEM_CONFIG_START(tutor)
723   /* cartridge port is not emulated */
724   CONFIG_DEVICE(tutor_parallel_getinfo)
725SYSTEM_CONFIG_END
726
727695/*      YEAR    NAME    PARENT      COMPAT  MACHINE     INPUT   INIT    CONFIG      COMPANY     FULLNAME */
728COMP(   1983?,   tutor,   0,         0,      tutor,      tutor,   tutor,   tutor,      "Tomy",      "Tomy Tutor" , 0)
696COMP(   1983?,   tutor,   0,         0,      tutor,      tutor,   tutor,   0,      "Tomy",      "Tomy Tutor" , 0)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team