Previous 15994 Revisions Next

r6748 Friday 25th December, 2009 at 10:02:46 UTC by Miodrag Milanović
[VTECH1] Removed usage of sysconfig for floppy
[src/mess/drivers]vtech1.c

src/mess/drivers/vtech1.c
r6747r6748
119119#include "sound/wave.h"
120120#include "sound/speaker.h"
121121#include "devices/cartslot.h"
122#include "devices/flopdrv.h"
122123#include "devices/snapquik.h"
123124#include "devices/cassette.h"
124125#include "devices/z80bin.h"
r6747r6748
291292/***************************************************************************
292293    FLOPPY DRIVE
293294***************************************************************************/
294
295static const device_config *vtech1_file(running_machine *machine)
295static void vtech1_load_proc(const device_config *image)
296296{
297   vtech1_state *vtech1 = machine->driver_data;
298
299   if (vtech1->drive < 0)
300      return NULL;
301
302   return image_from_devtype_and_index(machine, IO_FLOPPY, vtech1->drive);
303}
304
305static DEVICE_IMAGE_LOAD( vtech1_floppy )
306{
307297   vtech1_state *vtech1 = image->machine->driver_data;
308   int id = image_index_in_device(image);
309
298   int id = floppy_get_drive(image);
299   
310300   if (image_is_writable(image))
311301      vtech1->fdc_wrprot[id] = 0x00;
312302   else
313303      vtech1->fdc_wrprot[id] = 0x80;
314
315   return INIT_PASS;
316304}
317305
318306static void vtech1_get_track(running_machine *machine)
r6747r6748
320308   vtech1_state *vtech1 = machine->driver_data;
321309
322310   /* drive selected or and image file ok? */
323   if (vtech1->drive >= 0 && image_exists(vtech1_file(machine)))
311   if (vtech1->drive >= 0 && image_exists(floppy_get_device(machine,vtech1->drive)))
324312   {
325313      int size, offs;
326314      size = TRKSIZE_VZ;
327315      offs = TRKSIZE_VZ * vtech1->fdc_track_x2[vtech1->drive]/2;
328      image_fseek(vtech1_file(machine), offs, SEEK_SET);
329      size = image_fread(vtech1_file(machine), vtech1->fdc_data, size);
316      image_fseek(floppy_get_device(machine,vtech1->drive), offs, SEEK_SET);
317      size = image_fread(floppy_get_device(machine,vtech1->drive), vtech1->fdc_data, size);
330318      if (LOG_VTECH1_FDC)
331319         logerror("get track @$%05x $%04x bytes\n", offs, size);
332320    }
r6747r6748
339327   vtech1_state *vtech1 = machine->driver_data;
340328
341329    /* drive selected and image file ok? */
342   if (vtech1->drive >= 0 && vtech1_file(machine) != NULL)
330   if (vtech1->drive >= 0 && floppy_get_device(machine,vtech1->drive) != NULL)
343331   {
344332      int size, offs;
345333      offs = TRKSIZE_VZ * vtech1->fdc_track_x2[vtech1->drive]/2;
346      image_fseek(vtech1_file(machine), offs + vtech1->fdc_start, SEEK_SET);
347      size = image_fwrite(vtech1_file(machine), &vtech1->fdc_data[vtech1->fdc_start], vtech1->fdc_write);
334      image_fseek(floppy_get_device(machine,vtech1->drive), offs + vtech1->fdc_start, SEEK_SET);
335      size = image_fwrite(floppy_get_device(machine,vtech1->drive), &vtech1->fdc_data[vtech1->fdc_start], vtech1->fdc_write);
348336      if (LOG_VTECH1_FDC)
349337         logerror("put track @$%05X+$%X $%04X/$%04X bytes\n", offs, vtech1->fdc_start, size, vtech1->fdc_write);
350338    }
r6747r6748
494482    }
495483}
496484
485static FLOPPY_IDENTIFY( vtech1_dsk_identify )
486{
487   *vote = 100;
488   return FLOPPY_ERROR_SUCCESS;
489}
497490
491
492static FLOPPY_CONSTRUCT( vtech1_dsk_construct )
493{
494   return FLOPPY_ERROR_SUCCESS;
495}
496
497FLOPPY_OPTIONS_START( vtech1_only )
498   FLOPPY_OPTION(
499      vtech1_dsk,
500      "dsk",
501      "Laser floppy disk image",
502      vtech1_dsk_identify,
503      vtech1_dsk_construct,
504      NULL
505   )
506      { NULL }
507};
508
509static const floppy_config vtech1_floppy_config =
510{
511   DEVCB_NULL,
512   DEVCB_NULL,
513   DEVCB_NULL,
514   DEVCB_NULL,
515   DEVCB_NULL,
516   FLOPPY_DRIVE_DS_80,
517   FLOPPY_OPTIONS_NAME(vtech1_only),
518   DO_NOT_KEEP_GEOMETRY
519};
520
498521/***************************************************************************
499522    PRINTER
500523***************************************************************************/
r6747r6748
658681{
659682   vtech1_state *vtech1 = machine->driver_data;
660683   const address_space *prg = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
684   int id;
661685
662686   /* find devices */
663687   vtech1->mc6847 = devtag_get_device(machine, "mc6847");
r6747r6748
706730   vtech1->fdc_write = 0;
707731   vtech1->fdc_offs = 0;
708732   vtech1->fdc_latch = 0;
733   
734   for(id=0;id<2;id++)
735   {
736      floppy_install_load_proc(floppy_get_device(machine, id), vtech1_load_proc);
737   }   
709738}
710739
711740static DRIVER_INIT( vtech1h )
712741{
713   const address_space *prg = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
742   const address_space *prg = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);   
714743
715744   DRIVER_INIT_CALL(vtech1);
716745
r6747r6748
720749
721750   memory_install_readwrite_bank(prg, 0x7000, 0x77ff, 0, 0, "bank4");
722751   memory_configure_bank(machine, "bank4", 0, 4, machine->generic.videoram.u8, 0x800);
723   memory_set_bank(machine, "bank4", 0);
752   memory_set_bank(machine, "bank4", 0);   
724753}
725754
726
727755/***************************************************************************
728756    ADDRESS MAPS
729757***************************************************************************/
r6747r6748
10151043   MDRV_RAM_ADD("messram")
10161044   MDRV_RAM_DEFAULT_SIZE("66K")
10171045   MDRV_RAM_EXTRA_OPTIONS("2K,18K,4098K")
1046   
1047   MDRV_FLOPPY_2_DRIVES_ADD(vtech1_floppy_config)
10181048MACHINE_DRIVER_END
10191049
10201050static MACHINE_DRIVER_START( laser200 )
r6747r6748
11081138#define rom_vz300       rom_laser310
11091139#define rom_laser310h   rom_laser310
11101140
1111
11121141/***************************************************************************
1113    SYSTEM_CONFIG
1114***************************************************************************/
1115
1116static void vtech1_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
1117{
1118   switch (state)
1119   {
1120      /* --- the following bits of info are returned as 64-bit signed integers --- */
1121      case MESS_DEVINFO_INT_TYPE:            info->i = IO_FLOPPY; break;
1122      case MESS_DEVINFO_INT_READABLE:         info->i = 1; break;
1123      case MESS_DEVINFO_INT_WRITEABLE:      info->i = 1; break;
1124      case MESS_DEVINFO_INT_CREATABLE:      info->i = 1; break;
1125      case MESS_DEVINFO_INT_COUNT:         info->i = 2; break;
1126
1127      /* --- the following bits of info are returned as pointers to data or functions --- */
1128      case MESS_DEVINFO_PTR_LOAD:            info->load = DEVICE_IMAGE_LOAD_NAME(vtech1_floppy); break;
1129
1130      /* --- the following bits of info are returned as NULL-terminated strings --- */
1131      case MESS_DEVINFO_STR_FILE_EXTENSIONS:   strcpy(info->s = device_temp_str(), "dsk"); break;
1132   }
1133}
1134
1135static SYSTEM_CONFIG_START( vtech1 )
1136    CONFIG_DEVICE(vtech1_floppy_getinfo)
1137SYSTEM_CONFIG_END
1138
1139
1140/***************************************************************************
11411142    GAME DRIVERS
11421143***************************************************************************/
11431144
11441145/*    YEAR  NAME       PARENT    COMPAT  MACHINE    INPUT   INIT     CONFIG  COMPANY                   FULLNAME                          FLAGS */
1145COMP( 1983, laser110,  0,        0,      laser110,  vtech1, vtech1,  vtech1, "Video Technology",       "Laser 110",                      0 )
1146COMP( 1983, las110de,  laser110, 0,      laser110,  vtech1, vtech1,  vtech1, "Sanyo",                  "Laser 110 (Germany)",            0 )
1147COMP( 1983, laser200,  0,        0,      laser200,  vtech1, vtech1,  vtech1, "Video Technology",       "Laser 200",                      0 )
1148COMP( 1983, vz200de,   laser200, 0,      laser200,  vtech1, vtech1,  vtech1, "Video Technology",       "VZ-200 (Germany & Netherlands)", 0 )
1149COMP( 1983, fellow,    laser200, 0,      laser200,  vtech1, vtech1,  vtech1, "Salora",                 "Fellow (Finland)",               0 )
1150COMP( 1983, tx8000,    laser200, 0,      laser200,  vtech1, vtech1,  vtech1, "Texet",                  "TX-8000 (UK)",                   0 )
1151COMP( 1984, laser210,  0,        0,      laser210,  vtech1, vtech1,  vtech1, "Video Technology",       "Laser 210",                      0 )
1152COMP( 1984, vz200,     laser210, 0,      laser210,  vtech1, vtech1,  vtech1, "Dick Smith Electronics", "VZ-200 (Oceania)",               0 )
1153COMP( 1984, las210de,  laser210, 0,      laser210,  vtech1, vtech1,  vtech1, "Sanyo",                  "Laser 210 (Germany)",            0 )
1154COMP( 1984, laser310,  0,        0,      laser310,  vtech1, vtech1,  vtech1, "Video Technology",       "Laser 310",                      0 )
1155COMP( 1984, vz300,     laser310, 0,      laser310,  vtech1, vtech1,  vtech1, "Dick Smith Electronics", "VZ-300 (Oceania)",               0 )
1156COMP( 1984, laser310h, laser310, 0,      laser310h, vtech1, vtech1h, vtech1, "Video Technology",       "Laser 310 (SHRG)",               GAME_COMPUTER_MODIFIED )
1146COMP( 1983, laser110,  0,        0,      laser110,  vtech1, vtech1,  0, "Video Technology",       "Laser 110",                      0 )
1147COMP( 1983, las110de,  laser110, 0,      laser110,  vtech1, vtech1,  0, "Sanyo",                  "Laser 110 (Germany)",            0 )
1148COMP( 1983, laser200,  0,        0,      laser200,  vtech1, vtech1,  0, "Video Technology",       "Laser 200",                      0 )
1149COMP( 1983, vz200de,   laser200, 0,      laser200,  vtech1, vtech1,  0, "Video Technology",       "VZ-200 (Germany & Netherlands)", 0 )
1150COMP( 1983, fellow,    laser200, 0,      laser200,  vtech1, vtech1,  0, "Salora",                 "Fellow (Finland)",               0 )
1151COMP( 1983, tx8000,    laser200, 0,      laser200,  vtech1, vtech1,  0, "Texet",                  "TX-8000 (UK)",                   0 )
1152COMP( 1984, laser210,  0,        0,      laser210,  vtech1, vtech1,  0, "Video Technology",       "Laser 210",                      0 )
1153COMP( 1984, vz200,     laser210, 0,      laser210,  vtech1, vtech1,  0, "Dick Smith Electronics", "VZ-200 (Oceania)",               0 )
1154COMP( 1984, las210de,  laser210, 0,      laser210,  vtech1, vtech1,  0, "Sanyo",                  "Laser 210 (Germany)",            0 )
1155COMP( 1984, laser310,  0,        0,      laser310,  vtech1, vtech1,  0, "Video Technology",       "Laser 310",                      0 )
1156COMP( 1984, vz300,     laser310, 0,      laser310,  vtech1, vtech1,  0, "Dick Smith Electronics", "VZ-300 (Oceania)",               0 )
1157COMP( 1984, laser310h, laser310, 0,      laser310h, vtech1, vtech1h, 0, "Video Technology",       "Laser 310 (SHRG)",               GAME_COMPUTER_MODIFIED )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team