Previous 15994 Revisions Next

r4394 Thursday 5th March, 2009 at 18:53:48 UTC by Wilbert Pol
[THOMSON family] Converted to use the 6821 pia device implementation
[src/mess/drivers]thomson.c
[src/mess/includes]thomson.h
[src/mess/machine]thomson.c

src/mess/includes/thomson.h
r4393r4394
1111
1212#include "driver.h"
1313#include "cpu/m6809/m6809.h"
14#include "machine/6821pia.h"
14#include "machine/6821new.h"
1515#include "machine/mc6846.h"
1616#include "machine/6850acia.h"
1717#include "machine/6551.h"
r4393r4394
3535/*************************** common ********************************/
3636
3737/* 6821 PIAs */
38#define THOM_PIA_SYS    0  /* system PIA */
39#define THOM_PIA_GAME   1  /* music & game PIA (joypad + sound) */
40#define THOM_PIA_IO     2  /* CC 90-232 I/O extension (parallel & RS-232) */
41#define THOM_PIA_MODEM  3  /* MD 90-120 MODEM extension */
38#define THOM_PIA_SYS    "pia_0"  /* system PIA */
39#define THOM_PIA_GAME   "pia_1"  /* music & game PIA (joypad + sound) */
40#define THOM_PIA_IO     "pia_2"  /* CC 90-232 I/O extension (parallel & RS-232) */
41#define THOM_PIA_MODEM  "pia_3"  /* MD 90-120 MODEM extension */
4242
4343/* sound ports */
4444#define THOM_SOUND_BUZ    0 /* 1-bit buzzer */
r4393r4394
6262extern DEVICE_IMAGE_LOAD( thom_serial );
6363extern DEVICE_IMAGE_UNLOAD( thom_serial );
6464
65extern const pia6821_interface to7_pia6821_sys;
66extern const pia6821_interface to7_pia6821_io;
67extern const pia6821_interface to7_pia6821_modem;
68extern const pia6821_interface to7_pia6821_game;
69extern const pia6821_interface to770_pia6821_sys;
70extern const pia6821_interface mo5_pia6821_sys;
71extern const pia6821_interface to9_pia6821_sys;
72extern const pia6821_interface to8_pia6821_sys;
73extern const pia6821_interface to9p_pia6821_sys;
74extern const pia6821_interface mo6_pia6821_game;
75extern const pia6821_interface mo6_pia6821_sys;
76extern const pia6821_interface mo5nr_pia6821_sys;
77extern const pia6821_interface mo5nr_pia6821_game;
78
6579/***************************** TO7 / T9000 *************************/
6680
6781/* cartridge bank-switching */
src/mess/machine/thomson.c
r4393r4394
1010#include "devices/thomflop.h"
1111#include "formats/thom_dsk.h"
1212#include "includes/thomson.h"
13#include "machine/6821new.h"
1314#include "machine/ctronics.h"
1415
1516#define VERBOSE       0
r4393r4394
136137
137138
138139
139static WRITE8_HANDLER ( to7_set_cassette_motor )
140static WRITE8_DEVICE_HANDLER ( to7_set_cassette_motor )
140141{
141   const device_config* img = thom_cassette_img( space->machine );
142   const device_config* img = thom_cassette_img( device->machine );
142143   cassette_state state = cassette_get_state( img );
143144   double pos = cassette_get_position(img);
144145
145146   LOG (( "$%04x %f to7_set_cassette_motor: cassette motor %s bitpos=%i\n",
146          cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(img->machine)), data ? "off" : "on",
147          cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(img->machine)), data ? "off" : "on",
147148          (int) (pos / TO7_BIT_LENGTH) ));
148149
149150   if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 )
r4393r4394
211212
212213
213214
214static WRITE8_HANDLER ( mo5_set_cassette_motor )
215static WRITE8_DEVICE_HANDLER ( mo5_set_cassette_motor )
215216{
216   const device_config* img = thom_cassette_img( space->machine );
217   const device_config* img = thom_cassette_img( device->machine );
217218   cassette_state state = cassette_get_state( img );
218219   double pos = cassette_get_position(img);
219220
220221   LOG (( "$%04x %f mo5_set_cassette_motor: cassette motor %s hbitpos=%i\n",
221          cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data ? "off" : "on",
222          cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), data ? "off" : "on",
222223          (int) (pos / MO5_HBIT_LENGTH) ));
223224
224225   if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED &&  !data && pos > 0.3 )
r4393r4394
316317
317318
318319
319static void thom_irq_1  ( running_machine *machine, int state )
320static WRITE_LINE_DEVICE_HANDLER( thom_irq_1 )
320321{
321   thom_set_irq  ( machine, 1, state );
322   thom_set_irq  ( device->machine, 1, state );
322323}
323324
324325static void thom_irq_3  ( running_machine *machine, int state )
r4393r4394
326327   thom_set_irq  ( machine, 3, state );
327328}
328329
329static void thom_firq_1 ( running_machine *machine, int state )
330static WRITE_LINE_DEVICE_HANDLER( thom_firq_1 )
330331{
331   thom_set_firq ( machine, 1, state );
332   thom_set_firq ( device->machine, 1, state );
332333}
333334
334335static void thom_firq_2 ( running_machine *machine, int state )
r4393r4394
616617
617618static void to7_lightpen_cb ( running_machine *machine, int step )
618619{
620   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
621
619622   if ( ! to7_lightpen )
620623      return;
621624
622625   LOG_VIDEO(( "%f to7_lightpen_cb: step=%i\n", attotime_to_double(timer_get_time(machine)), step ));
623   pia_set_input_cb1( THOM_PIA_SYS, 1 );
624   pia_set_input_cb1( THOM_PIA_SYS, 0 );
626   pia_cb1_w( sys_pia, 0, 1 );
627   pia_cb1_w( sys_pia, 0, 0 );
625628   to7_lightpen_step = step;
626629}
627630
r4393r4394
633636
634637static void to7_set_init ( running_machine *machine, int init )
635638{
639   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
636640   /* INIT signal wired to system PIA 6821 */
637641
638642   LOG_VIDEO(( "%f to7_set_init: init=%i\n", attotime_to_double(timer_get_time(machine)), init ));
639   pia_set_input_ca1( THOM_PIA_SYS, init );
643   pia_ca1_w( sys_pia, 0, init );
640644}
641645
642646
r4393r4394
645649
646650
647651
648static WRITE8_HANDLER ( to7_sys_cb2_out )
652static WRITE8_DEVICE_HANDLER ( to7_sys_cb2_out )
649653{
650654   to7_lightpen = !data;
651655}
652656
653657
654658
655static WRITE8_HANDLER ( to7_sys_portb_out )
659static WRITE8_DEVICE_HANDLER ( to7_sys_portb_out )
656660{
657661   /* value fetched in to7_sys_porta_in */
658662}
r4393r4394
663667
664668
665669
666static READ8_HANDLER ( to7_sys_porta_in )
670static READ8_DEVICE_HANDLER ( to7_sys_porta_in )
667671{
668672   if ( to7_lightpen )
669673   {
670674      /* lightpen hi */
671      return to7_lightpen_gpl( space->machine, TO7_LIGHTPEN_DECAL, to7_lightpen_step ) >> 8;
675      return to7_lightpen_gpl( device->machine, TO7_LIGHTPEN_DECAL, to7_lightpen_step ) >> 8;
672676   }
673677   else
674678   {
675679      /* keyboard  */
676      int keyline = pia_get_output_b( THOM_PIA_SYS );
680      int keyline = pianew_get_output_b( device );
677681      UINT8 val = 0xff;
678682      int i;
679683      static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3",
r4393r4394
682686      for ( i = 0; i < 8; i++ )
683687      {
684688         if ( ! (keyline & (1 << i)) )
685            val &= input_port_read(space->machine, keynames[i]);
689            val &= input_port_read(device->machine, keynames[i]);
686690      }
687691      return val;
688692   }
r4393r4394
690694
691695
692696
693static READ8_HANDLER ( to7_sys_portb_in )
697static READ8_DEVICE_HANDLER ( to7_sys_portb_in )
694698{
695699   /* lightpen low */
696   return to7_lightpen_gpl( space->machine, TO7_LIGHTPEN_DECAL, to7_lightpen_step ) & 0xff;
700   return to7_lightpen_gpl( device->machine, TO7_LIGHTPEN_DECAL, to7_lightpen_step ) & 0xff;
697701}
698702
699703
700704
701static const pia6821_interface to7_sys =
705const pia6821_interface to7_pia6821_sys =
702706{
703   to7_sys_porta_in, to7_sys_portb_in,
704   NULL, NULL, NULL, NULL,
705   NULL, to7_sys_portb_out, to7_set_cassette_motor, to7_sys_cb2_out,
706   thom_firq_1, thom_firq_1
707   DEVCB_HANDLER(to7_sys_porta_in),
708   DEVCB_HANDLER(to7_sys_portb_in),
709   DEVCB_NULL,
710   DEVCB_NULL,
711   DEVCB_NULL,
712   DEVCB_NULL,
713   DEVCB_NULL,
714   DEVCB_HANDLER(to7_sys_portb_out),
715   DEVCB_HANDLER(to7_set_cassette_motor),
716   DEVCB_HANDLER(to7_sys_cb2_out),
717   DEVCB_LINE(thom_firq_1),
718   DEVCB_LINE(thom_firq_1)
707719};
708720
709721
r4393r4394
747759
748760static WRITE_LINE_DEVICE_HANDLER( to7_io_ack )
749761{
750   pia_set_input_cb1(THOM_PIA_IO, state);
762   const device_config *io_pia = devtag_get_device( device->machine, PIA6821, THOM_PIA_IO );
763
764   pia_cb1_w( io_pia, 0, state);
751765   //LOG_IO (( "%f to7_io_ack: CENTRONICS new state $%02X (ack=%i)\n", attotime_to_double(timer_get_time(machine)), data, ack ));
752766}
753767
754768
755769
756static WRITE8_HANDLER ( to7_io_porta_out )
770static WRITE8_DEVICE_HANDLER ( to7_io_porta_out )
757771{
758772   int tx  = data & 1;
759773   int dtr = ( data & 2 ) ? 1 : 0;
760774
761   LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n",  cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), tx, dtr ));
775   LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n",  cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), tx, dtr ));
762776   if ( dtr )
763777      to7_io_line.State |=  SERIAL_STATE_DTR;
764778   else
765779      to7_io_line.State &= ~SERIAL_STATE_DTR;
766780
767781   set_out_data_bit( to7_io_line.State, tx );
768   serial_connection_out( space->machine, &to7_io_line );
782   serial_connection_out( device->machine, &to7_io_line );
769783}
770784
771785
772786
773static READ8_HANDLER( to7_io_porta_in )
787static READ8_DEVICE_HANDLER( to7_io_porta_in )
774788{
775   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
789   const device_config *printer = devtag_get_device(device->machine, CENTRONICS, "centronics");
776790   int cts = 1;
777791   int dsr = ( to7_io_line.input_state & SERIAL_STATE_DSR ) ? 0 : 1;
778792   int rd  = get_in_data_bit( to7_io_line.input_state );
779793
780   if ( to7_io_mode(space->machine) == TO7_IO_RS232 )
794   if ( to7_io_mode(device->machine) == TO7_IO_RS232 )
781795      cts = to7_io_line.input_state & SERIAL_STATE_CTS ? 0 : 1;
782796   else
783797      cts = !centronics_busy_r(printer);
784798
785   LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), to7_io_mode(space->machine), cts, dsr, rd ));
799   LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), to7_io_mode(device->machine), cts, dsr, rd ));
786800
787801   return (dsr ? 0x20 : 0) | (cts ? 0x40 : 0) | (rd ? 0x80: 0);
788802}
789803
790804
791805
792static WRITE8_HANDLER( to7_io_portb_out )
806static WRITE8_DEVICE_HANDLER( to7_io_portb_out )
793807{
794   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
808   const device_config *printer = devtag_get_device(device->machine, CENTRONICS, "centronics");
795809
796   LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data ));
810   LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), data ));
797811
798812   /* set 8-bit data */
799813   centronics_data_w(printer, 0, data);
r4393r4394
801815
802816
803817
804static WRITE8_HANDLER( to7_io_cb2_out )
818static WRITE8_DEVICE_HANDLER( to7_io_cb2_out )
805819{
806   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
820   const device_config *printer = devtag_get_device(device->machine, CENTRONICS, "centronics");
807821
808   LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data ));
822   LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), data ));
809823
810824   /* send STROBE to printer */
811825   centronics_strobe_w(printer, data);
r4393r4394
823837
824838
825839
826static const pia6821_interface to7_io =
840const pia6821_interface to7_pia6821_io =
827841{
828   to7_io_porta_in, NULL, NULL, NULL, NULL, NULL,
829   to7_io_porta_out, to7_io_portb_out, NULL, to7_io_cb2_out,
830   thom_firq_1, thom_firq_1
842   DEVCB_HANDLER(to7_io_porta_in),
843   DEVCB_NULL,
844   DEVCB_NULL,
845   DEVCB_NULL,
846   DEVCB_NULL,
847   DEVCB_NULL,
848   DEVCB_HANDLER(to7_io_porta_out),
849   DEVCB_HANDLER(to7_io_portb_out),
850   DEVCB_NULL,
851   DEVCB_HANDLER(to7_io_cb2_out),
852   DEVCB_LINE(thom_firq_1),
853   DEVCB_LINE(thom_firq_1)
831854};
832855
833856
r4393r4394
842865
843866static void to7_io_reset( running_machine *machine )
844867{
868   const device_config *io_pia = devtag_get_device( machine, PIA6821, THOM_PIA_IO );
869
845870   LOG (( "to7_io_reset called\n" ));
846871
847   /* pia_reset() is called in MACHINE_RESET */
848   pia_set_port_a_z_mask( THOM_PIA_IO, 0x03 );
872   pianew_set_port_a_z_mask( io_pia, 0x03 );
849873   to7_io_line.input_state = SERIAL_STATE_CTS;
850874   to7_io_line.State &= ~SERIAL_STATE_DTR;
851875   to7_io_line.State |=  SERIAL_STATE_RTS;  /* always ready to send */
r4393r4394
858882static void to7_io_init( running_machine *machine )
859883{
860884   LOG (( "to7_io_init: CC 90-323 serial / parallel extension\n" ));
861   pia_config( machine, THOM_PIA_IO, &to7_io );
862885   serial_connection_init( machine, &to7_io_line );
863886   serial_connection_set_in_callback( machine, &to7_io_line, to7_io_in_cb );
864887}
r4393r4394
900923
901924
902925
903static const pia6821_interface to7_pia_modem =
926const pia6821_interface to7_pia6821_modem =
904927{
905   NULL, NULL, NULL, NULL, NULL, NULL,
906   NULL, NULL, NULL, NULL,
907   NULL, NULL
928   DEVCB_NULL,
929   DEVCB_NULL,
930   DEVCB_NULL,
931   DEVCB_NULL,
932   DEVCB_NULL,
933   DEVCB_NULL,
934   DEVCB_NULL,
935   DEVCB_NULL,
936   DEVCB_NULL,
937   DEVCB_NULL,
938   DEVCB_NULL,
939   DEVCB_NULL
908940};
909941
910942static READ_LINE_DEVICE_HANDLER( to7_modem_rx_r )
r4393r4394
945977static void to7_modem_init( running_machine *machine )
946978{
947979   LOG (( "to7_modem_init: MODEM not implemented!\n" ));
948   pia_config( machine, THOM_PIA_MODEM, &to7_pia_modem );
949980   state_save_register_global( machine, to7_modem_rx );
950981   state_save_register_global( machine, to7_modem_tx );
951982}
r4393r4394
10501081
10511082
10521083
1053static READ8_HANDLER ( to7_game_porta_in )
1084static READ8_DEVICE_HANDLER ( to7_game_porta_in )
10541085{
10551086   UINT8 data;
1056   if ( input_port_read(space->machine, "config") & 1 )
1087   if ( input_port_read(device->machine, "config") & 1 )
10571088   {
10581089      /* mouse */
1059      data = to7_get_mouse_signal(space->machine) & 0x0c;             /* XB, YB */
1060      data |= input_port_read(space->machine, "mouse_button") & 3; /* buttons */
1090      data = to7_get_mouse_signal(device->machine) & 0x0c;             /* XB, YB */
1091      data |= input_port_read(device->machine, "mouse_button") & 3; /* buttons */
10611092   }
10621093   else
10631094   {
10641095      /* joystick */
1065      data = input_port_read(space->machine, "game_port_directions");
1096      data = input_port_read(device->machine, "game_port_directions");
10661097      /* bit 0=0 => P1 up      bit 4=0 => P2 up
10671098         bit 1=0 => P1 down    bit 5=0 => P2 down
10681099         bit 2=0 => P1 left    bit 6=0 => P2 left
r4393r4394
10911122
10921123
10931124
1094static READ8_HANDLER ( to7_game_portb_in )
1125static READ8_DEVICE_HANDLER ( to7_game_portb_in )
10951126{
10961127   UINT8 data;
1097   if ( input_port_read(space->machine, "config") & 1 )
1128   if ( input_port_read(device->machine, "config") & 1 )
10981129   {
10991130      /* mouse */
1100      UINT8 mouse =  to7_get_mouse_signal(space->machine);
1131      UINT8 mouse =  to7_get_mouse_signal(device->machine);
11011132      data = 0;
11021133      if ( mouse & 1 )
11031134         data |= 0x04; /* XA */
r4393r4394
11111142      /* bits 2-3: action buttons B (0=pressed) */
11121143      /* bits 4-5: unused (ouput) */
11131144      /* bits 0-1: unknown! */
1114      data = input_port_read(space->machine, "game_port_buttons");
1145      data = input_port_read(device->machine, "game_port_buttons");
11151146   }
11161147   return data;
11171148}
11181149
11191150
11201151
1121static WRITE8_HANDLER ( to7_game_portb_out )
1152static WRITE8_DEVICE_HANDLER ( to7_game_portb_out )
11221153{
11231154   /* 6-bit DAC sound */
11241155   to7_game_sound = data & 0x3f;
1125   to7_game_sound_update(space->machine);
1156   to7_game_sound_update(device->machine);
11261157}
11271158
11281159
11291160
1130static WRITE8_HANDLER ( to7_game_cb2_out )
1161static WRITE8_DEVICE_HANDLER ( to7_game_cb2_out )
11311162{
11321163   /* undocumented */
11331164   /* some TO8 games (e.g.: F15) seem to write here a lot */
r4393r4394
11351166
11361167
11371168
1138static const pia6821_interface to7_game =
1169const pia6821_interface to7_pia6821_game =
11391170{
1140   to7_game_porta_in, to7_game_portb_in,
1141   NULL, NULL, NULL, NULL,
1142   NULL, to7_game_portb_out, NULL, to7_game_cb2_out,
1143   thom_irq_1, thom_irq_1
1171   DEVCB_HANDLER(to7_game_porta_in),
1172   DEVCB_HANDLER(to7_game_portb_in),
1173   DEVCB_NULL,
1174   DEVCB_NULL,
1175   DEVCB_NULL,
1176   DEVCB_NULL,
1177   DEVCB_NULL,
1178   DEVCB_HANDLER(to7_game_portb_out),
1179   DEVCB_NULL,
1180   DEVCB_HANDLER(to7_game_cb2_out),
1181   DEVCB_LINE(thom_irq_1),
1182   DEVCB_LINE(thom_irq_1)
11441183};
11451184
11461185
r4393r4394
11481187/* this should be called periodically */
11491188static TIMER_CALLBACK(to7_game_update_cb)
11501189{
1190   const device_config *game_pia = devtag_get_device( machine, PIA6821, THOM_PIA_GAME );
1191
11511192   if ( input_port_read(machine, "config") & 1 )
11521193   {
11531194      /* mouse */
11541195      UINT8 mouse = to7_get_mouse_signal(machine);
1155      pia_set_input_ca1( THOM_PIA_GAME, (mouse & 1) ? 1 : 0 ); /* XA */
1156      pia_set_input_ca2( THOM_PIA_GAME, (mouse & 2) ? 1 : 0 ); /* YA */
1196      pia_ca1_w( game_pia, 0, (mouse & 1) ? 1 : 0 ); /* XA */
1197      pia_ca2_w( game_pia, 0, (mouse & 2) ? 1 : 0 ); /* YA */
11571198   }
11581199   else
11591200   {
11601201      /* joystick */
11611202      UINT8 in = input_port_read(machine, "game_port_buttons");
1162      pia_set_input_cb2( THOM_PIA_GAME, (in & 0x80) ? 1 : 0 ); /* P2 action A */
1163      pia_set_input_ca2( THOM_PIA_GAME, (in & 0x40) ? 1 : 0 ); /* P1 action A */
1164      pia_set_input_cb1( THOM_PIA_GAME, (in & 0x08) ? 1 : 0 ); /* P2 action B */
1165      pia_set_input_ca1( THOM_PIA_GAME, (in & 0x04) ? 1 : 0 ); /* P1 action B */
1203      pia_cb2_w( game_pia, 0, (in & 0x80) ? 1 : 0 ); /* P2 action A */
1204      pia_ca2_w( game_pia, 0, (in & 0x40) ? 1 : 0 ); /* P1 action A */
1205      pia_cb1_w( game_pia, 0, (in & 0x08) ? 1 : 0 ); /* P2 action B */
1206      pia_ca1_w( game_pia, 0, (in & 0x04) ? 1 : 0 ); /* P1 action B */
11661207      /* TODO:
11671208         it seems that CM 90-112 behaves differently
11681209         - ca1 is P1 action A, i.e., in & 0x40
r4393r4394
11801221static void to7_game_init ( running_machine *machine )
11811222{
11821223   LOG (( "to7_game_init called\n" ));
1183   pia_config( machine, THOM_PIA_GAME, &to7_game );
11841224   to7_game_timer = timer_alloc( machine, to7_game_update_cb , NULL);
11851225   timer_adjust_periodic(to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD);
11861226   state_save_register_global( machine, to7_game_sound );
r4393r4394
11911231
11921232static void to7_game_reset ( running_machine *machine )
11931233{
1234   const device_config *game_pia = devtag_get_device( machine, PIA6821, THOM_PIA_GAME );
1235
11941236   LOG (( "to7_game_reset called\n" ));
1195   pia_set_input_ca1( THOM_PIA_GAME, 0 );
1237   pia_ca1_w( game_pia, 0, 0 );
11961238   to7_game_sound = 0;
11971239   to7_game_mute = 0;
11981240   to7_game_sound_update( machine );
r4393r4394
14571499
14581500MACHINE_RESET ( to7 )
14591501{
1502   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
1503
14601504   LOG (( "to7: machine reset called\n" ));
14611505
14621506   /* subsystems */
14631507   thom_irq_reset(machine);
1464   pia_reset();
14651508   to7_game_reset(machine);
14661509   to7_floppy_reset(machine);
14671510   to7_io_reset(machine);
r4393r4394
14741517   thom_set_lightpen_callback( machine, 3, to7_lightpen_cb );
14751518   thom_set_mode_point( machine, 0 );
14761519   thom_set_border_color( machine, 0 );
1477   pia_set_input_cb1( THOM_PIA_SYS, 0 );
1520   pia_cb1_w( sys_pia, 0, 0 );
14781521
14791522   /* memory */
14801523   to7_update_cart_bank(machine);
r4393r4394
14951538
14961539   /* subsystems */
14971540   thom_irq_init(machine);
1498   pia_config( machine, THOM_PIA_SYS, &to7_sys );
14991541   to7_game_init(machine);
15001542   to7_floppy_init(machine, mem + 0x20000);
15011543   to7_io_init(machine);
r4393r4394
15451587
15461588
15471589
1548static WRITE8_HANDLER ( to770_sys_cb2_out )
1590static WRITE8_DEVICE_HANDLER ( to770_sys_cb2_out )
15491591{
15501592   /* video overlay: black pixels are transparent and show TV image underneath */
1551   LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", cpu_get_previouspc( space->machine->cpu[0] ), data ));
1593   LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", cpu_get_previouspc( device->machine->cpu[0] ), data ));
15521594}
15531595
15541596
15551597
1556static READ8_HANDLER ( to770_sys_porta_in )
1598static READ8_DEVICE_HANDLER ( to770_sys_porta_in )
15571599{
15581600   /* keyboard */
15591601   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3",
15601602                              "keyboard_4", "keyboard_5", "keyboard_6", "keyboard_7" };
1561   int keyline = pia_get_output_b( THOM_PIA_SYS ) & 7;
1603   int keyline = pianew_get_output_b( device ) & 7;
15621604
1563   return input_port_read(space->machine, keynames[7 - keyline]);
1605   return input_port_read(device->machine, keynames[7 - keyline]);
15641606}
15651607
15661608
15671609
15681610static void to770_update_ram_bank(running_machine *machine)
15691611{
1612   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
15701613   const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
1571   UINT8 portb = pia_get_port_b_z_mask( THOM_PIA_SYS );
1614   UINT8 portb = pianew_get_port_b_z_mask( sys_pia );
15721615   static int old_bank = -1;
15731616   int bank;
15741617
r4393r4394
16171660
16181661
16191662
1620static WRITE8_HANDLER ( to770_sys_portb_out )
1663static WRITE8_DEVICE_HANDLER ( to770_sys_portb_out )
16211664{
1622   to770_update_ram_bank(space->machine);
1665   to770_update_ram_bank(device->machine);
16231666}
16241667
16251668
16261669
1627static const pia6821_interface to770_sys =
1670const pia6821_interface to770_pia6821_sys =
16281671{
1629   to770_sys_porta_in, NULL,
1630   NULL, NULL, NULL, NULL,
1631   NULL, to770_sys_portb_out, to7_set_cassette_motor, to770_sys_cb2_out,
1632   thom_firq_1, thom_firq_1
1672   DEVCB_HANDLER(to770_sys_porta_in),
1673   DEVCB_NULL,
1674   DEVCB_NULL,
1675   DEVCB_NULL,
1676   DEVCB_NULL,
1677   DEVCB_NULL,
1678   DEVCB_NULL,
1679   DEVCB_HANDLER(to770_sys_portb_out),
1680   DEVCB_HANDLER(to7_set_cassette_motor),
1681   DEVCB_HANDLER(to770_sys_cb2_out),
1682   DEVCB_LINE(thom_firq_1),
1683   DEVCB_LINE(thom_firq_1)
16331684};
16341685
16351686
r4393r4394
17021753
17031754MACHINE_RESET( to770 )
17041755{
1756   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
1757
17051758   LOG (( "to770: machine reset called\n" ));
17061759
17071760   /* subsystems */
17081761   thom_irq_reset(machine);
1709   pia_reset();
17101762   to7_game_reset(machine);
17111763   to7_floppy_reset(machine);
17121764   to7_io_reset(machine);
r4393r4394
17191771   thom_set_lightpen_callback( machine, 3, to7_lightpen_cb );
17201772   thom_set_mode_point( machine, 0 );
17211773   thom_set_border_color( machine, 8 );
1722   pia_set_input_cb1( THOM_PIA_SYS, 0 );
1774   pia_cb1_w( sys_pia, 0, 0 );
17231775
17241776   /* memory */
17251777   to7_update_cart_bank(machine);
r4393r4394
17401792
17411793   /* subsystems */
17421794   thom_irq_init(machine);
1743   pia_config( machine, THOM_PIA_SYS, &to770_sys );
17441795   to7_game_init(machine);
17451796   to7_floppy_init( machine, mem + 0x20000 );
17461797   to7_io_init(machine);
r4393r4394
17811832
17821833static void mo5_lightpen_cb ( running_machine *machine, int step )
17831834{
1835   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
1836
17841837   /* MO5 signals ca1 (TO7 signals cb1) */
17851838   if ( ! to7_lightpen )
17861839      return;
17871840
1788   pia_set_input_ca1( THOM_PIA_SYS, 1 );
1789   pia_set_input_ca1( THOM_PIA_SYS, 0 );
1841   pia_ca1_w( sys_pia, 0, 1 );
1842   pia_ca1_w( sys_pia, 0, 0 );
17901843   to7_lightpen_step = step;
17911844}
17921845
r4393r4394
18051858
18061859static TIMER_CALLBACK(mo5_periodic_cb)
18071860{
1861   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
1862
18081863   /* pulse */
1809   pia_set_input_cb1( THOM_PIA_SYS, 1 );
1810   pia_set_input_cb1( THOM_PIA_SYS, 0 );
1864   pia_cb1_w( sys_pia, 0, 1 );
1865   pia_cb1_w( sys_pia, 0, 0 );
18111866}
18121867
18131868
r4393r4394
18241879
18251880
18261881
1827static WRITE8_HANDLER ( mo5_sys_porta_out )
1882static WRITE8_DEVICE_HANDLER ( mo5_sys_porta_out )
18281883{
1829   thom_set_mode_point( space->machine, data & 1 );      /* bit 0: video bank switch */
1830   thom_set_border_color( space->machine, (data >> 1) & 15 );   /* bit 1-4: border color */
1831   mo5_set_cassette( space->machine, (data & 0x40) ? 1 : 0 );   /* bit 6: cassette output */
1884   thom_set_mode_point( device->machine, data & 1 );      /* bit 0: video bank switch */
1885   thom_set_border_color( device->machine, (data >> 1) & 15 );   /* bit 1-4: border color */
1886   mo5_set_cassette( device->machine, (data & 0x40) ? 1 : 0 );   /* bit 6: cassette output */
18321887}
18331888
18341889
18351890
1836static READ8_HANDLER ( mo5_sys_porta_in )
1891static READ8_DEVICE_HANDLER ( mo5_sys_porta_in )
18371892{
18381893   return
1839      (mo5_get_cassette(space->machine) ? 0x80 : 0) |     /* bit 7: cassette input */
1840      ((input_port_read(space->machine, "lightpen_button") & 1) ? 0x20 : 0)
1894      (mo5_get_cassette(device->machine) ? 0x80 : 0) |     /* bit 7: cassette input */
1895      ((input_port_read(device->machine, "lightpen_button") & 1) ? 0x20 : 0)
18411896      /* bit 5: lightpen button */;
18421897}
18431898
18441899
18451900
1846static WRITE8_HANDLER ( mo5_sys_portb_out )
1901static WRITE8_DEVICE_HANDLER ( mo5_sys_portb_out )
18471902{
1848   dac_data_w( devtag_get_device(space->machine, SOUND, "buzzer"), (data & 1) ? 0x80 : 0); /* 1-bit buzzer */
1903   dac_data_w( devtag_get_device(device->machine, SOUND, "buzzer"), (data & 1) ? 0x80 : 0); /* 1-bit buzzer */
18491904}
18501905
18511906
18521907
1853static READ8_HANDLER ( mo5_sys_portb_in )
1908static READ8_DEVICE_HANDLER ( mo5_sys_portb_in )
18541909{
1855   UINT8 portb = pia_get_output_b( THOM_PIA_SYS );
1910   UINT8 portb = pianew_get_output_b( device );
18561911   int col = (portb >> 1) & 7;       /* key column */
18571912   int lin = 7 - ((portb >> 4) & 7); /* key line */
18581913   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3",
18591914                              "keyboard_4", "keyboard_5", "keyboard_6", "keyboard_7" };
18601915
1861   return ( input_port_read(space->machine, keynames[lin]) & (1 << col) ) ? 0x80 : 0;
1916   return ( input_port_read(device->machine, keynames[lin]) & (1 << col) ) ? 0x80 : 0;
18621917}
18631918
18641919
18651920
1866static const pia6821_interface mo5_sys =
1921const pia6821_interface mo5_pia6821_sys =
18671922{
1868   mo5_sys_porta_in, mo5_sys_portb_in,
1869   NULL, NULL, NULL, NULL,
1870   mo5_sys_porta_out, mo5_sys_portb_out, mo5_set_cassette_motor, NULL,
1871   thom_firq_1, thom_irq_1 /* WARNING: differs from TO7 ! */
1923   DEVCB_HANDLER(mo5_sys_porta_in),
1924   DEVCB_HANDLER(mo5_sys_portb_in),
1925   DEVCB_NULL,
1926   DEVCB_NULL,
1927   DEVCB_NULL,
1928   DEVCB_NULL,
1929   DEVCB_HANDLER(mo5_sys_porta_out),
1930   DEVCB_HANDLER(mo5_sys_portb_out),
1931   DEVCB_HANDLER(mo5_set_cassette_motor),
1932   DEVCB_NULL,
1933   DEVCB_LINE(thom_firq_1),
1934   DEVCB_LINE(thom_irq_1) /* WARNING: differs from TO7 ! */
18721935};
18731936
18741937
r4393r4394
20562119
20572120MACHINE_RESET( mo5 )
20582121{
2122   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
2123
20592124   LOG (( "mo5: machine reset called\n" ));
20602125
20612126   /* subsystems */
20622127   thom_irq_reset(machine);
2063   pia_reset();
2064   pia_set_port_a_z_mask( THOM_PIA_SYS, 0x5f );
2128   pianew_set_port_a_z_mask( sys_pia, 0x5f );
20652129   to7_game_reset(machine);
20662130   to7_floppy_reset(machine);
20672131   to7_io_reset(machine);
r4393r4394
20742138   thom_set_lightpen_callback( machine, 3, mo5_lightpen_cb );
20752139   thom_set_mode_point( machine, 0 );
20762140   thom_set_border_color( machine, 0 );
2077   pia_set_input_ca1( THOM_PIA_SYS, 0 );
2141   pia_ca1_w( sys_pia, 0, 0 );
20782142
20792143   /* memory */
20802144   mo5_update_cart_bank(machine);
r4393r4394
20952159
20962160   /* subsystems */
20972161   thom_irq_init(machine);
2098   pia_config( machine, THOM_PIA_SYS, &mo5_sys );
20992162   to7_game_init(machine);
21002163   to7_floppy_init( machine, mem + 0x20000 );
21012164   to7_io_init(machine);
r4393r4394
24132476
24142477static void to9_update_ram_bank (running_machine *machine)
24152478{
2479   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
24162480   const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
24172481   static int old_bank = -1;
24182482   UINT8 port = mc6846_get_output_port(devtag_get_device(machine, MC6846, "mc6846"));
2419   UINT8 portb = pia_get_port_b_z_mask( THOM_PIA_SYS );
2483   UINT8 portb = pianew_get_port_b_z_mask( sys_pia );
24202484   UINT8 disk = ((port >> 2) & 1) | ((port >> 5) & 2); /* bits 6,2: RAM bank */
24212485   int bank;
24222486
r4393r4394
29332997/* afaik, P2-P7 are not connected, so, the warning about undefined 0xf0 can be safely ignored */
29342998
29352999
2936static READ8_HANDLER ( to9_sys_porta_in )
3000static READ8_DEVICE_HANDLER ( to9_sys_porta_in )
29373001{
2938   UINT8 ktest = to9_kbd_ktest(space->machine);
3002   UINT8 ktest = to9_kbd_ktest(device->machine);
29393003
29403004   LOG_KBD(( "to9_sys_porta_in: ktest=%i\n", ktest ));
29413005
r4393r4394
29443008
29453009
29463010
2947static WRITE8_HANDLER ( to9_sys_porta_out )
3011static WRITE8_DEVICE_HANDLER ( to9_sys_porta_out )
29483012{
2949   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
3013   const device_config *printer = devtag_get_device(device->machine, CENTRONICS, "centronics");
29503014   centronics_data_w(printer, 0, data & 0xfe);
29513015}
29523016
29533017
29543018
2955static WRITE8_HANDLER ( to9_sys_portb_out )
3019static WRITE8_DEVICE_HANDLER ( to9_sys_portb_out )
29563020{
2957   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
3021   const device_config *printer = devtag_get_device(device->machine, CENTRONICS, "centronics");
29583022
29593023   centronics_d0_w(printer, BIT(data, 0));
29603024   centronics_strobe_w(printer, BIT(data, 1));
29613025
2962   to9_update_ram_bank(space->machine);
3026   to9_update_ram_bank(device->machine);
29633027
29643028   if ( data & 4 ) /* bit 2: video overlay (TODO) */
29653029      LOG(( "to9_sys_portb_out: video overlay not handled\n" ));
r4393r4394
29673031
29683032
29693033
2970static const pia6821_interface to9_sys =
3034const pia6821_interface to9_pia6821_sys =
29713035{
2972   to9_sys_porta_in, NULL,
2973   NULL, NULL, NULL, NULL,
2974   to9_sys_porta_out, to9_sys_portb_out, to7_set_cassette_motor, NULL,
2975   NULL, thom_firq_1
3036   DEVCB_HANDLER(to9_sys_porta_in),
3037   DEVCB_NULL,
3038   DEVCB_NULL,
3039   DEVCB_NULL,
3040   DEVCB_NULL,
3041   DEVCB_NULL,
3042   DEVCB_HANDLER(to9_sys_porta_out),
3043   DEVCB_HANDLER(to9_sys_portb_out),
3044   DEVCB_HANDLER(to7_set_cassette_motor),
3045   DEVCB_NULL,
3046   DEVCB_NULL,
3047   DEVCB_LINE(thom_firq_1)
29763048};
29773049
29783050
r4393r4394
30073079
30083080MACHINE_RESET ( to9 )
30093081{
3082   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
3083
30103084   LOG (( "to9: machine reset called\n" ));
30113085
30123086   /* subsystems */
30133087   thom_irq_reset(machine);
3014   pia_reset();
3015   pia_set_port_a_z_mask( THOM_PIA_SYS, 0xfe );
3088   pianew_set_port_a_z_mask( sys_pia, 0xfe );
30163089   to7_game_reset(machine);
30173090   to9_floppy_reset(machine);
30183091   to9_kbd_reset(machine);
r4393r4394
30243097   thom_set_lightpen_callback( machine, 3, to7_lightpen_cb );
30253098   thom_set_border_color( machine, 8 );
30263099   thom_set_mode_point( machine, 0 );
3027   pia_set_input_cb1( THOM_PIA_SYS, 0 );
3100   pia_cb1_w( sys_pia, 0, 0 );
30283101
30293102   /* memory */
30303103   to9_soft_bank = 0;
r4393r4394
30463119
30473120   /* subsystems */
30483121   thom_irq_init(machine);
3049   pia_config( machine, THOM_PIA_SYS, &to9_sys );
30503122   to7_game_init(machine);
30513123   to9_floppy_init( machine, mem + 0xe000, mem + 0x40000 );
30523124   to9_kbd_init(machine);
r4393r4394
34543526
34553527static void to8_update_ram_bank (running_machine *machine)
34563528{
3529   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
34573530   const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
34583531   UINT8 bank = 0;
34593532
r4393r4394
34653538   }
34663539   else
34673540   {
3468      UINT8 portb = pia_get_port_b_z_mask( THOM_PIA_SYS );
3541      UINT8 portb = pianew_get_port_b_z_mask( sys_pia );
34693542
34703543      switch ( portb & 0xf8 )
34713544      {
r4393r4394
38593932
38603933
38613934
3862static READ8_HANDLER ( to8_sys_porta_in )
3935static READ8_DEVICE_HANDLER ( to8_sys_porta_in )
38633936{
3864   int ktest = to8_kbd_ktest (space->machine);
3937   int ktest = to8_kbd_ktest (device->machine);
38653938
3866   LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), ktest ));
3939   LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), ktest ));
38673940
38683941   return ktest;
38693942}
38703943
38713944
38723945
3873static WRITE8_HANDLER ( to8_sys_portb_out )
3946static WRITE8_DEVICE_HANDLER ( to8_sys_portb_out )
38743947{
3875   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
3948   const device_config *printer = devtag_get_device(device->machine, CENTRONICS, "centronics");
38763949
38773950   centronics_d0_w(printer, BIT(data, 0));
38783951   centronics_strobe_w(printer, BIT(data, 1));
38793952
3880   to8_update_ram_bank(space->machine);
3953   to8_update_ram_bank(device->machine);
38813954
38823955   if ( data & 4 ) /* bit 2: video overlay (TODO) */
38833956      LOG(( "to8_sys_portb_out: video overlay not handled\n" ));
r4393r4394
38853958
38863959
38873960
3888static const pia6821_interface to8_sys =
3961const pia6821_interface to8_pia6821_sys =
38893962{
3890   to8_sys_porta_in, NULL,
3891   NULL, NULL, NULL, NULL,
3892   to9_sys_porta_out, to8_sys_portb_out, to7_set_cassette_motor, NULL,
3893   NULL, thom_firq_1
3963   DEVCB_HANDLER(to8_sys_porta_in),
3964   DEVCB_NULL,
3965   DEVCB_NULL,
3966   DEVCB_NULL,
3967   DEVCB_NULL,
3968   DEVCB_NULL,
3969   DEVCB_HANDLER(to9_sys_porta_out),
3970   DEVCB_HANDLER(to8_sys_portb_out),
3971   DEVCB_HANDLER(to7_set_cassette_motor),
3972   DEVCB_NULL,
3973   DEVCB_NULL,
3974   DEVCB_LINE(thom_firq_1)
38943975};
38953976
38963977
r4393r4394
39664047
39674048MACHINE_RESET ( to8 )
39684049{
4050   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
39694051   LOG (( "to8: machine reset called\n" ));
39704052
39714053   /* subsystems */
39724054   thom_irq_reset(machine);
3973   pia_reset();
3974   pia_set_port_a_z_mask( THOM_PIA_SYS, 0xfe );
4055   pianew_set_port_a_z_mask( sys_pia, 0xfe );
39754056   to7_game_reset(machine);
39764057   to8_floppy_reset(machine);
39774058   to8_kbd_reset(machine);
r4393r4394
39924073   thom_set_lightpen_callback( machine, 4, to8_lightpen_cb );
39934074   thom_set_border_color( machine, 0 );
39944075   thom_set_mode_point( machine, 0 );
3995   pia_set_input_cb1( THOM_PIA_SYS, 0 );
4076   pia_cb1_w( sys_pia, 0, 0 );
39964077
39974078   /* memory */
39984079   to8_cart_vpage = 0;
r4393r4394
40164097
40174098   /* subsystems */
40184099   thom_irq_init(machine);
4019   pia_config( machine, THOM_PIA_SYS, &to8_sys );
40204100   to7_game_init(machine);
40214101   to8_floppy_init(machine);
40224102   to8_kbd_init(machine);
r4393r4394
40744154
40754155
40764156
4077static const pia6821_interface to9p_sys =
4157const pia6821_interface to9p_pia6821_sys =
40784158{
4079   to9_sys_porta_in, NULL,
4080   NULL, NULL, NULL, NULL,
4081   to9_sys_porta_out, to8_sys_portb_out, to7_set_cassette_motor, NULL,
4082   NULL, thom_firq_1
4159   DEVCB_HANDLER(to9_sys_porta_in),
4160   DEVCB_NULL,
4161   DEVCB_NULL,
4162   DEVCB_NULL,
4163   DEVCB_NULL,
4164   DEVCB_NULL,
4165   DEVCB_HANDLER(to9_sys_porta_out),
4166   DEVCB_HANDLER(to8_sys_portb_out),
4167   DEVCB_HANDLER(to7_set_cassette_motor),
4168   DEVCB_NULL,
4169   DEVCB_NULL,
4170   DEVCB_LINE(thom_firq_1)
40834171};
40844172
40854173
r4393r4394
41264214
41274215MACHINE_RESET ( to9p )
41284216{
4217   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
41294218   LOG (( "to9p: machine reset called\n" ));
41304219
41314220   /* subsystems */
41324221   thom_irq_reset(machine);
4133   pia_reset();
4134   pia_set_port_a_z_mask( THOM_PIA_SYS, 0xfe );
4222   pianew_set_port_a_z_mask( sys_pia, 0xfe );
41354223   to7_game_reset(machine);
41364224   to8_floppy_reset(machine);
41374225   to9_kbd_reset(machine);
r4393r4394
41524240   thom_set_lightpen_callback( machine, 4, to8_lightpen_cb );
41534241   thom_set_border_color( machine, 0 );
41544242   thom_set_mode_point( machine, 0 );
4155   pia_set_input_cb1( THOM_PIA_SYS, 0 );
4243   pia_cb1_w( sys_pia, 0, 0 );
41564244
41574245   /* memory */
41584246   to8_cart_vpage = 0;
r4393r4394
41764264
41774265   /* subsystems */
41784266   thom_irq_init(machine);
4179   pia_config( machine, THOM_PIA_SYS, &to9p_sys );
41804267   to7_game_init(machine);
41814268   to8_floppy_init( machine );
41824269   to9_kbd_init(machine);
r4393r4394
42604347
42614348static void mo6_update_cart_bank (running_machine *machine)
42624349{
4350   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
42634351   const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
4264   int b = (pia_get_output_a( THOM_PIA_SYS ) >> 5) & 1;
4352   int b = (pianew_get_output_a( sys_pia ) >> 5) & 1;
42654353   static int old_bank = -1;
42664354   int bank = 0;
42674355
r4393r4394
43834471
43844472static WRITE_LINE_DEVICE_HANDLER( mo6_centronics_busy )
43854473{
4386   pia_set_input_cb1(THOM_PIA_GAME, state);
4474   const device_config *game_pia = devtag_get_device( device->machine, PIA6821, THOM_PIA_GAME );
4475   pia_cb1_w(game_pia, 0, state);
43874476}
43884477
43894478
r4393r4394
43964485};
43974486
43984487
4399static WRITE8_HANDLER ( mo6_game_porta_out )
4488static WRITE8_DEVICE_HANDLER ( mo6_game_porta_out )
44004489{
4401   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
4490   const device_config *printer = devtag_get_device(device->machine, CENTRONICS, "centronics");
44024491
4403   LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data ));
4492   LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), data ));
44044493
44054494   /* centronics data */
44064495   centronics_data_w(printer, 0, data);
r4393r4394
44084497
44094498
44104499
4411static WRITE8_HANDLER ( mo6_game_cb2_out )
4500static WRITE8_DEVICE_HANDLER ( mo6_game_cb2_out )
44124501{
4413   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
4502   const device_config *printer = devtag_get_device(device->machine, CENTRONICS, "centronics");
44144503
4415   LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data ));
4504   LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), data ));
44164505
44174506   /* centronics strobe */
44184507   centronics_strobe_w(printer, data);
r4393r4394
44204509
44214510
44224511
4423static const pia6821_interface mo6_game =
4512const pia6821_interface mo6_pia6821_game =
44244513{
4425   to7_game_porta_in, to7_game_portb_in,
4426   NULL, NULL, NULL, NULL,
4427   mo6_game_porta_out, to7_game_portb_out, NULL, mo6_game_cb2_out,
4428   thom_irq_1, thom_irq_1
4514   DEVCB_HANDLER(to7_game_porta_in),
4515   DEVCB_HANDLER(to7_game_portb_in),
4516   DEVCB_NULL,
4517   DEVCB_NULL,
4518   DEVCB_NULL,
4519   DEVCB_NULL,
4520   DEVCB_HANDLER(mo6_game_porta_out),
4521   DEVCB_HANDLER(to7_game_portb_out),
4522   DEVCB_NULL,
4523   DEVCB_HANDLER(mo6_game_cb2_out),
4524   DEVCB_LINE(thom_irq_1),
4525   DEVCB_LINE(thom_irq_1)
44294526};
44304527
44314528
44324529
44334530static TIMER_CALLBACK(mo6_game_update_cb)
44344531{
4532   const device_config *game_pia = devtag_get_device( machine, PIA6821, THOM_PIA_GAME );
4533
44354534   /* unlike the TO8, CB1 & CB2 are not connected to buttons */
44364535   if ( input_port_read(machine, "config") & 1 )
44374536   {
44384537      UINT8 mouse = to7_get_mouse_signal(machine);
4439      pia_set_input_ca1( THOM_PIA_GAME, mouse & 1 ); /* XA */
4440      pia_set_input_ca2( THOM_PIA_GAME, mouse & 2 ); /* YA */
4538      pia_ca1_w( game_pia, 0, mouse & 1 ); /* XA */
4539      pia_ca2_w( game_pia, 0, mouse & 2 ); /* YA */
44414540   }
44424541   else
44434542   {
44444543      /* joystick */
44454544      UINT8 in = input_port_read(machine, "game_port_buttons");
4446      pia_set_input_ca1( THOM_PIA_GAME, in & 0x04 ); /* P1 action B */
4447      pia_set_input_ca2( THOM_PIA_GAME, in & 0x40 ); /* P1 action A */
4545      pia_ca1_w( game_pia, 0, in & 0x04 ); /* P1 action B */
4546      pia_ca2_w( game_pia, 0, in & 0x40 ); /* P1 action A */
44484547   }
44494548}
44504549
r4393r4394
44534552static void mo6_game_init ( running_machine *machine )
44544553{
44554554   LOG (( "mo6_game_init called\n" ));
4456   pia_config( machine, THOM_PIA_GAME, &mo6_game );
44574555   to7_game_timer = timer_alloc( machine, mo6_game_update_cb , NULL);
44584556   timer_adjust_periodic(to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD);
44594557   state_save_register_global( machine, to7_game_sound );
r4393r4394
44644562
44654563static void mo6_game_reset ( running_machine *machine )
44664564{
4565   const device_config *game_pia = devtag_get_device( machine, PIA6821, THOM_PIA_GAME );
44674566   LOG (( "mo6_game_reset called\n" ));
4468   pia_set_input_ca1( THOM_PIA_GAME, 0 );
4567   pia_ca1_w( game_pia, 0, 0 );
44694568   to7_game_sound = 0;
44704569   to7_game_mute = 0;
44714570   to7_game_sound_update(machine);
r4393r4394
44774576
44784577
44794578
4480static READ8_HANDLER ( mo6_sys_porta_in )
4579static READ8_DEVICE_HANDLER ( mo6_sys_porta_in )
44814580{
44824581   return
4483      (mo5_get_cassette(space->machine) ? 0x80 : 0) |     /* bit 7: cassette input */
4582      (mo5_get_cassette(device->machine) ? 0x80 : 0) |     /* bit 7: cassette input */
44844583      8 |                                   /* bit 3: kbd-line float up to 1 */
4485      ((input_port_read(space->machine, "lightpen_button") & 1) ? 2 : 0);
4584      ((input_port_read(device->machine, "lightpen_button") & 1) ? 2 : 0);
44864585   /* bit 1: lightpen button */;
44874586}
44884587
44894588
44904589
4491static READ8_HANDLER ( mo6_sys_portb_in )
4590static READ8_DEVICE_HANDLER ( mo6_sys_portb_in )
44924591{
44934592   /* keyboard: 9 lines of 8 keys */
4494   UINT8 porta = pia_get_output_a( THOM_PIA_SYS );
4495   UINT8 portb = pia_get_output_b( THOM_PIA_SYS );
4593   UINT8 porta = pianew_get_output_a( device );
4594   UINT8 portb = pianew_get_output_b( device );
44964595   int col = (portb >> 4) & 7;    /* B bits 4-6: kbd column */
44974596   int lin = (portb >> 1) & 7;    /* B bits 1-3: kbd line */
44984597   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4",
r4393r4394
45024601      lin = 8;     /* A bit 3: 9-th kbd line select */
45034602
45044603   return
4505      ( input_port_read(space->machine, keynames[lin]) & (1 << col) ) ?  0x80 : 0;
4604      ( input_port_read(device->machine, keynames[lin]) & (1 << col) ) ?  0x80 : 0;
45064605   /* bit 7: key up */
45074606}
45084607
45094608
45104609
4511static WRITE8_HANDLER ( mo6_sys_porta_out )
4610static WRITE8_DEVICE_HANDLER ( mo6_sys_porta_out )
45124611{
4513   thom_set_mode_point( space->machine,data & 1 );            /* bit 0: video bank switch */
4612   thom_set_mode_point( device->machine,data & 1 );            /* bit 0: video bank switch */
45144613   to7_game_mute = data & 4;                  /* bit 2: sound mute */
4515   thom_set_caps_led( space->machine,(data & 16) ? 0 : 1 ) ;      /* bit 4: keyboard led */
4516   mo5_set_cassette( space->machine, (data & 0x40) ? 1 : 0 );       /* bit 6: cassette output */
4517   mo6_update_cart_bank(space->machine);               /* bit 5: rom bank */
4518   to7_game_sound_update(space->machine);
4614   thom_set_caps_led( device->machine,(data & 16) ? 0 : 1 ) ;      /* bit 4: keyboard led */
4615   mo5_set_cassette( device->machine, (data & 0x40) ? 1 : 0 );       /* bit 6: cassette output */
4616   mo6_update_cart_bank(device->machine);               /* bit 5: rom bank */
4617   to7_game_sound_update(device->machine);
45194618}
45204619
45214620
45224621
4523static WRITE8_HANDLER ( mo6_sys_portb_out )
4622static WRITE8_DEVICE_HANDLER ( mo6_sys_portb_out )
45244623{
4525   dac_data_w( devtag_get_device(space->machine, SOUND, "buzzer"), (data & 1) ? 0x80 : 0); /* bit 0: buzzer */
4624   dac_data_w( devtag_get_device(device->machine, SOUND, "buzzer"), (data & 1) ? 0x80 : 0); /* bit 0: buzzer */
45264625}
45274626
45284627
45294628
4530static WRITE8_HANDLER ( mo6_sys_cb2_out )
4629static WRITE8_DEVICE_HANDLER ( mo6_sys_cb2_out )
45314630{
45324631   /* SCART pin 8 = slow switch (?) */
45334632   LOG(( "mo6_sys_cb2_out: SCART slow switch set to %i\n", data ));
r4393r4394
45354634
45364635
45374636
4538static const pia6821_interface mo6_sys =
4637const pia6821_interface mo6_pia6821_sys =
45394638{
4540   mo6_sys_porta_in, mo6_sys_portb_in,
4541   NULL, NULL, NULL, NULL,
4542   mo6_sys_porta_out, mo6_sys_portb_out, mo5_set_cassette_motor, mo6_sys_cb2_out,
4543   thom_firq_1, thom_irq_1 /* differs from TO */
4639   DEVCB_HANDLER(mo6_sys_porta_in),
4640   DEVCB_HANDLER(mo6_sys_portb_in),
4641   DEVCB_NULL,
4642   DEVCB_NULL,
4643   DEVCB_NULL,
4644   DEVCB_NULL,
4645   DEVCB_HANDLER(mo6_sys_porta_out),
4646   DEVCB_HANDLER(mo6_sys_portb_out),
4647   DEVCB_HANDLER(mo5_set_cassette_motor),
4648   DEVCB_HANDLER(mo6_sys_cb2_out),
4649   DEVCB_LINE(thom_firq_1),
4650   DEVCB_LINE(thom_irq_1) /* differs from TO */
45444651};
45454652
45464653
r4393r4394
47224829
47234830MACHINE_RESET ( mo6 )
47244831{
4832   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
47254833   LOG (( "mo6: machine reset called\n" ));
47264834
47274835   /* subsystems */
47284836   thom_irq_reset(machine);
4729   pia_reset();
4730   pia_set_port_a_z_mask( THOM_PIA_SYS, 0x75 );
4837   pianew_set_port_a_z_mask( sys_pia, 0x75 );
47314838   mo6_game_reset(machine);
47324839   to7_floppy_reset(machine);
47334840   to7_modem_reset(machine);
r4393r4394
47474854   thom_set_lightpen_callback( machine, 3, to8_lightpen_cb );
47484855   thom_set_border_color( machine, 0 );
47494856   thom_set_mode_point( machine, 0 );
4750   pia_set_input_ca1( THOM_PIA_SYS, 0 );
4857   pia_ca1_w( sys_pia, 0, 0 );
47514858
47524859   /* memory */
47534860   to8_cart_vpage = 0;
r4393r4394
47684875
47694876   /* subsystems */
47704877   thom_irq_init(machine);
4771   pia_config( machine, THOM_PIA_SYS, &mo6_sys );
47724878   mo6_game_init(machine);
47734879   to7_floppy_init( machine, mem + 0x30000 );
47744880   to9_palette_init(machine);
r4393r4394
48804986
48814987
48824988
4883static READ8_HANDLER ( mo5nr_sys_portb_in )
4989static READ8_DEVICE_HANDLER ( mo5nr_sys_portb_in )
48844990{
48854991   /* keyboard: only 8 lines of 8 keys (MO6 has 9 lines) */
4886   UINT8 portb = pia_get_output_b( THOM_PIA_SYS );
4992   UINT8 portb = pianew_get_output_b( device );
48874993   int col = (portb >> 4) & 7;    /* B bits 4-6: kbd column */
48884994   int lin = (portb >> 1) & 7;    /* B bits 1-3: kbd line */
48894995   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3",
48904996                              "keyboard_4", "keyboard_5", "keyboard_6", "keyboard_7" };
48914997
4892   return ( input_port_read(space->machine, keynames[lin]) & (1 << col) ) ? 0x80 : 0;
4998   return ( input_port_read(device->machine, keynames[lin]) & (1 << col) ) ? 0x80 : 0;
48934999   /* bit 7: key up */
48945000}
48955001
48965002
48975003
4898static WRITE8_HANDLER ( mo5nr_sys_porta_out )
5004static WRITE8_DEVICE_HANDLER ( mo5nr_sys_porta_out )
48995005{
49005006   /* no keyboard LED */
4901   thom_set_mode_point( space->machine, data & 1 );         /* bit 0: video bank switch */
5007   thom_set_mode_point( device->machine, data & 1 );         /* bit 0: video bank switch */
49025008   to7_game_mute = data & 4;                  /* bit 2: sound mute */
4903   mo5_set_cassette( space->machine, (data & 0x40) ? 1 : 0 );      /* bit 6: cassette output */
4904   mo6_update_cart_bank(space->machine);               /* bit 5: rom bank */
4905   to7_game_sound_update(space->machine);
5009   mo5_set_cassette( device->machine, (data & 0x40) ? 1 : 0 );      /* bit 6: cassette output */
5010   mo6_update_cart_bank(device->machine);               /* bit 5: rom bank */
5011   to7_game_sound_update(device->machine);
49065012}
49075013
49085014
49095015
4910static const pia6821_interface mo5nr_sys =
5016const pia6821_interface mo5nr_pia6821_sys =
49115017{
4912   mo6_sys_porta_in, mo5nr_sys_portb_in,
4913   NULL, NULL, NULL, NULL,
4914   mo5nr_sys_porta_out, mo6_sys_portb_out, mo5_set_cassette_motor, mo6_sys_cb2_out,
4915   thom_firq_1, thom_irq_1 /* differs from TO */
5018   DEVCB_HANDLER(mo6_sys_porta_in),
5019   DEVCB_HANDLER(mo5nr_sys_portb_in),
5020   DEVCB_NULL,
5021   DEVCB_NULL,
5022   DEVCB_NULL,
5023   DEVCB_NULL,
5024   DEVCB_HANDLER(mo5nr_sys_porta_out),
5025   DEVCB_HANDLER(mo6_sys_portb_out),
5026   DEVCB_HANDLER(mo5_set_cassette_motor),
5027   DEVCB_HANDLER(mo6_sys_cb2_out),
5028   DEVCB_LINE(thom_firq_1),
5029   DEVCB_LINE(thom_irq_1) /* differs from TO */
49165030};
49175031
49185032
r4393r4394
49245038
49255039
49265040
4927static const pia6821_interface mo5nr_game =
5041const pia6821_interface mo5nr_pia6821_game =
49285042{
4929   to7_game_porta_in, to7_game_portb_in,
4930   NULL, NULL, NULL, NULL,
4931   mo6_game_porta_out, to7_game_portb_out, NULL, NULL,
4932   thom_irq_1, thom_irq_1
5043   DEVCB_HANDLER(to7_game_porta_in),
5044   DEVCB_HANDLER(to7_game_portb_in),
5045   DEVCB_NULL,
5046   DEVCB_NULL,
5047   DEVCB_NULL,
5048   DEVCB_NULL,
5049   DEVCB_HANDLER(mo6_game_porta_out),
5050   DEVCB_HANDLER(to7_game_portb_out),
5051   DEVCB_NULL,
5052   DEVCB_NULL,
5053   DEVCB_LINE(thom_irq_1),
5054   DEVCB_LINE(thom_irq_1)
49335055};
49345056
49355057
r4393r4394
49375059static void mo5nr_game_init ( running_machine* machine )
49385060{
49395061   LOG (( "mo5nr_game_init called\n" ));
4940   pia_config( machine, THOM_PIA_GAME, &mo5nr_game );
49415062   to7_game_timer = timer_alloc( machine, mo6_game_update_cb , NULL);
49425063   timer_adjust_periodic( to7_game_timer, TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD );
49435064   state_save_register_global( machine, to7_game_sound );
r4393r4394
49485069
49495070static void mo5nr_game_reset ( running_machine* machine )
49505071{
5072   const device_config *game_pia = devtag_get_device( machine, PIA6821, THOM_PIA_GAME );
49515073   LOG (( "mo5nr_game_reset called\n" ));
4952   pia_set_input_ca1( THOM_PIA_GAME, 0 );
5074   pia_ca1_w( game_pia, 0, 0 );
49535075   to7_game_sound = 0;
49545076   to7_game_mute = 0;
49555077   to7_game_sound_update(machine);
r4393r4394
49635085
49645086MACHINE_RESET ( mo5nr )
49655087{
5088   const device_config *sys_pia = devtag_get_device( machine, PIA6821, THOM_PIA_SYS );
49665089   LOG (( "mo5nr: machine reset called\n" ));
49675090
49685091   /* subsystems */
49695092   thom_irq_reset(machine);
4970   pia_reset();
4971   pia_set_port_a_z_mask( THOM_PIA_SYS, 0x65 );
5093   pianew_set_port_a_z_mask( sys_pia, 0x65 );
49725094   mo5nr_game_reset(machine);
49735095   to7_floppy_reset(machine);
49745096   to7_modem_reset(machine);
r4393r4394
49885110   thom_set_lightpen_callback( machine, 3, to8_lightpen_cb );
49895111   thom_set_border_color( machine, 0 );
49905112   thom_set_mode_point( machine, 0 );
4991   pia_set_input_ca1( THOM_PIA_SYS, 0 );
5113   pia_ca1_w( sys_pia, 0, 0 );
49925114
49935115   /* memory */
49945116   to8_cart_vpage = 0;
r4393r4394
50095131
50105132   /* subsystems */
50115133   thom_irq_init(machine);
5012   pia_config( machine, THOM_PIA_SYS, &mo5nr_sys );
50135134   mo5nr_game_init(machine);
50145135   to7_floppy_init( machine, mem + 0x30000 );
50155136   to9_palette_init(machine);
src/mess/drivers/thomson.c
r4393r4394
7373*/
7474
7575#include "includes/thomson.h"
76#include "machine/6821new.h"
7677#include "machine/ctronics.h"
7778
7879
r4393r4394
373374     AM_RANGE ( 0xc000, 0xdfff ) AM_NOP       /*  8 KB (for extension) */
374375     AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK   ( THOM_FLOP_BANK )
375376     AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE(MC6846, "mc6846", mc6846_r, mc6846_w)
376     AM_RANGE ( 0xe7c8, 0xe7cb ) AM_READWRITE ( pia_0_alt_r,  pia_0_alt_w )
377     AM_RANGE ( 0xe7cc, 0xe7cf ) AM_READWRITE ( pia_1_alt_r,  pia_1_alt_w )
377     AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE ( PIA6821, "pia_0", pia_alt_r,  pia_alt_w )
378     AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE ( PIA6821, "pia_1", pia_alt_r,  pia_alt_w )
378379     AM_RANGE ( 0xe7d0, 0xe7df ) AM_READWRITE ( to7_floppy_r, to7_floppy_w )
379     AM_RANGE ( 0xe7e0, 0xe7e3 ) AM_READWRITE ( pia_2_alt_r, pia_2_alt_w )
380     AM_RANGE ( 0xe7e0, 0xe7e3 ) AM_DEVREADWRITE ( PIA6821, "pia_2", pia_alt_r, pia_alt_w )
380381     AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE(ACIA6551, "acia",  acia_6551_r, acia_6551_w )
381382     AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w )
382     AM_RANGE ( 0xe7f8, 0xe7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w )
383     AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE ( PIA6821, "pia_3", pia_alt_r, pia_alt_w )
383384     AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r,
384385                  to7_modem_mea8000_w )
385386     AM_RANGE ( 0xe800, 0xffff ) AM_ROM       /* system bios  */
r4393r4394
716717/* network */
717718     MDRV_MC6854_ADD( "mc6854", to7_network_iface )
718719
720   /* pia */
721   MDRV_PIA6821_ADD( THOM_PIA_SYS, to7_pia6821_sys )
722   MDRV_PIA6821_ADD( THOM_PIA_IO, to7_pia6821_io )
723   MDRV_PIA6821_ADD( THOM_PIA_GAME, to7_pia6821_game )
724   MDRV_PIA6821_ADD( THOM_PIA_MODEM, to7_pia6821_modem )
725
719726/* acia */
720727     MDRV_ACIA6551_ADD("acia")
721728
r4393r4394
798805     AM_RANGE ( 0xa000, 0xdfff ) AM_RAMBANK   ( THOM_RAM_BANK )  /* 6 * 16 KB */
799806     AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK   ( THOM_FLOP_BANK )
800807     AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE(MC6846, "mc6846", mc6846_r, mc6846_w)
801     AM_RANGE ( 0xe7c8, 0xe7cb ) AM_READWRITE ( pia_0_alt_r,  pia_0_alt_w )
802     AM_RANGE ( 0xe7cc, 0xe7cf ) AM_READWRITE ( pia_1_alt_r,  pia_1_alt_w )
808     AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE ( PIA6821, "pia_0", pia_alt_r,  pia_alt_w )
809     AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE ( PIA6821, "pia_1", pia_alt_r,  pia_alt_w )
803810     AM_RANGE ( 0xe7d0, 0xe7df ) AM_READWRITE ( to7_floppy_r, to7_floppy_w )
804     AM_RANGE ( 0xe7e0, 0xe7e3 ) AM_READWRITE ( pia_2_alt_r, pia_2_alt_w )
811     AM_RANGE ( 0xe7e0, 0xe7e3 ) AM_DEVREADWRITE ( PIA6821, "pia_2", pia_alt_r, pia_alt_w )
805812     AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to770_gatearray_r,
806813                                                to770_gatearray_w )
807814     AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE(ACIA6551, "acia",  acia_6551_r, acia_6551_w )
808815     AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w )
809     AM_RANGE ( 0xe7f8, 0xe7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w )
816     AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE ( PIA6821, "pia_3", pia_alt_r, pia_alt_w )
810817     AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r,
811818                  to7_modem_mea8000_w )
812819     AM_RANGE ( 0xe800, 0xffff ) AM_ROM       /* system bios  */
r4393r4394
919926     MDRV_CPU_MODIFY( "maincpu" )
920927     MDRV_CPU_PROGRAM_MAP ( to770, 0 )
921928
929   MDRV_PIA6821_MODIFY( THOM_PIA_SYS, to770_pia6821_sys )
930
922931     MDRV_MC6846_MODIFY( "mc6846", to770_timer )
923932MACHINE_DRIVER_END
924933
r4393r4394
9951004     AM_RANGE ( 0x0000, 0x1fff ) AM_READWRITE ( SMH_BANK(THOM_VRAM_BANK), to770_vram_w )
9961005     AM_RANGE ( 0x2000, 0x9fff ) AM_RAMBANK   ( THOM_BASE_BANK )
9971006     AM_RANGE ( 0xa000, 0xa7bf ) AM_ROMBANK   ( THOM_FLOP_BANK )
998     AM_RANGE ( 0xa7c0, 0xa7c3 ) AM_READWRITE ( pia_0_alt_r,  pia_0_alt_w )
1007     AM_RANGE ( 0xa7c0, 0xa7c3 ) AM_DEVREADWRITE ( PIA6821, "pia_0", pia_alt_r,  pia_alt_w )
9991008     AM_RANGE ( 0xa7cb, 0xa7cb ) AM_WRITE     ( mo5_ext_w )
1000     AM_RANGE ( 0xa7cc, 0xa7cf ) AM_READWRITE ( pia_1_alt_r,  pia_1_alt_w )
1009     AM_RANGE ( 0xa7cc, 0xa7cf ) AM_DEVREADWRITE ( PIA6821, "pia_1", pia_alt_r,  pia_alt_w )
10011010     AM_RANGE ( 0xa7d0, 0xa7df ) AM_READWRITE ( to7_floppy_r, to7_floppy_w )
1002     AM_RANGE ( 0xa7e0, 0xa7e3 ) AM_READWRITE ( pia_2_alt_r, pia_2_alt_w )
1011     AM_RANGE ( 0xa7e0, 0xa7e3 ) AM_DEVREADWRITE ( PIA6821, "pia_2", pia_alt_r, pia_alt_w )
10031012     AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE ( mo5_gatearray_r,
10041013                  mo5_gatearray_w )
10051014     AM_RANGE ( 0xa7e8, 0xa7eb ) AM_DEVREADWRITE(ACIA6551, "acia",  acia_6551_r, acia_6551_w )
r4393r4394
11201129
11211130     MDRV_MC6846_REMOVE( "mc6846" )
11221131
1132   MDRV_PIA6821_MODIFY( THOM_PIA_SYS, mo5_pia6821_sys )
1133
11231134   MDRV_CARTSLOT_MODIFY("cart")
11241135   MDRV_CARTSLOT_EXTENSION_LIST("m5,rom")
11251136   MDRV_CARTSLOT_LOAD(mo5_cartridge)
r4393r4394
12151226     AM_RANGE ( 0xa000, 0xdfff ) AM_RAMBANK   ( THOM_RAM_BANK )  /* 10 * 16 KB */
12161227     AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK   ( THOM_FLOP_BANK )
12171228     AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE(MC6846, "mc6846", mc6846_r, mc6846_w)
1218     AM_RANGE ( 0xe7c8, 0xe7cb ) AM_READWRITE ( pia_0_alt_r,  pia_0_alt_w )
1219     AM_RANGE ( 0xe7cc, 0xe7cf ) AM_READWRITE ( pia_1_alt_r,  pia_1_alt_w )
1229     AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE ( PIA6821, "pia_0", pia_alt_r,  pia_alt_w )
1230     AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE ( PIA6821, "pia_1", pia_alt_r,  pia_alt_w )
12201231     AM_RANGE ( 0xe7d0, 0xe7d9 ) AM_READWRITE ( to9_floppy_r, to9_floppy_w )
12211232     AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE ( to9_vreg_r, to9_vreg_w )
12221233     AM_RANGE ( 0xe7de, 0xe7df ) AM_READWRITE ( to9_kbd_r, to9_kbd_w )
r4393r4394
12251236     AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE(ACIA6551, "acia",  acia_6551_r, acia_6551_w )
12261237/*   AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */
12271238     AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w )
1228     AM_RANGE ( 0xe7f8, 0xe7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w )
1239     AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE ( PIA6821, "pia_3", pia_alt_r, pia_alt_w )
12291240     AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r,
12301241                  to7_modem_mea8000_w )
12311242     AM_RANGE ( 0xe800, 0xffff ) AM_ROM       /* system bios  */
r4393r4394
14701481     MDRV_CPU_MODIFY( "maincpu" )
14711482     MDRV_CPU_PROGRAM_MAP ( to9, 0 )
14721483
1484   MDRV_PIA6821_MODIFY( THOM_PIA_SYS, to9_pia6821_sys )
1485   MDRV_PIA6821_REMOVE( THOM_PIA_IO )
1486
14731487   MDRV_CENTRONICS_REMOVE("centronics")
14741488   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
14751489
r4393r4394
15531567     AM_RANGE ( 0xc000, 0xdfff ) AM_READWRITE ( SMH_BANK(TO8_DATA_HI), to8_data_hi_w )
15541568     AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK   ( THOM_FLOP_BANK ) /* 2 * 2 KB */
15551569     AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE(MC6846, "mc6846", mc6846_r, mc6846_w)
1556     AM_RANGE ( 0xe7c8, 0xe7cb ) AM_READWRITE ( pia_0_alt_r,  pia_0_alt_w )
1557     AM_RANGE ( 0xe7cc, 0xe7cf ) AM_READWRITE ( pia_1_alt_r,  pia_1_alt_w )
1570     AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE ( PIA6821, "pia_0", pia_alt_r,  pia_alt_w )
1571     AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE ( PIA6821, "pia_1", pia_alt_r,  pia_alt_w )
15581572     AM_RANGE ( 0xe7d0, 0xe7d9 ) AM_READWRITE ( to8_floppy_r, to8_floppy_w )
15591573     AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE ( to8_vreg_r, to8_vreg_w )
15601574     AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to8_gatearray_r,
r4393r4394
15621576     AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE(ACIA6551, "acia",  acia_6551_r, acia_6551_w )
15631577/*   AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */
15641578     AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w )
1565     AM_RANGE ( 0xe7f8, 0xe7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w )
1579     AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE ( PIA6821, "pia_3", pia_alt_r, pia_alt_w )
15661580     AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r,
15671581                  to7_modem_mea8000_w )
15681582     AM_RANGE ( 0xe800, 0xffff ) AM_ROMBANK   ( TO8_BIOS_BANK ) /* 2 * 6 KB */
r4393r4394
17071721     MDRV_CPU_MODIFY( "maincpu" )
17081722     MDRV_CPU_PROGRAM_MAP ( to8, 0 )
17091723
1724   MDRV_PIA6821_MODIFY( THOM_PIA_SYS, to8_pia6821_sys )
1725   MDRV_PIA6821_REMOVE( THOM_PIA_IO )
1726
17101727   MDRV_CENTRONICS_REMOVE("centronics")
17111728   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
17121729
r4393r4394
17701787     AM_RANGE ( 0xc000, 0xdfff ) AM_READWRITE ( SMH_BANK(TO8_DATA_HI), to8_data_hi_w )
17711788     AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK   ( THOM_FLOP_BANK ) /* 2 * 2 KB */
17721789     AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE(MC6846, "mc6846", mc6846_r, mc6846_w)
1773     AM_RANGE ( 0xe7c8, 0xe7cb ) AM_READWRITE ( pia_0_alt_r,  pia_0_alt_w )
1774     AM_RANGE ( 0xe7cc, 0xe7cf ) AM_READWRITE ( pia_1_alt_r,  pia_1_alt_w )
1790     AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE ( PIA6821, "pia_0", pia_alt_r,  pia_alt_w )
1791     AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE ( PIA6821, "pia_1", pia_alt_r,  pia_alt_w )
17751792     AM_RANGE ( 0xe7d0, 0xe7d9 ) AM_READWRITE ( to8_floppy_r, to8_floppy_w )
17761793     AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE ( to8_vreg_r, to8_vreg_w )
17771794     AM_RANGE ( 0xe7de, 0xe7df ) AM_READWRITE ( to9_kbd_r, to9_kbd_w )
r4393r4394
17801797     AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE(ACIA6551, "acia",  acia_6551_r, acia_6551_w )
17811798/*   AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */
17821799     AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w )
1783     AM_RANGE ( 0xe7f8, 0xe7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w )
1800     AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE ( PIA6821, "pia_3", pia_alt_r, pia_alt_w )
17841801     AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r,
17851802                  to7_modem_mea8000_w )
17861803     AM_RANGE ( 0xe800, 0xffff ) AM_ROMBANK   ( TO8_BIOS_BANK ) /* 2 * 6 KB */
r4393r4394
18651882     MDRV_CPU_MODIFY( "maincpu" )
18661883     MDRV_CPU_PROGRAM_MAP ( to9p, 0 )
18671884
1885   MDRV_PIA6821_MODIFY( THOM_PIA_SYS, to9p_pia6821_sys )
1886   MDRV_PIA6821_REMOVE( THOM_PIA_IO )
1887
18681888   MDRV_CENTRONICS_REMOVE("centronics")
18691889   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
18701890
r4393r4394
19411961     AM_RANGE ( 0x6000, 0x7fff ) AM_READWRITE ( SMH_BANK(TO8_DATA_LO), to8_data_lo_w )
19421962     AM_RANGE ( 0x8000, 0x9fff ) AM_READWRITE ( SMH_BANK(TO8_DATA_HI), to8_data_hi_w )
19431963     AM_RANGE ( 0xa000, 0xa7bf ) AM_ROMBANK   ( THOM_FLOP_BANK )
1944     AM_RANGE ( 0xa7c0, 0xa7c3 ) AM_READWRITE ( pia_0_alt_r,  pia_0_alt_w )
1964     AM_RANGE ( 0xa7c0, 0xa7c3 ) AM_DEVREADWRITE ( PIA6821, "pia_0", pia_alt_r,  pia_alt_w )
19451965     AM_RANGE ( 0xa7cb, 0xa7cb ) AM_WRITE     ( mo6_ext_w )
1946     AM_RANGE ( 0xa7cc, 0xa7cf ) AM_READWRITE ( pia_1_alt_r,  pia_1_alt_w )
1966     AM_RANGE ( 0xa7cc, 0xa7cf ) AM_DEVREADWRITE ( PIA6821, "pia_1", pia_alt_r,  pia_alt_w )
19471967     AM_RANGE ( 0xa7d0, 0xa7d9 ) AM_READWRITE ( to7_floppy_r, to7_floppy_w )
19481968     AM_RANGE ( 0xa7da, 0xa7dd ) AM_READWRITE ( mo6_vreg_r, mo6_vreg_w )
19491969     AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE ( mo6_gatearray_r,
r4393r4394
22162236
22172237     MDRV_MC6846_REMOVE( "mc6846" )
22182238
2239   MDRV_PIA6821_MODIFY( THOM_PIA_SYS, mo6_pia6821_sys )
2240   MDRV_PIA6821_REMOVE( THOM_PIA_IO )
2241   MDRV_PIA6821_MODIFY( THOM_PIA_GAME, mo6_pia6821_game )
2242
22192243   MDRV_CENTRONICS_REMOVE("centronics")
22202244   MDRV_CENTRONICS_ADD("centronics", mo6_centronics_config)
22212245
r4393r4394
22712295     AM_RANGE ( 0x6000, 0x7fff ) AM_READWRITE ( SMH_BANK(TO8_DATA_LO), to8_data_lo_w )
22722296     AM_RANGE ( 0x8000, 0x9fff ) AM_READWRITE ( SMH_BANK(TO8_DATA_HI), to8_data_hi_w )
22732297     AM_RANGE ( 0xa000, 0xa7bf ) AM_ROMBANK   ( THOM_FLOP_BANK )
2274     AM_RANGE ( 0xa7c0, 0xa7c3 ) AM_READWRITE ( pia_0_alt_r,  pia_0_alt_w )
2298     AM_RANGE ( 0xa7c0, 0xa7c3 ) AM_DEVREADWRITE ( PIA6821, "pia_0", pia_alt_r,  pia_alt_w )
22752299     AM_RANGE ( 0xa7cb, 0xa7cb ) AM_WRITE     ( mo6_ext_w )
2276     AM_RANGE ( 0xa7cc, 0xa7cf ) AM_READWRITE ( pia_1_alt_r,  pia_1_alt_w )
2300     AM_RANGE ( 0xa7cc, 0xa7cf ) AM_DEVREADWRITE ( PIA6821, "pia_1", pia_alt_r,  pia_alt_w )
22772301     AM_RANGE ( 0xa7d0, 0xa7d9 ) AM_READWRITE ( mo5nr_net_r, mo5nr_net_w )
22782302     AM_RANGE ( 0xa7da, 0xa7dd ) AM_READWRITE ( mo6_vreg_r, mo6_vreg_w )
22792303     AM_RANGE ( 0xa7e1, 0xa7e1 ) AM_DEVREADWRITE(CENTRONICS, "centronics", centronics_data_r, centronics_data_w)
r4393r4394
22832307     AM_RANGE ( 0xa7e8, 0xa7eb ) AM_DEVREADWRITE(ACIA6551, "acia",  acia_6551_r, acia_6551_w )
22842308/*   AM_RANGE ( 0xa7f0, 0xa7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */
22852309     AM_RANGE ( 0xa7f2, 0xa7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w )
2286     AM_RANGE ( 0xa7f8, 0xa7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w )
2310     AM_RANGE ( 0xa7f8, 0xa7fb ) AM_DEVREADWRITE ( PIA6821, "pia_3", pia_alt_r, pia_alt_w )
22872311     AM_RANGE ( 0xa7fe, 0xa7ff ) AM_DEVREADWRITE(MEA8000, "mea8000", mea8000_r, mea8000_w)
22882312     AM_RANGE ( 0xb000, 0xefff ) AM_READWRITE ( SMH_BANK(THOM_CART_BANK), mo6_cartridge_w ) /* 4 * 16 KB */
22892313     AM_RANGE ( 0xf000, 0xffff ) AM_ROMBANK   ( TO8_BIOS_BANK )
r4393r4394
24502474
24512475     MDRV_MC6846_REMOVE( "mc6846" )
24522476
2477   MDRV_PIA6821_MODIFY( THOM_PIA_SYS, mo5nr_pia6821_sys )
2478   MDRV_PIA6821_REMOVE( THOM_PIA_IO )
2479   MDRV_PIA6821_MODIFY( THOM_PIA_GAME, mo5nr_pia6821_game )
2480
24532481   MDRV_CENTRONICS_REMOVE("centronics")
24542482   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
24552483

Previous 15994 Revisions Next


© 1998-2018 The MESS Team