Previous 15994 Revisions Next

r2472 Friday 25th April, 2008 at 15:00:26 UTC by Wilbert Pol
[IBMPCJR] Added specific pcjr floppy handling code. Added regular ppi8255 interface. Bios now passes 8255 POST check.
[src/mess/drivers]pc.c
[src/mess/machine]pc_fdc.c pc_fdc.h

src/mess/machine/pc_fdc.c
r2471r2472
227227    | | `-------------- 1 = turn floppy drive B motor on
228228    | `---------------- 1 = turn floppy drive C motor on
229229    `------------------ 1 = turn floppy drive D motor on
230
231   On a PC Jr the DOR is wired up a bit differently:
232   |7|6|5|4|3|2|1|0|
233    | | | | | | | `--- Drive enable ( 0 = off, 1 = on )
234    | | | | | | `----- Reserved
235    | | | | | `------- Reserved
236    | | | | `--------- Reserved
237    | | | `----------- Reserved
238    | | `------------- Watchdog Timer Enable ( 0 = watchdog enabled, 1 = watchdog disabled )
239    | `--------------- Watchdog Timer Trigger ( on a 1->0 transition to strobe the trigger )
240    `----------------- FDC Reset ( 0 = hold reset, 1 = release reset )
241230 */
242231
243static void pc_fdc_dor_w(UINT8 data)
232static void pc_fdc_dor_w(running_machine *machine, UINT8 data)
244233{
245234   int selected_drive;
246235   int floppy_count;
247236
248   floppy_count = device_count(Machine, IO_FLOPPY);
237   floppy_count = device_count(machine, IO_FLOPPY);
249238
250239   if (floppy_count > (fdc->digital_output_register & 0x03))
251240      floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, fdc->digital_output_register & 0x03), 1, 0);
r2471r2472
321310}
322311
323312
313/*   PCJr FDC Digitial Output Register (DOR)
324314
315   On a PC Jr the DOR is wired up a bit differently:
316   |7|6|5|4|3|2|1|0|
317    | | | | | | | `--- Drive enable ( 0 = off, 1 = on )
318    | | | | | | `----- Reserved
319    | | | | | `------- Reserved
320    | | | | `--------- Reserved
321    | | | `----------- Reserved
322    | | `------------- Watchdog Timer Enable ( 0 = watchdog enabled, 1 = watchdog disabled )
323    | `--------------- Watchdog Timer Trigger ( on a 1->0 transition to strobe the trigger )
324    `----------------- FDC Reset ( 0 = hold reset, 1 = release reset )
325 */
326
327static void pcjr_fdc_dor_w(running_machine *machine, UINT8 data)
328{
329   int floppy_count;
330
331   floppy_count = device_count(machine, IO_FLOPPY);
332
333   /* set floppy drive motor state */
334   if (floppy_count > 0)
335      floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), data & 0x01);
336
337   if ( data & 0x01 )
338   {
339      if ( floppy_count )
340         floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1, 0);
341   }
342
343   /* reset? */
344   if ( ! (data & 0x80) )
345   {
346      /* yes */
347
348         /* pc-xt expects a interrupt to be generated
349         when the fdc is reset.
350         In the FDC docs, it states that a INT will
351         be generated if READY input is true when the
352         fdc is reset.
353
354            It also states, that outputs to drive are set to 0.
355            Maybe this causes the drive motor to go on, and therefore
356            the ready line is set.
357
358         This in return causes a int?? ---
359
360
361      what is not yet clear is if this is a result of the drives ready state
362      changing...
363      */
364         nec765_set_ready_state(1);
365
366      /* set FDC at reset */
367      nec765_set_reset_state(1);
368   }
369   else
370   {
371      pc_fdc_set_tc_state(0);
372
373      /* release reset on fdc */
374      nec765_set_reset_state(0);
375   }
376
377   logerror("pcjr_fdc_dor_w: changing dor from %02x to %02x\n", fdc->digital_output_register, data);
378
379   fdc->digital_output_register = data;
380}
381
382
325383READ8_HANDLER ( pc_fdc_r )
326384{
327385   UINT8 data = 0xff;
r2471r2472
367425      case 1:   /* n/a */
368426         break;
369427      case 2:
370         pc_fdc_dor_w(data);
428         pc_fdc_dor_w(machine, data);
371429         break;
372430      case 3:
373431         /* tape drive select? */
r2471r2472
395453   }
396454}
397455
456WRITE8_HANDLER ( pcjr_fdc_w )
457{
458   if (LOG_FDC)
459      logerror("pcjr_fdc_w(): pc=0x%08x offset=%d data=0x%02X\n", (unsigned) activecpu_get_reg(REG_PC), offset, data);
460
461   switch(offset)
462   {
463      case 2:
464         pcjr_fdc_dor_w( machine, data );
465         break;
466      default:
467         pc_fdc_w( machine, offset, data );
468         break;
469   }
470}
471
src/mess/machine/pc_fdc.h
r2471r2472
4141
4242READ8_HANDLER(pc_fdc_r);
4343WRITE8_HANDLER(pc_fdc_w);
44WRITE8_HANDLER ( pcjr_fdc_w );
4445
4546#endif /* PC_FDC_H */
4647
src/mess/drivers/pc.c
r2471r2472
285285
286286
287287
288static ADDRESS_MAP_START(ibmpcjr_io, ADDRESS_SPACE_IO, 8)
289   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE(DMA8237, "dma8237", dma8237_r, dma8237_w)
290   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE(PIC8259, "pic8259_master", pic8259_r, pic8259_w)
291   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE(PIT8253, "pit8253", pit8253_r, pit8253_w)
292   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE(PPI8255, "ppi8255", ppi8255_r, ppi8255_w)
293   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r,            pc_page_w)
294   AM_RANGE(0x00a0, 0x00a0) AM_WRITE( pc_nmi_enable_w )
295   AM_RANGE(0x00c0, 0x00c0) AM_WRITE(                        SN76496_0_w)
296   AM_RANGE(0x00f0, 0x00f7) AM_READWRITE(pc_fdc_r,               pcjr_fdc_w)
297   AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc_JOY_r,               pc_JOY_w)
298   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE(INS8250, "ins8250_0", ins8250_r, ins8250_w)
299   AM_RANGE(0x0320, 0x0323) AM_READWRITE(pc_HDC1_r,            pc_HDC1_w)
300   AM_RANGE(0x0324, 0x0327) AM_READWRITE(pc_HDC2_r,            pc_HDC2_w)
301   AM_RANGE(0x0378, 0x037f) AM_READWRITE(pc_t1t_p37x_r,         pc_t1t_p37x_w)
302   AM_RANGE(0x03bc, 0x03be) AM_READWRITE(pc_parallelport0_r,      pc_parallelport0_w)
303   AM_RANGE(0x03d0, 0x03df) AM_READWRITE(pc_T1T_r,               pc_T1T_w)
304   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE(INS8250, "ins8250_0", ins8250_r, ins8250_w)
305ADDRESS_MAP_END
306
307
308
288309static ADDRESS_MAP_START(pc200_io, ADDRESS_SPACE_IO, 16)
289310   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE8(DMA8237, "dma8237", dma8237_r, dma8237_w, 0xffff)
290311   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8(PIC8259, "pic8259_master", pic8259_r, pic8259_w, 0xffff)
r2471r2472
16841705MACHINE_DRIVER_END
16851706
16861707
1708static MACHINE_DRIVER_START( ibmpcjr )
1709   /* basic machine hardware */
1710   MDRV_CPU_PC(tandy1000, ibmpcjr, I8088, 8000000, tandy1000_frame_interrupt)
1711
1712   MDRV_MACHINE_START(pc)
1713   MDRV_MACHINE_RESET(pc)
1714
1715   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
1716   MDRV_DEVICE_CONFIG( pc_pit8253_config )
1717
1718   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
1719   MDRV_DEVICE_CONFIG( pc_dma8237_config )
1720
1721   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1722   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1723
1724   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1725   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1726
1727   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1728   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1729
1730   MDRV_DEVICE_ADD( "ins8250_0", INS8250 )         /* TODO: Verify model */
1731   MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] )
1732
1733   MDRV_DEVICE_ADD( "ins8250_1", INS8250 )         /* TODO: Verify model */
1734   MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] )
1735
1736   /* video hardware */
1737   MDRV_IMPORT_FROM( pcvideo_t1000 )
1738
1739    /* sound hardware */
1740   MDRV_SPEAKER_STANDARD_MONO("mono")
1741   MDRV_SOUND_ADD(CUSTOM, 0)
1742   MDRV_SOUND_CONFIG(pc_sound_interface)
1743   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
1744   MDRV_SOUND_ADD(SN76496, 2386360)
1745   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
1746
1747   MDRV_NVRAM_HANDLER( tandy1000 )
1748
1749   /* printer */
1750   MDRV_DEVICE_ADD("printer", PRINTER)
1751MACHINE_DRIVER_END
1752
16871753#if 0
16881754   //pcjr roms? (incomplete dump, most likely 64 kbyte)
16891755   // basic c1.20
r2471r2472
21312197COMP(  1988,   europc,      ibm5150,   0,      europc,     europc,      europc,     ibmpc,   "Schneider Rdf. AG",  "EURO PC", 0)
21322198
21332199// pcjr (better graphics, better sound)
2134COMP(  1983,   ibmpcjr,   ibm5150,   0,      t1000hx,    tandy1t,   t1000hx,    ibmpc,   "International Business Machines",  "IBM PC Jr", GAME_NOT_WORKING|GAME_IMPERFECT_COLORS )
2200COMP(  1983,   ibmpcjr,   ibm5150,   0,      ibmpcjr,    tandy1t,   t1000hx,    ibmpc,   "International Business Machines",  "IBM PC Jr", GAME_NOT_WORKING|GAME_IMPERFECT_COLORS )
21352201COMP(  1987,   t1000hx,   ibm5150,   0,      t1000hx,    tandy1t,   t1000hx,   ibmpc,   "Tandy Radio Shack",  "Tandy 1000HX", 0)
21362202COMP(  1987,   t1000sx,   ibm5150,   0,      t1000hx,    tandy1t,   t1000hx,   ibmpc,   "Tandy Radio Shack",  "Tandy 1000SX", 0)
21372203

Previous 15994 Revisions Next


© 1998-2018 The MESS Team