src/mess/drivers/pc6001.c
| r5899 | r5900 | |
| 4 | 4 | NEC PC-6600 series |
| 5 | 5 | |
| 6 | 6 | 12/05/2009 Skeleton driver. |
| 7 | | |
| 8 | | PC-6001 (1981-09): |
| 9 | 7 | |
| 8 | PC-6001 (1981-09): |
| 9 | |
| 10 | 10 | * CPU: Z80A @ 4 MHz |
| 11 | 11 | * ROM: 16KB + 4KB (chargen) - no kanji |
| 12 | 12 | * RAM: 16KB, it can be expanded to 32KB |
| 13 | 13 | * Text Mode: 32x16 and 2 colors |
| 14 | 14 | * Graphic Modes: 64x48 (9 colors), 128x192 (4 colors), 256x192 (2 colors) |
| 15 | 15 | * Sound: BEEP + PSG - Optional Voice Synth Cart |
| 16 | | * Keyboard: JIS Keyboard with 5 function keys, control key, TAB key, |
| 17 | | HOME/CLR key, INS key, DEL key, GRAPH key, Japanese syllabary |
| 16 | * Keyboard: JIS Keyboard with 5 function keys, control key, TAB key, |
| 17 | HOME/CLR key, INS key, DEL key, GRAPH key, Japanese syllabary |
| 18 | 18 | key, page key, STOP key, and cursor key (4 directions) |
| 19 | | * 1 cartslot, optional floppy drive, optional serial 232 port, 2 |
| 19 | * 1 cartslot, optional floppy drive, optional serial 232 port, 2 |
| 20 | 20 | joystick ports |
| 21 | | |
| 22 | 21 | |
| 23 | | PC-6001 mkII (1983-07): |
| 24 | 22 | |
| 23 | PC-6001 mkII (1983-07): |
| 24 | |
| 25 | 25 | * CPU: Z80A @ 4 MHz |
| 26 | 26 | * ROM: 32KB + 16KB (chargen) + 32KB (kanji) + 16KB (Voice Synth) |
| 27 | 27 | * RAM: 64KB |
| 28 | | * Text Mode: same as PC-6001 with N60-BASIC; 40x20 and 15 colors with |
| 28 | * Text Mode: same as PC-6001 with N60-BASIC; 40x20 and 15 colors with |
| 29 | 29 | N60M-BASIC |
| 30 | | * Graphic Modes: same as PC-6001 with N60-BASIC; 80x40 (15 colors), |
| 30 | * Graphic Modes: same as PC-6001 with N60-BASIC; 80x40 (15 colors), |
| 31 | 31 | 160x200 (15 colors), 320x200 (4 colors) with N60M-BASIC |
| 32 | 32 | * Sound: BEEP + PSG |
| 33 | | * Keyboard: JIS Keyboard with 5 function keys, control key, TAB key, |
| 34 | | HOME/CLR key, INS key, DEL key, CAPS key, GRAPH key, Japanese |
| 35 | | syllabary key, page key, mode key, STOP key, and cursor key (4 |
| 33 | * Keyboard: JIS Keyboard with 5 function keys, control key, TAB key, |
| 34 | HOME/CLR key, INS key, DEL key, CAPS key, GRAPH key, Japanese |
| 35 | syllabary key, page key, mode key, STOP key, and cursor key (4 |
| 36 | 36 | directions) |
| 37 | 37 | * 1 cartslot, floppy drive, optional serial 232 port, 2 joystick ports |
| 38 | | |
| 39 | 38 | |
| 40 | | PC-6001 mkIISR (1984-12): |
| 41 | 39 | |
| 40 | PC-6001 mkIISR (1984-12): |
| 41 | |
| 42 | 42 | * CPU: Z80A @ 3.58 MHz |
| 43 | 43 | * ROM: 64KB + 16KB (chargen) + 32KB (kanji) + 32KB (Voice Synth) |
| 44 | 44 | * RAM: 64KB |
| 45 | | * Text Mode: same as PC-6001/PC-6001mkII with N60-BASIC; 40x20, 40x25, |
| 45 | * Text Mode: same as PC-6001/PC-6001mkII with N60-BASIC; 40x20, 40x25, |
| 46 | 46 | 80x20, 80x25 and 15 colors with N66SR-BASIC |
| 47 | | * Graphic Modes: same as PC-6001/PC-6001mkII with N60-BASIC; 80x40 (15 colors), |
| 47 | * Graphic Modes: same as PC-6001/PC-6001mkII with N60-BASIC; 80x40 (15 colors), |
| 48 | 48 | 320x200 (15 colors), 640x200 (15 colors) with N66SR-BASIC |
| 49 | 49 | * Sound: BEEP + PSG + FM |
| 50 | | * Keyboard: JIS Keyboard with 5 function keys, control key, TAB key, |
| 51 | | HOME/CLR key, INS key, DEL key, CAPS key, GRAPH key, Japanese |
| 52 | | syllabary key, page key, mode key, STOP key, and cursor key (4 |
| 50 | * Keyboard: JIS Keyboard with 5 function keys, control key, TAB key, |
| 51 | HOME/CLR key, INS key, DEL key, CAPS key, GRAPH key, Japanese |
| 52 | syllabary key, page key, mode key, STOP key, and cursor key (4 |
| 53 | 53 | directions) |
| 54 | 54 | * 1 cartslot, floppy drive, optional serial 232 port, 2 joystick ports |
| 55 | | |
| 56 | 55 | |
| 56 | |
| 57 | 57 | info from http://www.geocities.jp/retro_zzz/machines/nec/6001/spc60.html |
| 58 | 58 | |
| 59 | === |
| 60 | |
| 61 | irq vector 00: writes 0x00 to [$fa19] |
| 62 | irq vector 02: (A = 0, B = 0) tests ppi port c, does something with ay ports (plus more?) |
| 63 | irq vector 04: uart irq |
| 64 | irq vector 06: operates with $fa28, $fa2e, $fd1b |
| 65 | irq vector 08: tests ppi port c, puts port A to $fa1d,puts 0x02 to [$fa19] |
| 66 | irq vector 0A: writes 0x00 to [$fa19] |
| 67 | irq vector 0C: writes 0x00 to [$fa19] |
| 68 | irq vector 0E: same as 2, (A = 0x03, B = 0x00) |
| 69 | irq vector 10: same as 2, (A = 0x03, B = 0x00) |
| 70 | irq vector 12: writes 0x10 to [$fa19] |
| 71 | irq vector 14: same as 2, (A = 0x00, B = 0x01) |
| 72 | irq vector 16: tests ppi port c, writes the result to $feca. |
| 73 | |
| 74 | |
| 59 | 75 | ****************************************************************************/ |
| 60 | 76 | |
| 61 | 77 | #include "driver.h" |
| r5899 | r5900 | |
| 71 | 87 | static WRITE8_HANDLER ( pc6001_system_latch_w ) |
| 72 | 88 | { |
| 73 | 89 | UINT16 startaddr[] = {0xC000, 0xE000, 0x8000, 0xA000 }; |
| 74 | | |
| 90 | |
| 75 | 91 | pc6001_video_ram = pc6001_ram + startaddr[(data >> 1) & 0x03] - 0x8000; |
| 76 | 92 | } |
| 77 | 93 | |
| r5899 | r5900 | |
| 103 | 119 | static READ8_DEVICE_HANDLER(nec_ppi8255_r) { |
| 104 | 120 | if (offset==2) { |
| 105 | 121 | return port_c_8255; |
| 106 | | } else { |
| 122 | } |
| 123 | else if(offset==0) |
| 124 | { |
| 125 | if(input_code_pressed(device->machine,KEYCODE_Z)) //quick kludge test |
| 126 | return 0x30; |
| 107 | 127 | return i8255a_r(device,offset); |
| 108 | 128 | } |
| 129 | else { |
| 130 | return i8255a_r(device,offset); |
| 131 | } |
| 109 | 132 | } |
| 110 | 133 | |
| 111 | 134 | static WRITE8_DEVICE_HANDLER(nec_ppi8255_w) { |
| r5899 | r5900 | |
| 127 | 150 | i8255a_w(device,offset,data); |
| 128 | 151 | } |
| 129 | 152 | |
| 130 | | static WRITE8_DEVICE_HANDLER(pc6100_ay8910_address_w) { |
| 131 | | ay8910_address_w(device,offset,data & 0x0f); |
| 132 | | } |
| 133 | | |
| 134 | 153 | static ADDRESS_MAP_START(pc6001_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 135 | 154 | ADDRESS_MAP_UNMAP_HIGH |
| 136 | 155 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| r5899 | r5900 | |
| 143 | 162 | AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("uart", msm8251_data_r,msm8251_data_w) |
| 144 | 163 | AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("uart", msm8251_status_r,msm8251_control_w) |
| 145 | 164 | AM_RANGE(0x90, 0x93) AM_DEVREADWRITE("ppi8255", nec_ppi8255_r, nec_ppi8255_w) |
| 146 | | AM_RANGE(0xB0, 0xB0) AM_WRITE(pc6001_system_latch_w) |
| 147 | | AM_RANGE(0xA0, 0xA0) AM_DEVWRITE("ay8910", pc6100_ay8910_address_w) |
| 148 | | AM_RANGE(0xA1, 0xA1) AM_DEVWRITE("ay8910", ay8910_data_w) |
| 165 | AM_RANGE(0xa0, 0xa0) AM_DEVWRITE("ay8910", ay8910_address_w) |
| 166 | AM_RANGE(0xa1, 0xa1) AM_DEVWRITE("ay8910", ay8910_data_w) |
| 167 | AM_RANGE(0xa2, 0xa2) AM_DEVREAD("ay8910", ay8910_r) |
| 168 | AM_RANGE(0xb0, 0xb0) AM_WRITE(pc6001_system_latch_w) |
| 149 | 169 | ADDRESS_MAP_END |
| 150 | 170 | |
| 151 | 171 | /* Input ports */ |
| r5899 | r5900 | |
| 154 | 174 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) |
| 155 | 175 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) |
| 156 | 176 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) |
| 157 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| 177 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| 158 | 178 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) |
| 159 | 179 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) |
| 160 | 180 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) |
| 161 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) |
| 181 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) |
| 162 | 182 | INPUT_PORTS_END |
| 163 | 183 | |
| 164 | 184 | static UINT8 irq_vector = 0x00; |
| r5899 | r5900 | |
| 166 | 186 | static INTERRUPT_GEN( pc6001_interrupt ) |
| 167 | 187 | { |
| 168 | 188 | irq_vector = 0x16; |
| 169 | | cpu_set_input_line(device, 0, HOLD_LINE); |
| 189 | cpu_set_input_line(device, 0, ASSERT_LINE); |
| 170 | 190 | } |
| 171 | 191 | |
| 192 | static INTERRUPT_GEN( key_irq ) |
| 193 | { |
| 194 | irq_vector = 0x14; |
| 195 | cpu_set_input_line(device, 0, ASSERT_LINE); |
| 196 | } |
| 197 | |
| 172 | 198 | static IRQ_CALLBACK ( pc6001_irq_callback ) |
| 173 | 199 | { |
| 200 | cpu_set_input_line(device, 0, CLEAR_LINE); |
| 174 | 201 | return irq_vector; |
| 175 | 202 | } |
| 176 | 203 | |
| r5899 | r5900 | |
| 178 | 205 | { |
| 179 | 206 | port_c_8255=0; |
| 180 | 207 | pc6001_video_ram = pc6001_ram; |
| 181 | | |
| 208 | |
| 182 | 209 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"),pc6001_irq_callback); |
| 183 | 210 | } |
| 184 | 211 | |
| r5899 | r5900 | |
| 200 | 227 | return 0; |
| 201 | 228 | } |
| 202 | 229 | static WRITE8_DEVICE_HANDLER (pc6001_8255_porta_w ) |
| 203 | | { |
| 204 | | // logerror("pc6001_8255_porta_w %02x\n",data); |
| 230 | { |
| 231 | // logerror("pc6001_8255_porta_w %02x\n",data); |
| 205 | 232 | } |
| 206 | 233 | |
| 207 | 234 | static READ8_DEVICE_HANDLER (pc6001_8255_portb_r ) |
| r5899 | r5900 | |
| 209 | 236 | return 0; |
| 210 | 237 | } |
| 211 | 238 | static WRITE8_DEVICE_HANDLER (pc6001_8255_portb_w ) |
| 212 | | { |
| 213 | | //logerror("pc6001_8255_portb_w %02x\n",data); |
| 239 | { |
| 240 | //logerror("pc6001_8255_portb_w %02x\n",data); |
| 214 | 241 | } |
| 215 | 242 | |
| 216 | 243 | static WRITE8_DEVICE_HANDLER (pc6001_8255_portc_w ) |
| 217 | | { |
| 218 | | //logerror("pc6001_8255_portc_w %02x\n",data); |
| 244 | { |
| 245 | //logerror("pc6001_8255_portc_w %02x\n",data); |
| 219 | 246 | } |
| 220 | 247 | |
| 221 | 248 | static READ8_DEVICE_HANDLER (pc6001_8255_portc_r ) |
| 222 | | { |
| 249 | { |
| 223 | 250 | return 0x88; |
| 224 | 251 | } |
| 225 | 252 | |
| r5899 | r5900 | |
| 256 | 283 | MDRV_CPU_PROGRAM_MAP(pc6001_mem) |
| 257 | 284 | MDRV_CPU_IO_MAP(pc6001_io) |
| 258 | 285 | MDRV_CPU_VBLANK_INT("screen", pc6001_interrupt) |
| 286 | MDRV_CPU_PERIODIC_INT(key_irq,25) |
| 259 | 287 | |
| 260 | 288 | // MDRV_CPU_ADD("subcpu", I8049, 7987200) |
| 261 | | |
| 289 | |
| 262 | 290 | MDRV_MACHINE_RESET(pc6001) |
| 263 | 291 | |
| 264 | | /* video hardware */ |
| 292 | /* video hardware */ |
| 265 | 293 | MDRV_SCREEN_ADD("screen", RASTER) |
| 266 | 294 | MDRV_SCREEN_REFRESH_RATE(M6847_NTSC_FRAMES_PER_SECOND) |
| 267 | 295 | MDRV_VIDEO_START(pc6001) |
| r5899 | r5900 | |
| 270 | 298 | MDRV_SCREEN_SIZE(320, 25+192+26) |
| 271 | 299 | MDRV_SCREEN_VISIBLE_AREA(0, 319, 1, 239) |
| 272 | 300 | |
| 301 | MDRV_I8255A_ADD( "ppi8255", pc6001_ppi8255_interface ) |
| 302 | /* uart */ |
| 303 | MDRV_MSM8251_ADD("uart", pc6001_usart_interface) |
| 304 | |
| 273 | 305 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 274 | 306 | MDRV_SOUND_ADD("ay8910", AY8910, XTAL_4MHz/2) |
| 275 | 307 | MDRV_SOUND_CONFIG(pc6001_ay_interface) |
| 276 | 308 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 277 | | |
| 278 | | MDRV_I8255A_ADD( "ppi8255", pc6001_ppi8255_interface ) |
| 279 | | /* uart */ |
| 280 | | MDRV_MSM8251_ADD("uart", pc6001_usart_interface) |
| 281 | | |
| 282 | 309 | MACHINE_DRIVER_END |
| 283 | 310 | |
| 284 | 311 | static MACHINE_DRIVER_START( pc6001sr ) |