src/mess/drivers/pc88va.c
| r9480 | r9481 | |
| 17 | 17 | //#include "cpu/z80/z80.h" |
| 18 | 18 | #include "machine/i8255a.h" |
| 19 | 19 | #include "machine/pic8259.h" |
| 20 | #include "machine/pit8253.h" |
| 20 | 21 | #include "machine/pc_fdc.h" |
| 21 | 22 | #include "machine/upd765.h" |
| 22 | 23 | |
| 23 | 24 | static UINT16 *palram; |
| 24 | 25 | static UINT16 bank_reg; |
| 25 | 26 | static UINT16 screen_ctrl_reg; |
| 27 | static UINT8 timer3_io_reg; |
| 28 | static emu_timer *t3_mouse_timer; |
| 26 | 29 | static struct |
| 27 | 30 | { |
| 28 | 31 | UINT16 tvram_vreg_offset; |
| r9480 | r9481 | |
| 636 | 639 | screen_ctrl_reg = data; |
| 637 | 640 | } |
| 638 | 641 | |
| 642 | static TIMER_CALLBACK( t3_mouse_callback ) |
| 643 | { |
| 644 | if(timer3_io_reg & 0x80) |
| 645 | { |
| 646 | pic8259_ir5_w(machine->device("pic8259_slave"), 1); |
| 647 | timer_adjust_oneshot(t3_mouse_timer, ATTOTIME_IN_HZ(120 >> (timer3_io_reg & 3)), 0); |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | static WRITE8_HANDLER( timer3_ctrl_reg_w ) |
| 652 | { |
| 653 | /* |
| 654 | x--- ---- MINTEN (TCU irq enable) |
| 655 | ---- --xx general purpose timer 3 interval (120, 60, 30, 15) |
| 656 | */ |
| 657 | timer3_io_reg = data; |
| 658 | |
| 659 | if(data & 0x80) |
| 660 | timer_adjust_oneshot(t3_mouse_timer, ATTOTIME_IN_HZ(120 >> (timer3_io_reg & 3)), 0); |
| 661 | else |
| 662 | { |
| 663 | pic8259_ir5_w(space->machine->device("pic8259_slave"), 0); |
| 664 | timer_adjust_oneshot(t3_mouse_timer, attotime_never, 0); |
| 665 | } |
| 666 | } |
| 667 | |
| 639 | 668 | static ADDRESS_MAP_START( pc88va_io_map, ADDRESS_SPACE_IO, 16 ) |
| 640 | 669 | AM_RANGE(0x0000, 0x000f) AM_READ8(key_r,0xffff) // Keyboard ROW reading |
| 641 | 670 | // AM_RANGE(0x0010, 0x0010) Printer / Calendar Clock Interface |
| r9480 | r9481 | |
| 692 | 721 | // AM_RANGE(0x0196, 0x0197) Keyboard sub CPU command port |
| 693 | 722 | AM_RANGE(0x0198, 0x0199) AM_WRITE(backupram_wp_1_w) //Backup RAM write inhibit |
| 694 | 723 | AM_RANGE(0x019a, 0x019b) AM_WRITE(backupram_wp_0_w) //Backup RAM write permission |
| 695 | | // AM_RANGE(0x01a0, 0x01a7) TCU (timer counter unit) |
| 696 | | // AM_RANGE(0x01a8, 0x01a9) General-purpose timer 3 control port |
| 724 | AM_RANGE(0x01a0, 0x01a7) AM_DEVREADWRITE8("pit8253", pit8253_r, pit8253_w, 0x00ff)// vTCU (timer counter unit) |
| 725 | AM_RANGE(0x01a8, 0x01a9) AM_WRITE8(timer3_ctrl_reg_w,0x00ff) // General-purpose timer 3 control port |
| 697 | 726 | AM_RANGE(0x01b0, 0x01bb) AM_READWRITE8(pc88va_fdc_r,pc88va_fdc_w,0x00ff)// FDC related (765) |
| 698 | 727 | // AM_RANGE(0x01c0, 0x01c1) ? |
| 699 | 728 | AM_RANGE(0x01c6, 0x01c7) AM_WRITENOP // ??? |
| r9480 | r9481 | |
| 1085 | 1114 | cpu_set_irq_callback(machine->device("maincpu"), pc88va_irq_callback); |
| 1086 | 1115 | |
| 1087 | 1116 | pc_fdc_init(machine, &pc88va_fdc_interface); |
| 1117 | |
| 1118 | t3_mouse_timer = timer_alloc(machine, t3_mouse_callback, 0); |
| 1119 | timer_adjust_oneshot(t3_mouse_timer, attotime_never, 0); |
| 1088 | 1120 | } |
| 1089 | 1121 | |
| 1090 | 1122 | static MACHINE_RESET( pc88va ) |
| r9480 | r9481 | |
| 1125 | 1157 | }; |
| 1126 | 1158 | |
| 1127 | 1159 | |
| 1160 | static WRITE_LINE_DEVICE_HANDLER( pc88va_pit_out0_changed ) |
| 1161 | { |
| 1162 | pic8259_ir0_w(device->machine->device("pic8259_master"), 1); |
| 1163 | } |
| 1164 | |
| 1165 | static const struct pit8253_config pc88va_pit8253_config = |
| 1166 | { |
| 1167 | { |
| 1168 | { |
| 1169 | /* general purpose timer 1 */ |
| 1170 | 8000000, |
| 1171 | DEVCB_NULL, |
| 1172 | DEVCB_LINE(pc88va_pit_out0_changed) |
| 1173 | }, |
| 1174 | { |
| 1175 | /* BEEP frequency setting */ |
| 1176 | 8000000, |
| 1177 | DEVCB_NULL, |
| 1178 | DEVCB_NULL |
| 1179 | }, |
| 1180 | { |
| 1181 | /* RS232C baud rate setting */ |
| 1182 | 8000000, |
| 1183 | DEVCB_NULL, |
| 1184 | DEVCB_NULL |
| 1185 | } |
| 1186 | } |
| 1187 | }; |
| 1188 | |
| 1128 | 1189 | static MACHINE_CONFIG_START( pc88va, driver_device ) |
| 1129 | 1190 | |
| 1130 | 1191 | MDRV_CPU_ADD("maincpu", V30, 8000000) /* 8 MHz */ |
| r9480 | r9481 | |
| 1162 | 1223 | MDRV_UPD765A_ADD("upd765", pc_fdc_upd765_connected_interface) |
| 1163 | 1224 | MDRV_FLOPPY_2_DRIVES_ADD(pc88va_floppy_config) |
| 1164 | 1225 | |
| 1226 | MDRV_PIT8253_ADD("pit8253",pc88va_pit8253_config) |
| 1227 | |
| 1228 | |
| 1165 | 1229 | MACHINE_CONFIG_END |
| 1166 | 1230 | |
| 1167 | 1231 | |