Previous 15994 Revisions Next

r4579 Tuesday 28th April, 2009 at 16:44:17 UTC by Wilbert Pol
[NGP,NGPC] Updated drivers to use driver state.
[src/mess/drivers]ngp.c

src/mess/drivers/ngp.c
r4578r4579
118118};
119119
120120
121static UINT8 io_reg[0x40];
122static emu_timer* seconds_timer;
121typedef struct _ngp_state ngp_state;
122struct _ngp_state {
123   UINT8 io_reg[0x40];
124   emu_timer* seconds_timer;
123125
124struct {
125   int      present;
126   UINT8   manufacturer_id;
127   UINT8   device_id;
128   UINT8   *data;
129   UINT8   org_data[16];
130   int      state;
131   UINT8   command[2];
132} flash_chip[2];
126   struct {
127      int      present;
128      UINT8   manufacturer_id;
129      UINT8   device_id;
130      UINT8   *data;
131      UINT8   org_data[16];
132      int      state;
133      UINT8   command[2];
134   } flash_chip[2];
135};
133136
134137
135138static TIMER_CALLBACK( ngp_seconds_callback )
136139{
137   io_reg[0x16] += 1;
138   if ( ( io_reg[0x16] & 0x0f ) == 0x0a )
140   ngp_state *state = machine->driver_data;
141
142   state->io_reg[0x16] += 1;
143   if ( ( state->io_reg[0x16] & 0x0f ) == 0x0a )
139144   {
140      io_reg[0x16] += 0x06;
145      state->io_reg[0x16] += 0x06;
141146   }
142147
143   if ( io_reg[0x16] >= 0x60 )
148   if ( state->io_reg[0x16] >= 0x60 )
144149   {
145      io_reg[0x16] = 0;
146      io_reg[0x15] += 1;
147      if ( ( io_reg[0x15] & 0x0f ) == 0x0a ) {
148         io_reg[0x15] += 0x06;
150      state->io_reg[0x16] = 0;
151      state->io_reg[0x15] += 1;
152      if ( ( state->io_reg[0x15] & 0x0f ) == 0x0a ) {
153         state->io_reg[0x15] += 0x06;
149154      }
150155
151      if ( io_reg[0x15] >= 0x60 )
156      if ( state->io_reg[0x15] >= 0x60 )
152157      {
153         io_reg[0x15] = 0;
154         io_reg[0x14] += 1;
155         if ( ( io_reg[0x14] & 0x0f ) == 0x0a ) {
156            io_reg[0x14] += 0x06;
158         state->io_reg[0x15] = 0;
159         state->io_reg[0x14] += 1;
160         if ( ( state->io_reg[0x14] & 0x0f ) == 0x0a ) {
161            state->io_reg[0x14] += 0x06;
157162         }
158163
159         if ( io_reg[0x14] == 0x24 )
164         if ( state->io_reg[0x14] == 0x24 )
160165         {
161            io_reg[0x14] = 0;
166            state->io_reg[0x14] = 0;
162167         }
163168      }
164169   }
r4578r4579
167172
168173static READ8_HANDLER( ngp_io_r )
169174{
170   UINT8   data = io_reg[offset];
175   ngp_state *state = space->machine->driver_data;
176   UINT8 data = state->io_reg[offset];
171177
172178   switch( offset )
173179   {
r4578r4579
186192
187193static WRITE8_HANDLER( ngp_io_w )
188194{
195   ngp_state *state = space->machine->driver_data;
196
189197   switch( offset )
190198   {
191199   case 0x20:      /* t6w28 "right" */
192200   case 0x21:      /* t6w28 "left" */
193      if ( io_reg[0x38] == 0x55 && io_reg[0x39] == 0xAA )
201      if ( state->io_reg[0x38] == 0x55 && state->io_reg[0x39] == 0xAA )
194202      {
195203         t6w28_w( devtag_get_device( space->machine, "t6w28" ), 0, data );
196204      }
r4578r4579
235243      cputag_set_input_line( space->machine, "soundcpu", INPUT_LINE_NMI, PULSE_LINE );
236244      break;
237245   }
238   io_reg[offset] = data;
246   state->io_reg[offset] = data;
239247}
240248
241249
242static void flash_w( int which, offs_t offset, UINT8 data )
250static void flash_w( ngp_state *state, int which, offs_t offset, UINT8 data )
243251{
244   if ( ! flash_chip[which].present )
252   if ( ! state->flash_chip[which].present )
245253      return;
246254
247   switch( flash_chip[which].state )
255   switch( state->flash_chip[which].state )
248256   {
249257   case F_READ:
250258      if ( offset == 0x5555 && data == 0xaa )
251         flash_chip[which].state = F_PROG1;
252      flash_chip[which].command[0] = 0;
259         state->flash_chip[which].state = F_PROG1;
260      state->flash_chip[which].command[0] = 0;
253261      break;
254262   case F_PROG1:
255263      if ( offset == 0x2aaa && data == 0x55 )
256         flash_chip[which].state = F_PROG2;
264         state->flash_chip[which].state = F_PROG2;
257265      else
258         flash_chip[which].state = F_READ;
266         state->flash_chip[which].state = F_READ;
259267      break;
260268   case F_PROG2:
261269      if ( data == 0x30 )
262270      {
263         if ( flash_chip[which].command[0] == 0x80 )
271         if ( state->flash_chip[which].command[0] == 0x80 )
264272         {
265273            int   size = 0x10000;
266            UINT8 *block = flash_chip[which].data;
274            UINT8 *block = state->flash_chip[which].data;
267275
268            flash_chip[which].state = F_AUTO_BLOCK_ERASE;
269            switch( flash_chip[which].device_id )
276            state->flash_chip[which].state = F_AUTO_BLOCK_ERASE;
277            switch( state->flash_chip[which].device_id )
270278            {
271279            case 0xab:
272280               if ( offset < 0x70000 )
273                  block = flash_chip[which].data + ( offset & 0x70000 );
281                  block = state->flash_chip[which].data + ( offset & 0x70000 );
274282               else
275283               {
276284                  if ( offset & 0x8000 )
277285                  {
278286                     if ( offset & 0x4000 )
279287                     {
280                        block = flash_chip[which].data + ( offset & 0x7c000 );
288                        block = state->flash_chip[which].data + ( offset & 0x7c000 );
281289                        size = 0x4000;
282290                     }
283291                     else
284292                     {
285                        block = flash_chip[which].data + ( offset & 0x7e000 );
293                        block = state->flash_chip[which].data + ( offset & 0x7e000 );
286294                        size = 0x2000;
287295                     }
288296                  }
289297                  else
290298                  {
291                     block = flash_chip[which].data + ( offset & 0x78000 );
299                     block = state->flash_chip[which].data + ( offset & 0x78000 );
292300                     size = 0x8000;
293301                  }
294302               }
295303               break;
296304            case 0x2c:
297305               if ( offset < 0xf0000 )
298                  block = flash_chip[which].data + ( offset & 0xf0000 );
306                  block = state->flash_chip[which].data + ( offset & 0xf0000 );
299307               else
300308               {
301309                  if ( offset & 0x8000 )
302310                  {
303311                     if ( offset & 0x4000 )
304312                     {
305                        block = flash_chip[which].data + ( offset & 0xfc000 );
313                        block = state->flash_chip[which].data + ( offset & 0xfc000 );
306314                        size = 0x4000;
307315                     }
308316                     else
309317                     {
310                        block = flash_chip[which].data + ( offset & 0xfe000 );
318                        block = state->flash_chip[which].data + ( offset & 0xfe000 );
311319                        size = 0x2000;
312320                     }
313321                  }
314322                  else
315323                  {
316                     block = flash_chip[which].data + ( offset & 0xf8000 );
324                     block = state->flash_chip[which].data + ( offset & 0xf8000 );
317325                     size = 0x8000;
318326                  }
319327               }
320328               break;
321329            case 0x2f:
322330               if ( offset < 0x1f0000 )
323                  block = flash_chip[which].data + ( offset & 0x1f0000 );
331                  block = state->flash_chip[which].data + ( offset & 0x1f0000 );
324332               else
325333               {
326334                  if ( offset & 0x8000 )
327335                  {
328336                     if ( offset & 0x4000 )
329337                     {
330                        block = flash_chip[which].data + ( offset & 0x1fc000 );
338                        block = state->flash_chip[which].data + ( offset & 0x1fc000 );
331339                        size = 0x4000;
332340                     }
333341                     else
334342                     {
335                        block = flash_chip[which].data + ( offset & 0x1fe000 );
343                        block = state->flash_chip[which].data + ( offset & 0x1fe000 );
336344                        size = 0x2000;
337345                     }
338346                  }
339347                  else
340348                  {
341                     block = flash_chip[which].data + ( offset & 0x1f8000 );
349                     block = state->flash_chip[which].data + ( offset & 0x1f8000 );
342350                     size = 0x8000;
343351                  }
344352               }
r4578r4579
347355            memset( block, 0xFF, size );
348356         }
349357         else
350            flash_chip[which].state = F_READ;
358            state->flash_chip[which].state = F_READ;
351359      }
352360      else if ( offset == 0x5555 )
353361      {
354362         switch( data )
355363         {
356364         case 0x80:
357            flash_chip[which].command[0] = 0x80;
358            flash_chip[which].state = F_COMMAND;
365            state->flash_chip[which].command[0] = 0x80;
366            state->flash_chip[which].state = F_COMMAND;
359367            break;
360368         case 0x90:
361            flash_chip[which].data[0x1fc000] = flash_chip[which].manufacturer_id;
362            flash_chip[which].data[0xfc000] = flash_chip[which].manufacturer_id;
363            flash_chip[which].data[0x7c000] = flash_chip[which].manufacturer_id;
364            flash_chip[which].data[0] = flash_chip[which].manufacturer_id;
365            flash_chip[which].data[0x1fc001] = flash_chip[which].device_id;
366            flash_chip[which].data[0xfc001] = flash_chip[which].device_id;
367            flash_chip[which].data[0x7c001] = flash_chip[which].device_id;
368            flash_chip[which].data[1] = flash_chip[which].device_id;
369            flash_chip[which].data[0x1fc002] = 0x02;
370            flash_chip[which].data[0xfc002] = 0x02;
371            flash_chip[which].data[0x7c002] = 0x02;
372            flash_chip[which].data[2] = 0x02;
373            flash_chip[which].data[0x1fc003] = 0x80;
374            flash_chip[which].data[0xfc003] = 0x80;
375            flash_chip[which].data[0x7c003] = 0x80;
376            flash_chip[which].data[3] = 0x80;
377            flash_chip[which].state = F_ID_READ;
369            state->flash_chip[which].data[0x1fc000] = state->flash_chip[which].manufacturer_id;
370            state->flash_chip[which].data[0xfc000] = state->flash_chip[which].manufacturer_id;
371            state->flash_chip[which].data[0x7c000] = state->flash_chip[which].manufacturer_id;
372            state->flash_chip[which].data[0] = state->flash_chip[which].manufacturer_id;
373            state->flash_chip[which].data[0x1fc001] = state->flash_chip[which].device_id;
374            state->flash_chip[which].data[0xfc001] = state->flash_chip[which].device_id;
375            state->flash_chip[which].data[0x7c001] = state->flash_chip[which].device_id;
376            state->flash_chip[which].data[1] = state->flash_chip[which].device_id;
377            state->flash_chip[which].data[0x1fc002] = 0x02;
378            state->flash_chip[which].data[0xfc002] = 0x02;
379            state->flash_chip[which].data[0x7c002] = 0x02;
380            state->flash_chip[which].data[2] = 0x02;
381            state->flash_chip[which].data[0x1fc003] = 0x80;
382            state->flash_chip[which].data[0xfc003] = 0x80;
383            state->flash_chip[which].data[0x7c003] = 0x80;
384            state->flash_chip[which].data[3] = 0x80;
385            state->flash_chip[which].state = F_ID_READ;
378386            break;
379387         case 0x9a:
380            if ( flash_chip[which].command[0] == 0x9a )
381               flash_chip[which].state = F_BLOCK_PROTECT;
388            if ( state->flash_chip[which].command[0] == 0x9a )
389               state->flash_chip[which].state = F_BLOCK_PROTECT;
382390            else
383391            {
384               flash_chip[which].command[0] = 0x9a;
385               flash_chip[which].state = F_COMMAND;
392               state->flash_chip[which].command[0] = 0x9a;
393               state->flash_chip[which].state = F_COMMAND;
386394            }
387395            break;
388396         case 0xa0:
389            flash_chip[which].state = F_AUTO_PROGRAM;
397            state->flash_chip[which].state = F_AUTO_PROGRAM;
390398            break;
391399         case 0xf0:
392400         default:
393            flash_chip[which].state = F_READ;
401            state->flash_chip[which].state = F_READ;
394402            break;
395403         }
396404      }
397405      else
398         flash_chip[which].state = F_READ;
406         state->flash_chip[which].state = F_READ;
399407      break;
400408   case F_COMMAND:
401409      if ( offset == 0x5555 && data == 0xaa )
402         flash_chip[which].state = F_PROG1;
410         state->flash_chip[which].state = F_PROG1;
403411      else
404         flash_chip[which].state = F_READ;
412         state->flash_chip[which].state = F_READ;
405413      break;
406414   case F_ID_READ:
407415      if ( offset == 0x5555 && data == 0xaa )
408         flash_chip[which].state = F_PROG1;
416         state->flash_chip[which].state = F_PROG1;
409417      else
410         flash_chip[which].state = F_READ;
411      flash_chip[which].command[0] = 0;
418         state->flash_chip[which].state = F_READ;
419      state->flash_chip[which].command[0] = 0;
412420      break;
413421   case F_AUTO_PROGRAM:
414422      /* Only 1 -> 0 changes can be programmed */
415      flash_chip[which].data[offset] = flash_chip[which].data[offset] & data;
416      flash_chip[which].state = F_READ;
423      state->flash_chip[which].data[offset] = state->flash_chip[which].data[offset] & data;
424      state->flash_chip[which].state = F_READ;
417425      break;
418426   case F_AUTO_CHIP_ERASE:
419      flash_chip[which].state = F_READ;
427      state->flash_chip[which].state = F_READ;
420428      break;
421429   case F_AUTO_BLOCK_ERASE:
422      flash_chip[which].state = F_READ;
430      state->flash_chip[which].state = F_READ;
423431      break;
424432   case F_BLOCK_PROTECT:
425      flash_chip[which].state = F_READ;
433      state->flash_chip[which].state = F_READ;
426434      break;
427435   }
428436
429   if ( flash_chip[which].state == F_READ )
437   if ( state->flash_chip[which].state == F_READ )
430438   {
431439      /* Exit command/back to normal operation*/
432      flash_chip[which].data[0] = flash_chip[which].org_data[0];
433      flash_chip[which].data[1] = flash_chip[which].org_data[1];
434      flash_chip[which].data[2] = flash_chip[which].org_data[2];
435      flash_chip[which].data[3] = flash_chip[which].org_data[3];
436      flash_chip[which].data[0x7c000] = flash_chip[which].org_data[4];
437      flash_chip[which].data[0x7c001] = flash_chip[which].org_data[5];
438      flash_chip[which].data[0x7c002] = flash_chip[which].org_data[6];
439      flash_chip[which].data[0x7c003] = flash_chip[which].org_data[7];
440      flash_chip[which].data[0xfc000] = flash_chip[which].org_data[8];
441      flash_chip[which].data[0xfc001] = flash_chip[which].org_data[9];
442      flash_chip[which].data[0xfc002] = flash_chip[which].org_data[10];
443      flash_chip[which].data[0xfc003] = flash_chip[which].org_data[11];
444      flash_chip[which].data[0x1fc000] = flash_chip[which].org_data[12];
445      flash_chip[which].data[0x1fc001] = flash_chip[which].org_data[13];
446      flash_chip[which].data[0x1fc002] = flash_chip[which].org_data[14];
447      flash_chip[which].data[0x1fc003] = flash_chip[which].org_data[15];
448      flash_chip[which].command[0] = 0;
440      state->flash_chip[which].data[0] = state->flash_chip[which].org_data[0];
441      state->flash_chip[which].data[1] = state->flash_chip[which].org_data[1];
442      state->flash_chip[which].data[2] = state->flash_chip[which].org_data[2];
443      state->flash_chip[which].data[3] = state->flash_chip[which].org_data[3];
444      state->flash_chip[which].data[0x7c000] = state->flash_chip[which].org_data[4];
445      state->flash_chip[which].data[0x7c001] = state->flash_chip[which].org_data[5];
446      state->flash_chip[which].data[0x7c002] = state->flash_chip[which].org_data[6];
447      state->flash_chip[which].data[0x7c003] = state->flash_chip[which].org_data[7];
448      state->flash_chip[which].data[0xfc000] = state->flash_chip[which].org_data[8];
449      state->flash_chip[which].data[0xfc001] = state->flash_chip[which].org_data[9];
450      state->flash_chip[which].data[0xfc002] = state->flash_chip[which].org_data[10];
451      state->flash_chip[which].data[0xfc003] = state->flash_chip[which].org_data[11];
452      state->flash_chip[which].data[0x1fc000] = state->flash_chip[which].org_data[12];
453      state->flash_chip[which].data[0x1fc001] = state->flash_chip[which].org_data[13];
454      state->flash_chip[which].data[0x1fc002] = state->flash_chip[which].org_data[14];
455      state->flash_chip[which].data[0x1fc003] = state->flash_chip[which].org_data[15];
456      state->flash_chip[which].command[0] = 0;
449457   }
450458}
451459
452460
453461static WRITE8_HANDLER( flash0_w )
454462{
455   flash_w( 0, offset, data );
463   ngp_state *state = space->machine->driver_data;
464
465   flash_w( state, 0, offset, data );
456466}
457467
458468
459469static WRITE8_HANDLER( flash1_w )
460470{
461   flash_w( 1, offset, data );
471   ngp_state *state = space->machine->driver_data;
472
473   flash_w( state, 1, offset, data );
462474}
463475
464476
r4578r4579
476488
477489static READ8_HANDLER( ngp_z80_comm_r )
478490{
479   return io_reg[0x3c];
491   ngp_state *state = space->machine->driver_data;
492
493   return state->io_reg[0x3c];
480494}
481495
482496
483497static WRITE8_HANDLER( ngp_z80_comm_w )
484498{
485   io_reg[0x3c] = data;
499   ngp_state *state = space->machine->driver_data;
500
501   state->io_reg[0x3c] = data;
486502}
487503
488504
r4578r4579
516532
517533static INPUT_CHANGED( power_callback )
518534{
519   if ( io_reg[0x33] & 0x04 )
535   ngp_state *state = field->port->machine->driver_data;
536
537   if ( state->io_reg[0x33] & 0x04 )
520538   {
521539      cputag_set_input_line( field->port->machine, "maincpu", TLCS900_NMI,
522540         (input_port_read(field->port->machine, "Power") & 0x01 ) ? CLEAR_LINE : ASSERT_LINE );
r4578r4579
565583
566584static MACHINE_START( ngp )
567585{
568   seconds_timer = timer_alloc( machine, ngp_seconds_callback, NULL );
569   timer_adjust_periodic( seconds_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1) );
586   ngp_state *state = machine->driver_data;
587
588   state->seconds_timer = timer_alloc( machine, ngp_seconds_callback, NULL );
589   timer_adjust_periodic( state->seconds_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1) );
570590}
571591
572592
r4578r4579
586606
587607static DEVICE_START( ngp_cart )
588608{
609   ngp_state *state = device->machine->driver_data;
589610   UINT8 *cart = memory_region( device->machine, "cart" );
590611
591   flash_chip[0].present = 0;
592   flash_chip[0].state = F_READ;
593   flash_chip[0].data = cart;
612   state->flash_chip[0].present = 0;
613   state->flash_chip[0].state = F_READ;
614   state->flash_chip[0].data = cart;
594615
595   flash_chip[1].present = 0;
596   flash_chip[1].state = F_READ;
597   flash_chip[1].data = cart + 0x200000;
616   state->flash_chip[1].present = 0;
617   state->flash_chip[1].state = F_READ;
618   state->flash_chip[1].data = cart + 0x200000;
598619}
599620
600621
601622static DEVICE_IMAGE_LOAD( ngp_cart )
602623{
624   ngp_state *state = image->machine->driver_data;
603625   int filesize = image_length( image );
604626
605627   if ( filesize != 0x80000 && filesize != 0x100000 && filesize != 0x200000 && filesize != 0x400000 )
r4578r4579
614636      return INIT_FAIL;
615637   }
616638
617   flash_chip[0].manufacturer_id = 0x98;
639   state->flash_chip[0].manufacturer_id = 0x98;
618640   switch( filesize )
619641   {
620642   case 0x80000:
621      flash_chip[0].device_id = 0xab;
643      state->flash_chip[0].device_id = 0xab;
622644      break;
623645   case 0x100000:
624      flash_chip[0].device_id = 0x2c;
646      state->flash_chip[0].device_id = 0x2c;
625647      break;
626648   case 0x200000:
627      flash_chip[0].device_id = 0x2f;
649      state->flash_chip[0].device_id = 0x2f;
628650      break;
629651   case 0x400000:
630      flash_chip[0].device_id = 0x2f;
631      flash_chip[1].manufacturer_id = 0x98;
632      flash_chip[1].device_id = 0x2f;
633      flash_chip[1].present = 0;
634      flash_chip[1].state = F_READ;
652      state->flash_chip[0].device_id = 0x2f;
653      state->flash_chip[1].manufacturer_id = 0x98;
654      state->flash_chip[1].device_id = 0x2f;
655      state->flash_chip[1].present = 0;
656      state->flash_chip[1].state = F_READ;
635657      break;
636658   }
637659
638   flash_chip[0].org_data[0] = flash_chip[0].data[0];
639   flash_chip[0].org_data[1] = flash_chip[0].data[1];
640   flash_chip[0].org_data[2] = flash_chip[0].data[2];
641   flash_chip[0].org_data[3] = flash_chip[0].data[3];
642   flash_chip[0].org_data[4] = flash_chip[0].data[0x7c000];
643   flash_chip[0].org_data[5] = flash_chip[0].data[0x7c001];
644   flash_chip[0].org_data[6] = flash_chip[0].data[0x7c002];
645   flash_chip[0].org_data[7] = flash_chip[0].data[0x7c003];
646   flash_chip[0].org_data[8] = flash_chip[0].data[0xfc000];
647   flash_chip[0].org_data[9] = flash_chip[0].data[0xfc001];
648   flash_chip[0].org_data[10] = flash_chip[0].data[0xfc002];
649   flash_chip[0].org_data[11] = flash_chip[0].data[0xfc003];
650   flash_chip[0].org_data[12] = flash_chip[0].data[0x1fc000];
651   flash_chip[0].org_data[13] = flash_chip[0].data[0x1fc001];
652   flash_chip[0].org_data[14] = flash_chip[0].data[0x1fc002];
653   flash_chip[0].org_data[15] = flash_chip[0].data[0x1fc003];
660   state->flash_chip[0].org_data[0] = state->flash_chip[0].data[0];
661   state->flash_chip[0].org_data[1] = state->flash_chip[0].data[1];
662   state->flash_chip[0].org_data[2] = state->flash_chip[0].data[2];
663   state->flash_chip[0].org_data[3] = state->flash_chip[0].data[3];
664   state->flash_chip[0].org_data[4] = state->flash_chip[0].data[0x7c000];
665   state->flash_chip[0].org_data[5] = state->flash_chip[0].data[0x7c001];
666   state->flash_chip[0].org_data[6] = state->flash_chip[0].data[0x7c002];
667   state->flash_chip[0].org_data[7] = state->flash_chip[0].data[0x7c003];
668   state->flash_chip[0].org_data[8] = state->flash_chip[0].data[0xfc000];
669   state->flash_chip[0].org_data[9] = state->flash_chip[0].data[0xfc001];
670   state->flash_chip[0].org_data[10] = state->flash_chip[0].data[0xfc002];
671   state->flash_chip[0].org_data[11] = state->flash_chip[0].data[0xfc003];
672   state->flash_chip[0].org_data[12] = state->flash_chip[0].data[0x1fc000];
673   state->flash_chip[0].org_data[13] = state->flash_chip[0].data[0x1fc001];
674   state->flash_chip[0].org_data[14] = state->flash_chip[0].data[0x1fc002];
675   state->flash_chip[0].org_data[15] = state->flash_chip[0].data[0x1fc003];
654676
655   flash_chip[1].org_data[0] = flash_chip[1].data[0];
656   flash_chip[1].org_data[1] = flash_chip[1].data[1];
657   flash_chip[1].org_data[2] = flash_chip[1].data[2];
658   flash_chip[1].org_data[3] = flash_chip[1].data[3];
659   flash_chip[1].org_data[4] = flash_chip[1].data[0x7c000];
660   flash_chip[1].org_data[5] = flash_chip[1].data[0x7c001];
661   flash_chip[1].org_data[6] = flash_chip[1].data[0x7c002];
662   flash_chip[1].org_data[7] = flash_chip[1].data[0x7c003];
663   flash_chip[1].org_data[8] = flash_chip[1].data[0xfc000];
664   flash_chip[1].org_data[9] = flash_chip[1].data[0xfc001];
665   flash_chip[1].org_data[10] = flash_chip[1].data[0xfc002];
666   flash_chip[1].org_data[11] = flash_chip[1].data[0xfc003];
667   flash_chip[1].org_data[12] = flash_chip[1].data[0x1fc000];
668   flash_chip[1].org_data[13] = flash_chip[1].data[0x1fc001];
669   flash_chip[1].org_data[14] = flash_chip[1].data[0x1fc002];
670   flash_chip[1].org_data[15] = flash_chip[1].data[0x1fc003];
677   state->flash_chip[1].org_data[0] = state->flash_chip[1].data[0];
678   state->flash_chip[1].org_data[1] = state->flash_chip[1].data[1];
679   state->flash_chip[1].org_data[2] = state->flash_chip[1].data[2];
680   state->flash_chip[1].org_data[3] = state->flash_chip[1].data[3];
681   state->flash_chip[1].org_data[4] = state->flash_chip[1].data[0x7c000];
682   state->flash_chip[1].org_data[5] = state->flash_chip[1].data[0x7c001];
683   state->flash_chip[1].org_data[6] = state->flash_chip[1].data[0x7c002];
684   state->flash_chip[1].org_data[7] = state->flash_chip[1].data[0x7c003];
685   state->flash_chip[1].org_data[8] = state->flash_chip[1].data[0xfc000];
686   state->flash_chip[1].org_data[9] = state->flash_chip[1].data[0xfc001];
687   state->flash_chip[1].org_data[10] = state->flash_chip[1].data[0xfc002];
688   state->flash_chip[1].org_data[11] = state->flash_chip[1].data[0xfc003];
689   state->flash_chip[1].org_data[12] = state->flash_chip[1].data[0x1fc000];
690   state->flash_chip[1].org_data[13] = state->flash_chip[1].data[0x1fc001];
691   state->flash_chip[1].org_data[14] = state->flash_chip[1].data[0x1fc002];
692   state->flash_chip[1].org_data[15] = state->flash_chip[1].data[0x1fc003];
671693
672   flash_chip[0].present = 1;
673   flash_chip[0].state = F_READ;
694   state->flash_chip[0].present = 1;
695   state->flash_chip[0].state = F_READ;
674696
675697   return INIT_PASS;
676698}
r4578r4579
678700
679701static DEVICE_IMAGE_UNLOAD( ngp_cart )
680702{
681   flash_chip[0].present = 0;
682   flash_chip[0].state = F_READ;
703   ngp_state *state = image->machine->driver_data;
683704
684   flash_chip[1].present = 0;
685   flash_chip[1].state = F_READ;
705   state->flash_chip[0].present = 0;
706   state->flash_chip[0].state = F_READ;
707
708   state->flash_chip[1].present = 0;
709   state->flash_chip[1].state = F_READ;
686710}
687711
688712
r4578r4579
703727
704728
705729static MACHINE_DRIVER_START( ngp_common )
730   MDRV_DRIVER_DATA( ngp_state )
731
706732   MDRV_CPU_ADD( "maincpu", TLCS900H, XTAL_6_144MHz )
707733   MDRV_CPU_PROGRAM_MAP( ngp_mem, 0 )
708734   MDRV_CPU_CONFIG( ngp_tlcs900_interface )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team