Previous 15994 Revisions Next

r9995 Tuesday 11th January, 2011 at 21:35:02 UTC by Angelo Salese
[PC-88VA] Added FDC intelligent mode hook-up, doesn't work due of a missing z80 CPU core feature
[src/mess/drivers]pc88va.c

src/mess/drivers/pc88va.c
r9994r9995
1313   - What exact kind of garbage happens if you try to enable both direct and palette color
1414     modes to a graphic layer?
1515   - What is exactly supposed to be a "bus slot"?
16   - fdc "intelligent mode" has 0x7f as irq vector ... 0x7f is ld a,a and it IS NOT correctly
17     hooked up by the current z80 core
1618
1719********************************************************************************************/
1820
1921#include "emu.h"
2022#include "cpu/nec/nec.h"
2123#include "cpu/z80/z80.h"
24#include "debug/debugcpu.h"
2225#include "machine/i8255a.h"
2326#include "machine/pic8259.h"
2427#include "machine/pit8253.h"
r9994r9995
6164   UINT8 buf_index;
6265   UINT8 buf_ram[16];
6366   UINT8 portc_test;
67
68   /* floppy state */
69   UINT8 i8255_0_pc;
70   UINT8 i8255_1_pc;
6471};
6572
73static UINT8 fdc_mode,fdc_irq_opcode;
6674
75
6776static VIDEO_START( pc88va )
6877{
6978
r9994r9995
905914   return 0x20;
906915}
907916
917static WRITE8_HANDLER( upd765_mc_w )
918{
919   floppy_mon_w(floppy_get_device(space->machine, 0), (data & 1) ? CLEAR_LINE : ASSERT_LINE);
920   floppy_mon_w(floppy_get_device(space->machine, 1), (data & 2) ? CLEAR_LINE : ASSERT_LINE);
921   floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), (data & 1), 0);
922   floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), (data & 2), 0);
923}
924
925static TIMER_CALLBACK( pc8801fd_upd765_tc_to_zero )
926{
927//   pc88va_state *state = machine->driver_data<pc88va_state>();
928
929   upd765_tc_w(machine->device("upd765"), 0);
930}
931
932READ8_HANDLER( upd765_tc_r )
933{
934   //pc88va_state *state = space->machine->driver_data<pc88va_state>();
935
936   upd765_tc_w(space->machine->device("upd765"), 1);
937   timer_set(space->machine,  ATTOTIME_IN_USEC(500), NULL, 0, pc8801fd_upd765_tc_to_zero );
938   return 0;
939}
940
908941static READ8_HANDLER( pc88va_fdc_r )
909942{
910943   switch(offset*2)
r9994r9995
930963      ---- ---x MODE: FDC op mode (0) Intelligent (1) DMA
931964      */
932965      case 0x00: // FDC mode register
966         fdc_mode = data & 1;
967         cputag_set_input_line(space->machine, "fdccpu", INPUT_LINE_HALT, (fdc_mode) ? ASSERT_LINE : CLEAR_LINE);
933968         break;
934969      /*
935970      --x- ---- CLK: FDC clock selection (0) 4.8MHz (1) 8 MHz
r9994r9995
943978      ---- x--- PCM: ?
944979      ---- --xx M1/M0: Drive 1/0 motor control (0) Motor OFF (1) Motor ON
945980      */
946      case 0x04: // FDC control port 1
947         break;
981      case 0x04: upd765_mc_w(space,0,data); break;
948982      /*
949983      x--- ---- FDCRST: FDC Reset
950984      -xx- ---- FDCFRY FRYCEN: FDC force ready control
r9994r9995
11081142   AM_RANGE(0x4000, 0x7fff) AM_RAM
11091143ADDRESS_MAP_END
11101144
1145static WRITE8_HANDLER( fdc_irq_vector_w )
1146{
1147   fdc_irq_opcode = data;
1148}
1149
11111150static ADDRESS_MAP_START( pc88va_z80_io_map, ADDRESS_SPACE_IO, 8 )
11121151   ADDRESS_MAP_GLOBAL_MASK(0xff)
1113//   AM_RANGE(0xf0, 0xf0) // Interrupt Opcode Port
1152   AM_RANGE(0xf0, 0xf0) AM_WRITE(fdc_irq_vector_w) // Interrupt Opcode Port
11141153//   AM_RANGE(0xf4, 0xf4) // Drive Control Port
1115//   AM_RANGE(0xf8, 0xf8) // (R) Terminal Count Port (W) Motor Control Port
1116//   AM_RANGE(0xfa, 0xfa) // FDC Status Register
1117//   AM_RANGE(0xfb, 0xfb) // FDC Data Register
1118   // 0xfc - 0xff there's a i8255 mapped, bidiretional handshake port
1119//   AM_RANGE(0xfc, 0xfc) // (R) Data input port from main CPU
1120//   AM_RANGE(0xfd, 0xfd) // (W) Data input port to main CPU
1121   AM_RANGE(0xfe, 0xfe) AM_NOP // Handshake Control Port
1122//   AM_RANGE(0xff, 0xff) // Mode Set / Bit Control
1154   AM_RANGE(0xf8, 0xf8) AM_READWRITE(upd765_tc_r,upd765_mc_w) // (R) Terminal Count Port (W) Motor Control Port
1155   AM_RANGE(0xfa, 0xfa) AM_DEVREAD("upd765", upd765_status_r )
1156   AM_RANGE(0xfb, 0xfb) AM_DEVREADWRITE("upd765", upd765_data_r, upd765_data_w )
1157   AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE("d8255_2s", i8255a_r,i8255a_w)
11231158ADDRESS_MAP_END
11241159
11251160
r9994r9995
13401375   GFXDECODE_ENTRY( "kanji",   0x00000, pc88va_chars_16x16,  0, 1 )
13411376GFXDECODE_END
13421377
1343static READ8_DEVICE_HANDLER( fdd_porta_r )
1378static READ8_DEVICE_HANDLER( cpu_8255_c_r )
13441379{
1345   return 0xff;
1346}
1380   pc88va_state *state = device->machine->driver_data<pc88va_state>();
13471381
1348static READ8_DEVICE_HANDLER( fdd_portb_r )
1349{
1350   return 0xff;
1382   return state->i8255_1_pc >> 4;
13511383}
13521384
1353static READ8_DEVICE_HANDLER( fdd_portc_r )
1385static WRITE8_DEVICE_HANDLER( cpu_8255_c_w )
13541386{
13551387   pc88va_state *state = device->machine->driver_data<pc88va_state>();
1356   state->portc_test^=5;
13571388
1358   return 0xff ^ state->portc_test;
1389   state->i8255_0_pc = data;
13591390}
13601391
1361static WRITE8_DEVICE_HANDLER( fdd_porta_w )
1392static I8255A_INTERFACE( master_fdd_intf )
13621393{
1363   // ...
1364}
1394   DEVCB_DEVICE_HANDLER("d8255_2s", i8255a_pb_r),   // Port A read
1395   DEVCB_NULL,                     // Port B read
1396   DEVCB_HANDLER(cpu_8255_c_r),      // Port C read
1397   DEVCB_NULL,                     // Port A write
1398   DEVCB_NULL,                     // Port B write
1399   DEVCB_HANDLER(cpu_8255_c_w)         // Port C write
1400};
13651401
1366static WRITE8_DEVICE_HANDLER( fdd_portb_w )
1402static READ8_DEVICE_HANDLER( fdc_8255_c_r )
13671403{
1368   // ...
1404   pc88va_state *state = device->machine->driver_data<pc88va_state>();
1405
1406   return state->i8255_0_pc >> 4;
13691407}
13701408
1371static WRITE8_DEVICE_HANDLER( fdd_portc_w )
1409static WRITE8_DEVICE_HANDLER( fdc_8255_c_w )
13721410{
1373   // ...
1411   pc88va_state *state = device->machine->driver_data<pc88va_state>();
1412
1413   state->i8255_1_pc = data;
13741414}
13751415
1376static I8255A_INTERFACE( fdd_intf )
1416static I8255A_INTERFACE( slave_fdd_intf )
13771417{
1378   DEVCB_HANDLER(fdd_porta_r),                  /* Port A read */
1379   DEVCB_HANDLER(fdd_portb_r),                  /* Port B read */
1380   DEVCB_HANDLER(fdd_portc_r),                  /* Port C read */
1381   DEVCB_HANDLER(fdd_porta_w),                  /* Port A write */
1382   DEVCB_HANDLER(fdd_portb_w),                  /* Port B write */
1383   DEVCB_HANDLER(fdd_portc_w)                  /* Port C write */
1418   DEVCB_DEVICE_HANDLER("d8255_2", i8255a_pb_r),   // Port A read
1419   DEVCB_NULL,                     // Port B read
1420   DEVCB_HANDLER(fdc_8255_c_r),      // Port C read
1421   DEVCB_NULL,                     // Port A write
1422   DEVCB_NULL,                     // Port B write
1423   DEVCB_HANDLER(fdc_8255_c_w)         // Port C write
13841424};
13851425
13861426static READ8_DEVICE_HANDLER( r232_ctrl_porta_r )
r9994r9995
14911531   }
14921532
14931533   state->tsp.tvram_vreg_offset = 0;
1534
1535   fdc_mode = 0;
1536   fdc_irq_opcode = 0x7f; // ld a,a !
14941537}
14951538
14961539static INTERRUPT_GEN( pc88va_vrtc_irq )
r9994r9995
15441587
15451588static WRITE_LINE_DEVICE_HANDLER(pc88va_upd765_interrupt)
15461589{
1547   pic8259_ir3_w(device->machine->device( "pic8259_slave"), state);
1590   if(fdc_mode)
1591      pic8259_ir3_w(device->machine->device( "pic8259_slave"), state);
1592   else
1593      cputag_set_input_line_and_vector(device->machine, "fdccpu", 0, HOLD_LINE, fdc_irq_opcode);
15481594};
15491595
1550
15511596static const struct upd765_interface pc88va_upd765_interface =
15521597{
15531598   DEVCB_LINE(pc88va_upd765_interrupt),
15541599   DEVCB_NULL, //DRQ, TODO
15551600   NULL,
15561601   UPD765_RDY_PIN_CONNECTED,
1557   {FLOPPY_0,NULL, NULL, NULL}
1602   {FLOPPY_0, FLOPPY_1, NULL, NULL}
15581603};
15591604
15601605static const ym2203_interface pc88va_ym2203_intf =
r9994r9995
15961641   MCFG_MACHINE_START( pc88va )
15971642   MCFG_MACHINE_RESET( pc88va )
15981643
1599   MCFG_I8255A_ADD( "d8255_2", fdd_intf )
1644   MCFG_I8255A_ADD( "d8255_2", master_fdd_intf )
16001645   MCFG_I8255A_ADD( "d8255_3", r232c_ctrl_intf )
16011646
1647   MCFG_I8255A_ADD( "d8255_2s", slave_fdd_intf )
1648
16021649   MCFG_PIC8259_ADD( "pic8259_master", pc88va_pic8259_master_config )
16031650   MCFG_PIC8259_ADD( "pic8259_slave", pc88va_pic8259_slave_config )
16041651

Previous 15994 Revisions Next


© 1998-2018 The MESS Team