src/mess/machine/kay_kbd.c
| r4673 | r4674 | |
| 169 | 169 | static UINT8 kbd_head = 0; |
| 170 | 170 | static UINT8 kbd_tail = 0; |
| 171 | 171 | static UINT8 beep_on = 0; |
| 172 | static UINT8 control_status = 0; |
| 172 | 173 | static UINT8 keyrows[10] = { 0,0,0,0,0,0,0,0,0,0 }; |
| 173 | 174 | static const char keyboard[8][10][8] = { |
| 174 | 175 | { /* normal */ |
| r4673 | r4674 | |
| 276 | 277 | set_led_status(1, 0); |
| 277 | 278 | kay_kbd_beeper = devtag_get_device(machine, "beep"); |
| 278 | 279 | beep_on = 1; |
| 280 | control_status = 0x14; |
| 279 | 281 | beep_set_state(kay_kbd_beeper, 0); |
| 280 | 282 | beep_set_frequency(kay_kbd_beeper, 950); /* piezo-device needs to be measured */ |
| 281 | 283 | kbd_head = kbd_tail = 0; /* init buffer */ |
| r4673 | r4674 | |
| 420 | 422 | UINT8 kay_kbd_c_r( void ) |
| 421 | 423 | { |
| 422 | 424 | /* d4 transmit buffer empty - 1=ok to send |
| 425 | d2 appears to be receive buffer empty - 1=ok to receive |
| 423 | 426 | d0 keyboard buffer empty - 1=key waiting to be used */ |
| 424 | 427 | |
| 425 | | UINT8 data = 0x10; |
| 428 | UINT8 data = control_status; |
| 426 | 429 | |
| 427 | 430 | if( kbd_head != kbd_tail ) |
| 428 | 431 | data++; |
| r4673 | r4674 | |
| 448 | 451 | static TIMER_CALLBACK( kay_kbd_beepoff ) |
| 449 | 452 | { |
| 450 | 453 | beep_set_state(kay_kbd_beeper, 0); |
| 454 | control_status |= 4; |
| 451 | 455 | } |
| 452 | 456 | |
| 453 | 457 | void kay_kbd_d_w( running_machine *machine, UINT8 data ) |
| r4673 | r4674 | |
| 480 | 484 | |
| 481 | 485 | if (length) |
| 482 | 486 | { |
| 487 | control_status &= 0xfb; |
| 483 | 488 | timer_set(machine, ATTOTIME_IN_MSEC(length), NULL, 0, kay_kbd_beepoff); |
| 484 | 489 | beep_set_state(kay_kbd_beeper, 1); |
| 485 | 490 | } |
src/mess/machine/kaypro.c
| r4673 | r4674 | |
| 4 | 4 | #include "machine/ctronics.h" |
| 5 | 5 | #include "machine/kay_kbd.h" |
| 6 | 6 | #include "devices/basicdsk.h" |
| 7 | #include "devices/snapquik.h" |
| 7 | 8 | #include "includes/kaypro.h" |
| 8 | 9 | |
| 9 | 10 | |
| r4673 | r4674 | |
| 14 | 15 | static const device_config *kaypro_printer; |
| 15 | 16 | static const device_config *kaypro_fdc; |
| 16 | 17 | |
| 17 | | UINT8 kaypro2x_system_port; |
| 18 | UINT8 kaypro_system_port; |
| 18 | 19 | |
| 19 | 20 | |
| 20 | 21 | /*********************************************************** |
| r4673 | r4674 | |
| 34 | 35 | { |
| 35 | 36 | /* d3 Centronics ready flag */ |
| 36 | 37 | |
| 37 | | return ~centronics_busy_r(kaypro_printer) << 3; |
| 38 | UINT8 data = ~centronics_busy_r(kaypro_printer) << 3; |
| 39 | return (kaypro_system_port & 0xf7) | (data & 8) ; |
| 38 | 40 | } |
| 39 | 41 | |
| 40 | 42 | static WRITE8_DEVICE_HANDLER( pio_system_w ) |
| r4673 | r4674 | |
| 76 | 78 | wd17xx_set_drive(kaypro_fdc, 1); |
| 77 | 79 | |
| 78 | 80 | wd17xx_set_side(kaypro_fdc, (data & 4) ? 1 : 0); /* only has one side but this circuit exists... */ |
| 81 | |
| 82 | kaypro_system_port = data; |
| 79 | 83 | } |
| 80 | 84 | |
| 81 | 85 | const z80pio_interface kayproii_pio_g_intf = |
| r4673 | r4674 | |
| 139 | 143 | READ8_HANDLER( kaypro2x_system_port_r ) |
| 140 | 144 | { |
| 141 | 145 | UINT8 data = centronics_busy_r(kaypro_printer) << 6; |
| 142 | | return data | kaypro2x_system_port; |
| 146 | return (kaypro_system_port & 0xbf) | data; |
| 143 | 147 | } |
| 144 | 148 | |
| 145 | 149 | WRITE8_HANDLER( kaypro2x_system_port_w ) |
| r4673 | r4674 | |
| 156 | 160 | /* get address space */ |
| 157 | 161 | const address_space *mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 158 | 162 | |
| 159 | | kaypro2x_system_port = data & 0xbf; |
| 160 | | |
| 161 | 163 | if (data & 0x80) |
| 162 | 164 | { |
| 163 | 165 | memory_install_readwrite8_handler (mem, 0x0000, 0x3fff, 0, 0, SMH_UNMAP, SMH_UNMAP); |
| r4673 | r4674 | |
| 183 | 185 | wd17xx_set_drive(kaypro_fdc, 1); |
| 184 | 186 | |
| 185 | 187 | wd17xx_set_side(kaypro_fdc, (data & 4) ? 0 : 1); |
| 188 | |
| 189 | kaypro_system_port = data; |
| 186 | 190 | } |
| 187 | 191 | |
| 188 | 192 | |
| r4673 | r4674 | |
| 432 | 436 | MACHINE_RESET_CALL(kay_kbd); |
| 433 | 437 | } |
| 434 | 438 | |
| 439 | |
| 440 | /*********************************************************** |
| 441 | |
| 442 | Quickload |
| 443 | |
| 444 | This loads a .COM file to address 0x100 then jumps |
| 445 | there. Sometimes .COM has been renamed to .CPM to |
| 446 | prevent windows going ballistic. These can be loaded |
| 447 | as well. |
| 448 | |
| 449 | ************************************************************/ |
| 450 | |
| 451 | QUICKLOAD_LOAD( kayproii ) |
| 452 | { |
| 453 | const device_config *cpu = cputag_get_cpu(image->machine, "maincpu"); |
| 454 | UINT8 *RAM = memory_region(image->machine, "rambank"); |
| 455 | UINT16 i; |
| 456 | UINT8 data; |
| 457 | |
| 458 | /* Load image to the TPA (Transient Program Area) */ |
| 459 | for (i = 0; i < quickload_size; i++) |
| 460 | { |
| 461 | if (image_fread(image, &data, 1) != 1) return INIT_FAIL; |
| 462 | |
| 463 | RAM[i+0x100] = data; |
| 464 | } |
| 465 | |
| 466 | // if (input_port_read(image->machine, "CONFIG") & 1) |
| 467 | { |
| 468 | pio_system_w(kayproii_z80pio_s, 0, kaypro_system_port & 0x7f); // switch TPA in |
| 469 | RAM[0x80]=0; // clear out command tail |
| 470 | RAM[0x81]=0; |
| 471 | cpu_set_reg(cpu, REG_GENPC, 0x100); // start program |
| 472 | } |
| 473 | |
| 474 | return INIT_PASS; |
| 475 | } |
| 476 | |
| 477 | QUICKLOAD_LOAD( kaypro2x ) |
| 478 | { |
| 479 | const address_space *space = cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 480 | const device_config *cpu = cputag_get_cpu(image->machine, "maincpu"); |
| 481 | UINT8 *RAM = memory_region(image->machine, "rambank"); |
| 482 | UINT16 i; |
| 483 | UINT8 data; |
| 484 | |
| 485 | for (i = 0; i < quickload_size; i++) |
| 486 | { |
| 487 | if (image_fread(image, &data, 1) != 1) return INIT_FAIL; |
| 488 | |
| 489 | RAM[i+0x100] = data; |
| 490 | } |
| 491 | |
| 492 | // if (input_port_read(image->machine, "CONFIG") & 1) |
| 493 | { |
| 494 | kaypro2x_system_port_w(space, 0, kaypro_system_port & 0x7f); |
| 495 | RAM[0x80]=0; |
| 496 | RAM[0x81]=0; |
| 497 | cpu_set_reg(cpu, REG_GENPC, 0x100); |
| 498 | } |
| 499 | |
| 500 | return INIT_PASS; |
| 501 | } |
src/mess/drivers/kaypro.c
| r4673 | r4674 | |
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | Things that need doing: |
| 22 | | - Floppy disks (I have no knowledge of how to set these up) |
| 23 | 22 | |
| 23 | - Need schematics of 2x and kaypro10 (used 2-84 which doesn't seem to be the same). |
| 24 | They currently are not reading any data from disk. |
| 24 | 25 | |
| 26 | - omni2 and kaypro4 would (I believe) boot up if we had a proper boot disk. The IMD |
| 27 | conversions seem to have the tracks scrambled (e.g reading side 0 track 1 gives us |
| 28 | side 1 track 0). |
| 29 | |
| 30 | - Kaypro2x and Kaypro10 don't centre the display at boot, but a soft reset fixes it. |
| 31 | Perhaps the guesswork emulation of the video ULA is incomplete. |
| 32 | |
| 33 | |
| 25 | 34 | **************************************************************************************************/ |
| 26 | 35 | |
| 27 | 36 | |
| r4673 | r4674 | |
| 31 | 40 | #include "machine/ctronics.h" |
| 32 | 41 | #include "machine/kay_kbd.h" |
| 33 | 42 | #include "sound/beep.h" |
| 43 | #include "devices/snapquik.h" |
| 34 | 44 | #include "includes/kaypro.h" |
| 35 | 45 | |
| 36 | 46 | |
| r4673 | r4674 | |
| 155 | 165 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 156 | 166 | |
| 157 | 167 | /* devices */ |
| 168 | MDRV_QUICKLOAD_ADD("quickload", kayproii, "com,cpm", 3) |
| 158 | 169 | MDRV_WD1793_ADD("wd1793", kaypro_wd1793_interface ) |
| 159 | 170 | MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 160 | 171 | MDRV_Z80PIO_ADD( "z80pio_g", kayproii_pio_g_intf ) |
| r4673 | r4674 | |
| 162 | 173 | MDRV_Z80SIO_ADD( "z80sio", 4800, kaypro_sio_intf ) /* start at 300 baud */ |
| 163 | 174 | MACHINE_DRIVER_END |
| 164 | 175 | |
| 165 | | static MACHINE_DRIVER_START( omni2 ) |
| 166 | | MDRV_IMPORT_FROM( kayproii ) |
| 167 | | MDRV_VIDEO_UPDATE( omni2 ) |
| 168 | | MACHINE_DRIVER_END |
| 169 | | |
| 170 | 176 | static MACHINE_DRIVER_START( kaypro2x ) |
| 171 | 177 | /* basic machine hardware */ |
| 172 | 178 | MDRV_CPU_ADD("maincpu", Z80, 4000000) /* 4 MHz */ |
| r4673 | r4674 | |
| 198 | 204 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 199 | 205 | |
| 200 | 206 | /* devices */ |
| 207 | MDRV_QUICKLOAD_ADD("quickload", kaypro2x, "com,cpm", 3) |
| 201 | 208 | MDRV_WD179X_ADD("wd1793", kaypro_wd1793_interface ) |
| 202 | 209 | MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 203 | 210 | MDRV_Z80SIO_ADD( "z80sio", 4800, kaypro_sio_intf ) |
| 204 | 211 | MDRV_Z80SIO_ADD( "z80sio_2x", 4800, kaypro_sio_intf ) /* extra sio for modem and printer */ |
| 205 | 212 | MACHINE_DRIVER_END |
| 206 | 213 | |
| 214 | static MACHINE_DRIVER_START( omni2 ) |
| 215 | MDRV_IMPORT_FROM( kayproii ) |
| 216 | MDRV_VIDEO_UPDATE( omni2 ) |
| 217 | MACHINE_DRIVER_END |
| 218 | |
| 207 | 219 | /*********************************************************** |
| 208 | 220 | |
| 209 | 221 | Game driver |