Previous 15994 Revisions Next

r5046 Thursday 18th June, 2009 at 12:20:49 UTC by Curt Coder
[PROF80] Fixed floppy access.
[src/mess/drivers]prof80.c
[src/mess/includes]prof80.h
[src/mess/machine]z80sti.c

src/mess/includes/prof80.h
r5045r5046
4343
4444   /* floppy state */
4545   int   fdc_index;         /* floppy index hole sensor */
46   int motor;            /* floppy motor */
4647
4748   /* GRIP state */
4849   UINT8 gripd;         /* GRIP data */
r5045r5046
5556   const device_config *ppi8255;
5657   const device_config *z80sti;
5758   const device_config *centronics;
59
60   /* timers */
61   emu_timer   *floppy_motor_off_timer;
5862};
5963
6064#endif
src/mess/machine/z80sti.c
r5045r5046
2626    PARAMETERS
2727***************************************************************************/
2828
29#define VERBOSE 1
29#define VERBOSE
3030
3131#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
3232
src/mess/drivers/prof80.c
r5045r5046
1414   TODO:
1515
1616   - keyboard
17   - GRIP does not send keys back to PROF-80
18   - GRIP jumpers
19   - NE555 timeout
20   - INUSE led
1721   - grip31 does not work
1822   - PROF-80 RAM banking
19   - PROF-80 floppy access
23   - PROF-80 floppy format
2024   - GRIP model selection
2125   - UNIO card (Z80-STI, Z80-SIO, 2x centronics)
2226   - GRIP-COLOR (192kB color RAM)
r5045r5046
3741#include "machine/z80sti.h"
3842#include "machine/ctronics.h"
3943
44INLINE const device_config *get_floppy_image(running_machine *machine, int drive)
45{
46   return image_from_devtype_and_index(machine, IO_FLOPPY, drive);
47}
48
4049/* Keyboard HACK */
4150
4251static const UINT8 prof80_keycodes[3][9][8] =
r5045r5046
179188   }
180189}
181190
191static TIMER_CALLBACK( floppy_motor_off_tick )
192{
193   prof80_state *state = machine->driver_data;
194
195   floppy_drive_set_motor_state(get_floppy_image(machine, 0), 0);
196   floppy_drive_set_motor_state(get_floppy_image(machine, 1), 0);
197   floppy_drive_set_ready_state(get_floppy_image(machine, 0), 0, 1);
198   floppy_drive_set_ready_state(get_floppy_image(machine, 1), 0, 1);
199
200   state->motor = 0;
201}
202
182203static void ls259_w(running_machine *machine, int fa, int sa, int fb, int sb)
183204{
184205   prof80_state *state = machine->driver_data;
r5045r5046
212233
213234   case 6:
214235      /* _MOTOR */
236      if (fa)
237      {
238         /* trigger floppy motor off NE555 timer */
239//         attotime duration = 0; // TODO: NE555 R=10M C=6.8uF
240         timer_adjust_oneshot(state->floppy_motor_off_timer, ATTOTIME_IN_SEC(10), 0);
241      }
242      else
243      {
244         /* turn on floppy motor */
245         floppy_drive_set_motor_state(get_floppy_image(machine, 0), 1);
246         floppy_drive_set_motor_state(get_floppy_image(machine, 1), 1);
247         floppy_drive_set_ready_state(get_floppy_image(machine, 0), 1, 1);
248         floppy_drive_set_ready_state(get_floppy_image(machine, 1), 1, 1);
249
250         state->motor = 1;
251
252         /* reset floppy motor off NE555 timer */
253         timer_enable(state->floppy_motor_off_timer, 0);
254      }
215255      break;
216256
217257   case 7:
r5045r5046
235275      break;
236276
237277   case 4: /* _MSTOP */
278      if (!fb)
279      {
280         /* turn floppy motor off immediately */
281         timer_adjust_oneshot(state->floppy_motor_off_timer, attotime_zero, 0);
282      }
238283      break;
239284
240285   case 5: /* TXP */
r5045r5046
304349
305350      bit      signal      description
306351
307      0      MOTOR
352      0      _MOTOR      floppy motor (0=on, 1=off)
308353      1
309354      2
310355      3
311      4      x
312      5      x
356      4      JS4
357      5      JS5
313358      6
314359      7      _TDO
315360
r5045r5046
317362
318363   prof80_state *state = space->machine->driver_data;
319364
320   return (!state->rtc_data << 7);
365   return (!state->rtc_data << 7) | !state->motor;
321366}
322367
323static READ8_HANDLER( fdc_status_r )
324{
325   /*
326
327      bit      signal      description
328
329      0      FDB1
330      1      FDB2
331      2      FDB3
332      3      FDB4
333      4      CB
334      5      EXM
335      6      DIO
336      7      RQM
337
338   */
339
340   return 0;
341}
342
343static WRITE8_HANDLER( fdc_w )
344{
345   prof80_state *state = space->machine->driver_data;
346
347   nec765_data_w(state->nec765, 0, data);
348}
349
350static READ8_HANDLER( fdc_r )
351{
352   prof80_state *state = space->machine->driver_data;
353
354   UINT8 data = nec765_data_r(state->nec765, 0);
355   data = nec765_status_r(state->nec765, 0); // TODO how to choose which read?
356
357   return data;
358}
359
360368static WRITE8_HANDLER( mmu_w )
361369{
362370   prof80_state *state = space->machine->driver_data;
r5045r5046
531539   AM_RANGE(0xd8, 0xd8) AM_MIRROR(0xff00) AM_WRITE(flr_w)
532540   AM_RANGE(0xda, 0xda) AM_MIRROR(0xff00) AM_READ(status_r)
533541   AM_RANGE(0xdb, 0xdb) AM_MIRROR(0xff00) AM_READ(status2_r)
534   AM_RANGE(0xdc, 0xdc) AM_MIRROR(0xff00) AM_READ(fdc_status_r)
535   AM_RANGE(0xdd, 0xdd) AM_MIRROR(0xff00) AM_READWRITE(fdc_r, fdc_w)
542   AM_RANGE(0xdc, 0xdc) AM_MIRROR(0xff00) AM_DEVREAD(NEC765_TAG, nec765_status_r)
543   AM_RANGE(0xdd, 0xdd) AM_MIRROR(0xff00) AM_DEVREADWRITE(NEC765_TAG, nec765_data_r, nec765_data_w)
536544   AM_RANGE(0xde, 0xde) AM_MIRROR(0xff01) AM_MASK(0xff00) AM_WRITE(mmu_w)
537545ADDRESS_MAP_END
538546
r5045r5046
712720   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT)
713721   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL))
714722   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT CTRL") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL))
723
724   PORT_START("J1")
725   PORT_CONFNAME( 0x01, 0x00, "J1 RDY/HDLD")
726   PORT_CONFSETTING( 0x00, "HDLD" )
727   PORT_CONFSETTING( 0x01, "READY" )
728
729   PORT_START("J2")
730   PORT_CONFNAME( 0x01, 0x01, "J2 RDY/DCHG")
731   PORT_CONFSETTING( 0x00, "DCHG" )
732   PORT_CONFSETTING( 0x01, "READY" )
733
734   PORT_START("J3")
735   PORT_CONFNAME( 0x01, 0x00, "J3 Port Address")
736   PORT_CONFSETTING( 0x00, "D8-DF" )
737   PORT_CONFSETTING( 0x01, "E8-EF" )
738
739   PORT_START("J4")
740   PORT_CONFNAME( 0x07, 0x00, "J4 Console")
741   PORT_CONFSETTING( 0x00, "GRIP-1" )
742   PORT_CONFSETTING( 0x01, "V24 DUPLEX" )
743   PORT_CONFSETTING( 0x02, "USER1" )
744   PORT_CONFSETTING( 0x03, "USER2" )
745   PORT_CONFSETTING( 0x04, "CP/M" )
746
747   PORT_START("J5")
748   PORT_CONFNAME( 0x07, 0x00, "J5 Baud")
749   PORT_CONFSETTING( 0x00, "9600" )
750   PORT_CONFSETTING( 0x01, "4800" )
751   PORT_CONFSETTING( 0x02, "2400" )
752   PORT_CONFSETTING( 0x03, "1200" )
753   PORT_CONFSETTING( 0x04, "300" )
754
755   PORT_START("J6")
756   PORT_CONFNAME( 0x01, 0x01, "J6 Interrupt")
757   PORT_CONFSETTING( 0x00, "Serial" )
758   PORT_CONFSETTING( 0x01, "ECB" )
759
760   PORT_START("J7")
761   PORT_CONFNAME( 0x01, 0x01, "J7 DMA MMU")
762   PORT_CONFSETTING( 0x00, "PROF" )
763   PORT_CONFSETTING( 0x01, "DMA Card" )
764
765   PORT_START("J8")
766   PORT_CONFNAME( 0x01, 0x01, "J8 Active Mode")
767   PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
768   PORT_CONFSETTING( 0x01, DEF_STR( On ) )
769
770   PORT_START("J9")
771   PORT_CONFNAME( 0x01, 0x00, "J9 EPROM Type")
772   PORT_CONFSETTING( 0x00, "2732/2764" )
773   PORT_CONFSETTING( 0x01, "27128" )
774
775   PORT_START("J10")
776   PORT_CONFNAME( 0x03, 0x00, "J10 Wait States")
777   PORT_CONFSETTING( 0x00, "On all memory accesses" )
778   PORT_CONFSETTING( 0x01, "On internal memory accesses" )
779   PORT_CONFSETTING( 0x02, DEF_STR( None ) )
780
781   PORT_START("L1")
782   PORT_CONFNAME( 0x01, 0x00, "L1 Write Polarity")
783   PORT_CONFSETTING( 0x00, "Inverted" )
784   PORT_CONFSETTING( 0x01, "Normal" )
715785INPUT_PORTS_END
716786
717787/* Video */
r5045r5046
9981068   /* configure FDC */
9991069   floppy_drive_set_index_pulse_callback(image_from_devtype_and_index(machine, IO_FLOPPY, 0), prof80_fdc_index_callback);
10001070
1071   /* allocate floppy motor off timer */
1072   state->floppy_motor_off_timer = timer_alloc(machine, floppy_motor_off_tick, NULL);
1073
10011074   /* allocate video RAM */
10021075   state->video_ram = auto_alloc_array(machine, UINT8, GRIP_VIDEORAM_SIZE);
10031076
r5045r5046
11351208   switch(state)
11361209   {
11371210      /* --- the following bits of info are returned as 64-bit signed integers --- */
1138      case MESS_DEVINFO_INT_COUNT:               info->i = 1; break;
1211      case MESS_DEVINFO_INT_COUNT:               info->i = 2; break;
11391212
11401213      /* --- the following bits of info are returned as pointers to data or functions --- */
11411214      case MESS_DEVINFO_PTR_LOAD:                  info->load = DEVICE_IMAGE_LOAD_NAME(prof80_floppy); break;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team