Previous 15994 Revisions Next

r9693 Tuesday 30th November, 2010 at 03:31:14 UTC by Nathan Woods
More Atari Ace conversions. [Atari Ace]
[src/mess/audio]dai.c special.c
[src/mess/drivers]aim65_40.c arcadia.c ccs2422.c comquest.c crvision.c czk80.c dai.c elwro800.c ex800.c fmtowns.c mtx.c pc8401a.c sg1000.c supercon.c ti89.c
[src/mess/includes]arcadia.h bbc.h comquest.h dai.h fmtowns.h p2000t.h pmd85.h spectrum.h ti89.h
[src/mess/machine]dai.c p2000t.c pmd85.c
[src/mess/video]arcadia.c bbc.c comquest.c dai.c p2000m.c

src/mess/audio/dai.c
r9692r9693
1616
1717static STREAM_UPDATE( dai_sh_update );
1818
19static sound_stream *mixer_channel;
19typedef struct _dai_sound_state dai_sound_state;
20struct _dai_sound_state
21{
22   sound_stream *mixer_channel;
23   int dai_input[3];
24   UINT8 osc_volume[3];
25   UINT8 noise_volume;
26};
2027
21static int dai_input[3];
28INLINE dai_sound_state *get_token(running_device *device)
29{
30   assert(device != NULL);
31   assert(device->type() == DAI);
32   return (dai_sound_state *) downcast<legacy_device_base *>(device)->token();
33}
2234
2335static const UINT16 dai_osc_volume_table[] = {
2436                  0,  500, 1000, 1500,
r9692r9693
3446                 2500, 3000, 3500, 4000
3547};
3648
37void dai_set_input(running_machine *machine, int index, int state)
49void dai_set_volume(running_device *device, int offset, UINT8 data)
3850{
39   stream_update( mixer_channel );
51   dai_sound_state *sndstate = get_token(device);
4052
41   dai_input[index] = state;
53   switch (offset)
54   {
55   case 0x04:
56      sndstate->osc_volume[0] = data&0x0f;
57      sndstate->osc_volume[1] = (data&0xf0)>>4;
58      break;
59
60   case 0x05:
61      sndstate->osc_volume[2] = data&0x0f;
62      sndstate->noise_volume = (data&0xf0)>>4;
63   }
4264}
4365
66void dai_set_input(running_device *device, int index, int state)
67{
68   dai_sound_state *sndstate = get_token(device);
69   stream_update( sndstate->mixer_channel );
4470
71   sndstate->dai_input[index] = state;
72}
73
74
4575static DEVICE_START(dai_sound)
4676{
47   dai_input[0] = dai_input[1] = dai_input[2] = 0;
77   dai_sound_state *state = get_token(device);
4878
49   mixer_channel = stream_create(device, 0, 2, device->machine->sample_rate, 0, dai_sh_update);
79   state->mixer_channel = stream_create(device, 0, 2, device->machine->sample_rate, 0, dai_sh_update);
5080
5181   logerror ("sample rate: %d\n", device->machine->sample_rate);
5282}
5383
5484static STREAM_UPDATE( dai_sh_update )
5585{
86   dai_sound_state *state = get_token(device);
5687   INT16 channel_0_signal;
5788   INT16 channel_1_signal;
5889   INT16 channel_2_signal;
r9692r9693
6091   stream_sample_t *sample_left = outputs[0];
6192   stream_sample_t *sample_right = outputs[1];
6293
63   channel_0_signal = dai_input[0] ? dai_osc_volume_table[dai_osc_volume[0]] : -dai_osc_volume_table[dai_osc_volume[0]];
64   channel_1_signal = dai_input[1] ? dai_osc_volume_table[dai_osc_volume[1]] : -dai_osc_volume_table[dai_osc_volume[1]];
65   channel_2_signal = dai_input[2] ? dai_osc_volume_table[dai_osc_volume[2]] : -dai_osc_volume_table[dai_osc_volume[2]];
94   channel_0_signal = state->dai_input[0] ? dai_osc_volume_table[state->osc_volume[0]] : -dai_osc_volume_table[state->osc_volume[0]];
95   channel_1_signal = state->dai_input[1] ? dai_osc_volume_table[state->osc_volume[1]] : -dai_osc_volume_table[state->osc_volume[1]];
96   channel_2_signal = state->dai_input[2] ? dai_osc_volume_table[state->osc_volume[2]] : -dai_osc_volume_table[state->osc_volume[2]];
6697
6798   while (samples--)
6899   {
r9692r9693
83114
84115      /* noise channel */
85116
86      *sample_left += mame_rand(device->machine)&0x01 ? dai_noise_volume_table[dai_noise_volume] : -dai_noise_volume_table[dai_noise_volume];
117      *sample_left += mame_rand(device->machine)&0x01 ? dai_noise_volume_table[state->noise_volume] : -dai_noise_volume_table[state->noise_volume];
87118
88119      sample_left++;
89120      sample_right++;
r9692r9693
96127{
97128   switch (state)
98129   {
130      /* --- the following bits of info are returned as 64-bit signed integers --- */
131      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(dai_sound_state);         break;
132
99133      /* --- the following bits of info are returned as pointers to data or functions --- */
100134      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(dai_sound);   break;
101135
src/mess/audio/special.c
r9692r9693
99
1010#include "emu.h"
1111#include "machine/pit8253.h"
12#include "includes/dai.h"
1312#include "streams.h"
1413#include "includes/special.h"
1514
src/mess/machine/dai.c
r9692r9693
2525#define LOG_DAI_PORT_W(_port, _data, _comment) do { if (DEBUG_DAI_PORTS) logerror ("DAI port write: %04x, Data: %02x (%s)\n", _port, _data, _comment); } while (0)
2626
2727/* Discrete I/O devices */
28UINT8 dai_noise_volume;
29UINT8 dai_osc_volume[3];
30static UINT8 dai_paddle_select;
31static UINT8 dai_paddle_enable;
32static UINT8 dai_cassette_motor[2];
33static running_device *dai_tms5501;
3428
3529
3630/* Memory */
3731
3832WRITE8_HANDLER( dai_stack_interrupt_circuit_w )
3933{
40   tms5501_sensor (dai_tms5501, 1);
41   tms5501_sensor (dai_tms5501, 0);
34   dai_state *state = space->machine->driver_data<dai_state>();
35   tms5501_sensor (state->tms5501, 1);
36   tms5501_sensor (state->tms5501, 0);
4237}
4338
4439static void dai_update_memory(running_machine *machine, int dai_rom_bank)
r9692r9693
5146   cpu_set_reg(machine->device("maincpu"), STATE_GENPC, 0xc000);
5247}
5348
54static UINT8 dai_keyboard_scan_mask = 0;
5549
5650static UINT8 dai_keyboard_read (running_device *device)
5751{
52   dai_state *state = device->machine->driver_data<dai_state>();
5853   UINT8 data = 0x00;
5954   int i;
6055   static const char *const keynames[] = { "IN0", "IN1", "IN2", "IN3", "IN4", "IN5", "IN6", "IN7" };
6156
6257   for (i = 0; i < 8; i++)
6358   {
64      if (dai_keyboard_scan_mask & (1 << i))
59      if (state->keyboard_scan_mask & (1 << i))
6560         data |= input_port_read(device->machine, keynames[i]);
6661   }
6762   return data;
r9692r9693
6964
7065static void dai_keyboard_write (running_device *device, UINT8 data)
7166{
72   dai_keyboard_scan_mask = data;
67   dai_state *state = device->machine->driver_data<dai_state>();
68   state->keyboard_scan_mask = data;
7369}
7470
7571static void dai_interrupt_callback(running_device *device, int intreq, UINT8 vector)
r9692r9693
10096
10197static WRITE_LINE_DEVICE_HANDLER( dai_pit_out0 )
10298{
103   dai_set_input(device->machine, 0, state);
99   dai_state *drvstate = device->machine->driver_data<dai_state>();
100   dai_set_input(drvstate->sound, 0, state);
104101}
105102
106103
107104static WRITE_LINE_DEVICE_HANDLER( dai_pit_out1 )
108105{
109   dai_set_input(device->machine, 1, state);
106   dai_state *drvstate = device->machine->driver_data<dai_state>();
107   dai_set_input(drvstate->sound, 1, state);
110108}
111109
112110
113111static WRITE_LINE_DEVICE_HANDLER( dai_pit_out2 )
114112{
115   dai_set_input(device->machine, 2, state);
113   dai_state *drvstate = device->machine->driver_data<dai_state>();
114   dai_set_input(drvstate->sound, 2, state);
116115}
117116
118117
r9692r9693
139138
140139static TIMER_CALLBACK( dai_timer )
141140{
142   tms5501_set_pio_bit_7 (dai_tms5501, (input_port_read(machine, "IN8") & 0x04) ? 1:0);
141   dai_state *state = machine->driver_data<dai_state>();
142   tms5501_set_pio_bit_7 (state->tms5501, (input_port_read(machine, "IN8") & 0x04) ? 1:0);
143143}
144144
145145MACHINE_START( dai )
146146{
147   dai_tms5501 = machine->device("tms5501");
147   dai_state *state = machine->driver_data<dai_state>();
148   state->sound = machine->device("custom");
149   state->tms5501 = machine->device("tms5501");
148150
149151   memory_configure_bank(machine, "bank2", 0, 4, memory_region(machine, "maincpu") + 0x010000, 0x1000);
150152   timer_set(machine, attotime_zero, NULL, 0, dai_bootstrap_callback);
r9692r9693
210212
211213WRITE8_HANDLER( dai_io_discrete_devices_w )
212214{
215   dai_state *state = space->machine->driver_data<dai_state>();
213216   switch(offset & 0x000f) {
214217   case 0x04:
215      dai_osc_volume[0] = data&0x0f;
216      dai_osc_volume[1] = (data&0xf0)>>4;
218      dai_set_volume(state->sound, offset, data);
217219      LOG_DAI_PORT_W (offset, data&0x0f, "discrete devices - osc. 0 volume");
218220      LOG_DAI_PORT_W (offset, (data&0xf0)>>4, "discrete devices - osc. 1 volume");
219221      break;
220222
221223   case 0x05:
222      dai_osc_volume[2] = data&0x0f;
223      dai_noise_volume = (data&0xf0)>>4;
224      dai_set_volume(state->sound, offset, data);
224225      LOG_DAI_PORT_W (offset, data&0x0f, "discrete devices - osc. 2 volume");
225226      LOG_DAI_PORT_W (offset, (data&0xf0)>>4, "discrete devices - noise volume");
226227      break;
227228
228229   case 0x06:
229      dai_paddle_select = (data&0x06)>>2;
230      dai_paddle_enable = (data&0x08)>>3;
231      dai_cassette_motor[0] = (data&0x10)>>4;
232      dai_cassette_motor[1] = (data&0x20)>>5;
233      cassette_change_state(space->machine->device("cassette"), dai_cassette_motor[0]?CASSETTE_MOTOR_DISABLED:CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
230      state->paddle_select = (data&0x06)>>2;
231      state->paddle_enable = (data&0x08)>>3;
232      state->cassette_motor[0] = (data&0x10)>>4;
233      state->cassette_motor[1] = (data&0x20)>>5;
234      cassette_change_state(space->machine->device("cassette"), state->cassette_motor[0]?CASSETTE_MOTOR_DISABLED:CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
234235      cassette_output(space->machine->device("cassette"), (data & 0x01) ? -1.0 : 1.0);
235236      dai_update_memory (space->machine, (data&0xc0)>>6);
236237      LOG_DAI_PORT_W (offset, (data&0x06)>>2, "discrete devices - paddle select");
src/mess/machine/pmd85.c
r9692r9693
2121
2222
2323
24static void (*pmd85_update_memory)(running_machine *);
25
2624enum {PMD85_LED_1, PMD85_LED_2, PMD85_LED_3};
2725enum {PMD85_1, PMD85_2, PMD85_2A, PMD85_2B, PMD85_3, ALFA, MATO, C2717};
2826
r9692r9693
586584   if (state->startup_mem_map)
587585   {
588586      state->startup_mem_map = 0;
589      (*pmd85_update_memory)(space->machine);
587      (*state->update_memory)(space->machine);
590588   }
591589
592590   switch (offset & 0x0c)
r9692r9693
600598                     if ((offset & 0x03) == 0x03)
601599                     {
602600                        state->pmd853_memory_mapping = data & 0x01;
603                        (*pmd85_update_memory)(space->machine);
601                        (*state->update_memory)(space->machine);
604602                     }
605603                     break;
606604            }
r9692r9693
696694   if (state->startup_mem_map)
697695   {
698696      state->startup_mem_map = 0;
699      (*pmd85_update_memory)(space->machine);
697      (*state->update_memory)(space->machine);
700698   }
701699
702700   switch (offset & 0x0c)
r9692r9693
889887{
890888   pmd85_state *state = machine->driver_data<pmd85_state>();
891889   state->model = PMD85_1;
892   pmd85_update_memory = pmd851_update_memory;
890   state->update_memory = pmd851_update_memory;
893891   pmd85_common_driver_init(machine);
894892}
895893
r9692r9693
897895{
898896   pmd85_state *state = machine->driver_data<pmd85_state>();
899897   state->model = PMD85_2A;
900   pmd85_update_memory = pmd852a_update_memory;
898   state->update_memory = pmd852a_update_memory;
901899   pmd85_common_driver_init(machine);
902900}
903901
r9692r9693
905903{
906904   pmd85_state *state = machine->driver_data<pmd85_state>();
907905   state->model = PMD85_3;
908   pmd85_update_memory = pmd853_update_memory;
906   state->update_memory = pmd853_update_memory;
909907   pmd85_common_driver_init(machine);
910908}
911909
r9692r9693
913911{
914912   pmd85_state *state = machine->driver_data<pmd85_state>();
915913   state->model = ALFA;
916   pmd85_update_memory = alfa_update_memory;
914   state->update_memory = alfa_update_memory;
917915   pmd85_common_driver_init(machine);
918916}
919917
r9692r9693
921919{
922920   pmd85_state *state = machine->driver_data<pmd85_state>();
923921   state->model = MATO;
924   pmd85_update_memory = mato_update_memory;
922   state->update_memory = mato_update_memory;
925923}
926924
927925DRIVER_INIT ( c2717 )
928926{
929927   pmd85_state *state = machine->driver_data<pmd85_state>();
930928   state->model = C2717;
931   pmd85_update_memory = c2717_update_memory;
929   state->update_memory = c2717_update_memory;
932930   pmd85_common_driver_init(machine);
933931}
934932
r9692r9693
969967   memset(messram_get_ptr(machine->device("messram")), 0, sizeof(unsigned char)*0x10000);
970968   state->pmd853_memory_mapping = 1;
971969   state->startup_mem_map = 1;
972   pmd85_update_memory(machine);
970   state->update_memory(machine);
973971
974972   timer_set(machine, attotime_zero, NULL, 0, setup_machine_state);
975973
src/mess/machine/p2000t.c
r9692r9693
3232
3333#define P2000M_707F_DISA   0x01
3434
35static struct
36{
37   UINT8 port_101f;
38   UINT8 port_202f;
39   UINT8 port_303f;
40   UINT8 port_707f;
41} p2000t_ports;
42
4335/*
4436    Keyboard port 0x0x
4537
r9692r9693
5244*/
5345READ8_HANDLER (   p2000t_port_000f_r )
5446{
47   p2000t_state *state = space->machine->driver_data<p2000t_state>();
5548   static const char *const keynames[] = {
5649      "KEY0", "KEY1", "KEY2", "KEY3", "KEY4",
5750      "KEY5", "KEY6", "KEY7", "KEY8", "KEY9"
5851   };
5952
60   if (p2000t_ports.port_101f & P2000M_101F_KEYINT)
53   if (state->port_101f & P2000M_101F_KEYINT)
6154   {
6255      return (input_port_read(space->machine, "KEY0") & input_port_read(space->machine, "KEY1") &
6356      input_port_read(space->machine, "KEY2") & input_port_read(space->machine, "KEY3") &
r9692r9693
10598*/
10699WRITE8_HANDLER ( p2000t_port_101f_w )
107100{
108   p2000t_ports.port_101f = data;
101   p2000t_state *state = space->machine->driver_data<p2000t_state>();
102   state->port_101f = data;
109103}
110104
111105/*
r9692r9693
122116*/
123117WRITE8_HANDLER ( p2000t_port_303f_w )
124118{
125   p2000t_ports.port_303f = data;
119   p2000t_state *state = space->machine->driver_data<p2000t_state>();
120   state->port_303f = data;
126121}
127122
128123/*
r9692r9693
161156*/
162157WRITE8_HANDLER ( p2000t_port_707f_w )
163158{
164   p2000t_ports.port_707f = data;
159   p2000t_state *state = space->machine->driver_data<p2000t_state>();
160   state->port_707f = data;
165161}
166162
167163WRITE8_HANDLER ( p2000t_port_888b_w ) {}
src/mess/video/comquest.c
r9692r9693
22
33#include "includes/comquest.h"
44
5static struct {
6   UINT8 data[128][8];
7   void *timer;
8   int line;
9   int dma_activ;
10   int state;
11   int count;
12} comquest_video={ { {0} } };
13
145VIDEO_START( comquest )
156{
16   (void) comquest_video;
177}
188
199VIDEO_UPDATE( comquest )
r9692r9693
2313   for (y=0; y<128;y++) {
2414      for (x=0, j=0; j<8;j++,x+=8*4) {
2515#if 0
26         drawgfx_opaque(bitmap, 0, machine->gfx[0], studio2_video.data[y][j],0,
16         drawgfx_opaque(bitmap, 0, machine->gfx[0], state->data[y][j],0,
2717               0,0,x,y);
2818#endif
2919      }
src/mess/video/dai.c
r9692r9693
4040   0xff, 0xff, 0xff,   /* 15 White     */
4141};
4242
43static unsigned short dai_4_colours_palette[4];
4443
4544PALETTE_INIT( dai )
4645{
r9692r9693
5958
6059VIDEO_UPDATE( dai )
6160{
61   dai_state *state = screen->machine->driver_data<dai_state>();
6262   address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
6363   int i, j, k, l;
6464
r9692r9693
111111      unit_mode = (colour & 0x40) >> 6;
112112
113113      if (colour & 0x80)
114         dai_4_colours_palette[(colour & 0x30) >> 4] = colour & 0x0f;
114         state->_4_colours_palette[(colour & 0x30) >> 4] = colour & 0x0f;
115115
116116      switch (display_mode)
117117      {
r9692r9693
133133                  {
134134                     for (k=0; k<8; k++)
135135                     {
136                        current_colour = dai_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
136                        current_colour = state->_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
137137                        for (l=0; l<12; l++)
138138                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*12+l) = current_colour;
139139                     }
r9692r9693
150150                  {
151151                     for (k=0; k<8; k++)
152152                     {
153                        current_colour = dai_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
153                        current_colour = state->_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
154154                        for (l=0; l<12; l++)
155155                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*12+l) = current_colour;
156156                     }
r9692r9693
172172                  {
173173                     for (k=0; k<8; k++)
174174                     {
175                        current_colour = dai_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
175                        current_colour = state->_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
176176                        for (l=0; l<6; l++)
177177                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*6+l) = current_colour;
178178                     }
r9692r9693
189189                  {
190190                     for (k=0; k<8; k++)
191191                     {
192                        current_colour = dai_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
192                        current_colour = state->_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
193193                        for (l=0; l<6; l++)
194194                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*6+l) = current_colour;
195195                     }
r9692r9693
211211                  {
212212                     for (k=0; k<8; k++)
213213                     {
214                        current_colour = dai_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
214                        current_colour = state->_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
215215                        for (l=0; l<3; l++)
216216                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*3+l) = current_colour;
217217                     }
r9692r9693
227227                  {
228228                     for (k=0; k<8; k++)
229229                     {
230                        current_colour = dai_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
230                        current_colour = state->_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
231231                        for (l=0; l<3; l++)
232232                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*3+l) = current_colour;
233233                     }
r9692r9693
249249                  {
250250                     for (k=0; k<8; k++)
251251                     {
252                        current_colour = dai_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
252                        current_colour = state->_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
253253                        for (l=0; l<2; l++)
254254                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*2+l) = current_colour;
255255                     }
r9692r9693
265265                  {
266266                     for (k=0; k<8; k++)
267267                     {
268                        current_colour = dai_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
268                        current_colour = state->_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)];
269269                        for (l=0; l<2; l++)
270270                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*2+l) = current_colour;
271271                     }
r9692r9693
294294                  {
295295                     for (k=0; k<8; k++)
296296                     {
297                        current_colour = dai_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
297                        current_colour = state->_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
298298                        for (l=0; l<12; l++)
299299                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*12+l) = current_colour;
300300                     }
r9692r9693
312312                  {
313313                     for (k=0; k<8; k++)
314314                     {
315                        current_colour = dai_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
315                        current_colour = state->_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
316316                        for (l=0; l<12; l++)
317317                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*12+l) = current_colour;
318318                     }
r9692r9693
335335                  {
336336                     for (k=0; k<8; k++)
337337                     {
338                        current_colour = dai_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
338                        current_colour = state->_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
339339                        for (l=0; l<6; l++)
340340                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*6+l) = current_colour;
341341                     }
r9692r9693
353353                  {
354354                     for (k=0; k<8; k++)
355355                     {
356                        current_colour = dai_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
356                        current_colour = state->_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
357357                        for (l=0; l<6; l++)
358358                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*6+l) = current_colour;
359359                     }
r9692r9693
376376                  {
377377                     for (k=0; k<8; k++)
378378                     {
379                        current_colour = dai_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
379                        current_colour = state->_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
380380                        for (l=0; l<3; l++)
381381                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*3+l) = current_colour;
382382                     }
r9692r9693
393393                  {
394394                     for (k=0; k<8; k++)
395395                     {
396                        current_colour = dai_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
396                        current_colour = state->_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
397397                        for (l=0; l<3; l++)
398398                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*3+l) = current_colour;
399399                     }
r9692r9693
415415                  {
416416                     for (k=0; k<8; k++)
417417                     {
418                        current_colour = dai_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
418                        current_colour = state->_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
419419                        for (l=0; l<2; l++)
420420                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*2+l) = current_colour;
421421                     }
r9692r9693
432432                  {
433433                     for (k=0; k<8; k++)
434434                     {
435                        current_colour = dai_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
435                        current_colour = state->_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)];
436436                        for (l=0; l<2; l++)
437437                           *BITMAP_ADDR16(bitmap, current_scan_line/2 + j, (i*8+k)*2+l) = current_colour;
438438                     }
src/mess/video/arcadia.c
r9692r9693
283283    // 8x user defined
284284};
285285
286static struct {
287    int line;
288    int charline;
289    int shift;
290    int ad_delay;
291    int ad_select;
292    int ypos;
293    int graphics;
294    int doublescan;
295    int lines26;
296    int multicolor;
297    struct { int x, y; } pos[4];
298    UINT8 bg[262][16+2*XPOS/8];
299    UINT8 rectangle[0x40][8];
300    UINT8 chars[0x40][8];
301    int breaker;
302    union {
303   UINT8 data[0x400];
304   struct   {
305         // 0x1800
306         UINT8 chars1[13][16];
307         UINT8 ram1[2][16];
308         struct   {
309            UINT8 y,x;
310         } pos[4];
311         UINT8 ram2[4];
312         UINT8 vpos;
313         UINT8 sound1, sound2;
314         UINT8 char_line;
315         // 0x1900
316         UINT8 pad1a, pad1b, pad1c, pad1d;
317         UINT8 pad2a, pad2b, pad2c, pad2d;
318         UINT8 keys, unmapped3[0x80-9];
319         UINT8 chars[8][8];
320         UINT8 unknown[0x38];
321         UINT8 pal[4];
322         UINT8 collision_bg,
323         collision_sprite;
324         UINT8 ad[2];
325         // 0x1a00
326         UINT8 chars2[13][16];
327         UINT8 ram3[3][16];
328   } d;
329    } reg;
330    bitmap_t *bitmap;
331} arcadia_video={ 0 };
332
333286VIDEO_START( arcadia )
334287{
288   arcadia_state *state = machine->driver_data<arcadia_state>();
335289   int i;
336   memcpy(&arcadia_video.chars, chars, sizeof(chars));
290   memcpy(&state->chars, chars, sizeof(chars));
337291   for (i=0; i<0x40; i++)
338292   {
339      arcadia_video.rectangle[i][0]=0;
340      arcadia_video.rectangle[i][4]=0;
341      if (i&1) arcadia_video.rectangle[i][0]|=3;
342      if (i&2) arcadia_video.rectangle[i][0]|=0x1c;
343      if (i&4) arcadia_video.rectangle[i][0]|=0xe0;
344      if (i&8) arcadia_video.rectangle[i][4]|=3;
345      if (i&0x10) arcadia_video.rectangle[i][4]|=0x1c;
346      if (i&0x20) arcadia_video.rectangle[i][4]|=0xe0;
347      arcadia_video.rectangle[i][1]=arcadia_video.rectangle[i][2]=arcadia_video.rectangle[i][3]=arcadia_video.rectangle[i][0];
348      arcadia_video.rectangle[i][5]=arcadia_video.rectangle[i][6]=arcadia_video.rectangle[i][7]=arcadia_video.rectangle[i][4];
293      state->rectangle[i][0]=0;
294      state->rectangle[i][4]=0;
295      if (i&1) state->rectangle[i][0]|=3;
296      if (i&2) state->rectangle[i][0]|=0x1c;
297      if (i&4) state->rectangle[i][0]|=0xe0;
298      if (i&8) state->rectangle[i][4]|=3;
299      if (i&0x10) state->rectangle[i][4]|=0x1c;
300      if (i&0x20) state->rectangle[i][4]|=0xe0;
301      state->rectangle[i][1]=state->rectangle[i][2]=state->rectangle[i][3]=state->rectangle[i][0];
302      state->rectangle[i][5]=state->rectangle[i][6]=state->rectangle[i][7]=state->rectangle[i][4];
349303   }
350304
351305   {
352306      screen_device *screen = screen_first(*machine);
353307      int width = screen->width();
354308      int height = screen->height();
355      arcadia_video.bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16);
309      state->bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16);
356310   }
357311}
358312
359313READ8_HANDLER(arcadia_video_r)
360314{
315   arcadia_state *state = space->machine->driver_data<arcadia_state>();
361316    UINT8 data=0;
362317    switch (offset) {
363    case 0xff: data=arcadia_video.charline|0xf0;break;
318    case 0xff: data=state->charline|0xf0;break;
364319    case 0x100: data=input_port_read(space->machine, "controller1_col1");break;
365320    case 0x101: data=input_port_read(space->machine, "controller1_col2");break;
366321    case 0x102: data=input_port_read(space->machine, "controller1_col3");break;
r9692r9693
372327    case 0x108: data=input_port_read(space->machine, "panel");break;
373328#if 0
374329    case 0x1fe:
375   if (arcadia_video.ad_select)
330   if (state->ad_select)
376331      data=input_port_read(space->machine, "controller1_joy_y")<<3;
377332   else
378333      data=input_port_read(space->machine, "controller1_joy_x")<<3;
379334   break;
380335    case 0x1ff:
381   if (arcadia_video.ad_select)
336   if (state->ad_select)
382337      data=input_port_read(space->machine, "controller2_joy_y")<<3;
383338   else
384339      data=input_port_read(space->machine, "controller2_joy_x")<<3;
r9692r9693
386341#else
387342    case 0x1fe:
388343   data = 0x80;
389   if (arcadia_video.ad_select) {
344   if (state->ad_select) {
390345       if (input_port_read(space->machine, "joysticks")&0x10) data=0;
391346       if (input_port_read(space->machine, "joysticks")&0x20) data=0xff;
392347   } else {
r9692r9693
396351   break;
397352    case 0x1ff:
398353   data = 0x6f; // 0x7f too big for alien invaders (movs right)
399   if (arcadia_video.ad_select) {
354   if (state->ad_select) {
400355       if (input_port_read(space->machine, "joysticks")&0x1) data=0;
401356       if (input_port_read(space->machine, "joysticks")&0x2) data=0xff;
402357   } else {
r9692r9693
406361   break;
407362#endif
408363    default:
409   data=arcadia_video.reg.data[offset];
364   data=state->reg.data[offset];
410365    }
411366    return data;
412367}
413368
414369WRITE8_HANDLER(arcadia_video_w)
415370{
416   arcadia_video.reg.data[offset]=data;
371   arcadia_state *state = space->machine->driver_data<arcadia_state>();
372   state->reg.data[offset]=data;
417373   switch (offset)
418374   {
419375      case 0xfc:
420         arcadia_video.ypos=255-data+YPOS;
376         state->ypos=255-data+YPOS;
421377         break;
422378      case 0xfd:
423379         arcadia_soundport_w(space->machine->device("custom"), offset&3, data);
424         arcadia_video.multicolor=data&0x80;
380         state->multicolor=data&0x80;
425381         break;
426382      case 0xfe:
427383         arcadia_soundport_w(space->machine->device("custom"), offset&3, data);
428         arcadia_video.shift=(data>>5);
384         state->shift=(data>>5);
429385         break;
430386      case 0xf0: case 0xf2: case 0xf4: case 0xf6:
431         arcadia_video.pos[(offset>>1)&3].y=(data^0xff)+1;
387         state->pos[(offset>>1)&3].y=(data^0xff)+1;
432388         break;
433389      case 0xf1: case 0xf3: case 0xf5: case 0xf7:
434         arcadia_video.pos[(offset>>1)&3].x=data-43;
390         state->pos[(offset>>1)&3].x=data-43;
435391         break;
436392      case 0x180: case 0x181: case 0x182: case 0x183: case 0x184: case 0x185: case 0x186: case 0x187:
437393      case 0x188: case 0x189: case 0x18a: case 0x18b: case 0x18c: case 0x18d: case 0x18e: case 0x18f:
r9692r9693
441397      case 0x1a8: case 0x1a9: case 0x1aa: case 0x1ab: case 0x1ac: case 0x1ad: case 0x1ae: case 0x1af:
442398      case 0x1b0: case 0x1b1: case 0x1b2: case 0x1b3: case 0x1b4: case 0x1b5: case 0x1b6: case 0x1b7:
443399      case 0x1b8: case 0x1b9: case 0x1ba: case 0x1bb: case 0x1bc: case 0x1bd: case 0x1be: case 0x1bf:
444         arcadia_video.chars[0x38|((offset>>3)&7)][offset&7]=data;
400         state->chars[0x38|((offset>>3)&7)][offset&7]=data;
445401         break;
446402      case 0x1f8:
447         arcadia_video.lines26=data&0x40;
448         arcadia_video.graphics=data&0x80;
403         state->lines26=data&0x40;
404         state->graphics=data&0x80;
449405         break;
450406      case 0x1f9:
451         arcadia_video.doublescan=!(data&0x80);
452         arcadia_video.ad_delay=10;
407         state->doublescan=!(data&0x80);
408         state->ad_delay=10;
453409         break;
454410   }
455411}
r9692r9693
457413INLINE void arcadia_draw_char(running_machine *machine, bitmap_t *bitmap, UINT8 *ch, int charcode,
458414               int y, int x)
459415{
416   arcadia_state *state = machine->driver_data<arcadia_state>();
460417    int k,b,cc,sc, colour;
461    if (arcadia_video.multicolor)
418    if (state->multicolor)
462419   {
463420      if (charcode&0x40)
464         cc=((arcadia_video.reg.d.pal[1]>>3)&7);
421         cc=((state->reg.d.pal[1]>>3)&7);
465422      else
466         cc=((arcadia_video.reg.d.pal[0]>>3)&7);
423         cc=((state->reg.d.pal[0]>>3)&7);
467424
468425      if (charcode&0x80)
469         sc=(arcadia_video.reg.d.pal[1]&7);
426         sc=(state->reg.d.pal[1]&7);
470427      else
471         sc=(arcadia_video.reg.d.pal[0]&7);
428         sc=(state->reg.d.pal[0]&7);
472429
473430    }
474431   else
475432   {
476      cc=((arcadia_video.reg.d.pal[1]>>3)&1)|((charcode>>5)&6);
477      sc=(arcadia_video.reg.d.pal[1]&7);
433      cc=((state->reg.d.pal[1]>>3)&1)|((charcode>>5)&6);
434      sc=(state->reg.d.pal[1]&7);
478435    }
479436   colour = (((sc << 3) | cc) + 4);
480437
481    if (arcadia_video.doublescan)
438    if (state->doublescan)
482439   {
483440   for (k=0; (k<8)&&(y<bitmap->height); k++, y+=2)
484441      {
485442       b=ch[k];
486       arcadia_video.bg[y][x>>3]|=b>>(x&7);
487       arcadia_video.bg[y][(x>>3)+1]|=b<<(8-(x&7));
443       state->bg[y][x>>3]|=b>>(x&7);
444       state->bg[y][(x>>3)+1]|=b<<(8-(x&7));
488445
489446            if (y+1<bitmap->height) {
490                arcadia_video.bg[y+1][x>>3]|=b>>(x&7);
491                arcadia_video.bg[y+1][(x>>3)+1]|=b<<(8-(x&7));
447                state->bg[y+1][x>>3]|=b>>(x&7);
448                state->bg[y+1][(x>>3)+1]|=b<<(8-(x&7));
492449                drawgfx_opaque(bitmap, 0, machine->gfx[0], b,colour,
493450                        0,0,x,y);
494451                drawgfx_opaque(bitmap, 0, machine->gfx[0], b,colour,
r9692r9693
501458   for (k=0; (k<8)&&(y<bitmap->height); k++, y++)
502459      {
503460       b=ch[k];
504            arcadia_video.bg[y][x>>3]|=b>>(x&7);
505       arcadia_video.bg[y][(x>>3)+1]|=b<<(8-(x&7));
461            state->bg[y][x>>3]|=b>>(x&7);
462       state->bg[y][(x>>3)+1]|=b<<(8-(x&7));
506463
507464       drawgfx_opaque(bitmap, 0, machine->gfx[0], b,colour,
508465          0,0,x,y);
r9692r9693
513470INLINE void arcadia_vh_draw_line(running_machine *machine, bitmap_t *bitmap,
514471             int y, UINT8 chars1[16])
515472{
473   arcadia_state *state = machine->driver_data<arcadia_state>();
516474    int x, ch, j, h;
517    int graphics=arcadia_video.graphics;
518    h=arcadia_video.doublescan?16:8;
475    int graphics=state->graphics;
476    h=state->doublescan?16:8;
519477
520    if (bitmap->height-arcadia_video.line<h)
521      h=bitmap->height-arcadia_video.line;
478    if (bitmap->height-state->line<h)
479      h=bitmap->height-state->line;
522480
523   plot_box(bitmap, 0, y, bitmap->width, h, (arcadia_video.reg.d.pal[1]&7));
524    memset(arcadia_video.bg[y], 0, sizeof(arcadia_video.bg[0])*h);
481   plot_box(bitmap, 0, y, bitmap->width, h, (state->reg.d.pal[1]&7));
482    memset(state->bg[y], 0, sizeof(state->bg[0])*h);
525483
526   for (x=XPOS+arcadia_video.shift, j=0; j<16;j++,x+=8)
484   for (x=XPOS+state->shift, j=0; j<16;j++,x+=8)
527485   {
528486      ch=chars1[j];
529487// hangman switches with 0x40
r9692r9693
539497         }
540498      }
541499      if (graphics)
542         arcadia_draw_char(machine, bitmap, arcadia_video.rectangle[ch&0x3f], ch, y, x);
500         arcadia_draw_char(machine, bitmap, state->rectangle[ch&0x3f], ch, y, x);
543501      else
544         arcadia_draw_char(machine, bitmap, arcadia_video.chars[ch&0x3f], ch, y, x);
502         arcadia_draw_char(machine, bitmap, state->chars[ch&0x3f], ch, y, x);
545503    }
546504}
547505
548static int arcadia_sprite_collision(int n1, int n2)
506static int arcadia_sprite_collision(arcadia_state *state, int n1, int n2)
549507{
550508    int k, b1, b2, x;
551    if (arcadia_video.pos[n1].x+8<=arcadia_video.pos[n2].x) return FALSE;
552    if (arcadia_video.pos[n1].x>=arcadia_video.pos[n2].x+8) return FALSE;
509    if (state->pos[n1].x+8<=state->pos[n2].x) return FALSE;
510    if (state->pos[n1].x>=state->pos[n2].x+8) return FALSE;
553511    for (k=0; k<8; k++) {
554   if (arcadia_video.pos[n1].y+k<arcadia_video.pos[n2].y) continue;
555   if (arcadia_video.pos[n1].y+k>=arcadia_video.pos[n2].y+8) break;
556   x=arcadia_video.pos[n1].x-arcadia_video.pos[n2].x;
557   b1=arcadia_video.reg.d.chars[n1][k];
558   b2=arcadia_video.reg.d.chars[n2][arcadia_video.pos[n1].y+k-arcadia_video.pos[n2].y];
512   if (state->pos[n1].y+k<state->pos[n2].y) continue;
513   if (state->pos[n1].y+k>=state->pos[n2].y+8) break;
514   x=state->pos[n1].x-state->pos[n2].x;
515   b1=state->reg.d.chars[n1][k];
516   b2=state->reg.d.chars[n2][state->pos[n1].y+k-state->pos[n2].y];
559517   if (x<0) b2>>=-x;
560518   if (x>0) b1>>=x;
561519   if (b1&b2) return TRUE;
r9692r9693
565523
566524static void arcadia_draw_sprites(running_machine *machine, bitmap_t *bitmap)
567525{
526   arcadia_state *state = machine->driver_data<arcadia_state>();
568527    int i, k, x, y, color=0;
569528    UINT8 b;
570529
571    arcadia_video.reg.d.collision_bg|=0xf;
572    arcadia_video.reg.d.collision_sprite|=0x3f;
530    state->reg.d.collision_bg|=0xf;
531    state->reg.d.collision_sprite|=0x3f;
573532    for (i=0; i<4; i++)
574533   {
575534   int doublescan = FALSE;
576   if (arcadia_video.pos[i].y<=-YPOS) continue;
577   if (arcadia_video.pos[i].y>=bitmap->height-YPOS-8) continue;
578   if (arcadia_video.pos[i].x<=-XPOS) continue;
579   if (arcadia_video.pos[i].x>=128+XPOS-8) continue;
535   if (state->pos[i].y<=-YPOS) continue;
536   if (state->pos[i].y>=bitmap->height-YPOS-8) continue;
537   if (state->pos[i].x<=-XPOS) continue;
538   if (state->pos[i].x>=128+XPOS-8) continue;
580539
581540   switch (i)
582541   {
583542   case 0:
584       color=(arcadia_video.reg.d.pal[3]>>3)&7;
585       doublescan=arcadia_video.reg.d.pal[3]&0x80?FALSE:TRUE;
543       color=(state->reg.d.pal[3]>>3)&7;
544       doublescan=state->reg.d.pal[3]&0x80?FALSE:TRUE;
586545       break;
587546   case 1:
588       color=arcadia_video.reg.d.pal[3]&7;
589       doublescan=arcadia_video.reg.d.pal[3]&0x40?FALSE:TRUE;
547       color=state->reg.d.pal[3]&7;
548       doublescan=state->reg.d.pal[3]&0x40?FALSE:TRUE;
590549       break;
591550   case 2:
592       color=(arcadia_video.reg.d.pal[2]>>3)&7;
593       doublescan=arcadia_video.reg.d.pal[2]&0x80?FALSE:TRUE;
551       color=(state->reg.d.pal[2]>>3)&7;
552       doublescan=state->reg.d.pal[2]&0x80?FALSE:TRUE;
594553       break;
595554   case 3:
596       color=arcadia_video.reg.d.pal[2]&7;
597       doublescan=arcadia_video.reg.d.pal[2]&0x40?FALSE:TRUE;
555       color=state->reg.d.pal[2]&7;
556       doublescan=state->reg.d.pal[2]&0x40?FALSE:TRUE;
598557       break;
599558   }
600559   for (k=0; k<8; k++)
601560   {
602561      int j, m;
603       b=arcadia_video.reg.d.chars[i][k];
604       x=arcadia_video.pos[i].x+XPOS;
562       b=state->reg.d.chars[i][k];
563       x=state->pos[i].x+XPOS;
605564       if (!doublescan)
606565      {
607      y=arcadia_video.pos[i].y+YPOS+k;
566      y=state->pos[i].y+YPOS+k;
608567      for (j=0,m=0x80; j<8; j++, m>>=1)
609568      {
610569         if (b & m)
r9692r9693
615574       }
616575      else
617576      {
618      y=arcadia_video.pos[i].y+YPOS+k*2;
577      y=state->pos[i].y+YPOS+k*2;
619578      for (j=0,m=0x80; j<8; j++, m>>=1)
620579      {
621580         if (b & m)
r9692r9693
625584         }
626585      }
627586       }
628       if (arcadia_video.reg.d.collision_bg&(1<<i))
587       if (state->reg.d.collision_bg&(1<<i))
629588      {
630         if ( (b<<(8-(x&7))) & ((arcadia_video.bg[y][x>>3]<<8)
631                        |arcadia_video.bg[y][(x>>3)+1]) )
632            arcadia_video.reg.d.collision_bg&=~(1<<i);
589         if ( (b<<(8-(x&7))) & ((state->bg[y][x>>3]<<8)
590                        |state->bg[y][(x>>3)+1]) )
591            state->reg.d.collision_bg&=~(1<<i);
633592       }
634593   }
635594    }
636    if (arcadia_sprite_collision(0,1)) arcadia_video.reg.d.collision_sprite&=~1;
637    if (arcadia_sprite_collision(0,2)) arcadia_video.reg.d.collision_sprite&=~2;
638    if (arcadia_sprite_collision(0,3)) arcadia_video.reg.d.collision_sprite&=~4;
639    if (arcadia_sprite_collision(1,2)) arcadia_video.reg.d.collision_sprite&=~8;
640    if (arcadia_sprite_collision(1,3)) arcadia_video.reg.d.collision_sprite&=~0x10; //guess
641    if (arcadia_sprite_collision(2,3)) arcadia_video.reg.d.collision_sprite&=~0x20; //guess
595    if (arcadia_sprite_collision(state,0,1)) state->reg.d.collision_sprite&=~1;
596    if (arcadia_sprite_collision(state,0,2)) state->reg.d.collision_sprite&=~2;
597    if (arcadia_sprite_collision(state,0,3)) state->reg.d.collision_sprite&=~4;
598    if (arcadia_sprite_collision(state,1,2)) state->reg.d.collision_sprite&=~8;
599    if (arcadia_sprite_collision(state,1,3)) state->reg.d.collision_sprite&=~0x10; //guess
600    if (arcadia_sprite_collision(state,2,3)) state->reg.d.collision_sprite&=~0x20; //guess
642601}
643602
644603INTERRUPT_GEN( arcadia_video_line )
645604{
605   arcadia_state *state = device->machine->driver_data<arcadia_state>();
646606   screen_device *screen = screen_first(*device->machine);
647607   int width = screen->width();
648608
649   if (arcadia_video.ad_delay<=0)
650   arcadia_video.ad_select=arcadia_video.reg.d.pal[1]&0x40;
651   else arcadia_video.ad_delay--;
609   if (state->ad_delay<=0)
610   state->ad_select=state->reg.d.pal[1]&0x40;
611   else state->ad_delay--;
652612
653   arcadia_video.line++;
654   arcadia_video.line%=262;
613   state->line++;
614   state->line%=262;
655615   // unbelievable, reflects only charline, but alien invaders uses it for
656616   // alien scrolling
657617
658   if (arcadia_video.line<arcadia_video.ypos)
618   if (state->line<state->ypos)
659619   {
660      plot_box(arcadia_video.bitmap, 0, arcadia_video.line, width, 1, (arcadia_video.reg.d.pal[1])&7);
661      memset(arcadia_video.bg[arcadia_video.line], 0, sizeof(arcadia_video.bg[0]));
620      plot_box(state->bitmap, 0, state->line, width, 1, (state->reg.d.pal[1])&7);
621      memset(state->bg[state->line], 0, sizeof(state->bg[0]));
662622   }
663623   else
664624   {
665      int h=arcadia_video.doublescan?16:8;
625      int h=state->doublescan?16:8;
666626
667      arcadia_video.charline=(arcadia_video.line-arcadia_video.ypos)/h;
627      state->charline=(state->line-state->ypos)/h;
668628
669      if (arcadia_video.charline<13)
629      if (state->charline<13)
670630      {
671         if (((arcadia_video.line-arcadia_video.ypos)&(h-1))==0)
631         if (((state->line-state->ypos)&(h-1))==0)
672632         {
673            arcadia_vh_draw_line(device->machine, arcadia_video.bitmap, arcadia_video.charline*h+arcadia_video.ypos,
674               arcadia_video.reg.d.chars1[arcadia_video.charline]);
633            arcadia_vh_draw_line(device->machine, state->bitmap, state->charline*h+state->ypos,
634               state->reg.d.chars1[state->charline]);
675635         }
676636      }
677637      else
678         if (arcadia_video.lines26 && (arcadia_video.charline<26))
638         if (state->lines26 && (state->charline<26))
679639         {
680            if (((arcadia_video.line-arcadia_video.ypos)&(h-1))==0)
640            if (((state->line-state->ypos)&(h-1))==0)
681641            {
682               arcadia_vh_draw_line(device->machine, arcadia_video.bitmap, arcadia_video.charline*h+arcadia_video.ypos,
683                  arcadia_video.reg.d.chars2[arcadia_video.charline-13]);
642               arcadia_vh_draw_line(device->machine, state->bitmap, state->charline*h+state->ypos,
643                  state->reg.d.chars2[state->charline-13]);
684644            }
685         arcadia_video.charline-=13;
645         state->charline-=13;
686646         }
687647         else
688648         {
689         arcadia_video.charline=0xd;
690         plot_box(arcadia_video.bitmap, 0, arcadia_video.line, width, 1, (arcadia_video.reg.d.pal[1])&7);
691         memset(arcadia_video.bg[arcadia_video.line], 0, sizeof(arcadia_video.bg[0]));
649         state->charline=0xd;
650         plot_box(state->bitmap, 0, state->line, width, 1, (state->reg.d.pal[1])&7);
651         memset(state->bg[state->line], 0, sizeof(state->bg[0]));
692652         }
693653   }
694   if (arcadia_video.line==261)
695      arcadia_draw_sprites(device->machine, arcadia_video.bitmap);
654   if (state->line==261)
655      arcadia_draw_sprites(device->machine, state->bitmap);
696656}
697657
698658READ8_HANDLER(arcadia_vsync_r)
699659{
700    return arcadia_video.line>=216?0x80:0;
660   arcadia_state *state = space->machine->driver_data<arcadia_state>();
661    return state->line>=216?0x80:0;
701662}
702663
703664VIDEO_UPDATE( arcadia )
704665{
705   copybitmap(bitmap, arcadia_video.bitmap, 0, 0, 0, 0, cliprect);
666   arcadia_state *state = screen->machine->driver_data<arcadia_state>();
667   copybitmap(bitmap, state->bitmap, 0, 0, 0, 0, cliprect);
706668   return 0;
707669}
src/mess/video/p2000m.c
r9692r9693
1010#include "includes/p2000t.h"
1111
1212
13static INT8 frame_count;
1413
1514
1615VIDEO_START( p2000m )
1716{
18   frame_count = 0;
17   p2000t_state *state = machine->driver_data<p2000t_state>();
18   state->frame_count = 0;
1919}
2020
2121
r9692r9693
3030      sy = (offs / 80) * 20;
3131      sx = (offs % 80) * 12;
3232
33      if ((frame_count > 25) && (videoram[offs + 2048] & 0x40))
33      if ((state->frame_count > 25) && (videoram[offs + 2048] & 0x40))
3434         code = 32;
3535      else
3636      {
src/mess/video/bbc.c
r9692r9693
1717static void BBC_draw_hi_res(running_machine* machine);
1818static void BBC_draw_teletext(running_machine *machine);
1919
20static void (*draw_function)(running_machine* machine);
21
2220static void BBC_draw_RGB_in(running_machine *machine, int offset,int data);
2321
2422/************************************************************************
r9692r9693
276274         state->emulation_pixels_per_real_pixel=3;
277275         state->x_screen_offset=-154;
278276         state->y_screen_offset=0;
279         draw_function=*BBC_draw_teletext;
277         state->draw_function=*BBC_draw_teletext;
280278      } else {
281279         // this is the number of BBC pixels held in each byte
282280         state->pixels_per_byte=pixels_per_byte_set[state->videoULA_characters_per_line|(state->videoULA_6845_clock_rate<<2)];
r9692r9693
286284         state->emulation_pixels_per_real_pixel=emulation_pixels_per_real_pixel_set[state->videoULA_characters_per_line];
287285         state->x_screen_offset=-96;
288286         state->y_screen_offset=-11;
289         draw_function=*BBC_draw_hi_res;
287         state->draw_function=*BBC_draw_hi_res;
290288      }
291289
292290      break;
r9692r9693
602600   // or until a timeout (this catches the 6845 with silly register values that would not give a VSYNC signal)
603601   while((!state->BBC_VSync)&&(c<60000))
604602   {
605      if ((state->y_screen_pos>=cliprect->min_y) && (state->y_screen_pos<=cliprect->max_y)) (draw_function)(screen->machine);
603      if ((state->y_screen_pos>=cliprect->min_y) && (state->y_screen_pos<=cliprect->max_y)) (state->draw_function)(screen->machine);
606604
607605      // and check the cursor
608606      if (state->VideoULA_CR) BBC_Clock_CR(state);
r9692r9693
660658
661659   state->BBC_Video_RAM = memory_region(machine, "maincpu");
662660   state->vidmem_RAM = state->vidmem;
663   draw_function = *BBC_draw_hi_res;
661   state->draw_function = *BBC_draw_hi_res;
664662}
665663
666664VIDEO_START( bbca )
src/mess/includes/comquest.h
r9692r9693
88#define COMQUEST_H_
99
1010
11class comquest_state : public driver_device
12{
13public:
14   comquest_state(running_machine &machine, const driver_device_config_base &config)
15      : driver_device(machine, config) { }
16
17   UINT8 data[128][8];
18   void *timer;
19   int line;
20   int dma_activ;
21   int state;
22   int count;
23};
24
25
1126/*----------- defined in video/comquest.c -----------*/
1227
1328VIDEO_START( comquest );
src/mess/includes/dai.h
r9692r9693
1313#define DAI_DEBUG   1
1414
1515
16class dai_state : public driver_device
17{
18public:
19   dai_state(running_machine &machine, const driver_device_config_base &config)
20      : driver_device(machine, config) { }
21
22   UINT8 paddle_select;
23   UINT8 paddle_enable;
24   UINT8 cassette_motor[2];
25   running_device *sound;
26   running_device *tms5501;
27   UINT8 keyboard_scan_mask;
28   unsigned short _4_colours_palette[4];
29};
30
31
1632/*----------- defined in machine/dai.c -----------*/
1733
1834extern const struct pit8253_config dai_pit8253_intf;
r9692r9693
2642WRITE8_HANDLER( dai_stack_interrupt_circuit_w );
2743READ8_HANDLER( dai_amd9511_r );
2844WRITE8_HANDLER( dai_amd9511_w );
29extern UINT8 dai_noise_volume;
30extern UINT8 dai_osc_volume[3];
3145
3246
3347/*----------- defined in video/dai.c -----------*/
r9692r9693
4357
4458DECLARE_LEGACY_SOUND_DEVICE(DAI, dai_sound);
4559
46void dai_set_input(running_machine *machine, int index, int state);
60void dai_set_input(running_device *device, int index, int state);
61void dai_set_volume(running_device *device, int offset, UINT8 data);
4762
4863
4964#endif /* DAI_H_ */
src/mess/includes/arcadia.h
r9692r9693
1818#define XPOS 32
1919
2020
21class arcadia_state : public driver_device
22{
23public:
24   arcadia_state(running_machine &machine, const driver_device_config_base &config)
25      : driver_device(machine, config) { }
26
27    int line;
28    int charline;
29    int shift;
30    int ad_delay;
31    int ad_select;
32    int ypos;
33    int graphics;
34    int doublescan;
35    int lines26;
36    int multicolor;
37    struct { int x, y; } pos[4];
38    UINT8 bg[262][16+2*XPOS/8];
39    UINT8 rectangle[0x40][8];
40    UINT8 chars[0x40][8];
41    int breaker;
42    union {
43   UINT8 data[0x400];
44   struct   {
45         // 0x1800
46         UINT8 chars1[13][16];
47         UINT8 ram1[2][16];
48         struct   {
49            UINT8 y,x;
50         } pos[4];
51         UINT8 ram2[4];
52         UINT8 vpos;
53         UINT8 sound1, sound2;
54         UINT8 char_line;
55         // 0x1900
56         UINT8 pad1a, pad1b, pad1c, pad1d;
57         UINT8 pad2a, pad2b, pad2c, pad2d;
58         UINT8 keys, unmapped3[0x80-9];
59         UINT8 chars[8][8];
60         UINT8 unknown[0x38];
61         UINT8 pal[4];
62         UINT8 collision_bg,
63         collision_sprite;
64         UINT8 ad[2];
65         // 0x1a00
66         UINT8 chars2[13][16];
67         UINT8 ram3[3][16];
68   } d;
69    } reg;
70    bitmap_t *bitmap;
71};
72
73
2174/*----------- defined in video/arcadia.c -----------*/
2275
2376extern INTERRUPT_GEN( arcadia_video_line );
src/mess/includes/pmd85.h
r9692r9693
2424   int clk_level_tape;
2525   UINT8 model;
2626   emu_timer * cassette_timer;
27   void (*update_memory)(running_machine *);
2728};
2829
2930
src/mess/includes/spectrum.h
r9692r9693
8484   UINT8 *screen_location;
8585
8686   int ROMSelection;
87
88   /* for elwro800 */
89   /* RAM mapped at 0 */
90   UINT8 ram_at_0000;
91
92   /* NR signal */
93   UINT8 NR;
94   UINT8 df_on_databus;
9587};
9688
9789
src/mess/includes/p2000t.h
r9692r9693
1515      : driver_device(machine, config) { }
1616
1717   UINT8 *videoram;
18   UINT8 port_101f;
19   UINT8 port_202f;
20   UINT8 port_303f;
21   UINT8 port_707f;
22   INT8 frame_count;
1823};
1924
2025
src/mess/includes/fmtowns.h
r9692r9693
145145   running_device* hd2;
146146   running_device* hd3;
147147   running_device* hd4;
148   UINT32 kb_prev[4];
149   UINT8 prev_pad_mask;
150   UINT8 prev_x;
151   UINT8 prev_y;
148152};
149153
150154void towns_update_video_banks(address_space*);
src/mess/includes/ti89.h
r9692r9693
6060   READ16_MEMBER ( ti68k_io2_r );
6161   WRITE16_MEMBER ( flash_w );
6262   READ16_MEMBER ( flash_r );
63   UINT64 timer;
6364};
6465
6566#endif // TI89_H_
src/mess/includes/bbc.h
r9692r9693
111111   int *videoULA_pallet_lookup;
112112   int x_screen_offset;
113113   int y_screen_offset;
114   void (*draw_function)(running_machine *machine);
114115};
115116
116117
src/mess/drivers/comquest.c
r9692r9693
212212static const UINT32 amask= 0xffff;
213213
214214
215static MACHINE_CONFIG_START( comquest, driver_device )
215static MACHINE_CONFIG_START( comquest, comquest_state )
216216   /* basic machine hardware */
217217   MDRV_CPU_ADD("maincpu", M6805, 4000000)      /* 4000000? */
218218   /*MDRV_CPU_ADD("maincpu", HD63705, 4000000)    instruction set looks like m6805/m6808 */
src/mess/drivers/pc8401a.c
r9692r9693
4141
4242/* Fake Keyboard */
4343
44static UINT8 key_latch;
4544
4645static void pc8401a_keyboard_scan(running_machine *machine)
4746{
r9692r9693
5857      if (data != 0xff)
5958      {
6059         strobe = 1;
61         key_latch = data;
60         state->key_latch = data;
6261      }
6362   }
6463
r9692r9693
337336
338337static READ8_HANDLER( port71_r )
339338{
340   return key_latch;
339   pc8401a_state *state = space->machine->driver_data<pc8401a_state>();
340   return state->key_latch;
341341}
342342
343343static WRITE8_HANDLER( port70_w )
r9692r9693
349349
350350static WRITE8_HANDLER( port71_w )
351351{
352   pc8401a_state *state = space->machine->driver_data<pc8401a_state>();
352353   cputag_set_input_line(space->machine, Z80_TAG, INPUT_LINE_IRQ0, CLEAR_LINE);
353   key_latch = data;
354   state->key_latch = data;
354355}
355356
356357/* Memory Maps */
src/mess/drivers/dai.c
r9692r9693
201201GFXDECODE_END
202202
203203/* machine definition */
204static MACHINE_CONFIG_START( dai, driver_device )
204static MACHINE_CONFIG_START( dai, dai_state )
205205   /* basic machine hardware */
206206   MDRV_CPU_ADD("maincpu", I8080, 2000000)
207207   MDRV_CPU_PROGRAM_MAP(dai_mem)
src/mess/drivers/arcadia.c
r9692r9693
531531   return IMAGE_INIT_PASS;
532532}
533533
534static MACHINE_CONFIG_START( arcadia, driver_device )
534static MACHINE_CONFIG_START( arcadia, arcadia_state )
535535   /* basic machine hardware */
536536   MDRV_CPU_ADD("maincpu", S2650, 3580000/4)        /* 0.895 MHz */
537537   MDRV_CPU_PROGRAM_MAP(arcadia_mem)
src/mess/drivers/sg1000.c
r9692r9693
10441044***************************************************************************/
10451045
10461046/*-------------------------------------------------
1047    MACHINE_CONFIG_START( sg1000, driver_device )
1047    MACHINE_CONFIG_START( sg1000, sg1000_state )
10481048-------------------------------------------------*/
10491049
10501050static MACHINE_CONFIG_START( sg1000, sg1000_state )
r9692r9693
10811081MACHINE_CONFIG_END
10821082
10831083/*-------------------------------------------------
1084    MACHINE_CONFIG_START( omv, driver_device )
1084    MACHINE_CONFIG_DERIVED( omv, sg1000 )
10851085-------------------------------------------------*/
10861086
10871087static MACHINE_CONFIG_DERIVED( omv, sg1000 )
r9692r9693
10991099MACHINE_CONFIG_END
11001100
11011101/*-------------------------------------------------
1102    MACHINE_CONFIG_START( sc3000, driver_device )
1102    MACHINE_CONFIG_START( sc3000, sc3000_state )
11031103-------------------------------------------------*/
11041104
11051105static MACHINE_CONFIG_START( sc3000, sc3000_state )
r9692r9693
11401140MACHINE_CONFIG_END
11411141
11421142/*-------------------------------------------------
1143    MACHINE_CONFIG_START( sf7000, driver_device )
1143    MACHINE_CONFIG_START( sf7000, sf7000_state )
11441144-------------------------------------------------*/
11451145
11461146static MACHINE_CONFIG_START( sf7000, sf7000_state )
src/mess/drivers/ex800.c
r9692r9693
138138   ex800_state(running_machine &machine, const driver_device_config_base &config)
139139      : driver_device(machine, config) { }
140140
141   int irq_state;
141142};
142143
143144
r9692r9693
178179/* The ON LINE switch is directly connected to the INT1 input of the CPU */
179180static INPUT_CHANGED( online_switch )
180181{
181   static int state = ASSERT_LINE;
182
182   ex800_state *state = field->port->machine->driver_data<ex800_state>();
183183   if (newval)
184184   {
185      cputag_set_input_line(field->port->machine, "maincpu", UPD7810_INTF1, state);
186      state = (state == ASSERT_LINE) ? CLEAR_LINE : ASSERT_LINE;
185      cputag_set_input_line(field->port->machine, "maincpu", UPD7810_INTF1, state->irq_state);
186      state->irq_state = (state->irq_state == ASSERT_LINE) ? CLEAR_LINE : ASSERT_LINE;
187187   }
188188}
189189
190190
191191static MACHINE_START(ex800)
192192{
193   ex800_state *state = machine->driver_data<ex800_state>();
194   state->irq_state = ASSERT_LINE;
193195   running_device *speaker = machine->device("beep");
194196   /* Setup beep */
195197   beep_set_state(speaker, 0);
src/mess/drivers/crvision.c
r9692r9693
10381038***************************************************************************/
10391039
10401040/*-------------------------------------------------
1041    MACHINE_CONFIG_START( creativision, driver_device )
1041    MACHINE_CONFIG_START( creativision, crvision_state )
10421042-------------------------------------------------*/
10431043
10441044static MACHINE_CONFIG_START( creativision, crvision_state )
r9692r9693
10821082MACHINE_CONFIG_END
10831083
10841084/*-------------------------------------------------
1085    MACHINE_CONFIG_START( ntsc, driver_device )
1085    MACHINE_CONFIG_DERIVED( ntsc, creativision )
10861086-------------------------------------------------*/
10871087
10881088static MACHINE_CONFIG_DERIVED( ntsc, creativision )
r9692r9693
10971097MACHINE_CONFIG_END
10981098
10991099/*-------------------------------------------------
1100    MACHINE_CONFIG_START( pal, driver_device )
1100    MACHINE_CONFIG_DERIVED( pal, creativision )
11011101-------------------------------------------------*/
11021102
11031103static MACHINE_CONFIG_DERIVED( pal, creativision )
r9692r9693
11121112MACHINE_CONFIG_END
11131113
11141114/*-------------------------------------------------
1115    MACHINE_CONFIG_START( lasr2001, driver_device )
1115    MACHINE_CONFIG_START( lasr2001, crvision_state )
11161116-------------------------------------------------*/
11171117
11181118static MACHINE_CONFIG_START( lasr2001, crvision_state )
src/mess/drivers/fmtowns.c
r9692r9693
564564
565565static TIMER_CALLBACK( poll_keyboard )
566566{
567   const char* kb_ports[4] = { "key1", "key2", "key3", "key4" };
568   static UINT32 kb_prev[4];
567   towns_state *state = machine->driver_data<towns_state>();
568   static const char *const kb_ports[4] = { "key1", "key2", "key3", "key4" };
569569   int port,bit;
570570   UINT8 scan;
571571   UINT32 portval;
r9692r9693
576576      portval = input_port_read(machine,kb_ports[port]);
577577      for(bit=0;bit<32;bit++)
578578      {
579         if(((portval & (1<<bit))) != ((kb_prev[port] & (1<<bit))))
579         if(((portval & (1<<bit))) != ((state->kb_prev[port] & (1<<bit))))
580580         {  // bit changed
581581            if((portval & (1<<bit)) == 0)  // release
582582               towns_kb_sendcode(machine,scan,1);
r9692r9693
585585         }
586586         scan++;
587587      }
588      kb_prev[port] = portval;
588      state->kb_prev[port] = portval;
589589   }
590590}
591591
r9692r9693
896896static WRITE32_HANDLER(towns_pad_mask_w)
897897{
898898   towns_state* state = space->machine->driver_data<towns_state>();
899   static UINT8 prev;
900   static UINT8 prev_x,prev_y;
901899   UINT8 current_x,current_y;
902900   UINT32 type = input_port_read(space->machine,"ctrltype");
903901
r9692r9693
906904      state->towns_pad_mask = (data & 0x00ff0000) >> 16;
907905      if((type & 0x0f) == 0x02)  // mouse
908906      {
909         if((state->towns_pad_mask & 0x10) != 0 && (prev & 0x10) == 0)
907         if((state->towns_pad_mask & 0x10) != 0 && (state->prev_pad_mask & 0x10) == 0)
910908         {
911909            if(state->towns_mouse_output == MOUSE_START)
912910            {
913911               state->towns_mouse_output = MOUSE_X_HIGH;
914912               current_x = input_port_read(space->machine,"mouse2");
915913               current_y = input_port_read(space->machine,"mouse3");
916               state->towns_mouse_x = prev_x - current_x;
917               state->towns_mouse_y = prev_y - current_y;
918               prev_x = current_x;
919               prev_y = current_y;
914               state->towns_mouse_x = state->prev_x - current_x;
915               state->towns_mouse_y = state->prev_y - current_y;
916               state->prev_x = current_x;
917               state->prev_y = current_y;
920918            }
921919            else
922920               state->towns_mouse_output++;
923921            timer_adjust_periodic(state->towns_mouse_timer,ATTOTIME_IN_USEC(600),0,attotime_zero);
924922         }
925         if((state->towns_pad_mask & 0x10) == 0 && (prev & 0x10) != 0)
923         if((state->towns_pad_mask & 0x10) == 0 && (state->prev_pad_mask & 0x10) != 0)
926924         {
927925            if(state->towns_mouse_output == MOUSE_START)
928926            {
929927               state->towns_mouse_output = MOUSE_SYNC;
930928               current_x = input_port_read(space->machine,"mouse2");
931929               current_y = input_port_read(space->machine,"mouse3");
932               state->towns_mouse_x = prev_x - current_x;
933               state->towns_mouse_y = prev_y - current_y;
934               prev_x = current_x;
935               prev_y = current_y;
930               state->towns_mouse_x = state->prev_x - current_x;
931               state->towns_mouse_y = state->prev_y - current_y;
932               state->prev_x = current_x;
933               state->prev_y = current_y;
936934            }
937935            else
938936               state->towns_mouse_output++;
939937            timer_adjust_periodic(state->towns_mouse_timer,ATTOTIME_IN_USEC(600),0,attotime_zero);
940938         }
941         prev = state->towns_pad_mask;
939         state->prev_pad_mask = state->towns_pad_mask;
942940      }
943941      if((type & 0xf0) == 0x20)  // mouse
944942      {
945         if((state->towns_pad_mask & 0x20) != 0 && (prev & 0x20) == 0)
943         if((state->towns_pad_mask & 0x20) != 0 && (state->prev_pad_mask & 0x20) == 0)
946944         {
947945            if(state->towns_mouse_output == MOUSE_START)
948946            {
949947               state->towns_mouse_output = MOUSE_X_HIGH;
950948               current_x = input_port_read(space->machine,"mouse2");
951949               current_y = input_port_read(space->machine,"mouse3");
952               state->towns_mouse_x = prev_x - current_x;
953               state->towns_mouse_y = prev_y - current_y;
954               prev_x = current_x;
955               prev_y = current_y;
950               state->towns_mouse_x = state->prev_x - current_x;
951               state->towns_mouse_y = state->prev_y - current_y;
952               state->prev_x = current_x;
953               state->prev_y = current_y;
956954            }
957955            else
958956               state->towns_mouse_output++;
959957            timer_adjust_periodic(state->towns_mouse_timer,ATTOTIME_IN_USEC(600),0,attotime_zero);
960958         }
961         if((state->towns_pad_mask & 0x20) == 0 && (prev & 0x20) != 0)
959         if((state->towns_pad_mask & 0x20) == 0 && (state->prev_pad_mask & 0x20) != 0)
962960         {
963961            if(state->towns_mouse_output == MOUSE_START)
964962            {
965963               state->towns_mouse_output = MOUSE_SYNC;
966964               current_x = input_port_read(space->machine,"mouse2");
967965               current_y = input_port_read(space->machine,"mouse3");
968               state->towns_mouse_x = prev_x - current_x;
969               state->towns_mouse_y = prev_y - current_y;
970               prev_x = current_x;
971               prev_y = current_y;
966               state->towns_mouse_x = state->prev_x - current_x;
967               state->towns_mouse_y = state->prev_y - current_y;
968               state->prev_x = current_x;
969               state->prev_y = current_y;
972970            }
973971            else
974972               state->towns_mouse_output++;
975973            timer_adjust_periodic(state->towns_mouse_timer,ATTOTIME_IN_USEC(600),0,attotime_zero);
976974         }
977         prev = state->towns_pad_mask;
975         state->prev_pad_mask = state->towns_pad_mask;
978976      }
979977   }
980978}
src/mess/drivers/ccs2422.c
r9692r9693
1818      : driver_device(machine, config) { }
1919
2020   UINT8 *ccs_ram;
21   UINT8 term_data;
2122};
2223
23static UINT8 term_data;
2424
2525static READ8_HANDLER( ccs2422_10_r )
2626{
27   UINT8 ret = term_data;
28   term_data = 0;
27   ccs2422_state *state = space->machine->driver_data<ccs2422_state>();
28   UINT8 ret = state->term_data;
29   state->term_data = 0;
2930   return ret;
3031}
3132
3233static READ8_HANDLER( ccs2422_11_r )
3334{
34   return 4 | ((term_data) ? 1 : 0);
35   ccs2422_state *state = space->machine->driver_data<ccs2422_state>();
36   return 4 | ((state->term_data) ? 1 : 0);
3537}
3638
3739static WRITE8_HANDLER(ccs2422_10_w)
r9692r9693
6971
7072static WRITE8_DEVICE_HANDLER( ccs2422_kbd_put )
7173{
72   term_data = data;
74   ccs2422_state *state = device->machine->driver_data<ccs2422_state>();
75   state->term_data = data;
7376}
7477
7578static GENERIC_TERMINAL_INTERFACE( ccs2422_terminal_intf )
src/mess/drivers/aim65_40.c
r9692r9693
131131    MACHINE DRIVERS
132132***************************************************************************/
133133
134static MACHINE_CONFIG_START( aim65_40, driver_device )
134static MACHINE_CONFIG_START( aim65_40, aim65_40_state )
135135   /* basic machine hardware */
136136   MDRV_CPU_ADD(M6502_TAG, M6502, 1000000)
137137   MDRV_CPU_PROGRAM_MAP(aim65_40_mem)
src/mess/drivers/czk80.c
r9692r9693
2525      : driver_device(machine, config) { }
2626
2727   UINT8 *ram;
28   UINT8 term_data;
2829};
2930
30static UINT8 term_data;
3131
3232static WRITE8_HANDLER( czk80_80_w )
3333{
r9692r9693
3838
3939static READ8_HANDLER( czk80_80_r )
4040{
41   UINT8 ret = term_data;
42   term_data = 0;
41   czk80_state *state = space->machine->driver_data<czk80_state>();
42   UINT8 ret = state->term_data;
43   state->term_data = 0;
4344   return ret;
4445}
4546
r9692r9693
5051
5152static READ8_HANDLER( czk80_81_r )
5253{
53   return 1 | ((term_data) ? 2 : 0);
54   czk80_state *state = space->machine->driver_data<czk80_state>();
55   return 1 | ((state->term_data) ? 2 : 0);
5456}
5557
5658static ADDRESS_MAP_START(czk80_mem, ADDRESS_SPACE_PROGRAM, 8)
r9692r9693
8284
8385static WRITE8_DEVICE_HANDLER( czk80_kbd_put )
8486{
85   term_data = data;
87   czk80_state *state = device->machine->driver_data<czk80_state>();
88   state->term_data = data;
8689}
8790
8891static GENERIC_TERMINAL_INTERFACE( czk80_terminal_intf )
src/mess/drivers/mtx.c
r9692r9693
323323***************************************************************************/
324324
325325/*-------------------------------------------------
326    MACHINE_CONFIG_START( mtx512, driver_device )
326    MACHINE_CONFIG_START( mtx512, mtx_state )
327327-------------------------------------------------*/
328328
329329static MACHINE_CONFIG_START( mtx512, mtx_state )
r9692r9693
364364MACHINE_CONFIG_END
365365
366366/*-------------------------------------------------
367    MACHINE_CONFIG_START( mtx500, driver_device )
367    MACHINE_CONFIG_DERIVED( mtx500, mtx512 )
368368-------------------------------------------------*/
369369
370370static MACHINE_CONFIG_DERIVED( mtx500, mtx512 )
r9692r9693
376376MACHINE_CONFIG_END
377377
378378/*-------------------------------------------------
379    MACHINE_CONFIG_START( rs128, driver_device )
379    MACHINE_CONFIG_DERIVED( rs128, mtx512 )
380380-------------------------------------------------*/
381381
382382static MACHINE_CONFIG_DERIVED( rs128, mtx512 )
src/mess/drivers/elwro800.c
r9692r9693
3030#include "formats/tzx_cas.h"
3131#include "devices/messram.h"
3232
33
34class elwro800_state : public spectrum_state
35{
36public:
37   elwro800_state(running_machine &machine, const driver_device_config_base &config)
38      : spectrum_state(machine, config) { }
39
40   /* for elwro800 */
41   /* RAM mapped at 0 */
42   UINT8 ram_at_0000;
43
44   /* NR signal */
45   UINT8 NR;
46   UINT8 df_on_databus;
47};
48
49
3350/*************************************
3451 *
3552 * When RAM is mapped at 0x0000 - 0x1fff (in CP/J mode), reading a location 66 with /M1=0
r9692r9693
3956 *************************************/
4057DIRECT_UPDATE_HANDLER(elwro800_direct_handler)
4158{
42   spectrum_state *state = machine->driver_data<spectrum_state>();
59   elwro800_state *state = machine->driver_data<elwro800_state>();
4360   if (state->ram_at_0000 && address == 0x66)
4461   {
4562      direct.explicit_configure(0x66, 0x66, 0, &state->df_on_databus);
r9692r9693
89106   UINT8 *messram = messram_get_ptr(machine->device("messram"));
90107   UINT8 cs;
91108   UINT8 ls175;
92   spectrum_state *state = machine->driver_data<spectrum_state>();
109   elwro800_state *state = machine->driver_data<elwro800_state>();
93110
94111   ls175 = BITSWAP8(data, 7, 6, 5, 4, 4, 5, 7, 6) & 0x0f;
95112
r9692r9693
207224{
208225   UINT8 *prom = memory_region(space->machine, "proms");
209226   UINT8 cs = prom[offset & 0x1ff];
210   spectrum_state *state = space->machine->driver_data<spectrum_state>();
227   elwro800_state *state = space->machine->driver_data<elwro800_state>();
211228
212229   if (!BIT(cs,0))
213230   {
r9692r9693
490507
491508static MACHINE_RESET(elwro800)
492509{
493   spectrum_state *state = machine->driver_data<spectrum_state>();
510   elwro800_state *state = machine->driver_data<elwro800_state>();
494511   UINT8 *messram = messram_get_ptr(machine->device("messram"));
495512
496513   state->df_on_databus = 0xdf;
r9692r9693
551568GFXDECODE_END
552569
553570
554static MACHINE_CONFIG_START( elwro800, spectrum_state )
571static MACHINE_CONFIG_START( elwro800, elwro800_state )
555572
556573   /* basic machine hardware */
557574   MDRV_CPU_ADD("maincpu",Z80, 3500000)   /* 3.5 MHz */
src/mess/drivers/supercon.c
r9692r9693
2323
2424#include "supercon.lh"
2525
26
27class supercon_state : public driver_device
28{
29public:
30   supercon_state(running_machine &machine, const driver_device_config_base &config)
31      : driver_device(machine, config) { }
32
33   UINT8 *ram;
34   emu_timer* timer_update_irq;
35   int emu_started;
36   int moving_piece;
37   UINT8 data_1E00;
38   UINT8 data_1F00;
39   UINT8 LED_18;
40   UINT8 LED_AH;
41   UINT8 LED_ST;
42   UINT8 *last_LED;
43   UINT8 last_LED_value;
44   int led_update;
45   int remove_led_flag;
46   int selecting;
47   int confirm_board_click;
48   int *current_field;
49   int m_board[64];
50   int save_board[64];
51};
52
53
2654#define VERBOSE 0
2755#define LOG(x)   do { if (VERBOSE) logerror x; } while (0)
2856
r9692r9693
6088#define   TAKE      1
6189#define SET         2
6290
63static UINT8 *supercon_ram;
64static emu_timer* timer_update_irq;
6591
66static int emu_started=FALSE;
6792
68static int moving_piece=0;
6993
70static UINT8 data_1E00=0;
71static UINT8 data_1F00=0;
7294
73static UINT8 LED_18=0;
74static UINT8 LED_AH=0;
75static UINT8 LED_ST=0;
76static UINT8 *last_LED=NULL;
77static UINT8 last_LED_value=0;
7895
79static int led_update;
80static int remove_led_flag;
8196
82static int selecting=NO_ACTION;
83static int confirm_board_click=FALSE;
84static int *current_field;
8597
86static int m_board[64];
87static int save_board[64];
8898
8999/* artwork board */
90100static const int start_board[64] =
r9692r9693
102112static const UINT8 border_pieces[12] = {WK,WQ,WR,WB,WN,WP,BK,BQ,BR,BB,BN,BP,};
103113
104114
105static void set_board( void )
115static void set_board( supercon_state *state )
106116{
107117   int i;
108118   for (i=0;i<64;i++)
109      m_board[i]=start_board[i];
119      state->m_board[i]=start_board[i];
110120}
111121
112static void set_pieces (void)
122static void set_pieces (supercon_state *state)
113123{
114124   int i;
115125   for (i=0;i<64;i++)
116      output_set_indexed_value("P", i, m_board[i]);
126      output_set_indexed_value("P", i, state->m_board[i]);
117127}
118128
119129static void set_boarder_pieces (void)
r9692r9693
124134      output_set_indexed_value("Q", i, border_pieces[i]);
125135}
126136
127static void clear_pieces()
137static void clear_pieces(supercon_state *state)
128138{
129139   int i;
130140   for (i=0;i<64;i++)
131141   {
132142      output_set_indexed_value("P", i, EM);
133      m_board[i]=EM;
143      state->m_board[i]=EM;
134144   }
135145}
136146
r9692r9693
157167}
158168
159169
160static void update_leds( void )
170static void update_leds( supercon_state *state )
161171{
162172   int i;
163173
164174   for (i = 0; i < 8; i++)
165175   {
166      if (BIT(LED_18, i))
176      if (BIT(state->LED_18, i))
167177         output_set_led_value(i + 1, 1);
168178      else
169179         output_set_led_value(i + 1, 0);
170180
171      if (BIT(LED_AH, i))
181      if (BIT(state->LED_AH, i))
172182         output_set_led_value(i + 9, 1);
173183      else
174184         output_set_led_value(i + 9, 0);
175185
176      if (BIT(LED_ST, i))
186      if (BIT(state->LED_ST, i))
177187         output_set_led_value(i + 17, 1);
178188      else
179189         output_set_led_value(i + 17, 0);
r9692r9693
182192
183193static void mouse_update(running_machine *machine)
184194{
195   supercon_state *state = machine->driver_data<supercon_state>();
185196   UINT8 port_input, m_left;
186197   int i;
187198
188199/* Set-remove piece after mouse release and confirmation of a board click = beep */
189200
190201    m_left=input_port_read(machine, "BUTTON_L");
191    if (!m_left && selecting)
202    if (!m_left && state->selecting)
192203    {
193       if (confirm_board_click)
204       if (state->confirm_board_click)
194205       {
195         if (selecting==SET)
206         if (state->selecting==SET)
196207         {
197            *current_field=moving_piece;
198            moving_piece=EM;
208            *state->current_field=state->moving_piece;
209            state->moving_piece=EM;
199210         }else
200211         {
201            moving_piece=*current_field;
202            *current_field=EM;
212            state->moving_piece=*state->current_field;
213            *state->current_field=EM;
203214         }
204         set_pieces();
205         output_set_value("MOVING",moving_piece);
215         set_pieces(state);
216         output_set_value("MOVING",state->moving_piece);
206217       }
207218
208       selecting=NO_ACTION;
209       confirm_board_click=FALSE;
219       state->selecting=NO_ACTION;
220       state->confirm_board_click=FALSE;
210221    }
211222
212223/* Boarder pieces and moving pice */
r9692r9693
215226   if (port_input)
216227   {
217228      i=get_first_bit(port_input);
218      moving_piece=border_pieces[i];
219      output_set_value("MOVING",moving_piece);
229      state->moving_piece=border_pieces[i];
230      output_set_value("MOVING",state->moving_piece);
220231      return;
221232   }
222233
r9692r9693
225236   if (port_input)
226237   {
227238      i=get_first_bit(port_input);
228      moving_piece=border_pieces[6+i];
229      output_set_value("MOVING",moving_piece);
239      state->moving_piece=border_pieces[6+i];
240      output_set_value("MOVING",state->moving_piece);
230241      return;
231242   }
232243
r9692r9693
234245   port_input=input_port_read(machine, "B_CLR");
235246   if (port_input)
236247   {
237      if (moving_piece)
248      if (state->moving_piece)
238249      {
239         moving_piece=0;
240         output_set_value("MOVING",moving_piece);
250         state->moving_piece=0;
251         output_set_value("MOVING",state->moving_piece);
241252         return;
242253      }
243254   }
r9692r9693
247258
248259static DRIVER_INIT(supercon)
249260{
250   LED_18=0;
251   LED_AH=0;
252   LED_ST=0;
261   supercon_state *state = machine->driver_data<supercon_state>();
262   state->LED_18=0;
263   state->LED_AH=0;
264   state->LED_ST=0;
253265
254   moving_piece=0;
266   state->moving_piece=0;
255267}
256268
257269/* Read 1C000 */
r9692r9693
274286
275287static READ8_HANDLER( supercon_port3_r )
276288{
289   supercon_state *state = space->machine->driver_data<supercon_state>();
277290   int i;
278291   UINT8 key_data=0;
279292
r9692r9693
284297
285298/* remove last bit (only if it was not already set) */
286299
287   if ( data_1F00 & LED_LINE_AH )
300   if ( state->data_1F00 & LED_LINE_AH )
288301   {
289      if (last_LED_value != LED_AH)
290         LED_AH=LED_AH & ~data_1E00;
302      if (state->last_LED_value != state->LED_AH)
303         state->LED_AH=state->LED_AH & ~state->data_1E00;
291304   }
292   else if ( data_1F00 & LED_LINE_ST)
305   else if ( state->data_1F00 & LED_LINE_ST)
293306   {
294      if (last_LED_value != LED_ST)
295         LED_ST=LED_ST & ~data_1E00;
307      if (state->last_LED_value != state->LED_ST)
308         state->LED_ST=state->LED_ST & ~state->data_1E00;
296309   }
297   else if ( data_1F00 & LED_LINE_18 )
310   else if ( state->data_1F00 & LED_LINE_18 )
298311   {
299      if (last_LED_value != LED_18)
300         LED_18=LED_18 & ~data_1E00;
312      if (state->last_LED_value != state->LED_18)
313         state->LED_18=state->LED_18 & ~state->data_1E00;
301314   }
302315
303316
304   LOG(("LED_18 from %02x \n",LED_18));
305   LOG(("LED_AH from %02x \n",LED_AH));
306   LOG(("LED_ST from %02x \n",LED_ST));
317   LOG(("LED_18 from %02x \n",state->LED_18));
318   LOG(("LED_AH from %02x \n",state->LED_AH));
319   LOG(("LED_ST from %02x \n",state->LED_ST));
307320
308   if (led_update)         /*No LED Update if Port 1C00,1D00 was read */
309      update_leds();
321   if (state->led_update)         /*No LED Update if Port 1C00,1D00 was read */
322      update_leds(state);
310323
311   remove_led_flag=TRUE;
312   led_update=TRUE;
324   state->remove_led_flag=TRUE;
325   state->led_update=TRUE;
313326
314   LED_18=0;
315   LED_AH=0;
316   LED_ST=0;
327   state->LED_18=0;
328   state->LED_AH=0;
329   state->LED_ST=0;
317330
318331
319332/* Start */
320333
321   if (!emu_started)
334   if (!state->emu_started)
322335      return 0xbf;
323336   else
324      timer_adjust_periodic( timer_update_irq, attotime_zero, 0, ATTOTIME_IN_HZ(598) );  //HACK adjust timer after start ???
337      timer_adjust_periodic( state->timer_update_irq, attotime_zero, 0, ATTOTIME_IN_HZ(598) );  //HACK adjust timer after start ???
325338
326339
327340/* Buttons */
328341
329   i=get_first_bit(data_1E00);
342   i=get_first_bit(state->data_1E00);
330343   if (i==NOT_VALID)
331344      return 0xff;
332345
r9692r9693
340353
341354      if (i==0 && key_data==0x80)
342355      {
343         set_board();
344         set_pieces();
356         set_board(state);
357         set_pieces(state);
345358
346         emu_started=FALSE;
359         state->emu_started=FALSE;
347360      }
348361
349362/* Button: Clear Board -> remove all pieces */
350363
351364      if (i==3 && key_data==0x80)
352         clear_pieces();
365         clear_pieces(state);
353366
354367      if (key_data != 0xff )
355368         return key_data;
r9692r9693
363376
364377static READ8_HANDLER( supercon_port4_r )
365378{
379   supercon_state *state = space->machine->driver_data<supercon_state>();
366380   int i_18, i_AH;
367381   UINT8 key_data = 0x00;;
368382
r9692r9693
373387
374388/* Board buttons */
375389
376   i_18=get_first_bit(data_1E00);
390   i_18=get_first_bit(state->data_1E00);
377391   if (i_18==NOT_VALID)
378392      return 0xff;
379393
r9692r9693
389403/* Set or remove pieces */
390404
391405         i_AH=7-get_first_cleared_bit(key_data);
392         LOG(("Press -> AH: %d 18: %d Piece: %d\n",i_AH,i_18,m_board[i_18*8 + i_AH]););
406         LOG(("Press -> AH: %d 18: %d Piece: %d\n",i_AH,i_18,state->m_board[i_18*8 + i_AH]););
393407
394         if (selecting==NO_ACTION)
408         if (state->selecting==NO_ACTION)
395409         {
396            current_field=&m_board[i_18*8 + i_AH];
410            state->current_field=&state->m_board[i_18*8 + i_AH];
397411
398            if (moving_piece)
399               selecting=SET;
412            if (state->moving_piece)
413               state->selecting=SET;
400414            else
401               selecting=TAKE;
415               state->selecting=TAKE;
402416         }
403417         return key_data;
404418      }
r9692r9693
411425
412426static WRITE8_HANDLER( supercon_port1_w )
413427{
428   supercon_state *state = space->machine->driver_data<supercon_state>();
414429   LOG(("Write from %04x data: %02x\n",0x1C00,data));
415   led_update=FALSE;
430   state->led_update=FALSE;
416431}
417432
418433/* Write Port $1D00 */
419434
420435static WRITE8_HANDLER( supercon_port2_w )
421436{
437   supercon_state *state = space->machine->driver_data<supercon_state>();
422438
423439   LOG(("Write from %04x data: %02x\n",0x1D00,data));
424   led_update=FALSE;
440   state->led_update=FALSE;
425441}
426442
427443/* Write Port $1E00 */
428444
429445static WRITE8_HANDLER( supercon_port3_w )
430446{
447   supercon_state *state = space->machine->driver_data<supercon_state>();
431448
432449   if (data)
433450      LOG(("Write from %04x data: %02x\n",0x1E00,data));
434451
435452   if (data)
436453   {
437      data_1E00=data;
454      state->data_1E00=data;
438455
439456/* Set bits for LED's */
440457
441      if ( data_1F00)
458      if ( state->data_1F00)
442459      {
443460
444         if (data_1F00 & LED_LINE_AH )
461         if (state->data_1F00 & LED_LINE_AH )
445462         {
446            last_LED = &LED_AH;            /* save last value */
447            last_LED_value = *last_LED;
463            state->last_LED = &state->LED_AH;            /* save last value */
464            state->last_LED_value = *state->last_LED;
448465
449            LED_AH=LED_AH | data_1E00;
466            state->LED_AH=state->LED_AH | state->data_1E00;
450467         }
451         else if (data_1F00 & LED_LINE_ST )
468         else if (state->data_1F00 & LED_LINE_ST )
452469         {
453            last_LED = &LED_ST;
454            last_LED_value = *last_LED;
470            state->last_LED = &state->LED_ST;
471            state->last_LED_value = *state->last_LED;
455472
456            LED_ST=LED_ST | data_1E00;
473            state->LED_ST=state->LED_ST | state->data_1E00;
457474         }
458         else if (data_1F00 &  LED_LINE_18)
475         else if (state->data_1F00 &  LED_LINE_18)
459476         {
460            last_LED = &LED_18;
461            last_LED_value = *last_LED;
477            state->last_LED = &state->LED_18;
478            state->last_LED_value = *state->last_LED;
462479
463            LED_18=LED_18 | data_1E00;
480            state->LED_18=state->LED_18 | state->data_1E00;
464481         }
465482      }
466483
r9692r9693
472489
473490static WRITE8_HANDLER( supercon_port4_w )
474491{
492   supercon_state *state = space->machine->driver_data<supercon_state>();
475493   running_device *speaker = space->machine->device("beep");
476494
477495   if (data)
478496      LOG(("Write from %04x data: %02x\n",0x1F00,data));
479497
480498   if (data)
481      data_1F00=data;
499      state->data_1F00=data;
482500
483501/* Bit 7 is set -> Buzzer on */
484502
485   if ( data_1F00 & 0x80 )
503   if ( state->data_1F00 & 0x80 )
486504   {
487505      beep_set_state(speaker,1);
488      emu_started=TRUE;
506      state->emu_started=TRUE;
489507
490      if (selecting)               /* fast mouse clicks are recognized by the artwork but not by the emulation  */
491         confirm_board_click=TRUE;   /* therefore a beep must confirm each click on the board */
508      if (state->selecting)               /* fast mouse clicks are recognized by the artwork but not by the emulation  */
509         state->confirm_board_click=TRUE;   /* therefore a beep must confirm each click on the board */
492510   }
493511   else
494512      beep_set_state(speaker,0);
r9692r9693
510528
511529static STATE_PRESAVE( m_board_presave )
512530{
531   supercon_state *state = machine->driver_data<supercon_state>();
513532   int i;
514533   for (i=0;i<64;i++)
515      save_board[i]=m_board[i];
534      state->save_board[i]=state->m_board[i];
516535}
517536
518537static STATE_POSTLOAD( m_board_postload )
519538{
539   supercon_state *state = machine->driver_data<supercon_state>();
520540   int i;
521541   for (i=0;i<64;i++)
522      m_board[i]=save_board[i];
542      state->m_board[i]=state->save_board[i];
523543
524   set_pieces();
544   set_pieces(state);
525545}
526546
527547static MACHINE_START( supercon )
528548{
529   led_update=TRUE;
530   remove_led_flag=TRUE;
549   supercon_state *state = machine->driver_data<supercon_state>();
550   state->led_update=TRUE;
551   state->remove_led_flag=TRUE;
531552
532   timer_update_irq = timer_alloc(machine,update_irq,NULL);
533   timer_adjust_periodic( timer_update_irq, attotime_zero, 0, ATTOTIME_IN_HZ(1000) );
553   state->timer_update_irq = timer_alloc(machine,update_irq,NULL);
554   timer_adjust_periodic( state->timer_update_irq, attotime_zero, 0, ATTOTIME_IN_HZ(1000) );
534555
535556   timer_pulse(machine, ATTOTIME_IN_HZ(20), NULL, 0, update_artwork);
536557
537   state_save_register_global_array(machine,save_board);
558   state_save_register_global_array(machine,state->save_board);
538559   state_save_register_postload(machine,m_board_postload,NULL);
539560   state_save_register_presave(machine,m_board_presave,NULL);
540561}
541562
542563static MACHINE_RESET( supercon )
543564{
544   set_board();
545   set_pieces();
565   supercon_state *state = machine->driver_data<supercon_state>();
566   set_board(state);
567   set_pieces(state);
546568   set_boarder_pieces();
547569
548   emu_started=FALSE;
570   state->emu_started=FALSE;
549571}
550572
551573/* Address maps */
552574
553575static ADDRESS_MAP_START(supercon_mem, ADDRESS_SPACE_PROGRAM, 8)
554   AM_RANGE( 0x0000, 0x0fff) AM_RAM AM_BASE(&supercon_ram )
576   AM_RANGE( 0x0000, 0x0fff) AM_RAM AM_BASE_MEMBER(supercon_state, ram )
555577   AM_RANGE( 0x2000, 0x7fff) AM_ROM
556578    AM_RANGE( 0x8000, 0xffff) AM_ROM
557579
r9692r9693
725747INPUT_PORTS_END
726748
727749/* Machine driver */
728static MACHINE_CONFIG_START( supercon, driver_device )
750static MACHINE_CONFIG_START( supercon, supercon_state )
729751
730752    /* basic machine hardware */
731753   MDRV_CPU_ADD("maincpu",M6502,MAIN_CLOCK)
src/mess/drivers/ti89.c
r9692r9693
156156static TIMER_CALLBACK( ti68k_timer_callback )
157157{
158158   ti68k_state *state = machine->driver_data<ti68k_state>();
159   static UINT64 timer;
160159
161   timer++;
160   state->timer++;
162161
163162   if (state->m_timer_on)
164163   {
165      if (!(timer & state->m_timer_mask) && BIT(state->m_io_hw1[0x0a], 3))
164      if (!(state->timer & state->m_timer_mask) && BIT(state->m_io_hw1[0x0a], 3))
166165      {
167166         if (state->m_timer_val)
168167            state->m_timer_val++;
r9692r9693
172171
173172      if (!BIT(state->m_io_hw1[0x0a], 7) && ((state->m_hw_version == state->HW1) || (!BIT(state->m_io_hw1[0x0f], 2) && !BIT(state->m_io_hw1[0x0f], 1))))
174173      {
175         if (!(timer & 0x003f))
174         if (!(state->timer & 0x003f))
176175            state->m_maincpu->set_input_line(M68K_IRQ_1, HOLD_LINE);
177176
178         if (!(timer & 0x3fff) && !BIT(state->m_io_hw1[0x0a], 3))
177         if (!(state->timer & 0x3fff) && !BIT(state->m_io_hw1[0x0a], 3))
179178            state->m_maincpu->set_input_line(M68K_IRQ_3, HOLD_LINE);
180179
181         if (!(timer & state->m_timer_mask) && BIT(state->m_io_hw1[0x0a], 3) && state->m_timer_val == 0)
180         if (!(state->timer & state->m_timer_mask) && BIT(state->m_io_hw1[0x0a], 3) && state->m_timer_val == 0)
182181            state->m_maincpu->set_input_line(M68K_IRQ_5, HOLD_LINE);
183182      }
184183   }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team