Previous 15994 Revisions Next

r5384 Sunday 9th August, 2009 at 14:28:47 UTC by Miodrag Milanović
[PYL601] Added floppy support
[src/mess/drivers]pyl601.c

src/mess/drivers/pyl601.c
r5383r5384
99#include "driver.h"
1010#include "cpu/m6800/m6800.h"
1111#include "video/mc6845.h"
12#include "devices/basicdsk.h"
13#include "machine/nec765.h"
1214
1315static UINT8 rom_page;
1416static UINT32 vdisk_addr = 0;
r5383r5384
6870   return retVal;
6971}
7072
71static READ8_HANDLER ( unknown_r )
72{
73   return 0x80;
74}
75
7673UINT8 selectedline(UINT16 data)
7774{
7875   UINT8 i;
r5383r5384
138135   return retVal;
139136}
140137
138static WRITE8_HANDLER (speaker_w)
139{
140}
141141
142static WRITE8_HANDLER (led_w)
143{
144//   UINT8 caps_led = BIT(data,4);
145}
146
147INLINE const device_config *get_floppy_image(running_machine *machine, int drive)
148{
149   return image_from_devtype_and_index(machine, IO_FLOPPY, drive);
150}
151
152static NEC765_GET_IMAGE( pyldin_nec765_get_image )
153{
154   return get_floppy_image(device->machine, (floppy_index & 1)^1);
155}
156UINT8 floppy_ctrl = 0;
157static WRITE8_HANDLER (floppy_w)
158{
159   // bit 0 is reset (if zero)
160   // bit 1 is TC state
161   // bit 2 is drive selected
162   // bit 3 is motor state
163   const device_config *floppy = devtag_get_device(space->machine, "nec765");
164   if (BIT(data,0)==0) {     
165      //reset     
166      nec765_reset(floppy,0);
167   }
168   floppy_drive_set_motor_state(get_floppy_image(space->machine, BIT(data,2)), BIT(data,3));
169   
170   floppy_drive_set_ready_state(get_floppy_image(space->machine, 0), BIT(data,2), 0);
171   
172   nec765_set_tc_state(floppy, BIT(data,1));
173   
174   floppy_ctrl = data;
175}
176static READ8_HANDLER (floppy_r)
177{
178   return floppy_ctrl;
179}
180
181static const struct nec765_interface pyldin_nec765_interface =
182{
183   NULL,                  /* interrupt */
184   NULL,                  /* DMA request */
185   pyldin_nec765_get_image,   /* image lookup */
186   NEC765_RDY_PIN_CONNECTED   /* ready pin */
187};
188
142189static ADDRESS_MAP_START(pyl601_mem, ADDRESS_SPACE_PROGRAM, 8)
143190   ADDRESS_MAP_UNMAP_HIGH
144191   AM_RANGE( 0x0000, 0xbfff ) AM_RAMBANK(1)
r5383r5384
150197   AM_RANGE( 0xe605, 0xe605 ) AM_DEVREADWRITE("crtc", mc6845_register_r , mc6845_register_w)
151198   AM_RANGE( 0xe628, 0xe628 ) AM_READ(keyboard_r)
152199   AM_RANGE( 0xe629, 0xe629 ) AM_READWRITE(video_mode_r,video_mode_w)
153   AM_RANGE( 0xe62a, 0xe62a ) AM_READ(keycheck_r)
154   AM_RANGE( 0xe62b, 0xe62b ) AM_READ(timer_r)
200   AM_RANGE( 0xe62a, 0xe62a ) AM_READWRITE(keycheck_r,led_w)
201   AM_RANGE( 0xe62b, 0xe62b ) AM_READWRITE(timer_r,speaker_w)
155202   AM_RANGE( 0xe62d, 0xe62d ) AM_READ(video_mode_r)
156   AM_RANGE( 0xe62e, 0xe62e ) AM_READ(keycheck_r)   
203   AM_RANGE( 0xe62e, 0xe62e ) AM_READWRITE(keycheck_r,led_w)   
157204   AM_RANGE( 0xe680, 0xe680 ) AM_WRITE(vdisk_page_w)
158205   AM_RANGE( 0xe681, 0xe681 ) AM_WRITE(vdisk_h_w)
159206   AM_RANGE( 0xe682, 0xe682 ) AM_WRITE(vdisk_l_w)
160207   AM_RANGE( 0xe683, 0xe683 ) AM_READWRITE(vdisk_data_r,vdisk_data_w)
161   AM_RANGE( 0xe6d0, 0xe6d0 ) AM_READ(unknown_r)   
208   AM_RANGE( 0xe6c0, 0xe6c0 ) AM_READWRITE(floppy_r, floppy_w)
209   AM_RANGE( 0xe6d0, 0xe6d0 ) AM_DEVREAD("nec765", nec765_status_r)
210   AM_RANGE( 0xe6d1, 0xe6d1 ) AM_DEVREADWRITE("nec765", nec765_data_r, nec765_data_w)
162211   AM_RANGE( 0xe6f0, 0xe6f0 ) AM_READWRITE(rom_page_r, rom_page_w)
163212   AM_RANGE( 0xe700, 0xefff ) AM_RAMBANK(4)
164213   AM_RANGE( 0xf000, 0xffff ) AM_READWRITE(SMH_BANK(5), SMH_BANK(6))
r5383r5384
433482
434483   MDRV_VIDEO_START( pyl601 )
435484   MDRV_VIDEO_UPDATE( pyl601 )   
485   
486   MDRV_NEC765A_ADD("nec765", pyldin_nec765_interface)
436487MACHINE_DRIVER_END
437488
438489static MACHINE_DRIVER_START( pyl601a )
r5383r5384
442493   MDRV_MC6845_ADD("crtc", MC6845, XTAL_2MHz, pyl601a_crtc6845_interface)
443494MACHINE_DRIVER_END
444495
496static DEVICE_IMAGE_LOAD( pyldin_floppy )
497{
498   if (image_has_been_created(image))
499   {
500      return INIT_FAIL;
501   }
502
503   if (DEVICE_IMAGE_LOAD_NAME(basicdsk_floppy)(image) == INIT_PASS)
504   {
505      switch (image_length(image))
506      {
507      case 720*1024:
508         basicdsk_set_geometry(image, 80, 2, 9, 512, 1, 0, FALSE);
509         break;
510      default:
511         return INIT_FAIL;
512      }
513
514      return INIT_PASS;
515   }
516
517   return INIT_FAIL;
518} 
519
520static void pyldin_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
521{
522   switch (state)
523   {
524      /* --- the following bits of info are returned as 64-bit signed integers --- */
525      case MESS_DEVINFO_INT_COUNT:               info->i = 2; break;
526
527      /* --- the following bits of info are returned as pointers to data or functions --- */
528      case MESS_DEVINFO_PTR_LOAD:                  info->load = DEVICE_IMAGE_LOAD_NAME(pyldin_floppy); break;
529
530      /* --- the following bits of info are returned as NULL-terminated strings --- */
531      case MESS_DEVINFO_STR_FILE_EXTENSIONS:         strcpy(info->s = device_temp_str(), "img"); break;
532
533      default:                              legacybasicdsk_device_getinfo(devclass, state, info); break;
534   }
535}
445536static SYSTEM_CONFIG_START(pyl601)
446537   CONFIG_RAM_DEFAULT((64 +512) * 1024)
538   CONFIG_DEVICE( pyldin_floppy_getinfo )
447539SYSTEM_CONFIG_END
448540
449541/* ROM definition */
r5383r5384
454546   ROM_REGION(0x0800, "gfx1",0)
455547   ROM_LOAD( "video.rom",  0x0000, 0x0800, CRC(1c23ba43) SHA1(eb1cfc139858abd0aedbbf3d523f8ba55d27a11d))
456548
457   ROM_REGION(0x50000, "romdisk",ROMREGION_ERASEFF)
549   ROM_REGION(0x50000, "romdisk",ROMREGION_ERASEFF)     
458550   ROM_LOAD( "rom0.rom", 0x00000, 0x10000, CRC(60103920) SHA1(ee5b4ee5b513c4a0204da751e53d63b8c6c0aab9))
459551   ROM_LOAD( "rom1.rom", 0x10000, 0x10000, CRC(cb4a9b22) SHA1(dd09e4ba35b8d1a6f60e6e262aaf2f156367e385))
460552   ROM_LOAD( "rom2.rom", 0x20000, 0x08000, CRC(0b7684bf) SHA1(c02ad1f2a6f484cd9d178d8b060c21c0d4e53442))

Previous 15994 Revisions Next


© 1998-2018 The MESS Team