Previous 15994 Revisions Next

r4674 Tuesday 12th May, 2009 at 12:52:59 UTC by Robbbert
[KAYPRO] 1. Added quickload of COM files
2. kayproii - fixed read of system port
3. kay_kbd - fixed hang when outputting BEL character.
[src/mess/drivers]kaypro.c
[src/mess/includes]kaypro.h
[src/mess/machine]kay_kbd.c kaypro.c

src/mess/includes/kaypro.h
r4673r4674
3535MACHINE_RESET( kayproii );
3636MACHINE_RESET( kaypro2x );
3737
38QUICKLOAD_LOAD( kayproii );
39QUICKLOAD_LOAD( kaypro2x );
40
3841/* video.c */
3942
4043MC6845_UPDATE_ROW( kaypro2x_update_row );
src/mess/machine/kay_kbd.c
r4673r4674
169169static UINT8 kbd_head = 0;
170170static UINT8 kbd_tail = 0;
171171static UINT8 beep_on = 0;
172static UINT8 control_status = 0;
172173static UINT8 keyrows[10] = { 0,0,0,0,0,0,0,0,0,0 };
173174static const char keyboard[8][10][8] = {
174175   { /* normal */
r4673r4674
276277   set_led_status(1, 0);
277278   kay_kbd_beeper = devtag_get_device(machine, "beep");
278279   beep_on = 1;
280   control_status = 0x14;
279281   beep_set_state(kay_kbd_beeper, 0);
280282   beep_set_frequency(kay_kbd_beeper, 950);   /* piezo-device needs to be measured */
281283   kbd_head = kbd_tail = 0;         /* init buffer */
r4673r4674
420422UINT8 kay_kbd_c_r( void )
421423{
422424/*   d4 transmit buffer empty - 1=ok to send
425   d2 appears to be receive buffer empty - 1=ok to receive
423426   d0 keyboard buffer empty - 1=key waiting to be used */
424427
425   UINT8 data = 0x10;
428   UINT8 data = control_status;
426429
427430   if( kbd_head != kbd_tail )
428431      data++;
r4673r4674
448451static TIMER_CALLBACK( kay_kbd_beepoff )
449452{
450453   beep_set_state(kay_kbd_beeper, 0);
454   control_status |= 4;
451455}
452456
453457void kay_kbd_d_w( running_machine *machine, UINT8 data )
r4673r4674
480484
481485      if (length)
482486      {
487         control_status &= 0xfb;
483488         timer_set(machine, ATTOTIME_IN_MSEC(length), NULL, 0, kay_kbd_beepoff);
484489         beep_set_state(kay_kbd_beeper, 1);
485490      }
src/mess/machine/kaypro.c
r4673r4674
44#include "machine/ctronics.h"
55#include "machine/kay_kbd.h"
66#include "devices/basicdsk.h"
7#include "devices/snapquik.h"
78#include "includes/kaypro.h"
89
910
r4673r4674
1415static const device_config *kaypro_printer;
1516static const device_config *kaypro_fdc;
1617
17UINT8 kaypro2x_system_port;
18UINT8 kaypro_system_port;
1819
1920
2021/***********************************************************
r4673r4674
3435{
3536/*   d3 Centronics ready flag */
3637
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) ;
3840}
3941
4042static WRITE8_DEVICE_HANDLER( pio_system_w )
r4673r4674
7678      wd17xx_set_drive(kaypro_fdc, 1);
7779
7880   wd17xx_set_side(kaypro_fdc, (data & 4) ? 1 : 0);   /* only has one side but this circuit exists... */
81
82   kaypro_system_port = data;
7983}
8084
8185const z80pio_interface kayproii_pio_g_intf =
r4673r4674
139143READ8_HANDLER( kaypro2x_system_port_r )
140144{
141145   UINT8 data = centronics_busy_r(kaypro_printer) << 6;
142   return data | kaypro2x_system_port;
146   return (kaypro_system_port & 0xbf) | data;
143147}
144148
145149WRITE8_HANDLER( kaypro2x_system_port_w )
r4673r4674
156160   /* get address space */
157161   const address_space *mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
158162
159   kaypro2x_system_port = data & 0xbf;
160
161163   if (data & 0x80)
162164   {
163165      memory_install_readwrite8_handler (mem, 0x0000, 0x3fff, 0, 0, SMH_UNMAP, SMH_UNMAP);
r4673r4674
183185      wd17xx_set_drive(kaypro_fdc, 1);
184186
185187   wd17xx_set_side(kaypro_fdc, (data & 4) ? 0 : 1);
188
189   kaypro_system_port = data;
186190}
187191
188192
r4673r4674
432436   MACHINE_RESET_CALL(kay_kbd);
433437}
434438
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
451QUICKLOAD_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
477QUICKLOAD_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
r4673r4674
1919
2020
2121   Things that need doing:
22   - Floppy disks (I have no knowledge of how to set these up)
2322
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.
2425
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
2534**************************************************************************************************/
2635
2736
r4673r4674
3140#include "machine/ctronics.h"
3241#include "machine/kay_kbd.h"
3342#include "sound/beep.h"
43#include "devices/snapquik.h"
3444#include "includes/kaypro.h"
3545
3646
r4673r4674
155165   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
156166
157167   /* devices */
168   MDRV_QUICKLOAD_ADD("quickload", kayproii, "com,cpm", 3)
158169   MDRV_WD1793_ADD("wd1793", kaypro_wd1793_interface )
159170   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
160171   MDRV_Z80PIO_ADD( "z80pio_g", kayproii_pio_g_intf )
r4673r4674
162173   MDRV_Z80SIO_ADD( "z80sio", 4800, kaypro_sio_intf )   /* start at 300 baud */
163174MACHINE_DRIVER_END
164175
165static MACHINE_DRIVER_START( omni2 )
166   MDRV_IMPORT_FROM( kayproii )
167   MDRV_VIDEO_UPDATE( omni2 )
168MACHINE_DRIVER_END
169
170176static MACHINE_DRIVER_START( kaypro2x )
171177   /* basic machine hardware */
172178   MDRV_CPU_ADD("maincpu", Z80, 4000000)   /* 4 MHz */
r4673r4674
198204   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
199205
200206   /* devices */
207   MDRV_QUICKLOAD_ADD("quickload", kaypro2x, "com,cpm", 3)
201208   MDRV_WD179X_ADD("wd1793", kaypro_wd1793_interface )
202209   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
203210   MDRV_Z80SIO_ADD( "z80sio", 4800, kaypro_sio_intf )
204211   MDRV_Z80SIO_ADD( "z80sio_2x", 4800, kaypro_sio_intf )   /* extra sio for modem and printer */
205212MACHINE_DRIVER_END
206213
214static MACHINE_DRIVER_START( omni2 )
215   MDRV_IMPORT_FROM( kayproii )
216   MDRV_VIDEO_UPDATE( omni2 )
217MACHINE_DRIVER_END
218
207219/***********************************************************
208220
209221   Game driver

Previous 15994 Revisions Next


© 1998-2018 The MESS Team