Previous 15994 Revisions Next

r1262 Monday 12th November, 2007 at 14:05:50 UTC by Curt Coder
[QL] Added devices.
[src/mess/drivers]ql.c

src/mess/drivers/ql.c
r1261r1262
11#include "driver.h"
22#include "cpu/i8039/i8039.h"
33#include "cpu/m68000/m68000.h"
4#include "devices/cartslot.h"
5#include "includes/serial.h"
46#include "video/generic.h"
57#include "video/zx8301.h"
68#include "inputx.h"
r1261r1262
3537   zx8302_baudx4 = zx8302_baudx4 ? 0 : 1;
3638}
3739
38static WRITE8_HANDLER( zx8302_w )
40static WRITE8_HANDLER( zx8302_control_w )
3941{
4042   int baudx4 = 0;
4143
r1261r1262
6668   mame_timer_adjust(zx8302_baud_timer, time_zero, 0, MAME_TIME_IN_HZ(baudx4));
6769}
6870
69static WRITE8_HANDLER( i8049_w )
71static WRITE8_HANDLER( zx8302_ipc_w )
7072{
7173   /*
7274   process 8049 commands (p92)
r1261r1262
138140   return 0x0;
139141}
140142
141static WRITE8_HANDLER( clock_w )
143static WRITE8_HANDLER( zx8302_clock_w )
142144{
143145}
144146
r1261r1262
262264
263265static ADDRESS_MAP_START( ql_map, ADDRESS_SPACE_PROGRAM, 8 )
264266   AM_RANGE(0x000000, 0x00bfff) AM_ROM   // System ROM
265   AM_RANGE(0x00c000, 0x00ffff) AM_ROM   // Cartridge ROM
266   AM_RANGE(0x018000, 0x018001) AM_WRITE(clock_w)
267   AM_RANGE(0x018002, 0x018002) AM_WRITE(zx8302_w)
268   AM_RANGE(0x018003, 0x018003) AM_WRITE(i8049_w)
267   AM_RANGE(0x00c000, 0x00ffff) AM_ROMBANK(1) // Cartridge ROM
268   AM_RANGE(0x018000, 0x018001) AM_WRITE(zx8302_clock_w)
269   AM_RANGE(0x018002, 0x018002) AM_WRITE(zx8302_control_w)
270   AM_RANGE(0x018003, 0x018003) AM_WRITE(zx8302_ipc_w)
269271   AM_RANGE(0x018020, 0x018020) AM_READWRITE(mdv_status_r, mdv_ctrl_w)
270   AM_RANGE(0x018021, 0x018021) AM_WRITENOP // ???
271272   AM_RANGE(0x018022, 0x018022) AM_WRITE(mdv_data_w)
272   AM_RANGE(0x018023, 0x018023) AM_WRITENOP // ???
273273   AM_RANGE(0x018063, 0x018063) AM_WRITE(zx8301_control_w)
274274   AM_RANGE(0x020000, 0x02ffff) AM_RAM AM_BASE(&videoram)
275275   AM_RANGE(0x030000, 0x03ffff) AM_RAM // onboard RAM
276276   AM_RANGE(0x040000, 0x0bffff) AM_RAM // 512KB add-on RAM
277277   AM_RANGE(0x0c0000, 0x0dffff) AM_NOP // 8x16KB device slots
278   AM_RANGE(0x0e0000, 0x0fffff) AM_ROM   // add-on ROM
278   AM_RANGE(0x0e0000, 0x0fffff) AM_ROMBANK(2) // add-on ROM
279279ADDRESS_MAP_END
280280
281281static ADDRESS_MAP_START( ipc_map, ADDRESS_SPACE_PROGRAM, 8 )
r1261r1262
398398static MACHINE_START( ql )
399399{
400400   zx8302_baud_timer = mame_timer_alloc(zx8302_baud_tick);
401
402   memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, 0x00c000, 0x00ffff, 0, 0, MRA8_UNMAP, MWA8_UNMAP);
403
404   memory_configure_bank(1, 0, 1, memory_region(REGION_CPU1) + 0x00c000, 0);
405   memory_set_bank(1, 0);
401406}
402407
403408static MACHINE_DRIVER_START( ql )
r1261r1262
539544
540545/* System Configuration */
541546
547static DEVICE_LOAD( ql_microdrive )
548{
549   int   filesize = image_length(image);
550
551   if (filesize == 174930)
552   {
553      return INIT_PASS;
554   }
555
556   return INIT_FAIL;
557}
558
559static void ql_microdrive_getinfo(const device_class *devclass, UINT32 state, union devinfo *info)
560{
561   switch(state)
562   {
563      /* --- the following bits of info are returned as 64-bit signed integers --- */
564      case DEVINFO_INT_TYPE:                     info->i = IO_CASSETTE; break;
565      case DEVINFO_INT_COUNT:                     info->i = 2; break;
566
567      /* --- the following bits of info are returned as pointers to data or functions --- */
568      case DEVINFO_PTR_LOAD:                     info->load = device_load_ql_microdrive; break;
569
570      /* --- the following bits of info are returned as NULL-terminated strings --- */
571      case DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), "mdv"); break;
572   }
573}
574
575static DEVICE_LOAD( ql_serial )
576{
577   /* filename specified */
578   if (serial_device_load(image)==INIT_PASS)
579   {
580      /* setup transmit parameters */
581      serial_device_setup(image, 9600, 8, 1, SERIAL_PARITY_NONE);
582
583      serial_device_set_protocol(image, SERIAL_PROTOCOL_NONE);
584
585      /* and start transmit */
586      serial_device_set_transmit_state(image, 1);
587
588      return INIT_PASS;
589   }
590
591   return INIT_FAIL;
592}
593
594static void ql_serial_getinfo(const device_class *devclass, UINT32 state, union devinfo *info)
595{
596   /* serial */
597   switch(state)
598   {
599      /* --- the following bits of info are returned as 64-bit signed integers --- */
600      case DEVINFO_INT_TYPE:                     info->i = IO_SERIAL; break;
601      case DEVINFO_INT_COUNT:                     info->i = 2; break;
602
603      /* --- the following bits of info are returned as pointers to data or functions --- */
604      case DEVINFO_PTR_INIT:                     info->init = serial_device_init; break;
605      case DEVINFO_PTR_LOAD:                     info->load = device_load_ql_serial; break;
606      case DEVINFO_PTR_UNLOAD:                  info->unload = serial_device_unload; break;
607
608      /* --- the following bits of info are returned as NULL-terminated strings --- */
609      case DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), "txt"); break;
610   }
611}
612
613static DEVICE_LOAD( ql_cart )
614{
615   UINT8 *ptr = ((UINT8 *)memory_region(REGION_CPU1)) + 0x00c000;
616   int   filesize = image_length(image);
617
618   if (filesize <= 16 * 1024)
619   {
620      if (image_fread(image, ptr, filesize) == filesize)
621      {
622         memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, 0x00c000, 0x00ffff, 0, 0, MRA8_BANK1, MWA8_BANK1);
623
624         return INIT_PASS;
625      }
626   }
627
628   return INIT_FAIL;
629}
630
631static void ql_cartslot_getinfo( const device_class *devclass, UINT32 state, union devinfo *info )
632{
633   switch( state )
634   {
635   case DEVINFO_INT_COUNT:
636      info->i = 1;
637      break;
638   case DEVINFO_PTR_LOAD:
639      info->load = device_load_ql_cart;
640      break;
641   case DEVINFO_STR_FILE_EXTENSIONS:
642      strcpy(info->s = device_temp_str(), "qlc");
643      break;
644   default:
645      cartslot_device_getinfo( devclass, state, info );
646      break;
647   }
648}
649
542650SYSTEM_CONFIG_START( ql )
543651   CONFIG_RAM_DEFAULT   (128 * 1024)
544652   CONFIG_RAM         (640 * 1024)
653   CONFIG_DEVICE(ql_microdrive_getinfo)
654   CONFIG_DEVICE(ql_serial_getinfo)
655   CONFIG_DEVICE(ql_cartslot_getinfo)
545656SYSTEM_CONFIG_END
546657
547658/* Computer Drivers */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team