Previous 15994 Revisions Next

r10151 Sunday 23rd January, 2011 at 14:35:44 UTC by Nathan Woods
Added driver_device states to apple2 and chess drivers. [Atari Ace]
[docs]messnew.txt
[src/mess/drivers]apple2.c glasgow.c mephisto.c pc88va.c polgar.c
[src/mess/includes]apple2.h apple2gs.h apple3.h
[src/mess/machine]apple2.c apple2gs.c apple3.c ay3600.c ay3600.h
[src/mess/video]apple2.c

src/mess/machine/apple3.c
r10150r10151
112112   {
113113      case 0x00: case 0x01: case 0x02: case 0x03:
114114      case 0x04: case 0x05: case 0x06: case 0x07:
115         result = AY3600_keydata_strobe_r();
115         result = AY3600_keydata_strobe_r(space->machine);
116116         break;
117117
118118      case 0x08: case 0x09: case 0x0A: case 0x0B:
r10150r10151
125125      case 0x14: case 0x15: case 0x16: case 0x17:
126126      case 0x18: case 0x19: case 0x1A: case 0x1B:
127127      case 0x1C: case 0x1D: case 0x1E: case 0x1F:
128         AY3600_anykey_clearstrobe_r();
128         AY3600_anykey_clearstrobe_r(space->machine);
129129         break;
130130
131131      case 0x50: case 0x51: case 0x52: case 0x53:
r10150r10151
198198      case 0x14: case 0x15: case 0x16: case 0x17:
199199      case 0x18: case 0x19: case 0x1A: case 0x1B:
200200      case 0x1C: case 0x1D: case 0x1E: case 0x1F:
201         AY3600_anykey_clearstrobe_r();
201         AY3600_anykey_clearstrobe_r(space->machine);
202202         break;
203203
204204      case 0x50: case 0x51: case 0x52: case 0x53:
r10150r10151
252252{
253253   via6522_device *via_1 = device->machine->device<via6522_device>("via6522_1");
254254
255   via_1->write_ca2((AY3600_keydata_strobe_r() & 0x80) ? 1 : 0);
255   via_1->write_ca2((AY3600_keydata_strobe_r(device->machine) & 0x80) ? 1 : 0);
256256   via_1->write_cb1(device->machine->primary_screen->vblank());
257257   via_1->write_cb2(device->machine->primary_screen->vblank());
258258}
src/mess/machine/ay3600.c
r10150r10151
256256   }
257257};
258258
259static unsigned int *ay3600_keys;
260
261259static UINT8 keycode;
262static UINT8 keycode_unmodified;
263260static UINT8 keywaiting;
264static UINT8 keystilldown;
265static UINT8 keymodreg;
266261
267262#define A2_KEY_NORMAL            0
268263#define A2_KEY_CONTROL            1
r10150r10151
321316
322317int AY3600_init(running_machine *machine)
323318{
319   apple2_state *state = machine->driver_data<apple2_state>();
324320   /* Init the key remapping table */
325   ay3600_keys = auto_alloc_array_clear(machine, unsigned int, AY3600_KEYS_LENGTH);
321   state->ay3600_keys = auto_alloc_array_clear(machine, unsigned int, AY3600_KEYS_LENGTH);
326322
327323   /* We poll the keyboard periodically to scan the keys.  This is
328324    actually consistent with how the AY-3600 keyboard controller works. */
r10150r10151
333329
334330   keywaiting = 0;
335331   keycode = 0;
336   keystilldown = 0;
337   keymodreg = A2_KEYMOD_CAPSLOCK;   // caps lock on
332   state->keystilldown = 0;
333   state->keymodreg = A2_KEYMOD_CAPSLOCK;   // caps lock on
338334
339   inputx_setup_natural_keyboard(AY3600_keyboard_queue_chars,
335   state->last_key = 0xff;    /* necessary for special repeat key behaviour */
336   state->last_key_unmodified = 0xff;   /* necessary for special repeat key behaviour */
337   state->time_until_repeat = MAGIC_KEY_REPEAT_NUMBER;
338
339   inputx_setup_natural_keyboard(
340      AY3600_keyboard_queue_chars,
340341      AY3600_keyboard_accept_char,
341342      NULL);
342343
r10150r10151
351352
352353static TIMER_CALLBACK(AY3600_poll)
353354{
355   apple2_state *state = machine->driver_data<apple2_state>();
354356   int switchkey;   /* Normal, Shift, Control, or both */
355357   int port, num_ports, bit, data;
356358   int any_key_pressed = 0;   /* Have we pressed a key? True/False */
r10150r10151
358360   int curkey;
359361   int curkey_unmodified;
360362
361   static int reset_flag = 0;
362   static int last_key = 0xff;    /* necessary for special repeat key behaviour */
363   static int last_key_unmodified = 0xff;   /* necessary for special repeat key behaviour */
364363
365   static unsigned int time_until_repeat = MAGIC_KEY_REPEAT_NUMBER;
366
367364   static const char *const portnames[] = {
368365      "keyb_0", "keyb_1", "keyb_2", "keyb_3", "keyb_4", "keyb_5", "keyb_6",
369366      "keypad_1", "keypad_2"
r10150r10151
373370
374371   /* only repeat keys on a 2/2+ if special REPT key is pressed */
375372   if (a2_has_repeat(machine))
376      time_until_repeat = input_port_read(machine, "keyb_repeat") & 0x01 ? 0 : ~0;
373      state->time_until_repeat = input_port_read(machine, "keyb_repeat") & 0x01 ? 0 : ~0;
377374
378375   /* check caps lock and set LED here */
379376   if (apple2_pressed_specialkey(machine, SPECIALKEY_CAPSLOCK))
380377   {
381378      caps_lock = 1;
382379      set_led_status(machine,1,1);
383      keymodreg |= A2_KEYMOD_CAPSLOCK;
380      state->keymodreg |= A2_KEYMOD_CAPSLOCK;
384381   }
385382   else
386383   {
387384      caps_lock = 0;
388385      set_led_status(machine,1,0);
389      keymodreg &= ~A2_KEYMOD_CAPSLOCK;
386      state->keymodreg &= ~A2_KEYMOD_CAPSLOCK;
390387   }
391388
392389   switchkey = A2_KEY_NORMAL;
r10150r10151
395392   if (apple2_pressed_specialkey(machine, SPECIALKEY_SHIFT))
396393   {
397394      switchkey |= A2_KEY_SHIFT;
398      keymodreg |= A2_KEYMOD_SHIFT;
395      state->keymodreg |= A2_KEYMOD_SHIFT;
399396   }
400397   else
401398   {
402      keymodreg &= ~A2_KEYMOD_SHIFT;
399      state->keymodreg &= ~A2_KEYMOD_SHIFT;
403400   }
404401
405402   /* control key check - only one control key on the left side on the Apple */
406403   if (apple2_pressed_specialkey(machine, SPECIALKEY_CONTROL))
407404   {
408405      switchkey |= A2_KEY_CONTROL;
409      keymodreg |= A2_KEYMOD_CONTROL;
406      state->keymodreg |= A2_KEYMOD_CONTROL;
410407   }
411408   else
412409   {
413      keymodreg &= ~A2_KEYMOD_CONTROL;
410      state->keymodreg &= ~A2_KEYMOD_CONTROL;
414411   }
415412
416413   /* apple key check */
417414   if (apple2_pressed_specialkey(machine, SPECIALKEY_BUTTON0))
418415   {
419      keymodreg |= A2_KEYMOD_COMMAND;
416      state->keymodreg |= A2_KEYMOD_COMMAND;
420417   }
421418   else
422419   {
423      keymodreg &= ~A2_KEYMOD_COMMAND;
420      state->keymodreg &= ~A2_KEYMOD_COMMAND;
424421   }
425422
426423   /* option key check */
427424   if (apple2_pressed_specialkey(machine, SPECIALKEY_BUTTON1))
428425   {
429      keymodreg |= A2_KEYMOD_OPTION;
426      state->keymodreg |= A2_KEYMOD_OPTION;
430427   }
431428   else
432429   {
433      keymodreg &= ~A2_KEYMOD_OPTION;
430      state->keymodreg &= ~A2_KEYMOD_OPTION;
434431   }
435432
436433   /* reset key check */
437434   if (apple2_pressed_specialkey(machine, SPECIALKEY_RESET) &&
438435      (a2_no_ctrl_reset(machine) || switchkey & A2_KEY_CONTROL))
439436   {
440         if (!reset_flag)
437         if (!state->reset_flag)
441438         {
442            reset_flag = 1;
439            state->reset_flag = 1;
443440            /* using PULSE_LINE does not allow us to press and hold key */
444441            cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, ASSERT_LINE);
445442         }
446443         return;
447444   }
448   if (reset_flag)
445   if (state->reset_flag)
449446   {
450      reset_flag = 0;
447      state->reset_flag = 0;
451448      cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, CLEAR_LINE);
452449      machine->schedule_soft_reset();
453450   }
r10150r10151
455452   /* run through real keys and see what's being pressed */
456453   num_ports = a2_has_keypad(machine) ? 9 : 7;
457454
458   keymodreg &= ~A2_KEYMOD_KEYPAD;
455   state->keymodreg &= ~A2_KEYMOD_KEYPAD;
459456
460457   for (port = 0; port < num_ports; port++)
461458   {
r10150r10151
479476
480477            if (port == 8)
481478            {
482               keymodreg |= A2_KEYMOD_KEYPAD;
479               state->keymodreg |= A2_KEYMOD_KEYPAD;
483480            }
484481
485482            /* prevent overflow */
486            if (ay3600_keys[port*8+bit] < 65000)
487               ay3600_keys[port*8+bit]++;
483            if (state->ay3600_keys[port*8+bit] < 65000)
484               state->ay3600_keys[port*8+bit]++;
488485
489486            /* on every key press, reset the time until repeat and the key to repeat */
490            if ((ay3600_keys[port*8+bit] == 1) && (curkey_unmodified != last_key_unmodified))
487            if ((state->ay3600_keys[port*8+bit] == 1) && (curkey_unmodified != state->last_key_unmodified))
491488            {
492               time_until_repeat = MAGIC_KEY_REPEAT_NUMBER;
493               last_key = curkey;
494               last_key_unmodified = curkey_unmodified;
489               state->time_until_repeat = MAGIC_KEY_REPEAT_NUMBER;
490               state->last_key = curkey;
491               state->last_key_unmodified = curkey_unmodified;
495492            }
496493         }
497494         else
498495         {
499            ay3600_keys[port*8+bit] = 0;
496            state->ay3600_keys[port*8+bit] = 0;
500497         }
501498      }
502499   }
503500
504   keymodreg &= ~A2_KEYMOD_REPEAT;
501   state->keymodreg &= ~A2_KEYMOD_REPEAT;
505502
506503   if (!any_key_pressed)
507504   {
508505      /* If no keys have been pressed, reset the repeat time and return */
509      time_until_repeat = MAGIC_KEY_REPEAT_NUMBER;
510      last_key = 0xff;
511      last_key_unmodified = 0xff;
506      state->time_until_repeat = MAGIC_KEY_REPEAT_NUMBER;
507      state->last_key = 0xff;
508      state->last_key_unmodified = 0xff;
512509   }
513510   else
514511   {
515512      /* Otherwise, count down the repeat time */
516      if (time_until_repeat > 0)
517         time_until_repeat--;
513      if (state->time_until_repeat > 0)
514         state->time_until_repeat--;
518515
519516      /* Even if a key has been released, repeat it if it was the last key pressed */
520517      /* If we should output a key, set the appropriate Apple II data lines */
521      if (time_until_repeat == 0 ||
522         time_until_repeat == MAGIC_KEY_REPEAT_NUMBER-1)
518      if (state->time_until_repeat == 0 ||
519         state->time_until_repeat == MAGIC_KEY_REPEAT_NUMBER-1)
523520      {
524521         keywaiting = 1;
525         keycode = last_key;
526         keycode_unmodified = last_key_unmodified;
527         keymodreg |= A2_KEYMOD_REPEAT;
522         keycode = state->last_key;
523         state->keycode_unmodified = state->last_key_unmodified;
524         state->keymodreg |= A2_KEYMOD_REPEAT;
528525      }
529526   }
530   keystilldown = (last_key_unmodified == keycode_unmodified);
527   state->keystilldown = (state->last_key_unmodified == state->keycode_unmodified);
531528}
532529
533530
r10150r10151
536533  AY3600_keydata_strobe_r ($C00x)
537534***************************************************************************/
538535
539int AY3600_keydata_strobe_r(void)
536int AY3600_keydata_strobe_r(running_machine *machine)
540537{
541538   int rc;
542539   rc = keycode | (keywaiting ? 0x80 : 0x00);
r10150r10151
550547  AY3600_anykey_clearstrobe_r ($C01x)
551548***************************************************************************/
552549
553int AY3600_anykey_clearstrobe_r(void)
550int AY3600_anykey_clearstrobe_r(running_machine *machine)
554551{
552   apple2_state *state = machine->driver_data<apple2_state>();
555553   int rc;
556554   keywaiting = 0;
557   rc = keycode | (keystilldown ? 0x80 : 0x00);
555   rc = keycode | (state->keystilldown ? 0x80 : 0x00);
558556   LOG(("AY3600_anykey_clearstrobe_r(): rc=0x%02x\n", rc));
559557   return rc;
560558}
r10150r10151
564562  AY3600_keymod_r ($C025 - IIgs only)
565563***************************************************************************/
566564
567int AY3600_keymod_r(void)
565int AY3600_keymod_r(running_machine *machine)
568566{
569   return keymodreg;
567   apple2_state *state = machine->driver_data<apple2_state>();
568   return state->keymodreg;
570569}
571570
572571/***************************************************************************
src/mess/machine/ay3600.h
r10150r10151
1313/*----------- defined in machine/ay3600.c -----------*/
1414
1515int AY3600_init(running_machine *machine);
16int AY3600_anykey_clearstrobe_r(void);
17int AY3600_keydata_strobe_r(void);
18int AY3600_keymod_r(void);
16int AY3600_anykey_clearstrobe_r(running_machine *machine);
17int AY3600_keydata_strobe_r(running_machine *machine);
18int AY3600_keymod_r(running_machine *machine);
1919
2020#endif /* AY3600_H */
src/mess/machine/apple2gs.c
r10150r10151
922922         break;
923923
924924      case 0x22:   /* C022 - TBCOLOR */
925         result = (apple2_get_fgcolor() << 4)
926            | apple2_get_bgcolor();
925         result = (state->fgcolor << 4) | state->bgcolor;
927926         break;
928927
929928      case 0x23:   /* C023 - VGCINT */
r10150r10151
935934         break;
936935
937936      case 0x25:   /* C025 - KEYMODREG */
938         result = AY3600_keymod_r();
937         result = AY3600_keymod_r(space->machine);
939938         break;
940939
941940      case 0x26:   /* C026 - DATAREG */
r10150r10151
976975         break;
977976
978977      case 0x31:   /* C031 - DISKREG */
979         result = apple2_iwm_getdiskreg();
978         result = apple2_iwm_getdiskreg(space->machine);
980979         break;
981980
982981      case 0x33:   /* C033 - CLOCKDATA */
r10150r10151
10191018         break;
10201019
10211020      case 0x68:   /* C068 - STATEREG */
1022         result = ((apple2_flags & VAR_ALTZP)   ? 0x80 : 0x00)
1023            |   ((apple2_flags & VAR_PAGE2)   ? 0x40 : 0x00)
1024            |   ((apple2_flags & VAR_RAMRD)   ? 0x20 : 0x00)
1025            |   ((apple2_flags & VAR_RAMWRT)   ? 0x10 : 0x00)
1026            |   ((apple2_flags & VAR_LCRAM)   ? 0x00 : 0x08)
1027            |   ((apple2_flags & VAR_LCRAM2)   ? 0x04 : 0x00)
1028            |   ((apple2_flags & VAR_INTCXROM)? 0x01 : 0x00);
1021         result = ((state->flags & VAR_ALTZP)   ? 0x80 : 0x00)
1022            |   ((state->flags & VAR_PAGE2)   ? 0x40 : 0x00)
1023            |   ((state->flags & VAR_RAMRD)   ? 0x20 : 0x00)
1024            |   ((state->flags & VAR_RAMWRT)   ? 0x10 : 0x00)
1025            |   ((state->flags & VAR_LCRAM)   ? 0x00 : 0x08)
1026            |   ((state->flags & VAR_LCRAM2)   ? 0x04 : 0x00)
1027            |   ((state->flags & VAR_INTCXROM)? 0x01 : 0x00);
10291028         break;
10301029
10311030      case 0x71: case 0x72: case 0x73:
r10150r10151
10651064   switch(offset)
10661065   {
10671066      case 0x22:   /* C022 - TBCOLOR */
1068         apple2_set_fgcolor((data >> 4) & 0x0F);
1069         apple2_set_bgcolor((data >> 0) & 0x0F);
1067         state->fgcolor = (data >> 4) & 0x0F;
1068         state->bgcolor = (data >> 0) & 0x0F;
10701069         break;
10711070
10721071      case 0x23:   /* C023 - VGCINT */
r10150r10151
12841283
12851284static void apple2gs_mem_000000(running_machine *machine,offs_t begin, offs_t end, apple2_meminfo *meminfo)
12861285{
1287   meminfo->read_mem         = (apple2_flags & VAR_ALTZP)   ? 0x010000 : 0x000000;
1288   meminfo->write_mem         = (apple2_flags & VAR_ALTZP)   ? 0x010000 : 0x000000;
1286   apple2_state *state = machine->driver_data<apple2_state>();
1287   meminfo->read_mem         = (state->flags & VAR_ALTZP)   ? 0x010000 : 0x000000;
1288   meminfo->write_mem         = (state->flags & VAR_ALTZP)   ? 0x010000 : 0x000000;
12891289}
12901290
12911291static void apple2gs_mem_000200(running_machine *machine,offs_t begin, offs_t end, apple2_meminfo *meminfo)
12921292{
1293   meminfo->read_mem         = (apple2_flags & VAR_RAMRD)   ? 0x010200 : 0x000200;
1294   meminfo->write_mem         = (apple2_flags & VAR_RAMWRT)   ? 0x010200 : 0x000200;
1293   apple2_state *state = machine->driver_data<apple2_state>();
1294   meminfo->read_mem         = (state->flags & VAR_RAMRD)   ? 0x010200 : 0x000200;
1295   meminfo->write_mem         = (state->flags & VAR_RAMWRT)   ? 0x010200 : 0x000200;
12951296}
12961297
12971298static void apple2gs_mem_000400(running_machine *machine,offs_t begin, offs_t end, apple2_meminfo *meminfo)
12981299{
1299   if (apple2_flags & VAR_80STORE)
1300   apple2_state *state = machine->driver_data<apple2_state>();
1301   if (state->flags & VAR_80STORE)
13001302   {
1301      meminfo->read_mem      = (apple2_flags & VAR_PAGE2)   ? 0x010400 : 0x000400;
1302      meminfo->write_mem      = (apple2_flags & VAR_PAGE2)   ? 0x010400 : 0x000400;
1303      meminfo->write_handler   = (apple2_flags & VAR_PAGE2)   ? apple2gs_aux0400_w : apple2gs_main0400_w;
1303      meminfo->read_mem      = (state->flags & VAR_PAGE2)   ? 0x010400 : 0x000400;
1304      meminfo->write_mem      = (state->flags & VAR_PAGE2)   ? 0x010400 : 0x000400;
1305      meminfo->write_handler   = (state->flags & VAR_PAGE2)   ? apple2gs_aux0400_w : apple2gs_main0400_w;
13041306   }
13051307   else
13061308   {
1307      meminfo->read_mem      = (apple2_flags & VAR_RAMRD)   ? 0x010400 : 0x000400;
1308      meminfo->write_mem      = (apple2_flags & VAR_RAMWRT)   ? 0x010400 : 0x000400;
1309      meminfo->write_handler   = (apple2_flags & VAR_RAMWRT)   ? apple2gs_aux0400_w : apple2gs_main0400_w;
1309      meminfo->read_mem      = (state->flags & VAR_RAMRD)   ? 0x010400 : 0x000400;
1310      meminfo->write_mem      = (state->flags & VAR_RAMWRT)   ? 0x010400 : 0x000400;
1311      meminfo->write_handler   = (state->flags & VAR_RAMWRT)   ? apple2gs_aux0400_w : apple2gs_main0400_w;
13101312   }
13111313}
13121314
13131315static void apple2gs_mem_000800(running_machine *machine,offs_t begin, offs_t end, apple2_meminfo *meminfo)
13141316{
1315   meminfo->read_mem         = (apple2_flags & VAR_RAMRD)   ? 0x010800 : 0x000800;
1316   meminfo->write_mem         = (apple2_flags & VAR_RAMWRT)   ? 0x010800 : 0x000800;
1317   apple2_state *state = machine->driver_data<apple2_state>();
1318   meminfo->read_mem         = (state->flags & VAR_RAMRD)   ? 0x010800 : 0x000800;
1319   meminfo->write_mem         = (state->flags & VAR_RAMWRT)   ? 0x010800 : 0x000800;
13171320}
13181321
13191322static void apple2gs_mem_002000(running_machine *machine,offs_t begin, offs_t end, apple2_meminfo *meminfo)
13201323{
1321   if ((apple2_flags & (VAR_80STORE|VAR_HIRES)) == (VAR_80STORE|VAR_HIRES))
1324   apple2_state *state = machine->driver_data<apple2_state>();
1325   if ((state->flags & (VAR_80STORE|VAR_HIRES)) == (VAR_80STORE|VAR_HIRES))
13221326   {
1323      meminfo->read_mem      = (apple2_flags & VAR_PAGE2)   ? 0x012000 : 0x002000;
1324      meminfo->write_mem      = (apple2_flags & VAR_PAGE2)   ? 0x012000 : 0x002000;
1325      meminfo->write_handler   = (apple2_flags & VAR_PAGE2)   ? apple2gs_aux2000_w : apple2gs_main2000_w;
1327      meminfo->read_mem      = (state->flags & VAR_PAGE2)   ? 0x012000 : 0x002000;
1328      meminfo->write_mem      = (state->flags & VAR_PAGE2)   ? 0x012000 : 0x002000;
1329      meminfo->write_handler   = (state->flags & VAR_PAGE2)   ? apple2gs_aux2000_w : apple2gs_main2000_w;
13261330   }
13271331   else
13281332   {
1329      meminfo->read_mem      = (apple2_flags & VAR_RAMRD)   ? 0x012000 : 0x002000;
1330      meminfo->write_mem      = (apple2_flags & VAR_RAMWRT)   ? 0x012000 : 0x002000;
1331      meminfo->write_handler   = (apple2_flags & VAR_RAMWRT)   ? apple2gs_aux2000_w : apple2gs_main2000_w;
1333      meminfo->read_mem      = (state->flags & VAR_RAMRD)   ? 0x012000 : 0x002000;
1334      meminfo->write_mem      = (state->flags & VAR_RAMWRT)   ? 0x012000 : 0x002000;
1335      meminfo->write_handler   = (state->flags & VAR_RAMWRT)   ? apple2gs_aux2000_w : apple2gs_main2000_w;
13321336   }
13331337}
13341338
13351339static void apple2gs_mem_004000(running_machine *machine,offs_t begin, offs_t end, apple2_meminfo *meminfo)
13361340{
1337   meminfo->read_mem         = (apple2_flags & VAR_RAMRD)   ? 0x014000 : 0x004000;
1338   meminfo->write_handler      = (apple2_flags & VAR_RAMWRT)   ? apple2gs_aux4000_w : apple2gs_main4000_w;
1341   apple2_state *state = machine->driver_data<apple2_state>();
1342   meminfo->read_mem         = (state->flags & VAR_RAMRD)   ? 0x014000 : 0x004000;
1343   meminfo->write_handler      = (state->flags & VAR_RAMWRT)   ? apple2gs_aux4000_w : apple2gs_main4000_w;
13391344}
13401345
13411346static void apple2gs_mem_xxD000(running_machine *machine,apple2_meminfo *meminfo, UINT32 lcmem)
13421347{
1343   if (apple2_flags & VAR_LCRAM)
1348   apple2_state *state = machine->driver_data<apple2_state>();
1349   if (state->flags & VAR_LCRAM)
13441350   {
1345      if (apple2_flags & VAR_LCRAM2)
1351      if (state->flags & VAR_LCRAM2)
13461352         meminfo->read_mem   = lcmem | 0x00C000;
13471353      else
13481354         meminfo->read_mem   = lcmem | 0x00D000;
r10150r10151
13521358      meminfo->read_mem      = 0x03D000 | APPLE2_MEM_ROM;
13531359   }
13541360
1355   if (apple2_flags & VAR_LCWRITE)
1361   if (state->flags & VAR_LCWRITE)
13561362   {
1357      if (apple2_flags & VAR_LCRAM2)
1363      if (state->flags & VAR_LCRAM2)
13581364         meminfo->write_mem   = lcmem | 0x00C000;
13591365      else
13601366         meminfo->write_mem   = lcmem | 0x00D000;
r10150r10151
13671373
13681374static void apple2gs_mem_xxE000(running_machine *machine,apple2_meminfo *meminfo, UINT32 lcmem)
13691375{
1370   if (apple2_flags & VAR_LCRAM)
1376   apple2_state *state = machine->driver_data<apple2_state>();
1377   if (state->flags & VAR_LCRAM)
13711378      meminfo->read_mem      = lcmem | 0x00E000;
13721379   else
13731380      meminfo->read_mem      = 0x03E000 | APPLE2_MEM_ROM;
13741381
1375   if (apple2_flags & VAR_LCWRITE)
1382   if (state->flags & VAR_LCWRITE)
13761383      meminfo->write_mem      = lcmem | 0x00E000;
13771384   else
13781385      meminfo->write_mem      = APPLE2_MEM_FLOATING;
r10150r10151
13831390   apple2gs_state *state = machine->driver_data<apple2gs_state>();
13841391   if (state->shadow & 0x40)
13851392   {
1386      meminfo->read_mem      = (apple2_flags & VAR_RAMRD) ? 0x01D000 : 0x00D000;
1387      meminfo->write_mem      = (apple2_flags & VAR_RAMWRT) ? 0x01D000 : 0x00D000;
1393      meminfo->read_mem      = (state->flags & VAR_RAMRD) ? 0x01D000 : 0x00D000;
1394      meminfo->write_mem      = (state->flags & VAR_RAMWRT) ? 0x01D000 : 0x00D000;
13881395   }
13891396   else
13901397   {
1391      apple2gs_mem_xxD000(machine,meminfo, (apple2_flags & VAR_ALTZP) ? 0x010000 : 0x000000);
1398      apple2gs_mem_xxD000(machine,meminfo, (state->flags & VAR_ALTZP) ? 0x010000 : 0x000000);
13921399   }
13931400}
13941401
r10150r10151
13971404   apple2gs_state *state = machine->driver_data<apple2gs_state>();
13981405   if (state->shadow & 0x40)
13991406   {
1400      meminfo->read_mem      = (apple2_flags & VAR_RAMRD) ? 0x01E000 : 0x00E000;
1401      meminfo->write_mem      = (apple2_flags & VAR_RAMWRT) ? 0x01E000 : 0x00E000;
1407      meminfo->read_mem      = (state->flags & VAR_RAMRD) ? 0x01E000 : 0x00E000;
1408      meminfo->write_mem      = (state->flags & VAR_RAMWRT) ? 0x01E000 : 0x00E000;
14021409   }
14031410   else
14041411   {
1405      apple2gs_mem_xxE000(machine,meminfo, (apple2_flags & VAR_ALTZP) ? 0x010000 : 0x000000);
1412      apple2gs_mem_xxE000(machine,meminfo, (state->flags & VAR_ALTZP) ? 0x010000 : 0x000000);
14061413   }
14071414}
14081415
src/mess/machine/apple2.c
r10150r10151
4040#define PROFILER_A2INT   PROFILER_USER2
4141
4242/* softswitch */
43UINT32 apple2_flags;
4443
4544/* before the softswitch is changed, these are applied */
46static UINT32 a2_mask;
47static UINT32 a2_set;
4845
49INT32 a2_cnxx_slot;
5046
5147/* local */
52static int a2_speaker_state;
5348
54static double joystick_x1_time;
55static double joystick_y1_time;
56static double joystick_x2_time;
57static double joystick_y2_time;
5849
5950static WRITE8_HANDLER ( apple2_mainram0400_w );
6051static WRITE8_HANDLER ( apple2_mainram2000_w );
r10150r10151
9081 * New Apple II memory manager
9182 * ----------------------------------------------------------------------- */
9283
93static apple2_memmap_config apple2_mem_config;
94static apple2_meminfo *apple2_current_meminfo;
9584
9685
9786static READ8_HANDLER(read_floatingbus)
r10150r10151
10392
10493void apple2_setup_memory(running_machine *machine, const apple2_memmap_config *config)
10594{
106   apple2_mem_config = *config;
107   apple2_current_meminfo = NULL;
95   apple2_state *state = machine->driver_data<apple2_state>();
96   state->mem_config = *config;
97   state->current_meminfo = NULL;
10898   apple2_update_memory(machine);
10999}
110100
r10150r10151
112102
113103void apple2_update_memory(running_machine *machine)
114104{
105   apple2_state *state = machine->driver_data<apple2_state>();
115106   address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
116107   int i, bank;
117108   char rbank[10], wbank[10];
r10150r10151
126117   int wh_nop = 0;
127118
128119   /* need to build list of current info? */
129   if (!apple2_current_meminfo)
120   if (!state->current_meminfo)
130121   {
131      for (i = 0; apple2_mem_config.memmap[i].end; i++)
122      for (i = 0; state->mem_config.memmap[i].end; i++)
132123         ;
133      apple2_current_meminfo = auto_alloc_array(machine, apple2_meminfo, i);
124      state->current_meminfo = auto_alloc_array(machine, apple2_meminfo, i);
134125      full_update = 1;
135126   }
136127
r10150r10151
141132   slot_ram = (slot_length > 0) ? &rom[rom_length] : NULL;
142133
143134   /* loop through the entire memory map */
144   bank = apple2_mem_config.first_bank;
145   for (i = 0; apple2_mem_config.memmap[i].get_meminfo; i++)
135   bank = state->mem_config.first_bank;
136   for (i = 0; state->mem_config.memmap[i].get_meminfo; i++)
146137   {
147138      /* retrieve information on this entry */
148139      memset(&meminfo, 0, sizeof(meminfo));
149      apple2_mem_config.memmap[i].get_meminfo(machine, apple2_mem_config.memmap[i].begin, apple2_mem_config.memmap[i].end, &meminfo);
140      state->mem_config.memmap[i].get_meminfo(machine, state->mem_config.memmap[i].begin, state->mem_config.memmap[i].end, &meminfo);
150141
151      bank_disposition = apple2_mem_config.memmap[i].bank_disposition;
142      bank_disposition = state->mem_config.memmap[i].bank_disposition;
152143
153144      /* do we need to memory reading? */
154145      if (full_update
155         || (meminfo.read_mem != apple2_current_meminfo[i].read_mem)
156         || (meminfo.read_handler != apple2_current_meminfo[i].read_handler))
146         || (meminfo.read_mem != state->current_meminfo[i].read_mem)
147         || (meminfo.read_handler != state->current_meminfo[i].read_handler))
157148      {
158149         rbase = NULL;
159150         sprintf(rbank,"bank%d",bank);
160         begin = apple2_mem_config.memmap[i].begin;
161         end_r = apple2_mem_config.memmap[i].end;
151         begin = state->mem_config.memmap[i].begin;
152         end_r = state->mem_config.memmap[i].end;
162153         rh = NULL;
163154
164155         LOG(("apple2_update_memory():  Updating RD {%06X..%06X} [#%02d] --> %08X\n",
r10150r10151
178169         else if ((meminfo.read_mem & 0xC0000000) == APPLE2_MEM_AUX)
179170         {
180171            /* auxillary memory */
181            assert(apple2_mem_config.auxmem);
172            assert(state->mem_config.auxmem);
182173            offset = meminfo.read_mem & APPLE2_MEM_MASK;
183            rbase = &apple2_mem_config.auxmem[offset];
174            rbase = &state->mem_config.auxmem[offset];
184175         }
185176         else if ((meminfo.read_mem & 0xC0000000) == APPLE2_MEM_SLOT)
186177         {
r10150r10151
220211         }
221212
222213         /* did we 'go past the end?' */
223         if (end_r < apple2_mem_config.memmap[i].end)
224            memory_nop_read(space, end_r + 1, apple2_mem_config.memmap[i].end, 0, 0);
214         if (end_r < state->mem_config.memmap[i].end)
215            memory_nop_read(space, end_r + 1, state->mem_config.memmap[i].end, 0, 0);
225216
226217         /* set the memory bank */
227218         if (rbase)
r10150r10151
230221         }
231222
232223         /* record the current settings */
233         apple2_current_meminfo[i].read_mem = meminfo.read_mem;
234         apple2_current_meminfo[i].read_handler = meminfo.read_handler;
224         state->current_meminfo[i].read_mem = meminfo.read_mem;
225         state->current_meminfo[i].read_handler = meminfo.read_handler;
235226      }
236227
237228      /* do we need to memory writing? */
238229      if (full_update
239         || (meminfo.write_mem != apple2_current_meminfo[i].write_mem)
240         || (meminfo.write_handler != apple2_current_meminfo[i].write_handler))
230         || (meminfo.write_mem != state->current_meminfo[i].write_mem)
231         || (meminfo.write_handler != state->current_meminfo[i].write_handler))
241232      {
242233         wbase = NULL;
243234         if (bank_disposition == A2MEM_MONO)
244235            sprintf(wbank,"bank%d",bank);
245236         else if (bank_disposition == A2MEM_DUAL)
246237            sprintf(wbank,"bank%d",bank+1);
247         begin = apple2_mem_config.memmap[i].begin;
248         end_w = apple2_mem_config.memmap[i].end;
238         begin = state->mem_config.memmap[i].begin;
239         end_w = state->mem_config.memmap[i].end;
249240         wh = NULL;
250241
251242         LOG(("apple2_update_memory():  Updating WR {%06X..%06X} [#%02d] --> %08X\n",
r10150r10151
260251         else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_AUX)
261252         {
262253            /* auxillary memory */
263            assert(apple2_mem_config.auxmem);
254            assert(state->mem_config.auxmem);
264255            offset = meminfo.write_mem & APPLE2_MEM_MASK;
265            wbase = &apple2_mem_config.auxmem[offset];
256            wbase = &state->mem_config.auxmem[offset];
266257         }
267258         else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_SLOT)
268259         {
r10150r10151
308299         }
309300
310301         /* did we 'go past the end?' */
311         if (end_w < apple2_mem_config.memmap[i].end)
312            memory_nop_write(space, end_w + 1, apple2_mem_config.memmap[i].end, 0, 0);
302         if (end_w < state->mem_config.memmap[i].end)
303            memory_nop_write(space, end_w + 1, state->mem_config.memmap[i].end, 0, 0);
313304
314305         /* set the memory bank */
315306         if (wbase)
r10150r10151
318309         }
319310
320311         /* record the current settings */
321         apple2_current_meminfo[i].write_mem = meminfo.write_mem;
322         apple2_current_meminfo[i].write_handler = meminfo.write_handler;
312         state->current_meminfo[i].write_mem = meminfo.write_mem;
313         state->current_meminfo[i].write_handler = meminfo.write_handler;
323314      }
324315      bank += bank_disposition;
325316   }
r10150r10151
340331
341332READ8_HANDLER(apple2_c0xx_r)
342333{
334   apple2_state *state = space->machine->driver_data<apple2_state>();
343335   if(!space->debugger_access())
344336   {
345337      static const read8_space_func handlers[] =
r10150r10151
361353
362354      if (offset < 0x80)
363355      {
364         if (a2_cnxx_slot != -1)
356         if (state->a2_cnxx_slot != -1)
365357         {
366            a2_cnxx_slot = -1;
358            state->a2_cnxx_slot = -1;
367359            apple2_update_memory(space->machine);
368360         }
369361
r10150r10151
393385
394386WRITE8_HANDLER(apple2_c0xx_w)
395387{
388   apple2_state *state = space->machine->driver_data<apple2_state>();
396389   static const write8_space_func handlers[] =
397390   {
398391      apple2_c00x_w,
r10150r10151
411404
412405   if (offset < 0x80)
413406   {
414      if (a2_cnxx_slot != -1)
407      if (state->a2_cnxx_slot != -1)
415408      {
416         a2_cnxx_slot = -1;
409         state->a2_cnxx_slot = -1;
417410         apple2_update_memory(space->machine);
418411      }
419412
r10150r10151
438431/* returns default CnXX slotram for a slot space */
439432INT8 apple2_slotram_r(running_machine *machine, int slotnum, int offset)
440433{
434   apple2_state *state = machine->driver_data<apple2_state>();
441435   UINT8 *rom, *slot_ram;
442436   UINT32 rom_length, slot_length;
443437
r10150r10151
449443
450444   if (slot_ram)
451445   {
452      if (a2_cnxx_slot == -1)
446      if (state->a2_cnxx_slot == -1)
453447      {
454         a2_cnxx_slot = slotnum;
448         state->a2_cnxx_slot = slotnum;
455449         apple2_update_memory(machine);
456450      }
457451
r10150r10151
464458
465459static READ8_HANDLER( apple2_c1xx_r )
466460{
461   apple2_state *state = space->machine->driver_data<apple2_state>();
467462   int slotnum;
468463   device_t *slotdevice;
469464
470465   slotnum = ((offset>>8) & 0xf) + 1;
471466   slotdevice = apple2_slot(space->machine, slotnum);
472467
473   if (a2_cnxx_slot == -1)
468   if (state->a2_cnxx_slot == -1)
474469   {
475      a2_cnxx_slot = slotnum;
470      state->a2_cnxx_slot = slotnum;
476471      apple2_update_memory(space->machine);
477472   }
478473
r10150r10151
519514
520515static READ8_HANDLER( apple2_c4xx_r )
521516{
517   apple2_state *state = space->machine->driver_data<apple2_state>();
522518   int slotnum;
523519   device_t *slotdevice;
524520
525521   slotnum = ((offset>>8) & 0xf) + 4;
526522   slotdevice = apple2_slot(space->machine, slotnum);
527523
528   if (a2_cnxx_slot == -1)
524   if (state->a2_cnxx_slot == -1)
529525   {
530      a2_cnxx_slot = slotnum;
526      state->a2_cnxx_slot = slotnum;
531527      apple2_update_memory(space->machine);
532528   }
533529
r10150r10151
547543
548544static WRITE8_HANDLER ( apple2_c4xx_w )
549545{
546   apple2_state *state = space->machine->driver_data<apple2_state>();
550547   int slotnum;
551548   device_t *slotdevice;
552549   UINT8 *rom, *slot_ram;
r10150r10151
561558   slotnum = ((offset>>8) & 0xf) + 4;
562559   slotdevice = apple2_slot(space->machine, slotnum);
563560
564   if (a2_cnxx_slot == -1)
561   if (state->a2_cnxx_slot == -1)
565562   {
566      a2_cnxx_slot = slotnum;
563      state->a2_cnxx_slot = slotnum;
567564      apple2_update_memory(space->machine);
568565   }
569566
r10150r10151
580577
581578static READ8_HANDLER(apple2_cfff_r)
582579{
580   apple2_state *state = space->machine->driver_data<apple2_state>();
583581   // debugger guard
584582   if(!space->debugger_access())
585583   {
586      a2_cnxx_slot = -1;
584      state->a2_cnxx_slot = -1;
587585      apple2_update_memory(space->machine);
588586   }
589587
r10150r10151
592590
593591static WRITE8_HANDLER(apple2_cfff_w)
594592{
595   a2_cnxx_slot = -1;
593   apple2_state *state = space->machine->driver_data<apple2_state>();
594   state->a2_cnxx_slot = -1;
596595   apple2_update_memory(space->machine);
597596}
598597
599598static READ8_HANDLER ( apple2_c800_r )
600599{
600   apple2_state *state = space->machine->driver_data<apple2_state>();
601601   device_t *slotdevice;
602602
603   slotdevice = apple2_slot(space->machine, a2_cnxx_slot);
603   slotdevice = apple2_slot(space->machine, state->a2_cnxx_slot);
604604
605605   if (slotdevice != NULL)
606606   {
r10150r10151
612612
613613static WRITE8_HANDLER ( apple2_c800_w )
614614{
615   apple2_state *state = space->machine->driver_data<apple2_state>();
615616   device_t *slotdevice;
616617
617   slotdevice = apple2_slot(space->machine, a2_cnxx_slot);
618   slotdevice = apple2_slot(space->machine, state->a2_cnxx_slot);
618619
619620   if (slotdevice != NULL)
620621   {
r10150r10151
624625
625626static READ8_HANDLER ( apple2_ce00_r )
626627{
628   apple2_state *state = space->machine->driver_data<apple2_state>();
627629   device_t *slotdevice;
628630
629   slotdevice = apple2_slot(space->machine, a2_cnxx_slot);
631   slotdevice = apple2_slot(space->machine, state->a2_cnxx_slot);
630632
631633   if (slotdevice != NULL)
632634   {
r10150r10151
638640
639641static WRITE8_HANDLER ( apple2_ce00_w )
640642{
641      device_t *slotdevice;
643   apple2_state *state = space->machine->driver_data<apple2_state>();
644   device_t *slotdevice;
642645
643   slotdevice = apple2_slot(space->machine, a2_cnxx_slot);
646   slotdevice = apple2_slot(space->machine, state->a2_cnxx_slot);
644647
645648   if (slotdevice != NULL)
646649   {
r10150r10151
650653
651654static void apple2_mem_0000(running_machine *machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
652655{
653   meminfo->read_mem         = (apple2_flags & VAR_ALTZP)   ? 0x010000 : 0x000000;
654   meminfo->write_mem         = (apple2_flags & VAR_ALTZP)   ? 0x010000 : 0x000000;
656   apple2_state *state = machine->driver_data<apple2_state>();
657   meminfo->read_mem         = (state->flags & VAR_ALTZP)   ? 0x010000 : 0x000000;
658   meminfo->write_mem         = (state->flags & VAR_ALTZP)   ? 0x010000 : 0x000000;
655659}
656660
657661static void apple2_mem_0200(running_machine *machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
658662{
659   meminfo->read_mem         = (apple2_flags & VAR_RAMRD)   ? 0x010200 : 0x000200;
660   meminfo->write_mem         = (apple2_flags & VAR_RAMWRT)   ? 0x010200 : 0x000200;
663   apple2_state *state = machine->driver_data<apple2_state>();
664   meminfo->read_mem         = (state->flags & VAR_RAMRD)   ? 0x010200 : 0x000200;
665   meminfo->write_mem         = (state->flags & VAR_RAMWRT)   ? 0x010200 : 0x000200;
661666}
662667
663668static void apple2_mem_0400(running_machine *machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
664669{
665   if (apple2_flags & VAR_80STORE)
670   apple2_state *state = machine->driver_data<apple2_state>();
671   if (state->flags & VAR_80STORE)
666672   {
667      meminfo->read_mem      = (apple2_flags & VAR_PAGE2)   ? 0x010400 : 0x000400;
668      meminfo->write_mem      = (apple2_flags & VAR_PAGE2)   ? 0x010400 : 0x000400;
669      meminfo->write_handler   = (apple2_flags & VAR_PAGE2)   ? apple2_auxram0400_w : apple2_mainram0400_w;
673      meminfo->read_mem      = (state->flags & VAR_PAGE2)   ? 0x010400 : 0x000400;
674      meminfo->write_mem      = (state->flags & VAR_PAGE2)   ? 0x010400 : 0x000400;
675      meminfo->write_handler   = (state->flags & VAR_PAGE2)   ? apple2_auxram0400_w : apple2_mainram0400_w;
670676   }
671677   else
672678   {
673      meminfo->read_mem      = (apple2_flags & VAR_RAMRD)   ? 0x010400 : 0x000400;
674      meminfo->write_mem      = (apple2_flags & VAR_RAMWRT)   ? 0x010400 : 0x000400;
675      meminfo->write_handler   = (apple2_flags & VAR_RAMWRT)   ? apple2_auxram0400_w : apple2_mainram0400_w;
679      meminfo->read_mem      = (state->flags & VAR_RAMRD)   ? 0x010400 : 0x000400;
680      meminfo->write_mem      = (state->flags & VAR_RAMWRT)   ? 0x010400 : 0x000400;
681      meminfo->write_handler   = (state->flags & VAR_RAMWRT)   ? apple2_auxram0400_w : apple2_mainram0400_w;
676682   }
677683}
678684
679685static void apple2_mem_0800(running_machine *machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
680686{
681   meminfo->read_mem         = (apple2_flags & VAR_RAMRD)   ? 0x010800 : 0x000800;
682   meminfo->write_mem         = (apple2_flags & VAR_RAMWRT)   ? 0x010800 : 0x000800;
687   apple2_state *state = machine->driver_data<apple2_state>();
688   meminfo->read_mem         = (state->flags & VAR_RAMRD)   ? 0x010800 : 0x000800;
689   meminfo->write_mem         = (state->flags & VAR_RAMWRT)   ? 0x010800 : 0x000800;
683690}
684691
685692static void apple2_mem_2000(running_machine *machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
686693{
687   if ((apple2_flags & (VAR_80STORE|VAR_HIRES)) == (VAR_80STORE|VAR_HIRES))
694   apple2_state *state = machine->driver_data<apple2_state>();
695   if ((state->flags & (VAR_80STORE|VAR_HIRES)) == (VAR_80STORE|VAR_HIRES))
688696   {
689      meminfo->read_mem      = (apple2_flags & VAR_PAGE2)   ? 0x012000 : 0x002000;
690      meminfo->write_mem      = (apple2_flags & VAR_PAGE2)   ? 0x012000 : 0x002000;
691      meminfo->write_handler   = (apple2_flags & VAR_PAGE2)   ? apple2_auxram2000_w : apple2_mainram2000_w;
697      meminfo->read_mem      = (state->flags & VAR_PAGE2)   ? 0x012000 : 0x002000;
698      meminfo->write_mem      = (state->flags & VAR_PAGE2)   ? 0x012000 : 0x002000;
699      meminfo->write_handler   = (state->flags & VAR_PAGE2)   ? apple2_auxram2000_w : apple2_mainram2000_w;
692700   }
693701   else
694702   {
695      meminfo->read_mem      = (apple2_flags & VAR_RAMRD)   ? 0x012000 : 0x002000;
696      meminfo->write_mem      = (apple2_flags & VAR_RAMWRT)   ? 0x012000 : 0x002000;
697      meminfo->write_handler   = (apple2_flags & VAR_RAMWRT)   ? apple2_auxram2000_w : apple2_mainram2000_w;
703      meminfo->read_mem      = (state->flags & VAR_RAMRD)   ? 0x012000 : 0x002000;
704      meminfo->write_mem      = (state->flags & VAR_RAMWRT)   ? 0x012000 : 0x002000;
705      meminfo->write_handler   = (state->flags & VAR_RAMWRT)   ? apple2_auxram2000_w : apple2_mainram2000_w;
698706   }
699707}
700708
701709static void apple2_mem_4000(running_machine *machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
702710{
703   meminfo->read_mem         = (apple2_flags & VAR_RAMRD)   ? 0x014000 : 0x004000;
704   meminfo->write_mem         = (apple2_flags & VAR_RAMWRT)   ? 0x014000 : 0x004000;
711   apple2_state *state = machine->driver_data<apple2_state>();
712   meminfo->read_mem         = (state->flags & VAR_RAMRD)   ? 0x014000 : 0x004000;
713   meminfo->write_mem         = (state->flags & VAR_RAMWRT)   ? 0x014000 : 0x004000;
705714}
706715
707716static void apple2_mem_C000(running_machine *machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
r10150r10151
718727
719728static void apple2_mem_Cx00(running_machine *machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
720729{
721   if (apple2_flags & VAR_INTCXROM)
730   apple2_state *state = machine->driver_data<apple2_state>();
731   if (state->flags & VAR_INTCXROM)
722732   {
723      meminfo->read_mem      = (begin & 0x0FFF) | (apple2_flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM;
733      meminfo->read_mem      = (begin & 0x0FFF) | (state->flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM;
724734      meminfo->write_mem      = APPLE2_MEM_FLOATING;
725735   }
726736   else
r10150r10151
732742
733743static void apple2_mem_C300(running_machine *machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
734744{
735   if ((apple2_flags & (VAR_INTCXROM|VAR_SLOTC3ROM)) != VAR_SLOTC3ROM)
745   apple2_state *state = machine->driver_data<apple2_state>();
746   if ((state->flags & (VAR_INTCXROM|VAR_SLOTC3ROM)) != VAR_SLOTC3ROM)
736747   {
737      meminfo->read_mem      = (begin & 0x0FFF) | (apple2_flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM;
748      meminfo->read_mem      = (begin & 0x0FFF) | (state->flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM;
738749      meminfo->write_mem      = APPLE2_MEM_FLOATING;
739750   }
740751   else
r10150r10151
746757
747758static void apple2_mem_C800(running_machine *machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
748759{
749   if (a2_cnxx_slot == -1)
760   apple2_state *state = machine->driver_data<apple2_state>();
761   if (state->a2_cnxx_slot == -1)
750762   {
751      meminfo->read_mem         = (begin & 0x0FFF) | (apple2_flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM;
763      meminfo->read_mem         = (begin & 0x0FFF) | (state->flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM;
752764      meminfo->write_mem         = APPLE2_MEM_FLOATING;
753765   }
754766   else
r10150r10151
760772
761773static void apple2_mem_CE00(running_machine *machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
762774{
763   if ((apple2_flags & VAR_ROMSWITCH) && !strcmp(machine->gamedrv->name, "apple2cp"))
775   apple2_state *state = machine->driver_data<apple2_state>();
776   if ((state->flags & VAR_ROMSWITCH) && !strcmp(machine->gamedrv->name, "apple2cp"))
764777   {
765778      meminfo->read_mem      = APPLE2_MEM_AUX;
766779      meminfo->write_mem      = APPLE2_MEM_AUX;
767780   }
768781   else
769782   {
770      if (a2_cnxx_slot == -1)
783      if (state->a2_cnxx_slot == -1)
771784      {
772         meminfo->read_mem      = (begin & 0x0FFF) | (apple2_flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM;
785         meminfo->read_mem      = (begin & 0x0FFF) | (state->flags & VAR_ROMSWITCH ? 0x4000 : 0x0000) | APPLE2_MEM_ROM;
773786         meminfo->write_mem      = APPLE2_MEM_FLOATING;
774787      }
775788      else
r10150r10151
782795
783796static void apple2_mem_D000(running_machine *machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
784797{
785   if (apple2_flags & VAR_LCRAM)
798   apple2_state *state = machine->driver_data<apple2_state>();
799   if (state->flags & VAR_LCRAM)
786800   {
787      if (apple2_flags & VAR_LCRAM2)
788         meminfo->read_mem   = (apple2_flags & VAR_ALTZP)   ? 0x01C000 : 0x00C000;
801      if (state->flags & VAR_LCRAM2)
802         meminfo->read_mem   = (state->flags & VAR_ALTZP)   ? 0x01C000 : 0x00C000;
789803      else
790         meminfo->read_mem   = (apple2_flags & VAR_ALTZP)   ? 0x01D000 : 0x00D000;
804         meminfo->read_mem   = (state->flags & VAR_ALTZP)   ? 0x01D000 : 0x00D000;
791805   }
792806   else
793807   {
794      meminfo->read_mem      = (apple2_flags & VAR_ROMSWITCH) ? 0x005000 : 0x001000;
808      meminfo->read_mem      = (state->flags & VAR_ROMSWITCH) ? 0x005000 : 0x001000;
795809      meminfo->read_mem      |= APPLE2_MEM_ROM;
796810   }
797811
798   if (apple2_flags & VAR_LCWRITE)
812   if (state->flags & VAR_LCWRITE)
799813   {
800      if (apple2_flags & VAR_LCRAM2)
801         meminfo->write_mem   = (apple2_flags & VAR_ALTZP)   ? 0x01C000 : 0x00C000;
814      if (state->flags & VAR_LCRAM2)
815         meminfo->write_mem   = (state->flags & VAR_ALTZP)   ? 0x01C000 : 0x00C000;
802816      else
803         meminfo->write_mem   = (apple2_flags & VAR_ALTZP)   ? 0x01D000 : 0x00D000;
817         meminfo->write_mem   = (state->flags & VAR_ALTZP)   ? 0x01D000 : 0x00D000;
804818   }
805819   else
806820   {
r10150r10151
810824
811825static void apple2_mem_E000(running_machine *machine, offs_t begin, offs_t end, apple2_meminfo *meminfo)
812826{
813   if (apple2_flags & VAR_LCRAM)
827   apple2_state *state = machine->driver_data<apple2_state>();
828   if (state->flags & VAR_LCRAM)
814829   {
815      meminfo->read_mem      = (apple2_flags & VAR_ALTZP)   ? 0x01E000 : 0x00E000;
830      meminfo->read_mem      = (state->flags & VAR_ALTZP)   ? 0x01E000 : 0x00E000;
816831   }
817832   else
818833   {
819      meminfo->read_mem      = (apple2_flags & VAR_ROMSWITCH) ? 0x006000 : 0x002000;
834      meminfo->read_mem      = (state->flags & VAR_ROMSWITCH) ? 0x006000 : 0x002000;
820835      meminfo->read_mem      |= APPLE2_MEM_ROM;
821836   }
822837
823   if (apple2_flags & VAR_LCWRITE)
838   if (state->flags & VAR_LCWRITE)
824839   {
825      meminfo->write_mem      = (apple2_flags & VAR_ALTZP)   ? 0x01E000 : 0x00E000;
840      meminfo->write_mem      = (state->flags & VAR_ALTZP)   ? 0x01E000 : 0x00E000;
826841   }
827842   else
828843   {
r10150r10151
856871
857872void apple2_setvar(running_machine *machine, UINT32 val, UINT32 mask)
858873{
874   apple2_state *state = machine->driver_data<apple2_state>();
859875   LOG(("apple2_setvar(): val=0x%06x mask=0x%06x pc=0x%04x\n", val, mask,
860876               (unsigned int) cpu_get_reg(machine->device("maincpu"), STATE_GENPC)));
861877
862878   assert((val & mask) == val);
863879
864880   /* apply mask and set */
865   val &= a2_mask;
866   val |= a2_set;
881   val &= state->a2_mask;
882   val |= state->a2_set;
867883
868884   /* change the softswitch */
869   apple2_flags &= ~mask;
870   apple2_flags |= val;
885   state->flags &= ~mask;
886   state->flags |= val;
871887
872888   apple2_update_memory(machine);
873889}
r10150r10151
883899
884900UINT8 apple2_getfloatingbusvalue(running_machine *machine)
885901{
902   apple2_state *state = machine->driver_data<apple2_state>();
886903   enum
887904   {
888905      // scanner types
r10150r10151
920937
921938   // machine state switches
922939   //
923   Hires    = (apple2_flags & VAR_HIRES) ? 1 : 0;
924   Mixed    = (apple2_flags & VAR_MIXED) ? 1 : 0;
925   Page2    = (apple2_flags & VAR_PAGE2) ? 1 : 0;
926   _80Store = (apple2_flags & VAR_80STORE) ? 1 : 0;
940   Hires    = (state->flags & VAR_HIRES) ? 1 : 0;
941   Mixed    = (state->flags & VAR_MIXED) ? 1 : 0;
942   Page2    = (state->flags & VAR_PAGE2) ? 1 : 0;
943   _80Store = (state->flags & VAR_80STORE) ? 1 : 0;
927944
928945   // calculate video parameters according to display standard
929946   //
r10150r10151
10291046
10301047static void apple2_reset(running_machine &machine)
10311048{
1049   apple2_state *state = machine.driver_data<apple2_state>();
10321050   int need_intcxrom;
10331051
10341052   need_intcxrom = !strcmp(machine.gamedrv->name, "apple2c")
r10150r10151
10461064      apple2_setvar(&machine, VAR_LCWRITE|VAR_LCRAM2, VAR_LCWRITE | VAR_LCRAM | VAR_LCRAM2);
10471065   }
10481066
1049   a2_speaker_state = 0;
1067   state->a2_speaker_state = 0;
10501068
1051   joystick_x1_time = joystick_y1_time = 0;
1052   joystick_x2_time = joystick_y2_time = 0;
1069   state->joystick_x1_time = state->joystick_y1_time = 0;
1070   state->joystick_x2_time = state->joystick_y2_time = 0;
10531071}
10541072
10551073
r10150r10151
11291147   {
11301148      /* Read the keyboard data and strobe */
11311149      g_profiler.start(PROFILER_C00X);
1132      result = AY3600_keydata_strobe_r();
1150      result = AY3600_keydata_strobe_r(space->machine);
11331151      g_profiler.stop();
11341152   }
11351153
r10150r10151
11741192
11751193READ8_HANDLER ( apple2_c01x_r )
11761194{
1195   apple2_state *state = space->machine->driver_data<apple2_state>();
11771196   UINT8 result = apple2_getfloatingbusvalue(space->machine) & 0x7F;
11781197
11791198   if(!space->debugger_access())
r10150r10151
11831202      LOG(("a2 softswitch_r: %04x\n", offset + 0xc010));
11841203      switch (offset)
11851204      {
1186         case 0x00:         result |= AY3600_anykey_clearstrobe_r();      break;
1187         case 0x01:         result |= (apple2_flags & VAR_LCRAM2)      ? 0x80 : 0x00;   break;
1188         case 0x02:         result |= (apple2_flags & VAR_LCRAM)      ? 0x80 : 0x00;   break;
1189         case 0x03:         result |= (apple2_flags & VAR_RAMRD)      ? 0x80 : 0x00;   break;
1190         case 0x04:         result |= (apple2_flags & VAR_RAMWRT)      ? 0x80 : 0x00;   break;
1191         case 0x05:         result |= (apple2_flags & VAR_INTCXROM)   ? 0x80 : 0x00;   break;
1192         case 0x06:         result |= (apple2_flags & VAR_ALTZP)      ? 0x80 : 0x00;   break;
1193         case 0x07:         result |= (apple2_flags & VAR_SLOTC3ROM)   ? 0x80 : 0x00;   break;
1194         case 0x08:         result |= (apple2_flags & VAR_80STORE)   ? 0x80 : 0x00;   break;
1205         case 0x00:         result |= AY3600_anykey_clearstrobe_r(space->machine);      break;
1206         case 0x01:         result |= (state->flags & VAR_LCRAM2)      ? 0x80 : 0x00;   break;
1207         case 0x02:         result |= (state->flags & VAR_LCRAM)      ? 0x80 : 0x00;   break;
1208         case 0x03:         result |= (state->flags & VAR_RAMRD)      ? 0x80 : 0x00;   break;
1209         case 0x04:         result |= (state->flags & VAR_RAMWRT)      ? 0x80 : 0x00;   break;
1210         case 0x05:         result |= (state->flags & VAR_INTCXROM)   ? 0x80 : 0x00;   break;
1211         case 0x06:         result |= (state->flags & VAR_ALTZP)      ? 0x80 : 0x00;   break;
1212         case 0x07:         result |= (state->flags & VAR_SLOTC3ROM)   ? 0x80 : 0x00;   break;
1213         case 0x08:         result |= (state->flags & VAR_80STORE)   ? 0x80 : 0x00;   break;
11951214         case 0x09:         result |= !space->machine->primary_screen->vblank()      ? 0x80 : 0x00;   break;
1196         case 0x0A:         result |= (apple2_flags & VAR_TEXT)      ? 0x80 : 0x00;   break;
1197         case 0x0B:         result |= (apple2_flags & VAR_MIXED)      ? 0x80 : 0x00;   break;
1198         case 0x0C:         result |= (apple2_flags & VAR_PAGE2)      ? 0x80 : 0x00;   break;
1199         case 0x0D:         result |= (apple2_flags & VAR_HIRES)      ? 0x80 : 0x00;   break;
1200         case 0x0E:         result |= (apple2_flags & VAR_ALTCHARSET)   ? 0x80 : 0x00;   break;
1201         case 0x0F:         result |= (apple2_flags & VAR_80COL)      ? 0x80 : 0x00;   break;
1215         case 0x0A:         result |= (state->flags & VAR_TEXT)      ? 0x80 : 0x00;   break;
1216         case 0x0B:         result |= (state->flags & VAR_MIXED)      ? 0x80 : 0x00;   break;
1217         case 0x0C:         result |= (state->flags & VAR_PAGE2)      ? 0x80 : 0x00;   break;
1218         case 0x0D:         result |= (state->flags & VAR_HIRES)      ? 0x80 : 0x00;   break;
1219         case 0x0E:         result |= (state->flags & VAR_ALTCHARSET)   ? 0x80 : 0x00;   break;
1220         case 0x0F:         result |= (state->flags & VAR_80COL)      ? 0x80 : 0x00;   break;
12021221      }
12031222
12041223      g_profiler.stop();
r10150r10151
12171236{
12181237   /* Clear the keyboard strobe - ignore the returned results */
12191238   g_profiler.start(PROFILER_C01X);
1220   AY3600_anykey_clearstrobe_r();
1239   AY3600_anykey_clearstrobe_r(space->machine);
12211240   g_profiler.stop();
12221241}
12231242
r10150r10151
12441263
12451264WRITE8_HANDLER( apple2_c02x_w )
12461265{
1266   apple2_state *state = space->machine->driver_data<apple2_state>();
12471267   switch(offset)
12481268   {
12491269      case 0x08:
1250         apple2_setvar(space->machine, (apple2_flags & VAR_ROMSWITCH) ^ VAR_ROMSWITCH, VAR_ROMSWITCH);
1270         apple2_setvar(space->machine, (state->flags & VAR_ROMSWITCH) ^ VAR_ROMSWITCH, VAR_ROMSWITCH);
12511271         break;
12521272   }
12531273}
r10150r10151
12601280
12611281READ8_HANDLER ( apple2_c03x_r )
12621282{
1283   apple2_state *state = space->machine->driver_data<apple2_state>();
12631284   if(!space->debugger_access())
12641285   {
12651286      if (!offset)
12661287      {
12671288         device_t *speaker_device = space->machine->device("a2speaker");
12681289
1269         if (a2_speaker_state == 1)
1290         if (state->a2_speaker_state == 1)
12701291         {
1271            a2_speaker_state = 0;
1292            state->a2_speaker_state = 0;
12721293         }
12731294         else
12741295         {
1275            a2_speaker_state = 1;
1296            state->a2_speaker_state = 1;
12761297         }
1277         speaker_level_w(speaker_device, a2_speaker_state);
1298         speaker_level_w(speaker_device, state->a2_speaker_state);
12781299      }
12791300   }
12801301   return apple2_getfloatingbusvalue(space->machine);
r10150r10151
13391360
13401361READ8_HANDLER ( apple2_c06x_r )
13411362{
1363   apple2_state *state = space->machine->driver_data<apple2_state>();
13421364   int result = 0;
13431365   if(!space->debugger_access())
13441366   {
r10150r10151
13621384            break;
13631385         case 0x04:
13641386            /* X Joystick 1 axis */
1365            result = attotime_to_double(timer_get_time(space->machine)) < joystick_x1_time;
1387            result = attotime_to_double(timer_get_time(space->machine)) < state->joystick_x1_time;
13661388            break;
13671389         case 0x05:
13681390            /* Y Joystick 1 axis */
1369            result = attotime_to_double(timer_get_time(space->machine)) < joystick_y1_time;
1391            result = attotime_to_double(timer_get_time(space->machine)) < state->joystick_y1_time;
13701392            break;
13711393         case 0x06:
13721394            /* X Joystick 2 axis */
1373            result = attotime_to_double(timer_get_time(space->machine)) < joystick_x2_time;
1395            result = attotime_to_double(timer_get_time(space->machine)) < state->joystick_x2_time;
13741396            break;
13751397         case 0x07:
13761398            /* Y Joystick 2 axis */
1377            result = attotime_to_double(timer_get_time(space->machine)) < joystick_y2_time;
1399            result = attotime_to_double(timer_get_time(space->machine)) < state->joystick_y2_time;
13781400            break;
13791401         default:
13801402            /* c060 Empty Cassette head read
r10150r10151
13941416
13951417READ8_HANDLER ( apple2_c07x_r )
13961418{
1419   apple2_state *state = space->machine->driver_data<apple2_state>();
13971420   if(!space->debugger_access())
13981421   {
13991422      double x_calibration = attotime_to_double(ATTOTIME_IN_USEC(12));
r10150r10151
14011424
14021425      if (offset == 0)
14031426      {
1404         joystick_x1_time = attotime_to_double(timer_get_time(space->machine)) + x_calibration * input_port_read(space->machine, "joystick_1_x");
1405         joystick_y1_time = attotime_to_double(timer_get_time(space->machine)) + y_calibration * input_port_read(space->machine, "joystick_1_y");
1406         joystick_x2_time = attotime_to_double(timer_get_time(space->machine)) + x_calibration * input_port_read(space->machine, "joystick_2_x");
1407         joystick_y2_time = attotime_to_double(timer_get_time(space->machine)) + y_calibration * input_port_read(space->machine, "joystick_2_y");
1427         state->joystick_x1_time = attotime_to_double(timer_get_time(space->machine)) + x_calibration * input_port_read(space->machine, "joystick_1_x");
1428         state->joystick_y1_time = attotime_to_double(timer_get_time(space->machine)) + y_calibration * input_port_read(space->machine, "joystick_1_y");
1429         state->joystick_x2_time = attotime_to_double(timer_get_time(space->machine)) + x_calibration * input_port_read(space->machine, "joystick_2_x");
1430         state->joystick_y2_time = attotime_to_double(timer_get_time(space->machine)) + y_calibration * input_port_read(space->machine, "joystick_2_y");
14081431      }
14091432   }
14101433   return 0;
r10150r10151
14271450 * Floppy disk controller
14281451 * ----------------------------------------------------------------------- */
14291452
1430static int apple2_fdc_diskreg;
14311453
14321454static int apple2_fdc_has_35(running_machine *machine)
14331455{
r10150r10151
14411463
14421464static void apple2_fdc_set_lines(device_t *device, UINT8 lines)
14431465{
1444   if (apple2_fdc_diskreg & 0x40)
1466   apple2_state *state = device->machine->driver_data<apple2_state>();
1467   if (state->fdc_diskreg & 0x40)
14451468   {
14461469      if (apple2_fdc_has_35(device->machine))
14471470      {
r10150r10151
14631486
14641487static void apple2_fdc_set_enable_lines(device_t *device,int enable_mask)
14651488{
1489   apple2_state *state = device->machine->driver_data<apple2_state>();
14661490   int slot5_enable_mask = 0;
14671491   int slot6_enable_mask = 0;
14681492
1469   if (apple2_fdc_diskreg & 0x40)
1493   if (state->fdc_diskreg & 0x40)
14701494      slot5_enable_mask = enable_mask;
14711495   else
14721496      slot6_enable_mask = enable_mask;
r10150r10151
14881512
14891513static UINT8 apple2_fdc_read_data(device_t *device)
14901514{
1515   apple2_state *state = device->machine->driver_data<apple2_state>();
14911516   UINT8 result = 0x00;
14921517
1493   if (apple2_fdc_diskreg & 0x40)
1518   if (state->fdc_diskreg & 0x40)
14941519   {
14951520      if (apple2_fdc_has_35(device->machine))
14961521      {
r10150r10151
15131538
15141539static void apple2_fdc_write_data(device_t *device, UINT8 data)
15151540{
1516   if (apple2_fdc_diskreg & 0x40)
1541   apple2_state *state = device->machine->driver_data<apple2_state>();
1542   if (state->fdc_diskreg & 0x40)
15171543   {
15181544      if (apple2_fdc_has_35(device->machine))
15191545      {
r10150r10151
15351561
15361562static int apple2_fdc_read_status(device_t *device)
15371563{
1564   apple2_state *state = device->machine->driver_data<apple2_state>();
15381565   int result = 0;
15391566
1540   if (apple2_fdc_diskreg & 0x40)
1567   if (state->fdc_diskreg & 0x40)
15411568   {
15421569      if (apple2_fdc_has_35(device->machine))
15431570      {
r10150r10151
15601587
15611588void apple2_iwm_setdiskreg(running_machine *machine, UINT8 data)
15621589{
1563   apple2_fdc_diskreg = data & 0xC0;
1590   apple2_state *state = machine->driver_data<apple2_state>();
1591   state->fdc_diskreg = data & 0xC0;
15641592   if (apple2_fdc_has_35(machine))
1565      sony_set_sel_line( machine->device("fdc"),apple2_fdc_diskreg & 0x80);
1593      sony_set_sel_line( machine->device("fdc"),state->fdc_diskreg & 0x80);
15661594}
15671595
15681596
15691597
1570UINT8 apple2_iwm_getdiskreg(void)
1598UINT8 apple2_iwm_getdiskreg(running_machine *machine)
15711599{
1572   return apple2_fdc_diskreg;
1600   apple2_state *state = machine->driver_data<apple2_state>();
1601   return state->fdc_diskreg;
15731602}
15741603
15751604
r10150r10151
15931622
15941623void apple2_init_common(running_machine *machine)
15951624{
1596   apple2_flags = 0;
1597   apple2_fdc_diskreg = 0;
1625   apple2_state *state = machine->driver_data<apple2_state>();
1626   state->flags = 0;
1627   state->fdc_diskreg = 0;
15981628
15991629   AY3600_init(machine);
16001630   machine->add_notifier(MACHINE_NOTIFY_RESET, apple2_reset);
16011631
16021632   /* state save registers */
1603   state_save_register_global(machine, apple2_flags);
1633   state_save_register_global(machine, state->flags);
16041634   state_save_register_postload(machine, apple2_update_memory_postload, NULL);
16051635
16061636   /* --------------------------------------------- *
16071637     * set up the softswitch mask/set                *
16081638     * --------------------------------------------- */
1609   a2_mask = ~0;
1610   a2_set = 0;
1639   state->a2_mask = ~0;
1640   state->a2_set = 0;
16111641
16121642   /* disable VAR_ROMSWITCH if the ROM is only 16k */
16131643   if (machine->region("maincpu")->bytes() < 0x8000)
1614      a2_mask &= ~VAR_ROMSWITCH;
1644      state->a2_mask &= ~VAR_ROMSWITCH;
16151645
16161646   if (ram_get_size(machine->device(RAM_TAG)) <= 64*1024)
1617      a2_mask &= ~(VAR_RAMRD | VAR_RAMWRT | VAR_80STORE | VAR_ALTZP | VAR_80COL);
1647      state->a2_mask &= ~(VAR_RAMRD | VAR_RAMWRT | VAR_80STORE | VAR_ALTZP | VAR_80COL);
16181648}
16191649
16201650
src/mess/video/apple2.c
r10150r10151
1111
1212/***************************************************************************/
1313
14static const UINT8 *a2_videoram;
15static UINT32 a2_videomask;
16static UINT32 old_a2;
17static int fgcolor, bgcolor, flash;
18static int alt_charset_value;
19static UINT16 *hires_artifact_map;
20static UINT16 *dhires_artifact_map;
2114
2215#define   BLACK   0
2316#define DKRED   1
r10150r10151
4841    register
4942-------------------------------------------------*/
5043
51INLINE UINT32 effective_a2(void)
44INLINE UINT32 effective_a2(apple2_state *state)
5245{
53   return apple2_flags & a2_videomask;
46   return state->flags & state->a2_videomask;
5447}
5548
5649
r10150r10151
9689    textual character
9790-------------------------------------------------*/
9891
99INLINE void apple2_plot_text_character(bitmap_t *bitmap, int xpos, int ypos, int xscale, UINT32 code,
92INLINE void apple2_plot_text_character(running_machine *machine, bitmap_t *bitmap, int xpos, int ypos, int xscale, UINT32 code,
10093   const UINT8 *textgfx_data, UINT32 textgfx_datalen, UINT32 my_a2)
10194{
95   apple2_state *state = machine->driver_data<apple2_state>();
10296   int x, y, i;
103   int fg = fgcolor;
104   int bg = bgcolor;
97   int fg = state->fgcolor;
98   int bg = state->bgcolor;
10599   const UINT8 *chardata;
106100   UINT16 color;
107101
108102   if (my_a2 & VAR_ALTCHARSET)
109103   {
110104      /* we're using an alternate charset */
111      code |= alt_charset_value;
105      code |= state->alt_charset_value;
112106   }
113   else if (flash && (code >= 0x40) && (code <= 0x7f))
107   else if (state->flash && (code >= 0x40) && (code <= 0x7f))
114108   {
115109      /* we're flashing; swap */
116110      i = fg;
r10150r10151
145139
146140static void apple2_text_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow)
147141{
142   apple2_state *state = machine->driver_data<apple2_state>();
148143   int row, col;
149144   UINT32 start_address = (page ? 0x0800 : 0x0400);
150145   UINT32 address;
151146   const UINT8 *textgfx_data = machine->region("gfx1")->base();
152147   UINT32 textgfx_datalen = machine->region("gfx1")->bytes();
153   UINT32 my_a2 = effective_a2();
148   UINT32 my_a2 = effective_a2(state);
154149
155150   /* perform adjustments */
156151   adjust_begin_and_end_row(cliprect, &beginrow, &endrow);
r10150r10151
164159
165160         if (my_a2 & VAR_80COL)
166161         {
167            apple2_plot_text_character(bitmap, col * 14 + 0, row, 1, a2_videoram[address + 0x10000],
162            apple2_plot_text_character(machine, bitmap, col * 14 + 0, row, 1, state->a2_videoram[address + 0x10000],
168163               textgfx_data, textgfx_datalen, my_a2);
169            apple2_plot_text_character(bitmap, col * 14 + 7, row, 1, a2_videoram[address + 0x00000],
164            apple2_plot_text_character(machine, bitmap, col * 14 + 7, row, 1, state->a2_videoram[address + 0x00000],
170165               textgfx_data, textgfx_datalen, my_a2);
171166         }
172167         else
173168         {
174            apple2_plot_text_character(bitmap, col * 14, row, 2, a2_videoram[address],
169            apple2_plot_text_character(machine, bitmap, col * 14, row, 2, state->a2_videoram[address],
175170               textgfx_data, textgfx_datalen, my_a2);
176171         }
177172      }
r10150r10151
185180
186181static void apple2_lores_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow)
187182{
183   apple2_state *state = machine->driver_data<apple2_state>();
188184   int row, col, y, x;
189185   UINT8 code;
190186   UINT32 start_address = (page ? 0x0800 : 0x0400);
r10150r10151
201197         address = start_address + compute_video_address(col, row / 8);
202198
203199         /* perform the lookup */
204         code = a2_videoram[address];
200         code = state->a2_videoram[address];
205201
206202         /* and now draw */
207203         for (y = 0; y < 4; y++)
r10150r10151
219215}
220216
221217
222/*-------------------------------------------------
223    apple2_set_fgcolor
224-------------------------------------------------*/
225
226void apple2_set_fgcolor(int color)
227{
228   fgcolor = color;
229}
230
231
232/*-------------------------------------------------
233    apple2_set_bgcolor
234-------------------------------------------------*/
235
236void apple2_set_bgcolor(int color)
237{
238   bgcolor = color;
239}
240
241
242/*-------------------------------------------------
243    apple2_get_fgcolor
244-------------------------------------------------*/
245
246int apple2_get_fgcolor(void)
247{
248   return fgcolor;
249}
250
251
252/*-------------------------------------------------
253    apple2_get_bgcolor
254-------------------------------------------------*/
255
256int apple2_get_bgcolor(void)
257{
258   return bgcolor;
259}
260
261
262
263218/***************************************************************************
264219    HIGH RESOLUTION GRAPHICS
265220***************************************************************************/
266221
267222static void apple2_hires_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow)
268223{
224   apple2_state *state = machine->driver_data<apple2_state>();
269225   const UINT8 *vram;
270226   int row, col, b;
271227   int offset;
r10150r10151
284240   if (endrow < beginrow)
285241      return;
286242
287   vram      = a2_videoram + (page ? 0x4000 : 0x2000);
288   columns      = ((effective_a2() & (VAR_DHIRES|VAR_80COL)) == (VAR_DHIRES|VAR_80COL)) ? 80 : 40;
243   vram      = state->a2_videoram + (page ? 0x4000 : 0x2000);
244   columns      = ((effective_a2(state) & (VAR_DHIRES|VAR_80COL)) == (VAR_DHIRES|VAR_80COL)) ? 80 : 40;
289245
290246   vram_row[0] = 0;
291247   vram_row[columns + 1] = 0;
r10150r10151
324280         switch(columns)
325281         {
326282            case 40:
327               artifact_map_ptr = &hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16];
283               artifact_map_ptr = &state->hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16];
328284               for (b = 0; b < 7; b++)
329285               {
330286                  v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)];
r10150r10151
336292            case 80:
337293               for (b = 0; b < 7; b++)
338294               {
339                  v = dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F];
295                  v = state->dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F];
340296                  *(p++) = v;
341297               }
342298               break;
r10150r10151
357313
358314void apple2_video_start(running_machine *machine, const UINT8 *vram, size_t vram_size, UINT32 ignored_softswitches, int hires_modulo)
359315{
316   apple2_state *state = machine->driver_data<apple2_state>();
360317   int i, j;
361318   UINT16 c;
362319   UINT8 *apple2_font;
r10150r10151
375332      PURPLE,      LTBLUE,      PINK,   WHITE
376333   };
377334
378   fgcolor = 15;
379   bgcolor = 0;
380   flash = 0;
335   state->fgcolor = 15;
336   state->bgcolor = 0;
337   state->flash = 0;
381338   apple2_font = machine->region("gfx1")->base();
382   alt_charset_value = machine->region("gfx1")->bytes() / 16;
383   a2_videoram = vram;
339   state->alt_charset_value = machine->region("gfx1")->bytes() / 16;
340   state->a2_videoram = vram;
384341
385342   /* 2^3 dependent pixels * 2 color sets * 2 offsets */
386   hires_artifact_map = auto_alloc_array(machine, UINT16, 8 * 2 * 2);
343   state->hires_artifact_map = auto_alloc_array(machine, UINT16, 8 * 2 * 2);
387344
388345   /* 2^4 dependent pixels */
389   dhires_artifact_map = auto_alloc_array(machine, UINT16, 16);
346   state->dhires_artifact_map = auto_alloc_array(machine, UINT16, 16);
390347
391348   /* build hires artifact map */
392349   for (i = 0; i < 8; i++)
r10150r10151
407364            else
408365               c = 0;
409366         }
410         hires_artifact_map[ 0 + j*8 + i] = hires_artifact_color_table[(c + 0) % hires_modulo];
411         hires_artifact_map[16 + j*8 + i] = hires_artifact_color_table[(c + 4) % hires_modulo];
367         state->hires_artifact_map[ 0 + j*8 + i] = hires_artifact_color_table[(c + 0) % hires_modulo];
368         state->hires_artifact_map[16 + j*8 + i] = hires_artifact_color_table[(c + 4) % hires_modulo];
412369      }
413370   }
414371
r10150r10151
440397   /* build double hires artifact map */
441398   for (i = 0; i < 16; i++)
442399   {
443      dhires_artifact_map[i] = dhires_artifact_color_table[i];
400      state->dhires_artifact_map[i] = dhires_artifact_color_table[i];
444401   }
445402
446   memset(&old_a2, 0, sizeof(old_a2));
447   a2_videomask = ~ignored_softswitches;
403   memset(&state->old_a2, 0, sizeof(state->old_a2));
404   state->a2_videomask = ~ignored_softswitches;
448405}
449406
450407
451408
452409VIDEO_START( apple2 )
453410{
411   apple2_state *state = machine->driver_data<apple2_state>();
454412   apple2_video_start(machine, ram_get_ptr(machine->device(RAM_TAG)), ram_get_size(machine->device(RAM_TAG)), VAR_80COL | VAR_ALTCHARSET | VAR_DHIRES, 4);
455413
456414   /* hack to fix the colors on apple2/apple2p */
457   fgcolor = 0;
458   bgcolor = 15;
415   state->fgcolor = 0;
416   state->bgcolor = 15;
459417}
460418
461419
462420VIDEO_START( apple2p )
463421{
422   apple2_state *state = machine->driver_data<apple2_state>();
464423   apple2_video_start(machine, ram_get_ptr(machine->device(RAM_TAG)), ram_get_size(machine->device(RAM_TAG)), VAR_80COL | VAR_ALTCHARSET | VAR_DHIRES, 8);
465424
466425   /* hack to fix the colors on apple2/apple2p */
467   fgcolor = 0;
468   bgcolor = 15;
426   state->fgcolor = 0;
427   state->bgcolor = 15;
469428}
470429
471430
r10150r10151
477436
478437VIDEO_UPDATE( apple2 )
479438{
439   apple2_state *state = screen->machine->driver_data<apple2_state>();
480440   int page;
481441   UINT32 new_a2;
482442   running_machine *machine = screen->machine;
483443
484   /* calculate the flash value */
485   flash = (attotime_mul(timer_get_time(screen->machine), 4).seconds & 1) ? 1 : 0;
444   /* calculate the state->flash value */
445   state->flash = (attotime_mul(timer_get_time(screen->machine), 4).seconds & 1) ? 1 : 0;
486446
487447   /* read out relevant softswitch variables; to see what has changed */
488   new_a2 = effective_a2();
448   new_a2 = effective_a2(state);
489449   if (new_a2 & VAR_80STORE)
490450      new_a2 &= ~VAR_PAGE2;
491451   new_a2 &= VAR_TEXT | VAR_MIXED | VAR_HIRES | VAR_DHIRES | VAR_80COL | VAR_PAGE2 | VAR_ALTCHARSET;
492452
493   if (ALWAYS_REFRESH || (new_a2 != old_a2))
453   if (ALWAYS_REFRESH || (new_a2 != state->old_a2))
494454   {
495      old_a2 = new_a2;
455      state->old_a2 = new_a2;
496456   }
497457
498458   /* choose which page to use */
499459   page = (new_a2 & VAR_PAGE2) ? 1 : 0;
500460
501461   /* choose the video mode to draw */
502   if (effective_a2() & VAR_TEXT)
462   if (effective_a2(state) & VAR_TEXT)
503463   {
504464      /* text screen */
505465      apple2_text_draw(machine, bitmap, cliprect, page, 0, 191);
506466   }
507   else if ((effective_a2() & VAR_HIRES) && (effective_a2() & VAR_MIXED))
467   else if ((effective_a2(state) & VAR_HIRES) && (effective_a2(state) & VAR_MIXED))
508468   {
509469      /* hi-res on top; text at bottom */
510470      apple2_hires_draw(machine, bitmap, cliprect, page, 0, 159);
511471      apple2_text_draw(machine, bitmap, cliprect, page, 160, 191);
512472   }
513   else if (effective_a2() & VAR_HIRES)
473   else if (effective_a2(state) & VAR_HIRES)
514474   {
515475      /* hi-res screen */
516476      apple2_hires_draw(machine, bitmap, cliprect, page, 0, 191);
517477   }
518   else if (effective_a2() & VAR_MIXED)
478   else if (effective_a2(state) & VAR_MIXED)
519479   {
520480      /* lo-res on top; text at bottom */
521481      apple2_lores_draw(machine, bitmap, cliprect, page, 0, 159);
src/mess/includes/apple2gs.h
r10150r10151
99#ifndef APPLE2GS_H_
1010#define APPLE2GS_H_
1111
12#include "includes/apple2.h"
1213
1314// IIgs clocks as marked on the schematics
1415#define APPLE2GS_28M  (XTAL_28_63636MHz) // IIGS master clock
r10150r10151
3940} adbstate_t;
4041
4142
42class apple2gs_state : public driver_device
43class apple2gs_state : public apple2_state
4344{
4445public:
4546   apple2gs_state(running_machine &machine, const driver_device_config_base &config)
46      : driver_device(machine, config) { }
47      : apple2_state(machine, config) { }
4748
4849   UINT8 *slowmem;
4950   UINT8 newvideo;
src/mess/includes/apple3.h
r10150r10151
99#ifndef APPLE3_H_
1010#define APPLE3_H_
1111
12#include "includes/apple2.h"
1213#include "machine/applefdc.h"
1314#include "machine/6522via.h"
1415
r10150r10151
2223#define VAR_EXTSIDE      0x0080
2324
2425
25class apple3_state : public driver_device
26class apple3_state : public apple2_state
2627{
2728public:
2829   apple3_state(running_machine &machine, const driver_device_config_base &config)
29      : driver_device(machine, config) { }
30      : apple2_state(machine, config) { }
3031
3132   UINT32 flags;
3233   UINT8 via_0_a;
src/mess/includes/apple2.h
r10150r10151
102102};
103103
104104
105class apple2_state : public driver_device
106{
107public:
108   apple2_state(running_machine &machine, const driver_device_config_base &config)
109      : driver_device(machine, config) { }
110
111   UINT32 flags;
112   INT32 a2_cnxx_slot;
113   UINT32 a2_mask;
114   UINT32 a2_set;
115   int a2_speaker_state;
116   double joystick_x1_time;
117   double joystick_y1_time;
118   double joystick_x2_time;
119   double joystick_y2_time;
120   apple2_memmap_config mem_config;
121   apple2_meminfo *current_meminfo;
122   int fdc_diskreg;
123   unsigned int *ay3600_keys;
124   //UINT8 keycode;
125   UINT8 keycode_unmodified;
126   //UINT8 keywaiting;
127   UINT8 keystilldown;
128   UINT8 keymodreg;
129   int reset_flag;
130   int last_key;
131   int last_key_unmodified;
132   unsigned int time_until_repeat;
133   const UINT8 *a2_videoram;
134   UINT32 a2_videomask;
135   UINT32 old_a2;
136   int fgcolor;
137   int bgcolor;
138   int flash;
139   int alt_charset_value;
140   UINT16 *hires_artifact_map;
141   UINT16 *dhires_artifact_map;
142};
143
144
105145/*----------- defined in drivers/apple2.c -----------*/
106146
107147INPUT_PORTS_EXTERN( apple2ep );
r10150r10151
110150
111151/*----------- defined in machine/apple2.c -----------*/
112152
113extern UINT32 apple2_flags;
114extern INT32 a2_cnxx_slot;
115
116153extern const applefdc_interface apple2_fdc_interface;
117154
118155void apple2_iwm_setdiskreg(running_machine *machine, UINT8 data);
119UINT8 apple2_iwm_getdiskreg(void);
156UINT8 apple2_iwm_getdiskreg(running_machine *machine);
120157
121158void apple2_init_common(running_machine *machine);
122159MACHINE_START( apple2 );
r10150r10151
144181VIDEO_START( apple2p );
145182VIDEO_START( apple2e );
146183VIDEO_UPDATE( apple2 );
147void apple2_set_fgcolor(int color);
148void apple2_set_bgcolor(int color);
149int apple2_get_fgcolor(void);
150int apple2_get_bgcolor(void);
151184
152185#endif /* APPLE2_H_ */
src/mess/drivers/pc88va.c
r10150r10151
6868   /* floppy state */
6969   UINT8 i8255_0_pc;
7070   UINT8 i8255_1_pc;
71   UINT8 fdc_mode;
72   UINT8 fdc_irq_opcode;
7173};
7274
73static UINT8 fdc_mode,fdc_irq_opcode;
7475
7576
7677static VIDEO_START( pc88va )
r10150r10151
957958
958959static WRITE8_HANDLER( pc88va_fdc_w )
959960{
961   pc88va_state *state = space->machine->driver_data<pc88va_state>();
960962   switch(offset*2)
961963   {
962964      /*
963965      ---- ---x MODE: FDC op mode (0) Intelligent (1) DMA
964966      */
965967      case 0x00: // FDC mode register
966         fdc_mode = data & 1;
967         cputag_set_input_line(space->machine, "fdccpu", INPUT_LINE_HALT, (fdc_mode) ? ASSERT_LINE : CLEAR_LINE);
968         state->fdc_mode = data & 1;
969         cputag_set_input_line(space->machine, "fdccpu", INPUT_LINE_HALT, (state->fdc_mode) ? ASSERT_LINE : CLEAR_LINE);
968970         break;
969971      /*
970972      --x- ---- CLK: FDC clock selection (0) 4.8MHz (1) 8 MHz
r10150r10151
11451147
11461148static WRITE8_HANDLER( fdc_irq_vector_w )
11471149{
1148   fdc_irq_opcode = data;
1150   pc88va_state *state = space->machine->driver_data<pc88va_state>();
1151   state->fdc_irq_opcode = data;
11491152}
11501153
11511154static ADDRESS_MAP_START( pc88va_z80_io_map, ADDRESS_SPACE_IO, 8 )
r10150r10151
15331536
15341537   state->tsp.tvram_vreg_offset = 0;
15351538
1536   fdc_mode = 0;
1537   fdc_irq_opcode = 0x00; //0x7f ld a,a !
1539   state->fdc_mode = 0;
1540   state->fdc_irq_opcode = 0x00; //0x7f ld a,a !
15381541
15391542   cpu_set_input_line_vector(machine->device("fdccpu"), 0, 0);
15401543}
r10150r10151
15901593
15911594static WRITE_LINE_DEVICE_HANDLER(pc88va_upd765_interrupt)
15921595{
1593   if(fdc_mode)
1596   pc88va_state *drvstate = device->machine->driver_data<pc88va_state>();
1597   if(drvstate->fdc_mode)
15941598      pic8259_ir3_w(device->machine->device( "pic8259_slave"), state);
15951599   else
15961600      cputag_set_input_line(device->machine, "fdccpu", 0, HOLD_LINE);
src/mess/drivers/glasgow.c
r10150r10151
5353#include "sound/beep.h"
5454#include "machine/mboard.h"
5555
56static UINT8 lcd_shift_counter;
57static UINT8 led7;
58static UINT8 irq_flag;
59static UINT16 beeper;
6056
57class glasgow_state : public driver_device
58{
59public:
60   glasgow_state(running_machine &machine, const driver_device_config_base &config)
61      : driver_device(machine, config) { }
62
63   UINT8 lcd_shift_counter;
64   UINT8 led7;
65   UINT8 irq_flag;
66   UINT16 beeper;
67};
68
69
70
6171static WRITE16_HANDLER( glasgow_lcd_w )
6272{
73   glasgow_state *state = space->machine->driver_data<glasgow_state>();
6374   UINT8 lcd_data = data >> 8;
6475
65   if (led7 == 0)
66      output_set_digit_value(lcd_shift_counter, lcd_data);
76   if (state->led7 == 0)
77      output_set_digit_value(state->lcd_shift_counter, lcd_data);
6778
68   lcd_shift_counter--;
69   lcd_shift_counter &= 3;
79   state->lcd_shift_counter--;
80   state->lcd_shift_counter &= 3;
7081}
7182
7283static WRITE16_HANDLER( glasgow_lcd_flag_w )
7384{
85   glasgow_state *state = space->machine->driver_data<glasgow_state>();
7486   device_t *speaker = space->machine->device("beep");
7587   UINT16 lcd_flag = data & 0x8100;
7688
7789   beep_set_state(speaker, (lcd_flag & 0x100) ? 1 : 0);
7890
7991   if (lcd_flag)
80      led7 = 255;
92      state->led7 = 255;
8193   else
8294   {
83      led7 = 0;
95      state->led7 = 0;
8496      mboard_key_selector = 1;
8597   }
8698}
r10150r10151
108120
109121static WRITE16_HANDLER( write_lcd )
110122{
123   glasgow_state *state = space->machine->driver_data<glasgow_state>();
111124   UINT8 lcd_data = data >> 8;
112125
113   output_set_digit_value(lcd_shift_counter, mboard_lcd_invert & 1 ? lcd_data^0xff : lcd_data);
114   lcd_shift_counter--;
115   lcd_shift_counter &= 3;
126   output_set_digit_value(state->lcd_shift_counter, mboard_lcd_invert & 1 ? lcd_data^0xff : lcd_data);
127   state->lcd_shift_counter--;
128   state->lcd_shift_counter &= 3;
116129   logerror("LCD Offset = %d Data low = %x \n", offset, lcd_data);
117130}
118131
119132static WRITE16_HANDLER( write_lcd_flag )
120133{
134   glasgow_state *state = space->machine->driver_data<glasgow_state>();
121135   UINT8 lcd_flag;
122136   mboard_lcd_invert = 0;
123137   lcd_flag=data >> 8;
r10150r10151
128142 // The key function in the rom expects after writing to
129143 // the  a value from the second key row;
130144   if (lcd_flag != 0)
131      led7 = 255;
145      state->led7 = 255;
132146   else
133      led7 = 0;
147      state->led7 = 0;
134148
135149   logerror("LCD Flag 16 = %x \n", data);
136150}
137151
138152static WRITE16_HANDLER( write_irq_flag )
139153{
154   glasgow_state *state = space->machine->driver_data<glasgow_state>();
140155   device_t *speaker = space->machine->device("beep");
141156
142157   beep_set_state(speaker, data & 0x100);
143158   logerror("Write 0x800004 = %x \n", data);
144   irq_flag = 1;
145   beeper = data;
159   state->irq_flag = 1;
160   state->beeper = data;
146161}
147162
148163static READ16_HANDLER( read_newkeys16 )  //Amsterdam, Roma
r10150r10151
176191
177192static WRITE32_HANDLER( write_lcd32 )
178193{
194   glasgow_state *state = space->machine->driver_data<glasgow_state>();
179195   UINT8 lcd_data = data >> 8;
180196
181   output_set_digit_value(lcd_shift_counter, mboard_lcd_invert & 1 ? lcd_data^0xff : lcd_data);
182   lcd_shift_counter--;
183   lcd_shift_counter &= 3;
197   output_set_digit_value(state->lcd_shift_counter, mboard_lcd_invert & 1 ? lcd_data^0xff : lcd_data);
198   state->lcd_shift_counter--;
199   state->lcd_shift_counter &= 3;
184200   //logerror("LCD Offset = %d Data   = %x \n  ", offset, lcd_data);
185201}
186202
187203static WRITE32_HANDLER( write_lcd_flag32 )
188204{
205   glasgow_state *state = space->machine->driver_data<glasgow_state>();
189206   UINT8 lcd_flag = data >> 24;
190207
191208   mboard_lcd_invert = 0;
r10150r10151
197214   //beep_set_state(0, lcd_flag & 1 ? 1 : 0);
198215
199216   if (lcd_flag != 0)
200      led7 = 255;
217      state->led7 = 255;
201218   else
202      led7 = 0;
219      state->led7 = 0;
203220}
204221
205222static READ32_HANDLER( read_newkeys32 ) // Dallas 32, Roma 32
r10150r10151
227244
228245static WRITE32_HANDLER ( write_beeper32 )
229246{
247   glasgow_state *state = space->machine->driver_data<glasgow_state>();
230248   device_t *speaker = space->machine->device("beep");
231249   beep_set_state(speaker, data & 0x01000000);
232250   logerror("Write 0x8000004 = %x \n", data);
233   irq_flag = 1;
234   beeper = data;
251   state->irq_flag = 1;
252   state->beeper = data;
235253}
236254
237255static TIMER_CALLBACK( update_nmi )
r10150r10151
252270
253271static MACHINE_START( glasgow )
254272{
273   glasgow_state *state = machine->driver_data<glasgow_state>();
255274   device_t *speaker = machine->device("beep");
256275
257276   mboard_key_selector = 0;
258   irq_flag = 0;
259   lcd_shift_counter = 3;
277   state->irq_flag = 0;
278   state->lcd_shift_counter = 3;
260279   timer_pulse(machine, ATTOTIME_IN_HZ(50), NULL, 0, update_nmi);
261280   timer_pulse(machine, ATTOTIME_IN_HZ(100), NULL, 0, mboard_update_artwork);
262281   beep_set_frequency(speaker, 44);
r10150r10151
267286
268287static MACHINE_START( dallas32 )
269288{
289   glasgow_state *state = machine->driver_data<glasgow_state>();
270290   device_t *speaker = machine->device("beep");
271291
272   lcd_shift_counter = 3;
292   state->lcd_shift_counter = 3;
273293   timer_pulse(machine, ATTOTIME_IN_HZ(50), NULL, 0, update_nmi32);
274294   timer_pulse(machine, ATTOTIME_IN_HZ(100), NULL, 0, mboard_update_artwork);
275295   beep_set_frequency(speaker, 44);
r10150r10151
280300
281301static MACHINE_RESET( glasgow )
282302{
283   lcd_shift_counter = 3;
303   glasgow_state *state = machine->driver_data<glasgow_state>();
304   state->lcd_shift_counter = 3;
284305
285306   mboard_set_border_pieces();
286307   mboard_set_board();
r10150r10151
479500   PORT_INCLUDE( board )
480501INPUT_PORTS_END
481502
482static MACHINE_CONFIG_START( glasgow, driver_device )
503static MACHINE_CONFIG_START( glasgow, glasgow_state )
483504   /* basic machine hardware */
484505   MCFG_CPU_ADD("maincpu", M68000, 12000000)
485506   MCFG_CPU_PROGRAM_MAP(glasgow_mem)
src/mess/drivers/mephisto.c
r10150r10151
6161
6262#include "machine/mboard.h"
6363
64static UINT8 lcd_shift_counter;
65static UINT8 led_status;
66static UINT8 *mephisto_ram;
67static UINT8 led7;
6864
65class mephisto_state : public driver_device
66{
67public:
68   mephisto_state(running_machine &machine, const driver_device_config_base &config)
69      : driver_device(machine, config) { }
70
71   UINT8 lcd_shift_counter;
72   UINT8 led_status;
73   UINT8 *ram;
74   UINT8 led7;
75};
76
77
78
6979static WRITE8_HANDLER ( write_lcd )
7080{
71   if (led7==0)output_set_digit_value(lcd_shift_counter,data);    // 0x109 MM IV // 0x040 MM V
81   mephisto_state *state = space->machine->driver_data<mephisto_state>();
82   if (state->led7==0)output_set_digit_value(state->lcd_shift_counter,data);   // 0x109 MM IV // 0x040 MM V
7283
73   //output_set_digit_value(lcd_shift_counter,data ^ mephisto_ram[0x165]);    // 0x109 MM IV // 0x040 MM V
74   lcd_shift_counter--;
75   lcd_shift_counter&=3;
84   //output_set_digit_value(state->lcd_shift_counter,data ^ state->ram[0x165]);   // 0x109 MM IV // 0x040 MM V
85   state->lcd_shift_counter--;
86   state->lcd_shift_counter&=3;
7687}
7788
7889static READ8_HANDLER(read_keys)
7990{
91   mephisto_state *state = space->machine->driver_data<mephisto_state>();
8092   UINT8 data;
8193   static const char *const keynames[2][8] =
8294         {
r10150r10151
8597         };
8698
8799   data = 0xff;
88   if (((led_status & 0x80) == 0x00))
100   if (((state->led_status & 0x80) == 0x00))
89101      data=input_port_read(space->machine, keynames[0][offset]);
90102   else
91103      data=input_port_read(space->machine, keynames[1][offset]);
92104
93   logerror("Keyboard Port = %s Data = %d\n  ", ((led_status & 0x80) == 0x00) ? keynames[0][offset] : keynames[1][offset], data);
105   logerror("Keyboard Port = %s Data = %d\n  ", ((state->led_status & 0x80) == 0x00) ? keynames[0][offset] : keynames[1][offset], data);
94106   return data | 0x7f;
95107}
96108
97109static WRITE8_HANDLER ( write_led )
98110{
111   mephisto_state *state = space->machine->driver_data<mephisto_state>();
99112   UINT8 LED_offset=100;
100113   data &= 0x80;
101114
102   if (data==0)led_status &= 255-(1<<offset) ; else led_status|=1<<offset;
103   if (offset<6)output_set_led_value(LED_offset+offset, led_status&1<<offset?1:0);
104   if (offset==7) led7=data& 0x80 ? 0x00 :0xff;
115   if (data==0)state->led_status &= 255-(1<<offset) ; else state->led_status|=1<<offset;
116   if (offset<6)output_set_led_value(LED_offset+offset, state->led_status&1<<offset?1:0);
117   if (offset==7) state->led7=data& 0x80 ? 0x00 :0xff;
105118   logerror("LEDs  Offset = %d Data = %d\n",offset,data);
106119}
107120
108121static WRITE8_HANDLER ( write_led_mm2 )
109122{
123   mephisto_state *state = space->machine->driver_data<mephisto_state>();
110124
111125   UINT8 LED_offset=100;
112126   data &= 0x80;
113127
114128   if (data==0)
115      led_status &= 255-(1<<offset);
129      state->led_status &= 255-(1<<offset);
116130   else
117      led_status|=1<<offset;
131      state->led_status|=1<<offset;
118132
119133   if (offset<6)
120      output_set_led_value(LED_offset+offset, led_status&1<<offset?1:0);
134      output_set_led_value(LED_offset+offset, state->led_status&1<<offset?1:0);
121135
122136   if (offset==7)
123       led7= data & 0x80 ? 0xff :0x00;   //MM2
137      state->led7= data & 0x80 ? 0xff :0x00;   //MM2
124138
125139}
126140
127141static ADDRESS_MAP_START(rebel5_mem , ADDRESS_SPACE_PROGRAM, 8)
128   AM_RANGE( 0x0000, 0x1fff) AM_RAM                  // AM_BASE(&mephisto_ram)//
142   AM_RANGE( 0x0000, 0x1fff) AM_RAM                  // AM_BASE_MEMBER(mephisto_state, ram)//
129143   AM_RANGE( 0x5000, 0x5000) AM_WRITE( write_lcd )
130144   AM_RANGE( 0x3000, 0x3007) AM_READ( read_keys )         // Rebel 5.0
131145   AM_RANGE( 0x2000, 0x2007) AM_WRITE( write_led )         // Status LEDs+ buzzer
r10150r10151
137151
138152
139153static ADDRESS_MAP_START(mephisto_mem , ADDRESS_SPACE_PROGRAM, 8)
140   AM_RANGE( 0x0000, 0x1fff) AM_RAM AM_BASE(&mephisto_ram )//
154   AM_RANGE( 0x0000, 0x1fff) AM_RAM AM_BASE_MEMBER(mephisto_state, ram )//
141155   AM_RANGE( 0x2000, 0x2000) AM_WRITE( write_lcd )
142156   AM_RANGE( 0x2c00, 0x2c07) AM_READ( read_keys )
143157   AM_RANGE( 0x3400, 0x3407) AM_WRITE( write_led )         // Status LEDs+ buzzer
r10150r10151
150164ADDRESS_MAP_END
151165
152166static ADDRESS_MAP_START(mm2_mem , ADDRESS_SPACE_PROGRAM, 8)
153   AM_RANGE( 0x0000, 0x0fff) AM_RAM AM_BASE(&mephisto_ram )
167   AM_RANGE( 0x0000, 0x0fff) AM_RAM AM_BASE_MEMBER(mephisto_state, ram )
154168   AM_RANGE( 0x2800, 0x2800) AM_WRITE( write_lcd )
155169   AM_RANGE( 0x1800, 0x1807) AM_READ( read_keys )
156170   AM_RANGE( 0x1000, 0x1007) AM_WRITE( write_led_mm2 )      //Status LEDs
r10150r10151
304318
305319static TIMER_CALLBACK( update_nmi )
306320{
321   mephisto_state *state = machine->driver_data<mephisto_state>();
307322   device_t *speaker = machine->device("beep");
308323   cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI,PULSE_LINE);
309   // dac_data_w(0,led_status&64?128:0);
310   beep_set_state(speaker,led_status&64?1:0);
324   // dac_data_w(0,state->led_status&64?128:0);
325   beep_set_state(speaker,state->led_status&64?1:0);
311326}
312327
313328static TIMER_CALLBACK( update_irq )      //only mm2
314329{
330   mephisto_state *state = machine->driver_data<mephisto_state>();
315331   device_t *speaker = machine->device("beep");
316332
317333   cputag_set_input_line(machine, "maincpu", M6502_IRQ_LINE, ASSERT_LINE);
318334   cputag_set_input_line(machine, "maincpu", M6502_IRQ_LINE, CLEAR_LINE);
319335
320   beep_set_state(speaker,led_status&64?1:0);
336   beep_set_state(speaker,state->led_status&64?1:0);
321337}
322338static MACHINE_START( mephisto )
323339{
324   lcd_shift_counter=3;
340   mephisto_state *state = machine->driver_data<mephisto_state>();
341   state->lcd_shift_counter=3;
325342
326343   timer_pulse(machine, ATTOTIME_IN_HZ(600), NULL, 0, update_nmi);
327344   timer_pulse(machine, ATTOTIME_IN_HZ(100), NULL, 0, mboard_update_artwork);
r10150r10151
331348
332349static MACHINE_START( mm2 )
333350{
334   lcd_shift_counter=3;
335   led7=0xff;
351   mephisto_state *state = machine->driver_data<mephisto_state>();
352   state->lcd_shift_counter=3;
353   state->led7=0xff;
336354
337355   timer_pulse(machine, ATTOTIME_IN_HZ(450), NULL, 0, update_irq);
338356   timer_pulse(machine, ATTOTIME_IN_HZ(100), NULL, 0, mboard_update_artwork);
r10150r10151
343361
344362static MACHINE_RESET( mephisto )
345363{
346   lcd_shift_counter = 3;
364   mephisto_state *state = machine->driver_data<mephisto_state>();
365   state->lcd_shift_counter = 3;
347366
348367   mboard_set_border_pieces();
349368   mboard_set_board();
r10150r10151
363382}
364383
365384
366static MACHINE_CONFIG_START( mephisto, driver_device )
385static MACHINE_CONFIG_START( mephisto, mephisto_state )
367386   /* basic machine hardware */
368   MCFG_CPU_ADD("maincpu",M65C02,4915200)        /* 65C02 */
387   MCFG_CPU_ADD("maincpu",M65C02,4915200)   /* 65C02 */
369388   MCFG_CPU_PROGRAM_MAP(mephisto_mem)
370389   MCFG_QUANTUM_TIME(HZ(60))
371390   MCFG_MACHINE_START( mephisto )
r10150r10151
434453
435454static DRIVER_INIT( mephisto )
436455{
437   lcd_shift_counter = 3;
456   mephisto_state *state = machine->driver_data<mephisto_state>();
457   state->lcd_shift_counter = 3;
438458}
439459
440460/***************************************************************************
src/mess/drivers/apple2.c
r10150r10151
603603   NULL
604604};
605605
606static MACHINE_CONFIG_START( apple2_common, driver_device )
606static MACHINE_CONFIG_START( apple2_common, apple2_state )
607607   /* basic machine hardware */
608608   MCFG_CPU_ADD("maincpu", M6502, 1021800)      /* close to actual CPU frequency of 1.020484 MHz */
609609   MCFG_CPU_PROGRAM_MAP(apple2_map)
src/mess/drivers/polgar.c
r10150r10151
4444#include "machine/mboard.h"
4545#include "rendlay.h"
4646
47
48class polgar_state : public driver_device
49{
50public:
51   polgar_state(running_machine &machine, const driver_device_config_base &config)
52      : driver_device(machine, config) { }
53
54   UINT8 led_status;
55   UINT8 lcd_char;
56   UINT8 led7;
57   UINT8 latch_data;
58};
59
60
4761//static UINT8 lcd_shift_counter;
48static UINT8 led_status;
49static UINT8 lcd_char=0;
5062// static UINT8 *milano_ram;
51static UINT8 led7;
5263
5364static const int value[4] = {0x80,0x81,0x00,0x01};
5465
55static UINT8 latch_data;
5666
5767static const hd44780_interface polgar_display =
5868{
59    2,                  // number of lines
60    16,                 // chars for line
61    NULL                // custom display layout
69   2,   // number of lines
70   16,   // chars for line
71   NULL   // custom display layout
6272};
6373
6474
6575static WRITE8_HANDLER ( write_io )
6676{
67int i;
68 hd44780_device * hd44780 = space->machine->device<hd44780_device>("hd44780");
69 device_t *speaker = space->machine->device("beep");
77   polgar_state *state = space->machine->driver_data<polgar_state>();
78   int i;
79   hd44780_device * hd44780 = space->machine->device<hd44780_device>("hd44780");
80   device_t *speaker = space->machine->device("beep");
7081
71if (BIT(data,1)) {
72   if (BIT(data,0)) {
73      hd44780->data_write(128, lcd_char);
74   } else {
75      hd44780->control_write(128, lcd_char);
82   if (BIT(data,1)) {
83      if (BIT(data,0)) {
84         hd44780->data_write(128, state->lcd_char);
85      } else {
86         hd44780->control_write(128, state->lcd_char);
87      }
7688   }
77}
7889
79if (BIT(data,2) || BIT(data,3)) beep_set_state(speaker,1); else beep_set_state(speaker,0);
90   if (BIT(data,2) || BIT(data,3)) beep_set_state(speaker,1); else beep_set_state(speaker,0);
8091
81if (BIT(data,7) && BIT(data, 4))
92   if (BIT(data,7) && BIT(data, 4))
8293   {
8394      for (i=0;i<8;i++)
84      output_set_led_value(i,!BIT(latch_data,i));
95      output_set_led_value(i,!BIT(state->latch_data,i));
8596   }
86if (BIT(data,6) && BIT(data,5))
97   if (BIT(data,6) && BIT(data,5))
8798   {
8899      for (i=0;i<8;i++)
89      output_set_led_value(10+i,!BIT(latch_data,7-i));
100      output_set_led_value(10+i,!BIT(state->latch_data,7-i));
90101   }
91102
92103   //logerror("LCD Status  Data = %d\n",data);
r10150r10151
96107
97108static WRITE8_HANDLER ( write_lcd )
98109{
110   polgar_state *state = space->machine->driver_data<polgar_state>();
99111
100  lcd_char=data;
112   state->lcd_char=data;
101113
102 //logerror("LCD Data = %d [%c]\n",data,(data&0xff));
114   //logerror("LCD Data = %d [%c]\n",data,(data&0xff));
103115
104116}
105117
106118
107119static WRITE8_HANDLER ( write_board )
108120{
109  latch_data=data;
121   polgar_state *state = space->machine->driver_data<polgar_state>();
122   state->latch_data=data;
110123}
111124
112125
113126static WRITE8_HANDLER ( milano_write_led )
114127{
115128   UINT8 LED_offset=100;
116if (data==0xff) output_set_led_value(LED_offset+offset,1);
129   if (data==0xff)
130      output_set_led_value(LED_offset+offset,1);
117131   else
118132      output_set_led_value(LED_offset+offset,0);
119133
r10150r10151
122136
123137static WRITE8_HANDLER ( write_led )
124138{
139   polgar_state *state = space->machine->driver_data<polgar_state>();
125140   UINT8 LED_offset=100;
126141   data &= 0x80;
127142
128   if (data==0)led_status &= 255-(1<<offset) ; else led_status|=1<<offset;
129   if (offset<6)output_set_led_value(LED_offset+offset, led_status&1<<offset?1:0);
130   if (offset==7) led7=data& 0x80 ? 0x00 :0xff;
143   if (data==0)state->led_status &= 255-(1<<offset) ; else state->led_status|=1<<offset;
144   if (offset<6)output_set_led_value(LED_offset+offset, state->led_status&1<<offset?1:0);
145   if (offset==7) state->led7=data& 0x80 ? 0x00 :0xff;
131146   logerror("LEDs  Offset = %d Data = %d\n",offset,data);
132147}
133148
134/*static WRITE8_HANDLER ( write_led )
149#if 0
150static WRITE8_HANDLER ( write_led )
135151{
152   polgar_state *state = space->machine->driver_data<polgar_state>();
136153   UINT8 LED_offset=100;
137if (data==0xff) output_set_led_value(LED_offset+offset,1);
154   if (data==0xff)
155      output_set_led_value(LED_offset+offset,1);
138156   else
139157      output_set_led_value(LED_offset+offset,0);
140   if (data==0)led_status &= 255-(1<<offset) ; else led_status|=1<<offset;
141   if (offset<6)output_set_led_value(LED_offset+offset, led_status&1<<offset?1:0);
142    if (offset==7) led7=data& 0x80 ? 0x00 :0xff;
158   if (data==0)state->led_status &= 255-(1<<offset) ; else state->led_status|=1<<offset;
159   if (offset<6)output_set_led_value(LED_offset+offset, state->led_status&1<<offset?1:0);
160   if (offset==7) state->led7=data& 0x80 ? 0x00 :0xff;
143161
144162
145163   logerror("LEDs  Offset = %d Data = %d\n",offset,data);
146164}
147*/
165#endif
166
148167static READ8_HANDLER(read_board)
149168{
150169   UINT8 data;
151  data=input_port_read(space->machine, "KEY1_8");
152  logerror("Keydata  Data = %d\n  ",data);
153return data;
170   data=input_port_read(space->machine, "KEY1_8");
171   logerror("Keydata  Data = %d\n  ",data);
172   return data;
154173}
155174
156175static READ8_HANDLER(read_keys)
157176{
177   //polgar_state *state = space->machine->driver_data<polgar_state>();
158178   UINT8 data;
159179   static const char *const keynames[2][8] =
160180         {
r10150r10151
163183         };
164184
165185   data = 0xff;
166/*
167   if (((led_status & 0x80) == 0x00))
186#if 0
187   if (((state->led_status & 0x80) == 0x00))
168188      data=input_port_read(space->machine, keynames[0][offset]);
169189   else
170190      data=input_port_read(space->machine, keynames[1][offset]);
171*/
172  data=input_port_read(space->machine, keynames[0][offset]);
173   // logerror("Keyboard Port = %s Data = %d\n  ", ((led_status & 0x80) == 0x00) ? keynames[0][offset] : keynames[1][offset], data);
191#endif
192   data=input_port_read(space->machine, keynames[0][offset]);
193   // logerror("Keyboard Port = %s Data = %d\n  ", ((state->led_status & 0x80) == 0x00) ? keynames[0][offset] : keynames[1][offset], data);
174194   return data | 0x7f;
175195}
176196
r10150r10151
183203
184204static VIDEO_UPDATE( polgar )
185205{
186    hd44780_device * hd44780 = screen->machine->device<hd44780_device>("hd44780");
187    return hd44780->video_update( bitmap, cliprect );
206   hd44780_device * hd44780 = screen->machine->device<hd44780_device>("hd44780");
207   return hd44780->video_update( bitmap, cliprect );
188208}
189209
190210static PALETTE_INIT( polgar )
191211{
192//    palette_set_color(machine, 0, MAKE_RGB(138, 146, 148));
212   //palette_set_color(machine, 0, MAKE_RGB(138, 146, 148));
193213   palette_set_color(machine, 0, MAKE_RGB(195, 201, 200));
194  palette_set_color(machine, 1, MAKE_RGB(40, 30, 30));
214   palette_set_color(machine, 1, MAKE_RGB(40, 30, 30));
195215}
196216
197217
198218static const gfx_layout polgar_charlayout =
199219{
200    5, 8,                   /* 5 x 8 characters */
201    256,                    /* 256 characters */
202    1,                      /* 1 bits per pixel */
203    { 0 },                  /* no bitplanes */
204    { 3, 4, 5, 6, 7},
205    { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8},
206    8*8                     /* 8 bytes */
220   5, 8,   /* 5 x 8 characters */
221   256,   /* 256 characters */
222   1,   /* 1 bits per pixel */
223   { 0 },   /* no bitplanes */
224   { 3, 4, 5, 6, 7},
225   { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8},
226   8*8   /* 8 bytes */
207227};
208228
209229static GFXDECODE_START( polgar )
210    GFXDECODE_ENTRY( "hd44780", 0x0000, polgar_charlayout, 0, 1 )
230   GFXDECODE_ENTRY( "hd44780", 0x0000, polgar_charlayout, 0, 1 )
211231GFXDECODE_END
212232
213233
r10150r10151
219239   AM_RANGE( 0x3400, 0x3405) AM_WRITE( write_led)   // Function LEDs 3400 TRN 3401
220240   AM_RANGE( 0x2c00, 0x2c07) AM_READ( read_keys)   // CL Key
221241   AM_RANGE( 0x2004, 0x2004) AM_WRITE( write_io)   // LCD Instr. Reg + Beeper
222   AM_RANGE( 0x2000, 0x2000) AM_WRITE( write_lcd)           // LCD Char Reg.
242   AM_RANGE( 0x2000, 0x2000) AM_WRITE( write_lcd)   // LCD Char Reg.
223243    AM_RANGE( 0x4000, 0xffff) AM_ROM
224244ADDRESS_MAP_END
225245
r10150r10151
360380
361381static TIMER_CALLBACK( update_nmi )
362382{
363   // device_t *speaker = machine->device("beep");
383   //polgar_state *state = machine->driver_data<polgar_state>();
384   // running_device *speaker = machine->device("beep");
364385   cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI,PULSE_LINE);
365386   // cputag_set_input_line(machine, "maincpu", M6502_IRQ_LINE, CLEAR_LINE);
366   // dac_data_w(0,led_status&64?128:0);
367   // beep_set_state(speaker,led_status&64?1:0);
387   // dac_data_w(0,state->led_status&64?128:0);
388   // beep_set_state(speaker,state->led_status&64?1:0);
368389}
369390
370391
r10150r10151
385406}
386407
387408
388static MACHINE_CONFIG_START( polgar, driver_device )
409static MACHINE_CONFIG_START( polgar, polgar_state )
389410   /* basic machine hardware */
390   MCFG_CPU_ADD("maincpu",M65C02,4915200)        /* 65C02 */
411   MCFG_CPU_ADD("maincpu",M65C02,4915200)   /* 65C02 */
391412   MCFG_CPU_PROGRAM_MAP(polgar_mem)
392413   MCFG_QUANTUM_TIME(HZ(60))
393414   MCFG_MACHINE_START( polgar )
394415   MCFG_MACHINE_RESET( polgar )
395416
396417   /* video hardware */
397  // MCFG_DEFAULT_LAYOUT(layout_milano)
398  MCFG_SCREEN_ADD("screen", LCD)
418   // MCFG_DEFAULT_LAYOUT(layout_milano)
419   MCFG_SCREEN_ADD("screen", LCD)
399420   MCFG_SCREEN_REFRESH_RATE(50)
400421   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
401422   MCFG_SCREEN_SIZE(100, 20)
r10150r10151
407428
408429   MCFG_HD44780_ADD("hd44780", polgar_display)
409430
410    MCFG_VIDEO_START(polgar)
411    MCFG_VIDEO_UPDATE(polgar)
431   MCFG_VIDEO_START(polgar)
432   MCFG_VIDEO_UPDATE(polgar)
412433
413434
414//   MCFG_DEFAULT_LAYOUT(layout_van16)
415    MCFG_DEFAULT_LAYOUT(layout_lcd)
435   //MCFG_DEFAULT_LAYOUT(layout_van16)
436   MCFG_DEFAULT_LAYOUT(layout_lcd)
416437
417438
418439   /* sound hardware */
r10150r10151
423444
424445static MACHINE_CONFIG_DERIVED( milano, polgar )
425446   /* basic machine hardware */
426  // MCFG_IMPORT_FROM( polgar )
447   // MCFG_IMPORT_FROM( polgar )
427448   MCFG_CPU_MODIFY("maincpu")
428449   MCFG_CPU_PROGRAM_MAP(milano_mem)
429450   //beep_set_frequency(0, 4000);
r10150r10151
433454   ROM_REGION(0x10000,"maincpu",0)
434455   ROM_LOAD("milano.bin", 0x0000, 0x10000, CRC(0e9c8fe1) SHA1(e9176f42d86fe57e382185c703c7eff7e63ca711))
435456   ROM_REGION( 0x0860, "hd44780", ROMREGION_ERASE )
436   ROM_LOAD( "44780a00.bin",    0x0000, 0x0860,  BAD_DUMP CRC(3a89024c) SHA1(5a87b68422a916d1b37b5be1f7ad0b3fb3af5a8d))
457   ROM_LOAD( "44780a00.bin", 0x0000, 0x0860,  BAD_DUMP CRC(3a89024c) SHA1(5a87b68422a916d1b37b5be1f7ad0b3fb3af5a8d))
437458ROM_END
438459
439460
r10150r10151
442463   ROM_REGION(0x10000,"maincpu",0)
443464   ROM_LOAD("polgar.bin", 0x0000, 0x10000, CRC(88d55c0f) SHA1(e86d088ec3ac68deaf90f6b3b97e3e31b1515913))
444465   ROM_REGION( 0x0860, "hd44780", ROMREGION_ERASE )
445   ROM_LOAD( "44780a00.bin",    0x0000, 0x0860,  BAD_DUMP CRC(3a89024c) SHA1(5a87b68422a916d1b37b5be1f7ad0b3fb3af5a8d))
466   ROM_LOAD( "44780a00.bin", 0x0000, 0x0860,  BAD_DUMP CRC(3a89024c) SHA1(5a87b68422a916d1b37b5be1f7ad0b3fb3af5a8d))
446467ROM_END
447468
448469
449470static DRIVER_INIT( polgar )
450471{
451led_status=0;
472   polgar_state *state = machine->driver_data<polgar_state>();
473   state->led_status=0;
452474}
453475
454476/***************************************************************************
docs/messnew.txt
r10150r10151
7070- softlists: Added new lists, new dumps and info [anondumper, Barry Rodewald,
7171  Curt Coder, MESSfan, Fabio Priuli]
7272
73- Cleanups; static qualifiers.  [Atari Ace]
73- Cleanups; static qualifiers, added driver_states.  [Atari Ace]
7474
7575
7676

Previous 15994 Revisions Next


© 1998-2018 The MESS Team