Previous 15994 Revisions Next

r1981 Thursday 13th March, 2008 at 11:49:23 UTC by Dirk Best
Machine -> machine updates [Anonymous]
[src/emu]ui.c
[src/mess]image.c image.h inputx.c inputx.h mess.c messopts.c messopts.h uimess.c uimess.h
[src/mess/drivers]abc80x.c acrnsys1.c atarist.c ip20.c ip22.c x68k.c
[src/mess/includes]c128.h c16.h c64.h coco.h dgn_beta.h europc.h mac.h msx.h sms.h
[src/mess/machine]99_dsk.c 99_usbsm.c 99_usbsm.h aim65.c amigacrt.c apple2gs.c apple3.c atarifdc.c bbc.c bebox.c c128.c c16.c c64.c cbm.c cgenie.c coco.c compis.c concept.c cpm_bios.c cpm_bios.h dgn_beta.c ds1315.c europc.c galaxy.c gb.c genesis.c geneve.c hd63450.c hd63450.h ins8154.c ins8154.h kaypro.c kc.c lisa.c mac.c mc6846.c mc6846.h mc6850.c mc6850.h microtan.c mm58274c.c mm58274c.h msx.c mtx.c nes.c oric.c osborne1.c pc.c pc8801.c pce.c pdp1.c primo.c rp5c15.c rp5c15.h sgi.c sgi.h sms.c spectrum.c strata.c strata.h svi318.c thomson.c ti85.c ti990.c ti990.h ti99_4x.c tx0.c vc1541.c z80dart.c z80dart.h
[src/mess/video]coco3.c dgn_beta.c intv.c smsvdp.c ted7360.c x68k.c

src/emu/ui.c
r1980r1981
453453
454454#ifdef MESS
455455   /* let MESS display its stuff */
456   mess_ui_update();
456   mess_ui_update(machine);
457457#endif
458458}
459459
r1980r1981
12541254   }
12551255
12561256#ifdef MESS
1257   if (mess_disable_builtin_ui())
1257   if (mess_disable_builtin_ui(machine))
12581258      return 0;
12591259#endif
12601260
src/mess/uimess.c
r1980r1981
2121   return ui_active;
2222}
2323
24void mess_ui_update(void)
24void mess_ui_update(running_machine *machine)
2525{
2626   static int ui_toggle_key = 0;
2727
r1980r1981
2929   const struct IODevice *dev;
3030
3131   /* traditional MESS interface */
32   if (Machine->gamedrv->flags & GAME_COMPUTER)
32   if (machine->gamedrv->flags & GAME_COMPUTER)
3333   {
3434      if( input_ui_pressed(IPT_UI_TOGGLE_UI) )
3535      {
r1980r1981
7878   }
7979
8080   /* run display routine for device */
81   if (Machine->devices)
81   if (machine->devices)
8282   {
83      for (dev = Machine->devices; dev->type < IO_COUNT; dev++)
83      for (dev = machine->devices; dev->type < IO_COUNT; dev++)
8484      {
8585         if (dev->display)
8686         {
r1980r1981
202202
203203
204204
205int mess_disable_builtin_ui(void)
205int mess_disable_builtin_ui(running_machine *machine)
206206{
207   return mess_use_new_ui() || ((Machine->gamedrv->flags & GAME_COMPUTER) && !mess_ui_active());
207   return mess_use_new_ui() || ((machine->gamedrv->flags & GAME_COMPUTER) && !mess_ui_active());
208208}
src/mess/mess.c
r1980r1981
128128   mess_image *image;
129129
130130   /* initialize natural keyboard support */
131   inputx_init();
131   inputx_init(machine);
132132
133133   /* allocate the IODevice struct */
134134   machine->devices = (struct IODevice *) devices_allocate(machine->gamedrv);
r1980r1981
140140   ram_init(machine->gamedrv);
141141
142142   /* init all devices */
143   image_init();
143   image_init(machine);
144144
145145   /* make sure that any required devices have been allocated */
146146   for (dev = machine->devices; dev->type < IO_COUNT; dev++)
src/mess/uimess.h
r1980r1981
1212#include "ui.h"
1313
1414int mess_ui_active(void);
15void mess_ui_update(void);
15void mess_ui_update(running_machine *machine);
1616int mess_use_new_ui(void);
17int mess_disable_builtin_ui(void);
17int mess_disable_builtin_ui(running_machine *machine);
1818
1919/* image info screen */
2020int ui_sprintf_image_info(char *buf);
src/mess/image.c
r1980r1981
106106    image_init - initialize the core image system
107107-------------------------------------------------*/
108108
109int image_init(void)
109int image_init(running_machine *machine)
110110{
111111   int err;
112112   int count, indx, i, j;
r1980r1981
118118
119119   /* first count all images, and identify multiply defined devices */
120120   count = 0;
121   for (i = 0; Machine->devices[i].type < IO_COUNT; i++)
121   for (i = 0; machine->devices[i].type < IO_COUNT; i++)
122122   {
123123      /* check to see if this device type is used multiple times */
124      mask = 1 << Machine->devices[i].type;
124      mask = 1 << machine->devices[i].type;
125125      if (dev_mask & mask)
126126         multiple_dev_mask |= mask;
127127      else
128128         dev_mask |= mask;
129129
130130      /* increment the count */
131      count += Machine->devices[i].count;
131      count += machine->devices[i].count;
132132   }
133133
134134   /* allocate the array */
r1980r1981
140140
141141   /* initialize the devices */
142142   indx = 0;
143   for (i = 0; Machine->devices[i].type < IO_COUNT; i++)
143   for (i = 0; machine->devices[i].type < IO_COUNT; i++)
144144   {
145      for (j = 0; j < Machine->devices[i].count; j++)
145      for (j = 0; j < machine->devices[i].count; j++)
146146      {
147147         images[indx + j].mempool = pool_alloc(memory_error);
148148
149149         /* setup the device */
150150         tagpool_init(&images[indx + j].tagpool);
151         images[indx + j].dev = &Machine->devices[i];
151         images[indx + j].dev = &machine->devices[i];
152152
153         if (Machine->devices[i].init)
153         if (machine->devices[i].init)
154154         {
155            err = Machine->devices[i].init(&images[indx + j]);
155            err = machine->devices[i].init(&images[indx + j]);
156156            if (err != INIT_PASS)
157157               return err;
158158         }
159159
160160      }
161      indx += Machine->devices[i].count;
161      indx += machine->devices[i].count;
162162   }
163163
164   add_exit_callback(Machine, image_exit);
164   add_exit_callback(machine, image_exit);
165165   return INIT_PASS;
166166}
167167
r1980r1981
535535    image_load_internal - core image loading
536536-------------------------------------------------*/
537537
538static int image_load_internal(mess_image *image, const char *path,
538static int image_load_internal(running_machine *machine, mess_image *image, const char *path,
539539   int is_create, int create_format, option_resolution *create_args)
540540{
541541   image_error_t err;
r1980r1981
563563
564564   /* do we need to reset the CPU? */
565565   if ((attotime_compare(timer_get_time(), attotime_zero) > 0) && image->dev->reset_on_load)
566      mame_schedule_hard_reset(Machine);
566      mame_schedule_hard_reset(machine);
567567
568568   /* determine open plan */
569569   determine_open_plan(image, is_create, open_plan);
r1980r1981
574574      software_path = software_path_list;
575575      do
576576      {
577         gamedrv = Machine->gamedrv;
577         gamedrv = machine->gamedrv;
578578         while(!is_loaded(image) && gamedrv)
579579         {
580580            /* open the file */
r1980r1981
662662
663663int image_load(mess_image *image, const char *path)
664664{
665   return image_load_internal(image, path, FALSE, 0, NULL);
665   return image_load_internal(Machine, image, path, FALSE, 0, NULL);
666666}
667667
668668
r1980r1981
673673
674674int image_create(mess_image *image, const char *path, int create_format, option_resolution *create_args)
675675{
676   return image_load_internal(image, path, TRUE, create_format, create_args);
676   return image_load_internal(Machine, image, path, TRUE, create_format, create_args);
677677}
678678
679679
r1980r1981
752752   mess_image *image;
753753
754754   if (!ispreload)
755      mess_options_extract();
755      mess_options_extract(Machine);
756756
757757   /* normalize ispreload */
758758   ispreload = ispreload ? 1 : 0;
src/mess/includes/dgn_beta.h
r1980r1981
9393WRITE8_HANDLER(dgnbeta_wd2797_w);
9494
9595extern int dgnbeta_font;
96void dgn_beta_frame_interrupt (int data);
96void dgn_beta_frame_interrupt (running_machine *machine, int data);
9797void dgn_beta_line_interrupt (int data);
9898
9999
src/mess/includes/mac.h
r1980r1981
4040READ16_HANDLER ( macplus_scsi_r );
4141WRITE16_HANDLER ( macplus_scsi_w );
4242NVRAM_HANDLER( mac );
43void mac_scc_mouse_irq( int x, int y );
43void mac_scc_mouse_irq( running_machine *machine, int x, int y );
4444
4545
4646/*----------- defined in video/mac.c -----------*/
src/mess/includes/coco.h
r1980r1981
7171WRITE8_HANDLER( coco_pia_1_w );
7272void coco3_horizontal_sync_callback(int data);
7373void coco3_field_sync_callback(int data);
74void coco3_gime_field_sync_callback(void);
74void coco3_gime_field_sync_callback(running_machine *machine);
7575
7676/* Compusense Dragon Plus board */
7777READ8_HANDLER ( plus_reg_r );
r1980r1981
8787READ8_HANDLER(wd2797_r);
8888WRITE8_HANDLER(wd2797_w);
8989
90void coco_set_halt_line(int halt_line);
90#ifdef UNUSED_FUNCTION
91void coco_set_halt_line(running_machine *machine, int halt_line);
92#endif
9193
9294#define IO_BITBANGER IO_PRINTER
9395#define IO_VHD IO_HARDDISK
src/mess/includes/msx.h
r1980r1981
9494
9595void msx_memory_map_all (void);
9696void msx_memory_map_page (int page);
97void msx_memory_init (void);
97void msx_memory_init (running_machine *machine);
9898void msx_memory_set_carts (void);
9999void msx_memory_reset (void);
100100
src/mess/includes/c128.h
r1980r1981
102102extern VIDEO_START( c128 );
103103extern VIDEO_UPDATE( c128 );
104104
105void c128_bankswitch_64 (int reset);
105void c128_bankswitch_64 (running_machine *machine, int reset);
106106
107107
108108#endif /* C128_H_ */
src/mess/includes/c16.h
r1980r1981
159159
160160/* ted reads */
161161extern int c16_read_keyboard (int databus);
162extern void c16_interrupt (int);
162extern void c16_interrupt (running_machine *machine, int);
163163
164164extern void c16_driver_init(running_machine *machine);
165165extern MACHINE_RESET( c16 );
src/mess/includes/europc.h
r1980r1981
145145extern WRITE8_HANDLER( europc_rtc_w );
146146extern NVRAM_HANDLER( europc_rtc );
147147
148void europc_rtc_set_time(void);
148void europc_rtc_set_time(running_machine *machine);
149149void europc_rtc_init(void);
150150
151151
src/mess/includes/sms.h
r1980r1981
77#ifndef SMS_H_
88#define SMS_H_
99
10#include "deprecat.h"
11
1210#define LOG_REG
1311#define LOG_PAGING
1412//#define LOG_CURLINE
r1980r1981
2523#define FLAG_FM            0x00100000
2624#define FLAG_REGION_JAPAN      0x00200000
2725
28#define IS_GAMEGEAR         ( Machine->gamedrv->flags & FLAG_GAMEGEAR )
29#define HAS_BIOS_0400         ( Machine->gamedrv->flags & FLAG_BIOS_0400 )
30#define HAS_BIOS_2000         ( Machine->gamedrv->flags & FLAG_BIOS_2000 )
31#define HAS_BIOS_FULL         ( Machine->gamedrv->flags & FLAG_BIOS_FULL )
32#define HAS_BIOS         ( Machine->gamedrv->flags & ( FLAG_BIOS_0400 | FLAG_BIOS_2000 | FLAG_BIOS_FULL ) )
33#define HAS_FM            ( Machine->gamedrv->flags & FLAG_FM )
34#define IS_REGION_JAPAN         ( Machine->gamedrv->flags & FLAG_REGION_JAPAN )
26#define IS_GAMEGEAR         ( machine->gamedrv->flags & FLAG_GAMEGEAR )
27#define HAS_BIOS_0400         ( machine->gamedrv->flags & FLAG_BIOS_0400 )
28#define HAS_BIOS_2000         ( machine->gamedrv->flags & FLAG_BIOS_2000 )
29#define HAS_BIOS_FULL         ( machine->gamedrv->flags & FLAG_BIOS_FULL )
30#define HAS_BIOS         ( machine->gamedrv->flags & ( FLAG_BIOS_0400 | FLAG_BIOS_2000 | FLAG_BIOS_FULL ) )
31#define HAS_FM            ( machine->gamedrv->flags & FLAG_FM )
32#define IS_REGION_JAPAN         ( machine->gamedrv->flags & FLAG_REGION_JAPAN )
3533
3634
3735/*----------- defined in machine/sms.c -----------*/
r1980r1981
5654WRITE8_HANDLER(gg_psg_w);
5755 READ8_HANDLER(gg_input_port_2_r);
5856
59void setup_rom(void);
57void setup_rom(running_machine *machine);
6058
6159void sms_check_pause_button( running_machine *machine );
6260
src/mess/includes/c64.h
r1980r1981
239239DRIVER_INIT( ultimax );
240240DRIVER_INIT( c64gs );
241241DRIVER_INIT( sx64 );
242void c64_common_init_machine (void);
242void c64_common_init_machine (running_machine *machine);
243243
244244MACHINE_START( c64 );
245245INTERRUPT_GEN( c64_frame_interrupt );
src/mess/video/dgn_beta.c
r1980r1981
8080*/
8181
8282#include "driver.h"
83#include "deprecat.h"
8384#include "includes/dgn_beta.h"
8485#include "video/m6845.h"
8586
r1980r1981
307308#endif
308309   }
309310
310   dgn_beta_frame_interrupt(data);
311   dgn_beta_frame_interrupt(Machine, data);
311312}
312313
313314static void beta_Set_DE(int offset, int data)
src/mess/video/x68k.c
r1980r1981
2828#include "driver.h"
2929#include "includes/x68k.h"
3030#include "machine/68901mfp.h"
31#include "deprecat.h"
3231
3332extern struct x68k_system sys;
3433
r1980r1981
779778}
780779
781780// Sprite controller "Cynthia" at 0xeb0000
782static void x68k_draw_sprites(bitmap_t* bitmap, int priority, rectangle cliprect)
781static void x68k_draw_sprites(running_machine *machine, bitmap_t* bitmap, int priority, rectangle cliprect)
783782{
784783   /*
785784      0xeb0000 - 0xeb07ff - Sprite registers (up to 128)
r1980r1981
835834
836835         sx += sprite_shift;
837836
838         drawgfx(bitmap,Machine->gfx[1],code,colour+0x10,xflip,yflip,sys.crtc.hbegin+sx,sys.crtc.vbegin+sy,&cliprect,TRANSPARENCY_PEN,0x00);
837         drawgfx(bitmap,machine->gfx[1],code,colour+0x10,xflip,yflip,sys.crtc.hbegin+sx,sys.crtc.vbegin+sy,&cliprect,TRANSPARENCY_PEN,0x00);
839838      }
840839   }
841840}
r1980r1981
10171016      // Sprite / BG Tiles
10181017      if(priority == sys.video.sprite_pri /*&& (x68k_spritereg[0x404] & 0x0200)*/ && (sys.video.reg[2] & 0x0040))
10191018      {
1020         x68k_draw_sprites(bitmap,1,rect);
1019         x68k_draw_sprites(machine, bitmap,1,rect);
10211020         if((x68k_spritereg[0x404] & 0x0008))
10221021         {
10231022            if((x68k_spritereg[0x404] & 0x0030) == 0x10)  // BG1 TXSEL
r1980r1981
10331032               tilemap_draw(bitmap,&rect,x68k_bg1,0,0);
10341033            }
10351034         }
1036         x68k_draw_sprites(bitmap,2,rect);
1035         x68k_draw_sprites(machine,bitmap,2,rect);
10371036         if((x68k_spritereg[0x404] & 0x0001))
10381037         {
10391038            if((x68k_spritereg[0x404] & 0x0006) == 0x02)  // BG0 TXSEL
r1980r1981
10491048               tilemap_draw(bitmap,&rect,x68k_bg1,0,0);
10501049            }
10511050         }
1052         x68k_draw_sprites(bitmap,3,rect);
1051         x68k_draw_sprites(machine,bitmap,3,rect);
10531052      }
10541053
10551054      // Text screen
src/mess/video/coco3.c
r1980r1981
646646
647647static TIMER_CALLBACK(gime_fs)
648648{
649   coco3_gime_field_sync_callback();
649   coco3_gime_field_sync_callback(machine);
650650}
651651
652652
src/mess/video/smsvdp.c
r1980r1981
110110} smsvdp;
111111
112112static TIMER_CALLBACK(smsvdp_display_callback);
113static void sms_refresh_line(bitmap_t *bitmap, int offsetx, int offsety, int line);
113static void sms_refresh_line(running_machine *machine, bitmap_t *bitmap, int offsetx, int offsety, int line);
114114static void sms_update_palette(void);
115115
116116static void set_display_settings( running_machine *machine ) {
r1980r1981
281281      /* Draw middle of the border */
282282      /* We need to do this through the regular drawing function so it will */
283283      /* be included in the gamegear scaling functions */
284      sms_refresh_line( tmpbitmap, LBORDER_START + LBORDER_X_PIXELS, vpos_limit - smsvdp.sms_frame_timing[ACTIVE_DISPLAY_V], vpos - ( vpos_limit - smsvdp.sms_frame_timing[ACTIVE_DISPLAY_V] ) );
284      sms_refresh_line( machine, tmpbitmap, LBORDER_START + LBORDER_X_PIXELS, vpos_limit - smsvdp.sms_frame_timing[ACTIVE_DISPLAY_V], vpos - ( vpos_limit - smsvdp.sms_frame_timing[ACTIVE_DISPLAY_V] ) );
285285      return;
286286   }
287287
r1980r1981
323323         rec.min_x = LBORDER_START + LBORDER_X_PIXELS + 256;
324324         rec.max_x = rec.min_x + RBORDER_X_PIXELS - 1;
325325         fillbitmap( tmpbitmap, machine->pens[smsvdp.current_palette[BACKDROP_COLOR]], &rec );
326         sms_refresh_line( tmpbitmap, LBORDER_START + LBORDER_X_PIXELS, vpos_limit, vpos - vpos_limit );
326         sms_refresh_line( machine, tmpbitmap, LBORDER_START + LBORDER_X_PIXELS, vpos_limit, vpos - vpos_limit );
327327      }
328328      return;
329329   }
r1980r1981
347347      /* Draw middle of the border */
348348      /* We need to do this through the regular drawing function so it will */
349349      /* be included in the gamegear scaling functions */
350      sms_refresh_line( tmpbitmap, LBORDER_START + LBORDER_X_PIXELS, vpos_limit + smsvdp.sms_frame_timing[TOP_BORDER], vpos - ( vpos_limit + smsvdp.sms_frame_timing[TOP_BORDER] ) );
350      sms_refresh_line( machine, tmpbitmap, LBORDER_START + LBORDER_X_PIXELS, vpos_limit + smsvdp.sms_frame_timing[TOP_BORDER], vpos - ( vpos_limit + smsvdp.sms_frame_timing[TOP_BORDER] ) );
351351      return;
352352   }
353353}
r1980r1981
913913   sms_refresh_tms9918_sprites( lineBuffer, line );
914914}
915915
916static void sms_refresh_line( bitmap_t *bitmap, int pixelOffsetX, int pixelPlotY, int line ) {
916static void sms_refresh_line( running_machine *machine, bitmap_t *bitmap, int pixelOffsetX, int pixelPlotY, int line ) {
917917   int x;
918918   int *blitLineBuffer = smsvdp.line_buffer;
919919
r1980r1981
992992         line4 = smsvdp.line_buffer + ( ( ( myLine - 0 ) & 0x03 ) + 1 ) * 256;
993993
994994         for( x = 0+48; x < 160+48; x++ ) {
995            rgb_t   c1 = Machine->pens[line1[x]];
996            rgb_t   c2 = Machine->pens[line2[x]];
997            rgb_t   c3 = Machine->pens[line3[x]];
998            rgb_t   c4 = Machine->pens[line4[x]];
995            rgb_t   c1 = machine->pens[line1[x]];
996            rgb_t   c2 = machine->pens[line2[x]];
997            rgb_t   c3 = machine->pens[line3[x]];
998            rgb_t   c4 = machine->pens[line4[x]];
999999            *BITMAP_ADDR32( bitmap, pixelPlotY, pixelOffsetX + x) =
10001000               MAKE_RGB( ( RGB_RED(c1)/6 + RGB_RED(c2)/3 + RGB_RED(c3)/3 + RGB_RED(c4)/6 ),
10011001                  ( RGB_GREEN(c1)/6 + RGB_GREEN(c2)/3 + RGB_GREEN(c3)/3 + RGB_GREEN(c4)/6 ),
r1980r1981
10071007   }
10081008
10091009   for( x = 0; x < 256; x++ ) {
1010      *BITMAP_ADDR32( bitmap, pixelPlotY + line, pixelOffsetX + x) = Machine->pens[blitLineBuffer[x]];
1010      *BITMAP_ADDR32( bitmap, pixelPlotY + line, pixelOffsetX + x) = machine->pens[blitLineBuffer[x]];
10111011   }
10121012}
10131013
src/mess/video/intv.c
r1980r1981
446446}
447447
448448/*
449static void draw_background(bitmap_t *bitmap, int transparency)
449static void draw_background(running_machine *machine, bitmap_t *bitmap, int transparency)
450450{
451451   // First, draw the background
452452   int offs = 0;
r1980r1981
487487               if (colorb == 7) colorb = intv_color_stack[3];
488488               if (colorc == 7) colorc = intv_color_stack[3];
489489               if (colord == 7) colord = intv_color_stack[3];
490               plot_box(bitmap,col*16,row*16,8,8,Machine->pens[colora]);
491               plot_box(bitmap,col*16+8,row*16,8,8,Machine->pens[colorb]);
492               plot_box(bitmap,col*16,row*16+8,8,8,Machine->pens[colorc]);
493               plot_box(bitmap,col*16+8,row*16+8,8,8,Machine->pens[colord]);
490               plot_box(bitmap,col*16,row*16,8,8,machine->pens[colora]);
491               plot_box(bitmap,col*16+8,row*16,8,8,machine->pens[colorb]);
492               plot_box(bitmap,col*16,row*16+8,8,8,machine->pens[colorc]);
493               plot_box(bitmap,col*16+8,row*16+8,8,8,machine->pens[colord]);
494494            }
495495            else // normal color stack mode
496496            {
r1980r1981
513513                  code %= 64;  // keep from going outside the array
514514                  //if (intv_gramdirtybytes[code] == 1)
515515                  {
516                     decodechar(Machine->gfx[1],
516                     decodechar(machine->gfx[1],
517517                           code,
518518                           intv_gram,
519                           Machine->config->gfxdecodeinfo[1].gfxlayout);
519                           machine->config->gfxdecodeinfo[1].gfxlayout);
520520                     intv_gramdirtybytes[code] = 0;
521521                  }
522522                  // Draw GRAM char
523                  drawgfx(bitmap,Machine->gfx[1],
523                  drawgfx(bitmap,machine->gfx[1],
524524                     code,
525525                     bgcolor*16+fgcolor,
526526                     0,0,col*16,row*16,
r1980r1981
528528
529529                  for(j=0;j<8;j++)
530530                  {
531                     //intv_plot_pixel(bitmap, col*16+j*2, row*16+7*2+1, Machine->pens[1]);
532                     //intv_plot_pixel(bitmap, col*16+j*2+1, row*16+7*2+1, Machine->pens[1]);
531                     //intv_plot_pixel(bitmap, col*16+j*2, row*16+7*2+1, machine->pens[1]);
532                     //intv_plot_pixel(bitmap, col*16+j*2+1, row*16+7*2+1, machine->pens[1]);
533533                  }
534534
535535               }
536536               else // read from grom
537537               {
538                  drawgfx(bitmap,Machine->gfx[0],
538                  drawgfx(bitmap,machine->gfx[0],
539539                     code,
540540                     bgcolor*16+fgcolor,
541541                     0,0,col*16,row*16,
r1980r1981
543543
544544                  for(j=0;j<8;j++)
545545                  {
546                     //intv_plot_pixel(bitmap, col*16+j*2, row*16+7*2+1, Machine->pens[2]);
547                     //intv_plot_pixel(bitmap, col*16+j*2+1, row*16+7*2+1, Machine->pens[2]);
546                     //intv_plot_pixel(bitmap, col*16+j*2, row*16+7*2+1, machine->pens[2]);
547                     //intv_plot_pixel(bitmap, col*16+j*2+1, row*16+7*2+1, machine->pens[2]);
548548                  }
549549               }
550550            }
r1980r1981
568568            {
569569               //if (intv_gramdirtybytes[code] == 1)
570570               {
571                  decodechar(Machine->gfx[1],
571                  decodechar(machine->gfx[1],
572572                        code,
573573                        intv_gram,
574                        Machine->config->gfxdecodeinfo[1].gfxlayout);
574                        machine->config->gfxdecodeinfo[1].gfxlayout);
575575                  intv_gramdirtybytes[code] = 0;
576576               }
577577               // Draw GRAM char
578               drawgfx(bitmap,Machine->gfx[1],
578               drawgfx(bitmap,machine->gfx[1],
579579                  code,
580580                  bgcolor*16+fgcolor,
581581                  0,0,col*16,row*16,
r1980r1981
583583            }
584584            else // read from GROM
585585            {
586               drawgfx(bitmap,Machine->gfx[0],
586               drawgfx(bitmap,machine->gfx[0],
587587                  code,
588588                  bgcolor*16+fgcolor,
589589                  0,0,col*16,row*16,
r1980r1981
598598
599599/* TBD: need to handle sprites behind foreground? */
600600/*
601static void draw_sprites(bitmap_t *bitmap, int behind_foreground)
601static void draw_sprites(running_machine *machine, bitmap_t *bitmap, int behind_foreground)
602602{
603603   int i;
604604   int code;
r1980r1981
616616            {
617617               //if (intv_gramdirtybytes[code] == 1)
618618               {
619                  decodechar(Machine->gfx[1],
619                  decodechar(machine->gfx[1],
620620                     code,
621621                     intv_gram,
622                     Machine->config->gfxdecodeinfo[1].gfxlayout);
622                     machine->config->gfxdecodeinfo[1].gfxlayout);
623623                  intv_gramdirtybytes[code] = 0;
624624               }
625625               // Draw GRAM char
626               drawgfxzoom(bitmap,Machine->gfx[1],
626               drawgfxzoom(bitmap,machine->gfx[1],
627627                  code,
628628                  s->color,
629629                  s->xflip,s->yflip,
630630                  s->xpos*2-16,s->ypos*2-16,
631                  &Machine->screen[0].visarea,TRANSPARENCY_PEN,0,
631                  &machine->screen[0].visarea,TRANSPARENCY_PEN,0,
632632                  0x8000*s->xsize, 0x8000*s->ysize);
633633            }
634634            else
635635            {
636636               //if ((intv_gramdirtybytes[code] == 1) || (intv_gramdirtybytes[code+1] == 1))
637637               {
638                  decodechar(Machine->gfx[1],
638                  decodechar(machine->gfx[1],
639639                     code,
640640                     intv_gram,
641                     Machine->config->gfxdecodeinfo[1].gfxlayout);
642                  decodechar(Machine->gfx[1],
641                     machine->config->gfxdecodeinfo[1].gfxlayout);
642                  decodechar(machine->gfx[1],
643643                     code+1,
644644                     intv_gram,
645                     Machine->config->gfxdecodeinfo[1].gfxlayout);
645                     machine->config->gfxdecodeinfo[1].gfxlayout);
646646                  intv_gramdirtybytes[code] = 0;
647647                  intv_gramdirtybytes[code+1] = 0;
648648               }
649649               // Draw GRAM char
650               drawgfxzoom(bitmap,Machine->gfx[1],
650               drawgfxzoom(bitmap,machine->gfx[1],
651651                  code,
652652                  s->color,
653653                  s->xflip,s->yflip,
654654                  s->xpos*2-16,s->ypos*2-16+(s->yflip)*s->ysize*8,
655                  &Machine->screen[0].visarea,TRANSPARENCY_PEN,0,
655                  &machine->screen[0].visarea,TRANSPARENCY_PEN,0,
656656                  0x8000*s->xsize, 0x8000*s->ysize);
657               drawgfxzoom(bitmap,Machine->gfx[1],
657               drawgfxzoom(bitmap,machine->gfx[1],
658658                  code+1,
659659                  s->color,
660660                  s->xflip,s->yflip,
661661                  s->xpos*2-16,s->ypos*2-16+(1-s->yflip)*s->ysize*8,
662                  &Machine->screen[0].visarea,TRANSPARENCY_PEN,0,
662                  &machine->screen[0].visarea,TRANSPARENCY_PEN,0,
663663                  0x8000*s->xsize, 0x8000*s->ysize);
664664            }
665665         }
r1980r1981
668668            if (s->yres == 1)
669669            {
670670               // Draw GROM char
671               drawgfxzoom(bitmap,Machine->gfx[0],
671               drawgfxzoom(bitmap,machine->gfx[0],
672672                  code,
673673                  s->color,
674674                  s->xflip,s->yflip,
675675                  s->xpos*2-16,s->ypos*2-16,
676                  &Machine->screen[0].visarea,TRANSPARENCY_PEN,0,
676                  &machine->screen[0].visarea,TRANSPARENCY_PEN,0,
677677                  0x8000*s->xsize, 0x8000*s->ysize);
678678            }
679679            else
680680            {
681               drawgfxzoom(bitmap,Machine->gfx[0],
681               drawgfxzoom(bitmap,machine->gfx[0],
682682                  code,
683683                  s->color,
684684                  s->xflip,s->yflip,
685685                  s->xpos*2-16,s->ypos*2-16+(s->yflip)*s->ysize*8,
686                  &Machine->screen[0].visarea,TRANSPARENCY_PEN,0,
686                  &machine->screen[0].visarea,TRANSPARENCY_PEN,0,
687687                  0x8000*s->xsize, 0x8000*s->ysize);
688               drawgfxzoom(bitmap,Machine->gfx[0],
688               drawgfxzoom(bitmap,machine->gfx[0],
689689                  code+1,
690690                  s->color,
691691                  s->xflip,s->yflip,
692692                  s->xpos*2-16,s->ypos*2-16+(1-s->yflip)*s->ysize*8,
693                  &Machine->screen[0].visarea,TRANSPARENCY_PEN,0,
693                  &machine->screen[0].visarea,TRANSPARENCY_PEN,0,
694694                  0x8000*s->xsize, 0x8000*s->ysize);
695695            }
696696         }
src/mess/video/ted7360.c
r1980r1981
546546   vic_dma_read_rom = dma_read_rom;
547547}
548548
549static void ted7360_set_interrupt (int mask)
549static void ted7360_set_interrupt (running_machine *machine, int mask)
550550{
551551   /* kernel itself polls for timer 2 shot (interrupt disabled!)
552552    * when cassette loading */
r1980r1981
557557      {
558558         DBG_LOG (1, "ted7360", ("irq start %.2x\n", mask));
559559         ted7360[9] |= 0x80;
560         c16_interrupt (1);
560         c16_interrupt (machine, 1);
561561      }
562562   }
563563   ted7360[9] |= mask;
564564}
565565
566static void ted7360_clear_interrupt (int mask)
566static void ted7360_clear_interrupt (running_machine *machine, int mask)
567567{
568568   ted7360[9] &= ~mask;
569569   if ((ted7360[9] & 0x80) && !(ted7360[9] & ted7360[0xa] & 0x5e))
570570   {
571571      DBG_LOG (1, "ted7360", ("irq end %.2x\n", mask));
572572      ted7360[9] &= ~0x80;
573      c16_interrupt (0);
573      c16_interrupt (machine, 0);
574574   }
575575}
576576
r1980r1981
590590       // prooved by digisound of several intros like eoroidpro
591591      timer_adjust_oneshot(timer1, TEDTIME_IN_CYCLES (TIMER1), 1);
592592      timer1_active = 1;
593      ted7360_set_interrupt (8);
593      ted7360_set_interrupt (machine, 8);
594594      break;
595595   case 2:
596596      timer_adjust_oneshot(timer2, TEDTIME_IN_CYCLES (0x10000), 2);
597597      timer2_active = 1;
598      ted7360_set_interrupt (0x10);
598      ted7360_set_interrupt (machine, 0x10);
599599      break;
600600   case 3:
601601      timer_adjust_oneshot(timer3, TEDTIME_IN_CYCLES (0x10000), 3);
602602      timer3_active = 1;
603      ted7360_set_interrupt (0x40);
603      ted7360_set_interrupt (machine, 0x40);
604604      break;
605605   }
606606}
r1980r1981
725725      break;
726726   case 9:
727727      if (data & 8)
728         ted7360_clear_interrupt (8);
728         ted7360_clear_interrupt (machine, 8);
729729      if (data & 0x10)
730         ted7360_clear_interrupt (0x10);
730         ted7360_clear_interrupt (machine, 0x10);
731731      if (data & 0x40)
732         ted7360_clear_interrupt (0x40);
732         ted7360_clear_interrupt (machine, 0x40);
733733      if (data & 2)
734         ted7360_clear_interrupt (2);
734         ted7360_clear_interrupt (machine, 2);
735735      break;
736736   case 0xa:
737737      old = data;
r1980r1981
739739#if 0
740740      ted7360[9] = (ted7360[9] & 0xa1) | (ted7360[9] & data & 0x5e);
741741      if (ted7360[9] & 0x80)
742         ted7360_clear_interrupt (0);
742         ted7360_clear_interrupt (machine, 0);
743743#endif
744744      if ((data ^ old) & 1)
745745      {
r1980r1981
12201220   if (rasterline == C16_2_RASTERLINE (RASTERLINE))
12211221   {
12221222      ted7360_drawlines (machine, lastline, rasterline);
1223      ted7360_set_interrupt (2);
1223      ted7360_set_interrupt (machine, 2);
12241224   }
12251225}
12261226
src/mess/inputx.c
r1980r1981
637637
638638
639639
640void inputx_init(void)
640void inputx_init(running_machine *machine)
641641{
642642   codes = NULL;
643643   inputx_timer = NULL;
r1980r1981
647647   keybuffer = NULL;
648648
649649#ifdef ENABLE_DEBUGGER
650   if (Machine->debug_mode)
650   if (machine->debug_mode)
651651      debug_console_register_command("input", CMDFLAG_NONE, 0, 1, 1, execute_input);
652652#endif /* ENABLE_DEBUGGER */
653653
654654   /* posting keys directly only makes sense for a computer */
655   if (Machine->gamedrv->flags & GAME_COMPUTER)
655   if (machine->gamedrv->flags & GAME_COMPUTER)
656656   {
657      codes = build_codes(Machine->input_ports);
657      codes = build_codes(machine->input_ports);
658658      if (DUMP_CODES)
659659         dump_codes();
660660      setup_keybuffer();
src/mess/image.h
r1980r1981
4747****************************************************************************/
4848
4949/* not to be called by anything other than core */
50int image_init(void);
50int image_init(running_machine *machine);
5151
5252
5353
src/mess/inputx.h
r1980r1981
6060***************************************************************************/
6161
6262/* these are called by the core; they should not be called from FEs */
63void inputx_init(void);
63void inputx_init(running_machine *machine);
6464void inputx_update(void);
6565void inputx_handle_mess_extensions(input_port_entry *ipt);
6666
src/mess/messopts.c
r1980r1981
55****************************************************************************/
66
77#include "mame.h"
8#include "deprecat.h"
98#include "options.h"
109#include "driver.h"
1110#include "pool.h"
r1980r1981
276275   out of core into the options
277276-------------------------------------------------*/
278277
279void mess_options_extract(void)
278void mess_options_extract(running_machine *machine)
280279{
281280   /* only extract the device options if we've added them */
282281   if (options_get_bool(mame_options(), OPTION_ADDED_DEVICE_OPTIONS))
283      mess_enumerate_devices(mame_options(), Machine->gamedrv, extract_device_options_for_device);
282      mess_enumerate_devices(mame_options(), machine->gamedrv, extract_device_options_for_device);
284283
285284   /* write the config, if appropriate */
286285   if (options_get_bool(mame_options(), OPTION_WRITECONFIG))
287      write_config(NULL, Machine->gamedrv);
286      write_config(NULL, machine->gamedrv);
288287}
src/mess/messopts.h
r1980r1981
3232void mess_options_init(core_options *opts);
3333
3434/* extract device options out of core into the options */
35void mess_options_extract(void);
35void mess_options_extract(running_machine *machine);
3636
3737/* add the device options for a specified device */
3838void mess_add_device_options(core_options *opts, const game_driver *driver);
src/mess/machine/strata.c
r1980r1981
1313
1414#include "driver.h"
1515#include "strata.h"
16#include "deprecat.h"
1716
1817#define MAX_STRATA   1
1918
r1980r1981
6867   Initialize one FEEPROM chip: may be called at driver init or image load
6968   time (or machine init time if you don't use MESS image core)
7069*/
71int strataflash_init(int id)
70int strataflash_init(running_machine *machine, int id)
7271{
7372   int i;
7473
r1980r1981
9291   /* set-up factory-programmed protection register segment */
9392   strata[id].prot_regs[BYTE_XOR_LE(0)] &= 0xfe;
9493   for (i=2; i<10; i++)
95      strata[id].prot_regs[i] = mame_rand(Machine);
94      strata[id].prot_regs[i] = mame_rand(machine);
9695
9796   return 0;
9897}
src/mess/machine/cbm.c
r1980r1981
170170   cbm_rom[id].chip = 0;
171171}
172172
173static const struct IODevice *cbm_rom_find_device(void)
173static const struct IODevice *cbm_rom_find_device(running_machine *machine)
174174{
175   return device_find(Machine->devices, IO_CARTSLOT);
175   return device_find(machine->devices, IO_CARTSLOT);
176176}
177177
178178static DEVICE_INIT(cbm_rom)
r1980r1981
199199   if (i >= sizeof(cbm_rom) / sizeof(cbm_rom[0]))
200200      return INIT_FAIL;
201201
202   dev = cbm_rom_find_device();
202   dev = cbm_rom_find_device(Machine);
203203
204204   size = image_length(image);
205205
src/mess/machine/dgn_beta.c
r1980r1981
120120static void d_pia2_irq_a(int state);
121121static void d_pia2_irq_b(int state);
122122
123static void cpu0_recalc_irq(int state);
124static void cpu0_recalc_firq(int state);
123static void cpu0_recalc_irq(running_machine *machine, int state);
124static void cpu0_recalc_firq(running_machine *machine, int state);
125125
126static void cpu1_recalc_firq(int state);
126static void cpu1_recalc_firq(running_machine *machine, int state);
127127
128128static   int Keyboard[NoKeyrows];      /* Keyboard bit array */
129129static int RowShifter;            /* shift register to select row */
r1980r1981
649649
650650static void d_pia0_irq_a(int state)
651651{
652   cpu0_recalc_irq(state);
652   cpu0_recalc_irq(Machine, state);
653653}
654654
655655static void d_pia0_irq_b(int state)
656656{
657   cpu0_recalc_firq(state);
657   cpu0_recalc_firq(Machine, state);
658658}
659659
660660/* PIA #1 at $FC24-$FC27 I63
r1980r1981
741741
742742static void d_pia1_irq_a(int state)
743743{
744   cpu0_recalc_irq(state);
744   cpu0_recalc_irq(Machine, state);
745745}
746746
747747static void d_pia1_irq_b(int state)
748748{
749   cpu0_recalc_irq(state);
749   cpu0_recalc_irq(Machine, state);
750750}
751751
752752/* PIA #2 at FCC0-FCC3 I28
r1980r1981
845845static void d_pia2_irq_a(int state)
846846{
847847   logerror("PIA2 IRQ1 state=%02X\n",state);
848   cpu0_recalc_irq(state);
848   cpu0_recalc_irq(Machine, state);
849849}
850850
851851static void d_pia2_irq_b(int state)
852852{
853853   logerror("PIA2 IRQ2 state=%02X\n",state);
854   cpu0_recalc_irq(state);
854   cpu0_recalc_irq(Machine, state);
855855}
856856
857857/************************************ Recalculate CPU inturrupts ****************************/
858858/* CPU 0 */
859static void cpu0_recalc_irq(int state)
859static void cpu0_recalc_irq(running_machine *machine, int state)
860860{
861861   UINT8 pia0_irq_a = pia_get_irq_a(0);
862862   UINT8 pia1_irq_a = pia_get_irq_a(1);
r1980r1981
870870   else
871871      IRQ = CLEAR_LINE;
872872
873   cpunum_set_input_line(Machine, 0, M6809_IRQ_LINE, IRQ);
873   cpunum_set_input_line(machine, 0, M6809_IRQ_LINE, IRQ);
874874   LOG_INTS(("cpu0 IRQ : %d\n",IRQ));
875875}
876876
877static void cpu0_recalc_firq(int state)
877static void cpu0_recalc_firq(running_machine *machine, int state)
878878{
879879   UINT8 pia0_irq_b = pia_get_irq_b(0);
880880   UINT8 FIRQ;
r1980r1981
884884   else
885885      FIRQ = CLEAR_LINE;
886886
887   cpunum_set_input_line(Machine, 0, M6809_FIRQ_LINE, FIRQ);
887   cpunum_set_input_line(machine, 0, M6809_FIRQ_LINE, FIRQ);
888888
889889   LOG_INTS(("cpu0 FIRQ : %d\n",FIRQ));
890890}
891891
892892/* CPU 1 */
893893
894static void cpu1_recalc_firq(int state)
894static void cpu1_recalc_firq(running_machine *machine, int state)
895895{
896   cpunum_set_input_line(Machine, 1, M6809_FIRQ_LINE, state);
896   cpunum_set_input_line(machine, 1, M6809_FIRQ_LINE, state);
897897   LOG_INTS(("cpu1 FIRQ : %d\n",state));
898898}
899899
r1980r1981
916916         break;
917917      case WD17XX_DRQ_CLR:
918918         /*wd2797_drq=CLEAR_LINE;*/
919         cpu1_recalc_firq(CLEAR_LINE);
919         cpu1_recalc_firq(machine, CLEAR_LINE);
920920         break;
921921      case WD17XX_DRQ_SET:
922922         /*wd2797_drq=ASSERT_LINE;*/
923         cpu1_recalc_firq(ASSERT_LINE);
923         cpu1_recalc_firq(machine, ASSERT_LINE);
924924         break;
925925   }
926926
r1980r1981
10141014}
10151015
10161016/* VBlank inturrupt */
1017void dgn_beta_frame_interrupt (int data)
1017void dgn_beta_frame_interrupt (running_machine *machine, int data)
10181018{
1019   running_machine *machine = Machine;
1020
10211019   /* Set PIA line, so it recognises inturrupt */
10221020   if (!data)
10231021   {
src/mess/machine/strata.h
r1980r1981
22   strata.h: header file for strata.c
33*/
44
5int strataflash_init(int id);
5int strataflash_init(running_machine *machine, int id);
66int strataflash_load(int id, mame_file *f);
77int strataflash_save(int id, mame_file *file);
88UINT8 strataflash_8_r(int id, UINT32 address);
src/mess/machine/pdp1.c
r1980r1981
738738/*
739739   Write a character to typewriter
740740*/
741static void typewriter_out(UINT8 data)
741static void typewriter_out(running_machine *machine, UINT8 data)
742742{
743743   if (LOG_IOT_EXTRA)
744744      logerror("typewriter output %o\n", data);
745745
746   pdp1_typewriter_drawchar(Machine, data);
746   pdp1_typewriter_drawchar(machine, data);
747747   if (typewriter.fd)
748748#if 1
749749      image_fwrite(typewriter.fd, & data, 1);
r1980r1981
868868
869869   ch = (*io) & 077;
870870
871   typewriter_out(ch);
871   typewriter_out(Machine, ch);
872872   io_status &= ~io_st_tyo;
873873
874874   /* compute completion delay (source: maintainance manual 9-12, 9-13 and 9-14) */
r1980r1981
12501250/*
12511251   typewriter keyboard handler
12521252*/
1253static void pdp1_keyboard(void)
1253static void pdp1_keyboard(running_machine *machine)
12541254{
12551255   int i;
12561256   int j;
r1980r1981
12741274         typewriter.tb = (i << 4) + j;
12751275         io_status |= io_st_tyi;
12761276         #if USE_SBS
1277            cpunum_set_input_line_and_vector(Machine, 0, 0, ASSERT_LINE, 0);   /* interrupt it, baby */
1277            cpunum_set_input_line_and_vector(machine, 0, 0, ASSERT_LINE, 0);   /* interrupt it, baby */
12781278         #endif
12791279         cpunum_set_reg(0, PDP1_PF1, 1);
1280         pdp1_typewriter_drawchar(Machine, typewriter.tb);   /* we want to echo input */
1280         pdp1_typewriter_drawchar(machine, typewriter.tb);   /* we want to echo input */
12811281         break;
12821282      }
12831283   }
r1980r1981
14831483      old_tw_keys = 0;
14841484      old_ta_keys = 0;
14851485
1486      pdp1_keyboard();
1486      pdp1_keyboard(machine);
14871487   }
14881488
14891489   pdp1_lightpen();
src/mess/machine/apple2gs.c
r1980r1981
310310
311311
312312
313static void apple2gs_add_irq(UINT8 irq_mask)
313static void apple2gs_add_irq(running_machine *machine, UINT8 irq_mask)
314314{
315315   if ((apple2gs_pending_irqs & irq_mask) == 0x00)
316316   {
r1980r1981
318318         logerror("apple2gs_add_irq(): adding %s\n", apple2gs_irq_name(irq_mask));
319319
320320      apple2gs_pending_irqs |= irq_mask;
321      cpunum_set_input_line(Machine, 0, G65816_LINE_IRQ, apple2gs_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
321      cpunum_set_input_line(machine, 0, G65816_LINE_IRQ, apple2gs_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
322322   }
323323}
324324
325325
326326
327static void apple2gs_remove_irq(UINT8 irq_mask)
327static void apple2gs_remove_irq(running_machine *machine, UINT8 irq_mask)
328328{
329329   if (apple2gs_pending_irqs & irq_mask)
330330   {
r1980r1981
332332         logerror("apple2gs_remove_irq(): removing %s\n", apple2gs_irq_name(irq_mask));
333333
334334      apple2gs_pending_irqs &= ~irq_mask;
335      cpunum_set_input_line(Machine, 0, G65816_LINE_IRQ, apple2gs_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
335      cpunum_set_input_line(machine, 0, G65816_LINE_IRQ, apple2gs_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
336336   }
337337}
338338
r1980r1981
340340{
341341   if (state)
342342   {
343      apple2gs_add_irq(IRQ_DOC);
343      apple2gs_add_irq(Machine, IRQ_DOC);
344344   }
345345   else
346346   {
347      apple2gs_remove_irq(IRQ_DOC);
347      apple2gs_remove_irq(Machine, IRQ_DOC);
348348   }
349349}
350350
r1980r1981
355355   if ((apple2gs_vgcint & 0x04) && !(apple2gs_vgcint & 0x40))
356356   {
357357      apple2gs_vgcint |= 0xc0;
358      apple2gs_add_irq(IRQ_VGC_SECOND);
358      apple2gs_add_irq(machine, IRQ_VGC_SECOND);
359359   }
360360}
361361
r1980r1981
366366   if ((apple2gs_inten & 0x10) && !(apple2gs_intflag & 0x10))
367367   {
368368      apple2gs_intflag |= 0x10;
369      apple2gs_add_irq(IRQ_INTEN_QSECOND);
369      apple2gs_add_irq(machine, IRQ_INTEN_QSECOND);
370370   }
371371}
372372
r1980r1981
697697
698698
699699
700static UINT8 adb_read_mousedata(void)
700static UINT8 adb_read_mousedata(running_machine *machine)
701701{
702702   UINT8 result = 0x00;
703703   UINT8 absolute;
r1980r1981
710710         absolute = apple2gs_mouse_y;
711711         delta = apple2gs_mouse_dy;
712712         adb_kmstatus &= ~0x82;
713         apple2gs_remove_irq(IRQ_ADB_MOUSE);
713         apple2gs_remove_irq(machine, IRQ_ADB_MOUSE);
714714      }
715715      else
716716      {
r1980r1981
743743
744744
745745
746static void adb_check_mouse(void)
746static void adb_check_mouse(running_machine *machine)
747747{
748748   UINT8 new_mouse_x, new_mouse_y;
749749
r1980r1981
763763         adb_kmstatus |= 0x80;
764764         adb_kmstatus &= ~0x02;
765765         if (adb_kmstatus & 0x40)
766            apple2gs_add_irq(IRQ_ADB_MOUSE);
766            apple2gs_add_irq(machine, IRQ_ADB_MOUSE);
767767      }
768768   }
769769}
770770
771771
772772
773static void apple2gs_set_scanint(UINT8 data)
773static void apple2gs_set_scanint(running_machine *machine, UINT8 data)
774774{
775775   /* second interrupt */
776776   if ((apple2gs_vgcint & 0x40) && !(data & 0x40))
777777   {
778      apple2gs_remove_irq(IRQ_VGC_SECOND);
778      apple2gs_remove_irq(machine, IRQ_VGC_SECOND);
779779      apple2gs_vgcint &= ~0xC0;
780780   }
781781
782782   /* scanline interrupt */
783783   if ((apple2gs_vgcint & 0x20) && !(data & 0x20))
784784   {
785      apple2gs_remove_irq(IRQ_VGC_SCANLINE);
785      apple2gs_remove_irq(machine, IRQ_VGC_SCANLINE);
786786      apple2gs_vgcint &= ~0xA0;
787787   }
788788
r1980r1981
812812      if (scb & 0x40)
813813      {
814814         apple2gs_vgcint |= 0xa0;
815         apple2gs_add_irq(IRQ_VGC_SCANLINE);
815         apple2gs_add_irq(machine, IRQ_VGC_SCANLINE);
816816      }
817817   }
818818
r1980r1981
822822      if ((apple2gs_inten & 0x08) && !(apple2gs_intflag & 0x08))
823823      {
824824         apple2gs_intflag |= 0x08;
825         apple2gs_add_irq(IRQ_INTEN_VBL);
825         apple2gs_add_irq(machine, IRQ_INTEN_VBL);
826826      }
827827   }
828828
829829   /* check the mouse status */
830830   if ((scanline % 8) == 0)
831831   {
832      adb_check_mouse();
832      adb_check_mouse(machine);
833833
834834      /* call Apple II interrupt handler */
835835      if ((video_screen_get_vpos(0) % 8) == 7)
r1980r1981
979979         break;
980980
981981      case 0x24:   /* C024 - MOUSEDATA */
982         result = adb_read_mousedata();
982         result = adb_read_mousedata(machine);
983983         break;
984984
985985      case 0x25:   /* C025 - KEYMODREG */
r1980r1981
11531153         break;
11541154
11551155      case 0x32:   /* C032 - SCANINT */
1156         apple2gs_set_scanint(data);
1156         apple2gs_set_scanint(machine, data);
11571157         break;
11581158
11591159      case 0x33:   /* C033 - CLOCKDATA */
r1980r1981
11971197      case 0x41:   /* C041 - INTEN */
11981198         apple2gs_inten = data & 0x1F;
11991199         if ((apple2gs_inten & 0x10) == 0x00)
1200            apple2gs_remove_irq(IRQ_INTEN_QSECOND);
1200            apple2gs_remove_irq(machine, IRQ_INTEN_QSECOND);
12011201         if ((apple2gs_inten & 0x08) == 0x00)
1202            apple2gs_remove_irq(IRQ_INTEN_VBL);
1202            apple2gs_remove_irq(machine, IRQ_INTEN_VBL);
12031203         break;
12041204
12051205      case 0x47:   /* C047 - CLRVBLINT */
12061206         apple2gs_intflag &= ~0x18;
1207         apple2gs_remove_irq(IRQ_INTEN_QSECOND);
1208         apple2gs_remove_irq(IRQ_INTEN_VBL);
1207         apple2gs_remove_irq(machine, IRQ_INTEN_QSECOND);
1208         apple2gs_remove_irq(machine, IRQ_INTEN_VBL);
12091209         break;
12101210
12111211      case 0x68:   /* C068 - STATEREG */
src/mess/machine/apple3.c
r1980r1981
328328
329329
330330
331static void apple3_update_memory(void)
331static void apple3_update_memory(running_machine *machine)
332332{
333333   UINT16 bank;
334334   UINT8 page;
r1980r1981
338338      logerror("apple3_update_memory(): via_0_b=0x%02x via_1_a=0x0x%02x\n", via_0_b, via_1_a);
339339   }
340340
341   cpunum_set_clock(Machine, 0, (via_0_a & 0x80) ? 1000000 : 2000000);
341   cpunum_set_clock(machine, 0, (via_0_a & 0x80) ? 1000000 : 2000000);
342342
343343   /* bank 2 (0100-01FF) */
344344   if (!(via_0_a & 0x04))
r1980r1981
459459
460460
461461
462static void apple3_via_out(UINT8 *var, UINT8 data)
462static void apple3_via_out(running_machine *machine, UINT8 *var, UINT8 data)
463463{
464464   if (*var != data)
465465   {
466466      *var = data;
467      apple3_update_memory();
467      apple3_update_memory(machine);
468468   }
469469}
470470
r1980r1981
473473static READ8_HANDLER(apple3_via_1_in_a) { return ~0; }
474474static READ8_HANDLER(apple3_via_1_in_b) { return ~0; }
475475
476static WRITE8_HANDLER(apple3_via_0_out_a) { apple3_via_out(&via_0_a, data); }
477static WRITE8_HANDLER(apple3_via_0_out_b) { apple3_via_out(&via_0_b, data); }
478static WRITE8_HANDLER(apple3_via_1_out_a) { apple3_via_out(&via_1_a, data); }
479static WRITE8_HANDLER(apple3_via_1_out_b) { apple3_via_out(&via_1_b, data); }
476static WRITE8_HANDLER(apple3_via_0_out_a) { apple3_via_out(machine, &via_0_a, data); }
477static WRITE8_HANDLER(apple3_via_0_out_b) { apple3_via_out(machine, &via_0_b, data); }
478static WRITE8_HANDLER(apple3_via_1_out_a) { apple3_via_out(machine, &via_1_a, data); }
479static WRITE8_HANDLER(apple3_via_1_out_b) { apple3_via_out(machine, &via_1_b, data); }
480480
481481static void apple2_via_1_irq_func(int state)
482482{
r1980r1981
723723   via_0_a = ~0;
724724   via_1_a = ~0;
725725   via_1_irq = 0;
726   apple3_update_memory();
726   apple3_update_memory(machine);
727727
728728   memory_set_opbase_handler(0, apple3_opbase);
729729
src/mess/machine/mac.c
r1980r1981
138138
139139static int scc_interrupt, via_interrupt;
140140
141static void mac_field_interrupts(void)
141static void mac_field_interrupts(running_machine *machine)
142142{
143143   if (scc_interrupt)
144144      /* SCC interrupt */
145      cpunum_set_input_line(Machine, 0, 2, ASSERT_LINE);
145      cpunum_set_input_line(machine, 0, 2, ASSERT_LINE);
146146   else if (via_interrupt)
147147      /* VIA interrupt */
148      cpunum_set_input_line(Machine, 0, 1, ASSERT_LINE);
148      cpunum_set_input_line(machine, 0, 1, ASSERT_LINE);
149149   else
150150      /* clear all interrupts */
151      cpunum_set_input_line(Machine, 0, 7, CLEAR_LINE);
151      cpunum_set_input_line(machine, 0, 7, CLEAR_LINE);
152152}
153153
154static void set_scc_interrupt(int value)
154static void set_scc_interrupt(running_machine *machine, int value)
155155{
156156   scc_interrupt = value;
157   mac_field_interrupts();
157   mac_field_interrupts(machine);
158158}
159159
160static void set_via_interrupt(int value)
160static void set_via_interrupt(running_machine *machine, int value)
161161{
162162   via_interrupt = value;
163   mac_field_interrupts();
163   mac_field_interrupts(machine);
164164}
165165
166166
r1980r1981
557557
558558static int mouse_bit_x = 0, mouse_bit_y = 0;
559559
560static void mouse_callback(void)
560static void mouse_callback(running_machine *machine)
561561{
562562   static int   last_mx = 0, last_my = 0;
563563   static int   count_x = 0, count_y = 0;
r1980r1981
631631
632632   if (x_needs_update || y_needs_update)
633633      /* assert Port B External Interrupt on the SCC */
634      mac_scc_mouse_irq( x_needs_update, y_needs_update );
634      mac_scc_mouse_irq( machine, x_needs_update, y_needs_update );
635635}
636636
637637/* *************************************************************************
r1980r1981
716716
717717static void mac_scc_ack(void)
718718{
719   set_scc_interrupt(0);
719   set_scc_interrupt(Machine, 0);
720720}
721721
722722
723723
724void mac_scc_mouse_irq( int x, int y)
724void mac_scc_mouse_irq(running_machine *machine, int x, int y)
725725{
726726   static int last_was_x = 0;
727727
r1980r1981
743743   }
744744
745745   //cpunum_set_input_line(machine, 0, 2, ASSERT_LINE);
746   set_scc_interrupt(1);
746   set_scc_interrupt(machine, 1);
747747}
748748
749749
r1980r1981
12491249{
12501250   /* interrupt the 68k (level 1) */
12511251   //cpunum_set_input_line(machine, 0, 1, state);
1252   set_via_interrupt(state);
1252   set_via_interrupt(Machine, state);
12531253}
12541254
12551255READ16_HANDLER ( mac_via_r )
r1980r1981
14711471
14721472   /* check for mouse changes at 10 irqs per frame */
14731473   if (!(scanline % 10))
1474      mouse_callback();
1474      mouse_callback(machine);
14751475
14761476   timer_adjust_oneshot(mac_scanline_timer, video_screen_get_time_until_pos(0, (scanline+1) % MAC_V_TOTAL, 0), 0);
14771477
src/mess/machine/rp5c15.c
r1980r1981
6868*/
6969
7070#include "rp5c15.h"
71#include "deprecat.h"
7271
7372
7473static struct rp5c15 rtc;
r1980r1981
9998   }
10099}
101100
102void rp5c15_init(const struct rp5c15_interface* intf)
101void rp5c15_init(running_machine *machine, const struct rp5c15_interface* intf)
103102{
104103   mame_system_time systm;
105104   mame_system_tm time;
106105
107106   rtc.alarm_callback = intf->alarm_irq_callback;
108107
109   mame_get_base_datetime(Machine,&systm);
108   mame_get_base_datetime(machine,&systm);
110109   time = systm.local_time;
111110
112111   // date/time is stored as BCD
src/mess/machine/mc6850.c
r1980r1981
1111**********************************************************************/
1212
1313#include "driver.h"
14#include "deprecat.h"
1514#include "mc6850.h"
1615
1716struct acia6850
r1980r1981
3635{
3736}
3837
39int acia6850_read (int which, int offset)
38int acia6850_read (running_machine *machine, int which, int offset)
4039{
4140   struct acia6850 *currptr = acia + which;
4241   int   val = 0;
r1980r1981
4544   {
4645      case ACIA_6850_CTRL:
4746         if ((*(*currptr).intf).in_status_func)
48                     val = (*(*currptr).intf).in_status_func(Machine, 0);
47                     val = (*(*currptr).intf).in_status_func(machine, 0);
4948         break;
5049      case ACIA_6850_DATA:
5150         if ((*(*currptr).intf).in_recv_func)
52                     val = (*(*currptr).intf).in_recv_func(Machine, 0);
51                     val = (*(*currptr).intf).in_recv_func(machine, 0);
5352         break;
5453   }
5554   return (val);
5655}
5756
58void acia6850_write (int which, int offset, int data)
57void acia6850_write (running_machine *machine, int which, int offset, int data)
5958{
6059   struct acia6850 *currptr = acia + which;
6160
r1980r1981
6362   {
6463      case ACIA_6850_CTRL:
6564         if ((*(*currptr).intf).out_status_func)
66                     (*(*currptr).intf).out_status_func(Machine, 0, data);
65                     (*(*currptr).intf).out_status_func(machine, 0, data);
6766         break;
6867      case ACIA_6850_DATA:
6968         if ((*(*currptr).intf).out_tran_func)
70                     (*(*currptr).intf).out_tran_func(Machine, 0, data);
69                     (*(*currptr).intf).out_tran_func(machine, 0, data);
7170         break;
7271   }
7372}
7473
75 READ8_HANDLER( acia6850_0_r ) { return acia6850_read (0, offset); }
76 READ8_HANDLER( acia6850_1_r ) { return acia6850_read (1, offset); }
77 READ8_HANDLER( acia6850_2_r ) { return acia6850_read (2, offset); }
78 READ8_HANDLER( acia6850_3_r ) { return acia6850_read (3, offset); }
74 READ8_HANDLER( acia6850_0_r ) { return acia6850_read (machine, 0, offset); }
75 READ8_HANDLER( acia6850_1_r ) { return acia6850_read (machine, 1, offset); }
76 READ8_HANDLER( acia6850_2_r ) { return acia6850_read (machine, 2, offset); }
77 READ8_HANDLER( acia6850_3_r ) { return acia6850_read (machine, 3, offset); }
7978
80WRITE8_HANDLER( acia6850_0_w ) { acia6850_write (0, offset, data); }
81WRITE8_HANDLER( acia6850_1_w ) { acia6850_write (1, offset, data); }
82WRITE8_HANDLER( acia6850_2_w ) { acia6850_write (2, offset, data); }
83WRITE8_HANDLER( acia6850_3_w ) { acia6850_write (3, offset, data); }
79WRITE8_HANDLER( acia6850_0_w ) { acia6850_write (machine, 0, offset, data); }
80WRITE8_HANDLER( acia6850_1_w ) { acia6850_write (machine, 1, offset, data); }
81WRITE8_HANDLER( acia6850_2_w ) { acia6850_write (machine, 2, offset, data); }
82WRITE8_HANDLER( acia6850_3_w ) { acia6850_write (machine, 3, offset, data); }
8483
8584
8685
src/mess/machine/coco.c
r1980r1981
706706   COCO3_INT_ALL   = 0x3f
707707};
708708
709static void d_recalc_irq(void)
709static void d_recalc_irq(running_machine *machine)
710710{
711711   UINT8 pia0_irq_a = pia_get_irq_a(0);
712712   UINT8 pia0_irq_b = pia_get_irq_b(0);
713713
714714   if (pia0_irq_a || pia0_irq_b)
715      cpunum_set_input_line(Machine, 0, M6809_IRQ_LINE, ASSERT_LINE);
715      cpunum_set_input_line(machine, 0, M6809_IRQ_LINE, ASSERT_LINE);
716716   else
717      cpunum_set_input_line(Machine, 0, M6809_IRQ_LINE, CLEAR_LINE);
717      cpunum_set_input_line(machine, 0, M6809_IRQ_LINE, CLEAR_LINE);
718718}
719719
720static void d_recalc_firq(void)
720static void d_recalc_firq(running_machine *machine)
721721{
722722   UINT8 pia1_firq_a = pia_get_irq_a(1);
723723   UINT8 pia1_firq_b = pia_get_irq_b(1);
r1980r1981
725725   UINT8 pia2_firq_b = pia_get_irq_b(2);
726726
727727   if (pia1_firq_a || pia1_firq_b || pia2_firq_a || pia2_firq_b)
728      cpunum_set_input_line(Machine, 0, M6809_FIRQ_LINE, ASSERT_LINE);
728      cpunum_set_input_line(machine, 0, M6809_FIRQ_LINE, ASSERT_LINE);
729729   else
730      cpunum_set_input_line(Machine, 0, M6809_FIRQ_LINE, CLEAR_LINE);
730      cpunum_set_input_line(machine, 0, M6809_FIRQ_LINE, CLEAR_LINE);
731731}
732732
733static void coco3_recalc_irq(void)
733static void coco3_recalc_irq(running_machine *machine)
734734{
735735   if ((coco3_gimereg[0] & 0x20) && gime_irq)
736      cpunum_set_input_line(Machine, 0, M6809_IRQ_LINE, ASSERT_LINE);
736      cpunum_set_input_line(machine, 0, M6809_IRQ_LINE, ASSERT_LINE);
737737   else
738      d_recalc_irq();
738      d_recalc_irq(machine);
739739}
740740
741static void coco3_recalc_firq(void)
741static void coco3_recalc_firq(running_machine *machine)
742742{
743743   if ((coco3_gimereg[0] & 0x10) && gime_firq)
744      cpunum_set_input_line(Machine, 0, M6809_FIRQ_LINE, ASSERT_LINE);
744      cpunum_set_input_line(machine, 0, M6809_FIRQ_LINE, ASSERT_LINE);
745745   else
746      d_recalc_firq();
746      d_recalc_firq(machine);
747747}
748748
749749static void d_pia0_irq_a(int state)
750750{
751   d_recalc_irq();
751   d_recalc_irq(Machine);
752752}
753753
754754static void d_pia0_irq_b(int state)
755755{
756   d_recalc_irq();
756   d_recalc_irq(Machine);
757757}
758758
759759static void d_pia1_firq_a(int state)
760760{
761   d_recalc_firq();
761   d_recalc_firq(Machine);
762762}
763763
764764static void d_pia1_firq_b(int state)
765765{
766   d_recalc_firq();
766   d_recalc_firq(Machine);
767767}
768768
769769/* Dragon Alpha second PIA IRQ lines also cause FIRQ */
770770static void d_pia2_firq_a(int state)
771771{
772   d_recalc_firq();
772   d_recalc_firq(Machine);
773773}
774774
775775static void d_pia2_firq_b(int state)
776776{
777   d_recalc_firq();
777   d_recalc_firq(Machine);
778778}
779779
780780static void coco3_pia0_irq_a(int state)
781781{
782   coco3_recalc_irq();
782   coco3_recalc_irq(Machine);
783783}
784784
785785static void coco3_pia0_irq_b(int state)
786786{
787   coco3_recalc_irq();
787   coco3_recalc_irq(Machine);
788788}
789789
790790static void coco3_pia1_firq_a(int state)
791791{
792   coco3_recalc_firq();
792   coco3_recalc_firq(Machine);
793793}
794794
795795static void coco3_pia1_firq_b(int state)
796796{
797   coco3_recalc_firq();
797   coco3_recalc_firq(Machine);
798798}
799799
800static void coco3_raise_interrupt(UINT8 mask, int state)
800static void coco3_raise_interrupt(running_machine *machine, UINT8 mask, int state)
801801{
802802   int lowtohigh;
803803
r1980r1981
813813      if ((coco3_gimereg[0] & 0x20) && (coco3_gimereg[2] & mask))
814814      {
815815         gime_irq |= (coco3_gimereg[2] & mask);
816         coco3_recalc_irq();
816         coco3_recalc_irq(machine);
817817
818818         if (LOG_INT_COCO3)
819819            logerror("CoCo3 Interrupt: Raising IRQ; scanline=%i\n", video_screen_get_vpos(0));
r1980r1981
821821      if ((coco3_gimereg[0] & 0x10) && (coco3_gimereg[3] & mask))
822822      {
823823         gime_firq |= (coco3_gimereg[3] & mask);
824         coco3_recalc_firq();
824         coco3_recalc_firq(machine);
825825
826826         if (LOG_INT_COCO3)
827827            logerror("CoCo3 Interrupt: Raising FIRQ; scanline=%i\n", video_screen_get_vpos(0));
r1980r1981
834834void coco3_horizontal_sync_callback(int data)
835835{
836836   pia_0_ca1_w(Machine, 0, data);
837   coco3_raise_interrupt(COCO3_INT_HBORD, data);
837   coco3_raise_interrupt(Machine, COCO3_INT_HBORD, data);
838838}
839839
840840
r1980r1981
844844   pia_0_cb1_w(Machine, 0, data);
845845}
846846
847void coco3_gime_field_sync_callback(void)
847void coco3_gime_field_sync_callback(running_machine *machine)
848848{
849849   /* the CoCo 3 VBORD interrupt triggers right after the display */
850   coco3_raise_interrupt(COCO3_INT_VBORD, 1);
851   coco3_raise_interrupt(COCO3_INT_VBORD, 0);
850   coco3_raise_interrupt(machine, COCO3_INT_VBORD, 1);
851   coco3_raise_interrupt(machine, COCO3_INT_VBORD, 0);
852852}
853853
854854
r1980r1981
859859
860860static TIMER_CALLBACK(d_recalc_interrupts)
861861{
862   d_recalc_firq();
863   d_recalc_irq();
862   d_recalc_firq(machine);
863   d_recalc_irq(machine);
864864}
865865
866866static TIMER_CALLBACK(coco3_recalc_interrupts)
867867{
868   coco3_recalc_firq();
869   coco3_recalc_irq();
868   coco3_recalc_firq(machine);
869   coco3_recalc_irq(machine);
870870}
871871
872872static timer_fired_func recalc_interrupts;
873873
874void coco_set_halt_line(int halt_line)
874#ifdef UNUSED_FUNCTION
875void coco_set_halt_line(running_machine *machine, int halt_line)
875876{
876877   cpunum_set_input_line(Machine, 0, INPUT_LINE_HALT, halt_line);
877878   if (halt_line == CLEAR_LINE)
878879      timer_set(ATTOTIME_IN_CYCLES(1,0), NULL, 0, recalc_interrupts);
879880}
881#endif
880882
881
882883/***************************************************************************
883884   Input device abstractions
884885***************************************************************************/
r1980r1981
13361337   /* the CoCo 3 keyboard update routine must also check for the GIME EI1 interrupt */
13371338   UINT8 porta;
13381339   porta = coco_update_keyboard();
1339   coco3_raise_interrupt(COCO3_INT_EI1, ((porta & 0x7F) == 0x7F) ? CLEAR_LINE : ASSERT_LINE);
1340   coco3_raise_interrupt(Machine, COCO3_INT_EI1, ((porta & 0x7F) == 0x7F) ? CLEAR_LINE : ASSERT_LINE);
13401341   return porta;
13411342}
13421343
r1980r1981
20522053{
20532054   coco3_timer_reset();
20542055   coco3_vh_blink();
2055   coco3_raise_interrupt(COCO3_INT_TMR, 1);
2056   coco3_raise_interrupt(COCO3_INT_TMR, 0);
2056   coco3_raise_interrupt(machine, COCO3_INT_TMR, 1);
2057   coco3_raise_interrupt(machine, COCO3_INT_TMR, 0);
20572058}
20582059
20592060
r1980r1981
22722273      result = gime_irq;
22732274      if (result) {
22742275         gime_irq = 0;
2275         coco3_recalc_irq();
2276         coco3_recalc_irq(machine);
22762277      }
22772278      break;
22782279
r1980r1981
22802281      result = gime_firq;
22812282      if (result) {
22822283         gime_firq = 0;
2283         coco3_recalc_firq();
2284         coco3_recalc_firq(machine);
22842285      }
22852286      break;
22862287
r1980r1981
25962597static TIMER_CALLBACK(coco3_cart_timer_proc)
25972598{
25982599   int data = param;
2599   coco3_raise_interrupt(COCO3_INT_EI0, (data & 0x01) ? ASSERT_LINE : CLEAR_LINE);
2600   coco3_raise_interrupt(machine, COCO3_INT_EI0, (data & 0x01) ? ASSERT_LINE : CLEAR_LINE);
26002601   coco_cart_timer_w(machine, data);
26012602}
26022603
src/mess/machine/rp5c15.h
r1980r1981
5454   void (*alarm_callback)(int state);
5555};  //  Ricoh RP5C15
5656
57void rp5c15_init(const struct rp5c15_interface*);
57void rp5c15_init(running_machine *machine, const struct rp5c15_interface*);
5858
5959void rtc_add_second(void);
6060void rtc_add_minute(void);
src/mess/machine/nes.c
r1980r1981
199199
200200
201201
202static int zapper_hit_pixel(const nes_input *input)
202static int zapper_hit_pixel(running_machine *machine, const nes_input *input)
203203{
204204   UINT16 pix = 0;
205205   rgb_t col;
r1980r1981
209209   if (nes_zapper_hack)
210210      pix = *BITMAP_ADDR16(nes_zapper_hack, input->i2, input->i1);
211211
212   col = palette_get_color(Machine, pix);
212   col = palette_get_color(machine, pix);
213213   r = (UINT8) (col >> 16);
214214   g = (UINT8) (col >> 8);
215215   b = (UINT8) (col >> 0);
r1980r1981
239239      retVal |= ((in_0.i0 & 0x01) << 4);
240240
241241      /* Look at the screen and see if the cursor is over a bright pixel */
242      if (zapper_hit_pixel(&in_0))
242      if (zapper_hit_pixel(machine, &in_0))
243243         retVal &= ~0x08; /* sprite hit */
244244      else
245245         retVal |= 0x08;  /* no sprite hit */
r1980r1981
274274      retVal |= ((in_1.i0 & 0x01) << 4);
275275
276276      /* Look at the screen and see if the cursor is over a bright pixel */
277      if (zapper_hit_pixel(&in_1))
277      if (zapper_hit_pixel(machine, &in_1))
278278         retVal &= ~0x08; /* sprite hit */
279279      else
280280         retVal |= 0x08;  /* no sprite hit */
src/mess/machine/mc6850.h
r1980r1981
3535void acia6850_unconfig(void);
3636void acia6850_config_old( int which, const struct acia6850_interface *intf);
3737void acia6850_reset(void);
38int acia6850_read( int which, int offset);
39void acia6850_write( int which, int offset, int data);
38int acia6850_read(running_machine *machine, int which, int offset);
39void acia6850_write(running_machine *machine, int which, int offset, int data);
4040
4141 READ8_HANDLER( acia6850_0_r );
4242 READ8_HANDLER( acia6850_1_r );
src/mess/machine/gb.c
r1980r1981
154154static WRITE8_HANDLER( gb_rom_bank_select_mbc1_kor );
155155static WRITE8_HANDLER( gb_ram_bank_select_mbc1_kor );
156156static WRITE8_HANDLER( gb_mem_mode_select_mbc1_kor );
157static void gb_timer_increment( void );
157static void gb_timer_increment( running_machine *machine );
158158
159159#ifdef MAME_DEBUG
160160/* #define V_GENERAL*/      /* Display general debug information */
r1980r1981
781781   case 0x04:                  /* DIV - Divider register */
782782      /* Force increment of TIMECNT register */
783783      if ( gb_timer.divcount >= 16 )
784         gb_timer_increment();
784         gb_timer_increment(machine);
785785      gb_timer.divcount = 0;
786786      return;
787787   case 0x05:                  /* TIMA - Timer counter */
r1980r1981
802802      if ( ( ! ( data & 0x04 ) && ( TIMEFRQ & 0x04 ) ) || ( ( data & 0x04 ) && ( TIMEFRQ & 0x04 ) && ( data & 0x03 ) != ( TIMEFRQ & 0x03 ) ) ) {
803803         /* Check if TIMECNT should be incremented */
804804         if ( ( gb_timer.divcount & ( gb_timer.shift_cycles - 1 ) ) >= ( gb_timer.shift_cycles >> 1 ) ) {
805            gb_timer_increment();
805            gb_timer_increment(machine);
806806         }
807807      }
808808      gb_timer.shift = timer_shifts[data & 0x03];
r1980r1981
18231823   }
18241824}
18251825
1826INLINE void gb_timer_check_irq( void ) {
1826INLINE void gb_timer_check_irq( running_machine *machine ) {
18271827   gb_timer.reloading = 0;
18281828   if ( gb_timer.triggering_irq ) {
18291829      gb_timer.triggering_irq = 0;
18301830      if ( TIMECNT == 0 ) {
18311831         TIMECNT = TIMEMOD;
1832         cpunum_set_input_line(Machine, 0, TIM_INT, HOLD_LINE );
1832         cpunum_set_input_line(machine, 0, TIM_INT, HOLD_LINE );
18331833         gb_timer.reloading = 1;
18341834      }
18351835   }
18361836}
18371837
1838static void gb_timer_increment( void ) {
1839   gb_timer_check_irq();
1838static void gb_timer_increment( running_machine *machine ) {
1839   gb_timer_check_irq(machine);
18401840
18411841   TIMECNT += 1;
18421842   if ( TIMECNT == 0 ) {
r1980r1981
18481848   UINT16 old_gb_divcount = gb_timer.divcount;
18491849   gb_timer.divcount += cycles;
18501850
1851   gb_timer_check_irq();
1851   gb_timer_check_irq(Machine);
18521852
18531853   if ( TIMEFRQ & 0x04 ) {
18541854      UINT16 old_count = old_gb_divcount >> gb_timer.shift;
18551855      UINT16 new_count = gb_timer.divcount >> gb_timer.shift;
18561856      if ( cycles > gb_timer.shift_cycles ) {
1857         gb_timer_increment();
1857         gb_timer_increment(Machine);
18581858         old_count++;
18591859      }
18601860      if ( new_count != old_count ) {
1861         gb_timer_increment();
1861         gb_timer_increment(Machine);
18621862      }
18631863      if ( new_count << gb_timer.shift < gb_timer.divcount ) {
1864         gb_timer_check_irq();
1864         gb_timer_check_irq(Machine);
18651865      }
18661866   }
18671867}
src/mess/machine/concept.c
r1980r1981
8282   write8_machine_func rom_write;
8383} expansion_slots[4];
8484
85static void concept_fdc_init(int slot);
85static void concept_fdc_init(running_machine *machine, int slot);
8686static void concept_hdc_init(int slot);
8787
8888MACHINE_START(concept)
r1980r1981
9797
9898   /* initialize clock interface */
9999   clock_enable = 0/*1*/;
100   mm58274c_init(0, 0);
100   mm58274c_init(machine, 0, 0);
101101
102102   /* clear keyboard interface state */
103103   KeyQueueHead = KeyQueueLen = 0;
r1980r1981
107107   memset(expansion_slots, 0, sizeof(expansion_slots));
108108
109109   concept_hdc_init(1);   /* Flat cable Hard Disk Controller in Slot 2 */
110   concept_fdc_init(2);   /* Floppy Disk Controller in Slot 3 */
110   concept_fdc_init(machine, 2);   /* Floppy Disk Controller in Slot 3 */
111111}
112112
113113static void install_expansion_slot(int slot,
r1980r1981
142142   return 0;
143143}
144144
145static void concept_set_interrupt(int level, int state)
145static void concept_set_interrupt(running_machine *machine, int level, int state)
146146{
147147   int interrupt_mask;
148148   int final_level;
r1980r1981
157157
158158   if (final_level)
159159      /* assert interrupt */
160      cpunum_set_input_line_and_vector(Machine, 0, M68K_IRQ_1+final_level-1, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
160      cpunum_set_input_line_and_vector(machine, 0, M68K_IRQ_1+final_level-1, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
161161   else
162162      /* clear all interrupts */
163      cpunum_set_input_line_and_vector(Machine, 0, M68K_IRQ_1, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR);
163      cpunum_set_input_line_and_vector(machine, 0, M68K_IRQ_1, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR);
164164}
165165
166166INLINE void post_in_KeyQueue(int keycode)
r1980r1981
169169   KeyQueueLen++;
170170}
171171
172static void poll_keyboard(void)
172static void poll_keyboard(running_machine *machine)
173173{
174174   UINT32 keystate;
175175   UINT32 key_transitions;
r1980r1981
201201                  KeyStateSave[i] &= ~ (1 << j);
202202
203203               post_in_KeyQueue(keycode);
204               concept_set_interrupt(KEYINT_level, 1);
204               concept_set_interrupt(machine, KEYINT_level, 1);
205205            }
206206         }
207207      }
r1980r1981
210210
211211INTERRUPT_GEN( concept_interrupt )
212212{
213   poll_keyboard();
213   poll_keyboard(machine);
214214}
215215
216216/*
r1980r1981
276276*/
277277static void via_irq_func(int state)
278278{
279   concept_set_interrupt(TIMINT_level, state);
279   concept_set_interrupt(Machine, TIMINT_level, state);
280280}
281281
282282READ16_HANDLER(concept_io_r)
r1980r1981
362362            }
363363
364364            if (!KeyQueueLen)
365               concept_set_interrupt(KEYINT_level, 0);
365               concept_set_interrupt(machine, KEYINT_level, 0);
366366
367367            return reply;
368368
r1980r1981
574574static WRITE8_HANDLER(concept_fdc_reg_w);
575575static  READ8_HANDLER(concept_fdc_rom_r);
576576
577static void concept_fdc_init(int slot)
577static void concept_fdc_init(running_machine *machine, int slot)
578578{
579579   fdc_local_status = 0;
580580   fdc_local_command = 0;
581581
582   wd17xx_init(Machine, WD_TYPE_179X, fdc_callback, NULL);
582   wd17xx_init(machine, WD_TYPE_179X, fdc_callback, NULL);
583583
584584   install_expansion_slot(slot, concept_fdc_reg_r, concept_fdc_reg_w, concept_fdc_rom_r, NULL);
585585}
src/mess/machine/99_dsk.c
r1980r1981
408408   motor_on_timer = timer_alloc(motor_on_timer_callback, NULL);
409409   
410410   /* initialize the RTC for BwG and HFDC */
411   mm58274c_init(1, 1);
411   mm58274c_init(machine, 1, 1);
412412}
413413
414414/*===========================================================================*/
src/mess/machine/msx.c
r1980r1981
332332
333333static const struct tc8521_interface tc = { NULL };
334334
335static void msx_init(void)
335static void msx_init(running_machine *machine)
336336{
337337   int i, n;
338338
r1980r1981
349349      msx1.cart_state[i] = cart_state[i];
350350   }
351351
352   wd17xx_init (Machine, WD_TYPE_179X, msx_wd179x_int, NULL);
352   wd17xx_init (machine, WD_TYPE_179X, msx_wd179x_int, NULL);
353353   wd17xx_set_density (DEN_FM_HI);
354354   msx1.dsk_stat = 0x7f;
355355
356356   cpunum_set_input_line_vector (0, 0, 0xff);
357357   ppi8255_init (&msx_ppi8255_interface);
358358
359   msx_memory_init ();
359   msx_memory_init (machine);
360360
361361   /* adjust z80 cycles for the M1 wait state */
362362   for (i = 0; i < sizeof(z80_cycle_table) / sizeof(z80_cycle_table[0]); i++)
r1980r1981
390390
391391DRIVER_INIT( msx )
392392{
393   msx_init();
393   msx_init(machine);
394394}
395395
396396DRIVER_INIT( msx2 )
397397{
398   msx_init();
398   msx_init(machine);
399399   tc8521_init (&tc);
400400}
401401
r1980r1981
745745 *
746746 ***********************************************************************/
747747
748void msx_memory_init (void)
748void msx_memory_init (running_machine *machine)
749749{
750750   int   prim, sec, page, extent, option;
751751   int size = 0;
r1980r1981
767767   }
768768
769769   for (driver = msx_driver_list; driver->name[0]; driver++) {
770      if (!strcmp (driver->name, Machine->gamedrv->name)) {
770      if (!strcmp (driver->name, machine->gamedrv->name)) {
771771         layout = driver->layout;
772772      }
773773   }
src/mess/machine/ins8154.c
r1980r1981
1111 ****************************************************************************/
1212
1313#include "driver.h"
14#include "deprecat.h"
1514#include "ins8154.h"
1615
1716#define MAX_INS8154   2
r1980r1981
4948
5049
5150/* Config */
52void ins8154_config(int which, const ins8154_interface *intf)
51void ins8154_config(running_machine *machine, int which, const ins8154_interface *intf)
5352{
54   assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT,
53   assert_always(mame_get_phase(machine) == MAME_PHASE_INIT,
5554      "Can only call ins8154_config at init time!");
5655   assert_always(which < MAX_INS8154,
5756      "'which' exceeds maximum number of configured INS8154s!");
r1980r1981
7776}
7877
7978
80static UINT8 ins8154_read(int which, offs_t offset)
79static UINT8 ins8154_read(running_machine *machine, int which, offs_t offset)
8180{
8281   ins8154_state *i = &ins8154[which];
8382   UINT8 val = 0xff;
r1980r1981
9392   {
9493   case 0x20:
9594      if (i->intf->in_a_func)
96         val = i->intf->in_a_func(Machine, 0);
95         val = i->intf->in_a_func(machine, 0);
9796      i->in_a = val;
9897      break;
9998     
10099   case 0x21:
101100      if (i->intf->in_b_func)
102         val = i->intf->in_b_func(Machine, 0);
101         val = i->intf->in_b_func(machine, 0);
103102      i->in_b = val;
104103      break;
105104     
r1980r1981
107106      if (offset < 0x08)
108107      {
109108         if (i->intf->in_a_func)
110            val = (i->intf->in_a_func(Machine, 0) << (8 - offset)) & 0x80;
109            val = (i->intf->in_a_func(machine, 0) << (8 - offset)) & 0x80;
111110         i->in_a = val;
112111      }
113112      else
114113      {
115114         if (i->intf->in_a_func)
116            val = (i->intf->in_a_func(Machine, 0) << (8 - (offset >> 4))) & 0x80;
115            val = (i->intf->in_a_func(machine, 0) << (8 - (offset >> 4))) & 0x80;
117116         i->in_b = val;
118117      }
119118      break;
r1980r1981
123122}
124123
125124
126static void ins8154_write_port_a(int which, int data)
125static void ins8154_write_port_a(running_machine *machine, int which, int data)
127126{
128127   ins8154_state *i = &ins8154[which];
129128   
r1980r1981
133132   if (i->odra)
134133   {
135134      if (i->intf->out_a_func)
136         i->intf->out_a_func(Machine, 0, (data & i->odra) | (i->odra ^ 0xff));
135         i->intf->out_a_func(machine, 0, (data & i->odra) | (i->odra ^ 0xff));
137136      else
138137         logerror("INS8154 chip #%d (%08x): Write to port A but no write handler defined!\n",
139138            which, safe_activecpu_get_pc());
r1980r1981
141140}
142141
143142
144static void ins8154_write_port_b(int which, int data)
143static void ins8154_write_port_b(running_machine *machine, int which, int data)
145144{
146145   ins8154_state *i = &ins8154[which];
147146   
r1980r1981
151150   if (i->odrb)
152151   {
153152      if (i->intf->out_b_func)
154         i->intf->out_b_func(Machine, 0, (data & i->odrb) | (i->odrb ^ 0xff));
153         i->intf->out_b_func(machine, 0, (data & i->odrb) | (i->odrb ^ 0xff));
155154      else
156155         logerror("INS8154 chip #%d (%08x): Write to port B but no write handler defined!\n",
157156            which, safe_activecpu_get_pc());
r1980r1981
159158}
160159
161160
162static void ins8154_write(int which, offs_t offset, UINT8 data)
161static void ins8154_write(running_machine *machine, int which, offs_t offset, UINT8 data)
163162{
164163   ins8154_state *i = &ins8154[which];
165164   
r1980r1981
173172   switch (offset)
174173   {
175174   case 0x20:
176      ins8154_write_port_a(which, data);
175      ins8154_write_port_a(machine, which, data);
177176      break;
178177     
179178   case 0x21:
180      ins8154_write_port_b(which, data);
179      ins8154_write_port_b(machine, which, data);
181180      break;
182181     
183182   case 0x22:
r1980r1981
204203         /* Set bit */
205204         if (offset < 0x08)
206205         {
207            ins8154_write_port_a(which, i->out_a |= offset & 0x07);
206            ins8154_write_port_a(machine, which, i->out_a |= offset & 0x07);
208207         }
209208         else
210209         {
211            ins8154_write_port_b(which, i->out_b |= (offset >> 4) & 0x07);
210            ins8154_write_port_b(machine, which, i->out_b |= (offset >> 4) & 0x07);
212211         }
213212      }
214213      else
r1980r1981
216215         /* Clear bit */
217216         if (offset < 0x08)
218217         {
219            ins8154_write_port_a(which, i->out_a & ~(offset & 0x07));
218            ins8154_write_port_a(machine, which, i->out_a & ~(offset & 0x07));
220219         }
221220         else
222221         {
223            ins8154_write_port_b(which, i->out_b & ~((offset >> 4) & 0x07));
224         }         
222            ins8154_write_port_b(machine, which, i->out_b & ~((offset >> 4) & 0x07));
223         }
225224      }
226225     
227226      break;
r1980r1981
232231
233232/******************* Standard 8-bit CPU interfaces, D0-D7 *******************/
234233
235WRITE8_HANDLER( ins8154_0_w ) {   ins8154_write(0, offset, data); }
236WRITE8_HANDLER( ins8154_1_w ) {   ins8154_write(1, offset, data); }
234WRITE8_HANDLER( ins8154_0_w ) {   ins8154_write(machine, 0, offset, data); }
235WRITE8_HANDLER( ins8154_1_w ) {   ins8154_write(machine, 1, offset, data); }
237236
238READ8_HANDLER( ins8154_0_r ) { return ins8154_read(0, offset); }
239READ8_HANDLER( ins8154_1_r ) { return ins8154_read(1, offset); }
237READ8_HANDLER( ins8154_0_r ) { return ins8154_read(machine, 0, offset); }
238READ8_HANDLER( ins8154_1_r ) { return ins8154_read(machine, 1, offset); }
src/mess/machine/ti990.c
r1980r1981
1818   intlines = 0;
1919}
2020
21void ti990_set_int_line(int line, int state)
21void ti990_set_int_line(running_machine *machine, int line, int state)
2222{
2323   int level;
2424
r1980r1981
3232   {
3333      for (level = 0; ! (intlines & (1 << level)); level++)
3434         ;
35      cpunum_set_input_line_and_vector(Machine, 0, 0, ASSERT_LINE, level);   /* interrupt it, baby */
35      cpunum_set_input_line_and_vector(machine, 0, 0, ASSERT_LINE, level);   /* interrupt it, baby */
3636   }
3737   else
38      cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE);
38      cpunum_set_input_line(machine, 0, 0, CLEAR_LINE);
3939}
4040
4141void ti990_set_int2(int state)
4242{
43   ti990_set_int_line(2, state);
43   ti990_set_int_line(Machine, 2, state);
4444}
4545
4646void ti990_set_int3(int state)
4747{
48   ti990_set_int_line(3, state);
48   ti990_set_int_line(Machine, 3, state);
4949}
5050
5151void ti990_set_int6(int state)
5252{
53   ti990_set_int_line(6, state);
53   ti990_set_int_line(Machine, 6, state);
5454}
5555
5656void ti990_set_int7(int state)
5757{
58   ti990_set_int_line(7, state);
58   ti990_set_int_line(Machine, 7, state);
5959}
6060
6161void ti990_set_int9(int state)
6262{
63   ti990_set_int_line(9, state);
63   ti990_set_int_line(Machine, 9, state);
6464}
6565
6666void ti990_set_int10(int state)
6767{
68   ti990_set_int_line(10, state);
68   ti990_set_int_line(Machine, 10, state);
6969}
7070
7171void ti990_set_int13(int state)
7272{
73   ti990_set_int_line(13, state);
73   ti990_set_int_line(Machine, 13, state);
7474}
7575
7676/*
r1980r1981
9999void ti990_line_interrupt(void)
100100{
101101   if (ckon_state)
102      ti990_set_int_line(5, 1);
102      ti990_set_int_line(Machine, 5, 1);
103103}
104104
105105void ti990_ckon_ckof_callback(int state)
106106{
107107   ckon_state = state;
108108   if (! ckon_state)
109      ti990_set_int_line(5, 0);
109      ti990_set_int_line(Machine, 5, 0);
110110}
111111
112112
src/mess/machine/ins8154.h
r1980r1981
2525
2626/******************* Configuration ******************************************/
2727
28void ins8154_config(int which, const ins8154_interface *intf);
28void ins8154_config(running_machine *machine, int which, const ins8154_interface *intf);
2929void ins8154_reset(int which);
3030
3131
src/mess/machine/aim65.c
r1980r1981
7979   dl1416_write(chip, pia_a & 0x03, pia_b & 0x7f);
8080}
8181
82static void aim65_pia(void)
82static void aim65_pia(running_machine *machine)
8383{
84   dl1416_update(devtag_get_token(Machine, DL1416, "ds1"), 0);
85   dl1416_update(devtag_get_token(Machine, DL1416, "ds2"), 1);
86   dl1416_update(devtag_get_token(Machine, DL1416, "ds3"), 2);
87   dl1416_update(devtag_get_token(Machine, DL1416, "ds4"), 3);
88   dl1416_update(devtag_get_token(Machine, DL1416, "ds5"), 4);
84   dl1416_update(devtag_get_token(machine, DL1416, "ds1"), 0);
85   dl1416_update(devtag_get_token(machine, DL1416, "ds2"), 1);
86   dl1416_update(devtag_get_token(machine, DL1416, "ds3"), 2);
87   dl1416_update(devtag_get_token(machine, DL1416, "ds4"), 3);
88   dl1416_update(devtag_get_token(machine, DL1416, "ds5"), 4);
8989}
9090
9191
9292static WRITE8_HANDLER( aim65_pia_a_w )
9393{
9494   pia_a = data;
95   aim65_pia();
95   aim65_pia(machine);
9696}
9797
9898
9999static WRITE8_HANDLER( aim65_pia_b_w )
100100{
101101   pia_b = data;
102   aim65_pia();
102   aim65_pia(machine);
103103}
104104
105105
src/mess/machine/ti990.h
r1980r1981
33*/
44
55void ti990_reset_int(void);
6void ti990_set_int_line(int line, int state);
6void ti990_set_int_line(running_machine *machine, int line, int state);
77void ti990_set_int2(int state);
88void ti990_set_int3(int state);
99void ti990_set_int6(int state);
src/mess/machine/vc1541.c
r1980r1981
959959ADDRESS_MAP_END
960960
961961
962static void c1551x_write_data (TPI6525 *This, int data)
962static void c1551x_write_data (running_machine *machine, TPI6525 *This, int data)
963963{
964964   DBG_LOG(1, "c1551 cpu", ("%d write data %.2x\n",
965965                   cpu_getactivecpu (), data));
966966#ifdef CPU_SYNC
967967   cpu_sync();
968968#endif
969   tpi6525_0_port_a_w(Machine, 0,data);
969   tpi6525_0_port_a_w(machine, 0,data);
970970}
971971
972static int c1551x_read_data (TPI6525 *This)
972static int c1551x_read_data (running_machine *machine, TPI6525 *This)
973973{
974974   int data=0xff;
975975#ifdef CPU_SYNC
976976   cpu_sync ();
977977#endif
978   data=tpi6525_0_port_a_r(Machine, 0);
978   data=tpi6525_0_port_a_r(machine, 0);
979979   DBG_LOG(2, "c1551 cpu",("%d read data %.2x\n",
980980                   cpu_getactivecpu (), data));
981981   return data;
982982}
983983
984static void c1551x_write_handshake (TPI6525 *This, int data)
984static void c1551x_write_handshake (running_machine *machine, TPI6525 *This, int data)
985985{
986986   DBG_LOG(1, "c1551 cpu",("%d write handshake %.2x\n",
987987                   cpu_getactivecpu (), data));
988988#ifdef CPU_SYNC
989989   cpu_sync();
990990#endif
991   tpi6525_0_port_c_w(Machine, 0,data&0x40?0xff:0x7f);
991   tpi6525_0_port_c_w(machine, 0,data&0x40?0xff:0x7f);
992992}
993993
994static int c1551x_read_handshake (TPI6525 *This)
994static int c1551x_read_handshake (running_machine *machine, TPI6525 *This)
995995{
996996   int data=0xff;
997997#ifdef CPU_SYNC
998998   cpu_sync();
999999#endif
1000   data=tpi6525_0_port_c_r(Machine, 0)&8?0x80:0;
1000   data=tpi6525_0_port_c_r(machine, 0)&8?0x80:0;
10011001   DBG_LOG(2, "c1551 cpu",("%d read handshake %.2x\n",
10021002                   cpu_getactivecpu (), data));
10031003   return data;
10041004}
10051005
1006static int c1551x_read_status (TPI6525 *This)
1006static int c1551x_read_status (running_machine *machine, TPI6525 *This)
10071007{
10081008   int data=0xff;
10091009#ifdef CPU_SYNC
10101010   cpu_sync();
10111011#endif
1012   data=tpi6525_0_port_c_r(Machine, 0)&3;
1012   data=tpi6525_0_port_c_r(machine, 0)&3;
10131013   DBG_LOG(1, "c1551 cpu",("%d read status %.2x\n",
10141014                   cpu_getactivecpu (), data));
10151015   return data;
r1980r1981
10171017
10181018void c1551x_0_write_data (int data)
10191019{
1020   c1551x_write_data(tpi6525, data);
1020   c1551x_write_data(Machine, tpi6525, data);
10211021}
10221022
10231023int c1551x_0_read_data (void)
10241024{
1025   return c1551x_read_data(tpi6525);
1025   return c1551x_read_data(Machine, tpi6525);
10261026}
10271027
10281028void c1551x_0_write_handshake (int data)
10291029{
1030   c1551x_write_handshake(tpi6525, data);
1030   c1551x_write_handshake(Machine, tpi6525, data);
10311031}
10321032
10331033int c1551x_0_read_handshake (void)
10341034{
1035   return c1551x_read_handshake(tpi6525);
1035   return c1551x_read_handshake(Machine, tpi6525);
10361036}
10371037
10381038int c1551x_0_read_status (void)
10391039{
1040   return c1551x_read_status(tpi6525);
1040   return c1551x_read_status(Machine, tpi6525);
10411041}
10421042
10431043MACHINE_DRIVER_START( cpu_vc1540 )
src/mess/machine/mc6846.c
r1980r1981
1919**********************************************************************/
2020
2121#include "driver.h"
22#include "deprecat.h"
2322#include "mc6846.h"
2423
2524#define VERBOSE 0
r1980r1981
501500
502501
503502
504UINT8 mc6846_get_output_port ( void )
503UINT8 mc6846_get_output_port ( running_machine *machine )
505504{
506   running_machine *machine = Machine;
507505   return PORT;
508506}
509507
src/mess/machine/thomson.c
r1980r1981
5757
5858
5959
60static void thom_set_irq ( int line, int state )
60static void thom_set_irq ( running_machine *machine, int line, int state )
6161{
6262   int old = thom_irq;
6363
r1980r1981
7171   if ( old && !thom_irq )
7272      LOG_IRQ(( "%f thom_set_irq: irq line down %i\n", attotime_to_double(timer_get_time()), line ));
7373
74   cpunum_set_input_line(Machine, 0, M6809_IRQ_LINE, thom_irq ? ASSERT_LINE : CLEAR_LINE );
74   cpunum_set_input_line(machine, 0, M6809_IRQ_LINE, thom_irq ? ASSERT_LINE : CLEAR_LINE );
7575}
7676
7777
7878
79static void thom_set_firq ( int line, int state )
79static void thom_set_firq ( running_machine *machine, int line, int state )
8080{
8181   int old = thom_irq;
8282
r1980r1981
9090   if ( old && !thom_firq )
9191      LOG_IRQ(( "%f thom_set_firq: firq line down %i\n", attotime_to_double(timer_get_time()), line ));
9292
93   cpunum_set_input_line(Machine, 0, M6809_FIRQ_LINE, thom_firq ? ASSERT_LINE : CLEAR_LINE );
93   cpunum_set_input_line(machine, 0, M6809_FIRQ_LINE, thom_firq ? ASSERT_LINE : CLEAR_LINE );
9494}
9595
9696
9797
98static void thom_irq_reset ( void )
98static void thom_irq_reset ( running_machine *machine )
9999{
100100   thom_irq = 0;
101101   thom_firq = 0;
102   cpunum_set_input_line(Machine, 0, M6809_IRQ_LINE, CLEAR_LINE );
103   cpunum_set_input_line(Machine, 0, M6809_FIRQ_LINE, CLEAR_LINE );
102   cpunum_set_input_line(machine, 0, M6809_IRQ_LINE, CLEAR_LINE );
103   cpunum_set_input_line(machine, 0, M6809_FIRQ_LINE, CLEAR_LINE );
104104}
105105
106106
r1980r1981
115115
116116static void thom_irq_0  ( int state )
117117{
118   thom_set_irq  ( 0, state );
118   thom_set_irq  ( Machine, 0, state );
119119}
120120
121121static void thom_irq_1  ( int state )
122122{
123   thom_set_irq  ( 1, state );
123   thom_set_irq  ( Machine, 1, state );
124124}
125125
126126static void thom_irq_3  ( int state )
127127{
128   thom_set_irq  ( 3, state );
128   thom_set_irq  ( Machine, 3, state );
129129}
130130
131131static void thom_firq_1 ( int state )
132132{
133   thom_set_firq ( 1, state );
133   thom_set_firq ( Machine, 1, state );
134134}
135135
136136static void thom_firq_2 ( int state )
137137{
138   thom_set_firq ( 2, state );
138   thom_set_firq ( Machine, 2, state );
139139}
140140
141141#ifdef CHARDEV
142142static void thom_irq_4  ( int state )
143143{
144   thom_set_irq  ( 4, state );
144   thom_set_irq  ( Machine, 4, state );
145145}
146146#endif
147147
r1980r1981
12531253   LOG (( "to7: machine reset called\n" ));
12541254
12551255   /* subsystems */
1256   thom_irq_reset();
1256   thom_irq_reset(machine);
12571257   pia_reset();
12581258   mc6846_reset();
12591259   to7_game_reset();
r1980r1981
14851485   LOG (( "to770: machine reset called\n" ));
14861486
14871487   /* subsystems */
1488   thom_irq_reset();
1488   thom_irq_reset(machine);
14891489   pia_reset();
14901490   mc6846_reset();
14911491   to7_game_reset();
r1980r1981
18331833   LOG (( "mo5: machine reset called\n" ));
18341834
18351835   /* subsystems */
1836   thom_irq_reset();
1836   thom_irq_reset(machine);
18371837   pia_reset();
18381838   pia_set_port_a_z_mask( THOM_PIA_SYS, 0x5f );
18391839   to7_game_reset();
r1980r1981
21072107{
21082108   static int old_bank = -1;
21092109   int bank = 0;
2110   int slot = ( mc6846_get_output_port() >> 4 ) & 3; /* bits 4-5: ROM bank */
2110   int slot = ( mc6846_get_output_port(Machine) >> 4 ) & 3; /* bits 4-5: ROM bank */
21112111
21122112   /* reset cartridge read handler */
21132113   memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0003, 0, 0, (read8_machine_func)(STATIC_BANK1 + THOM_CART_BANK - 1) );
r1980r1981
21532153/* write signal to 0000-1fff generates a bank switch */
21542154WRITE8_HANDLER ( to9_cartridge_w )
21552155{
2156   int slot = ( mc6846_get_output_port() >> 4 ) & 3; /* bits 4-5: ROM bank */
2156   int slot = ( mc6846_get_output_port(machine) >> 4 ) & 3; /* bits 4-5: ROM bank */
21572157
21582158   if ( offset >= 0x2000 )
21592159      return;
r1980r1981
21822182static void to9_update_ram_bank ( void )
21832183{
21842184   static int old_bank = -1;
2185   UINT8 port = mc6846_get_output_port();
2185   UINT8 port = mc6846_get_output_port(Machine);
21862186   UINT8 portb = pia_get_port_b_z_mask( THOM_PIA_SYS );
21872187   UINT8 disk = ((port >> 2) & 1) | ((port >> 5) & 2); /* bits 6,2: RAM bank */
21882188   int bank;
r1980r1981
27702770   LOG (( "to9: machine reset called\n" ));
27712771
27722772   /* subsystems */
2773   thom_irq_reset();
2773   thom_irq_reset(machine);
27742774   pia_reset();
27752775   pia_set_port_a_z_mask( THOM_PIA_SYS, 0xfe );
27762776   mc6846_reset();
r1980r1981
36953695   LOG (( "to8: machine reset called\n" ));
36963696
36973697   /* subsystems */
3698   thom_irq_reset();
3698   thom_irq_reset(machine);
36993699   pia_reset();
37003700   pia_set_port_a_z_mask( THOM_PIA_SYS, 0xfe );
37013701   mc6846_reset();
r1980r1981
38573857   LOG (( "to9p: machine reset called\n" ));
38583858
38593859   /* subsystems */
3860   thom_irq_reset();
3860   thom_irq_reset(machine);
38613861   pia_reset();
38623862   pia_set_port_a_z_mask( THOM_PIA_SYS, 0xfe );
38633863   mc6846_reset();
r1980r1981
44304430   LOG (( "mo6: machine reset called\n" ));
44314431
44324432   /* subsystems */
4433   thom_irq_reset();
4433   thom_irq_reset(machine);
44344434   pia_reset();
44354435   pia_set_port_a_z_mask( THOM_PIA_SYS, 0x75 );
44364436   mo6_game_reset();
r1980r1981
46974697   LOG (( "mo5nr: machine reset called\n" ));
46984698
46994699   /* subsystems */
4700   thom_irq_reset();
4700   thom_irq_reset(machine);
47014701   pia_reset();
47024702   pia_set_port_a_z_mask( THOM_PIA_SYS, 0x65 );
47034703   mo5nr_game_reset();
src/mess/machine/lisa.c
r1980r1981
216216   Interrupt handling
217217*/
218218
219static void lisa_field_interrupts(void)
219static void lisa_field_interrupts(running_machine *machine)
220220{
221221   if (parity_error_pending)
222222      return;   /* don't touch anything... */
223223
224224   /*if (RSIR)
225225      // serial interrupt
226      cpunum_set_input_line_and_vector(Machine, 0, M68K_IRQ_6, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
226      cpunum_set_input_line_and_vector(machine, 0, M68K_IRQ_6, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
227227   else if (int0)
228228      // external interrupt
229      cpunum_set_input_line_and_vector(Machine, 0, M68K_IRQ_5, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
229      cpunum_set_input_line_and_vector(machine, 0, M68K_IRQ_5, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
230230   else if (int1)
231231      // external interrupt
232      cpunum_set_input_line_and_vector(Machine, 0, M68K_IRQ_4, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
232      cpunum_set_input_line_and_vector(machine, 0, M68K_IRQ_4, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
233233   else if (int2)
234234      // external interrupt
235      cpunum_set_input_line_and_vector(Machine, 0, M68K_IRQ_3, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
235      cpunum_set_input_line_and_vector(machine, 0, M68K_IRQ_3, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
236236   else*/ if (KBIR)
237237      /* COPS VIA interrupt */
238      cpunum_set_input_line_and_vector(Machine, 0, M68K_IRQ_2, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
238      cpunum_set_input_line_and_vector(machine, 0, M68K_IRQ_2, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
239239   else if (FDIR || VTIR)
240240      /* floppy disk or VBl */
241      cpunum_set_input_line_and_vector(Machine, 0, M68K_IRQ_1, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
241      cpunum_set_input_line_and_vector(machine, 0, M68K_IRQ_1, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
242242   else
243243      /* clear all interrupts */
244      cpunum_set_input_line_and_vector(Machine, 0, M68K_IRQ_1, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR);
244      cpunum_set_input_line_and_vector(machine, 0, M68K_IRQ_1, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR);
245245}
246246
247static void set_parity_error_pending(int value)
247static void set_parity_error_pending(running_machine *machine, int value)
248248{
249249#if 0
250250   /* does not work well due to bugs in 68k cores */
251251   parity_error_pending = value;
252252   if (parity_error_pending)
253253   {
254      cpunum_set_input_line_and_vector(Machine, 0, M68K_IRQ_7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
254      cpunum_set_input_line_and_vector(machine, 0, M68K_IRQ_7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
255255   }
256256   else
257257   {
r1980r1981
261261   /* work-around... */
262262   if ((! parity_error_pending) && value)
263263   {
264      parity_error_pending = TRUE;
265      cpunum_set_input_line_and_vector(Machine, 0, M68K_IRQ_7, PULSE_LINE, M68K_INT_ACK_AUTOVECTOR);
264      parity_error_pending = 1;
265      cpunum_set_input_line_and_vector(machine, 0, M68K_IRQ_7, PULSE_LINE, M68K_INT_ACK_AUTOVECTOR);
266266   }
267267   else if (parity_error_pending && (! value))
268268   {
269      parity_error_pending = FALSE;
270      lisa_field_interrupts();
269      parity_error_pending = 0;
270      lisa_field_interrupts(machine);
271271   }
272272#endif
273273}
274274
275INLINE void set_VTIR(int value)
275INLINE void set_VTIR(running_machine *machine, int value)
276276{
277277   if (VTIR != value)
278278   {
279279      VTIR = value;
280      lisa_field_interrupts();
280      lisa_field_interrupts(machine);
281281   }
282282}
283283
r1980r1981
519519{
520520   int command;
521521
522   COPS_Ready = FALSE;
522   COPS_Ready = 0;
523523
524524   /*logerror("read_COPS_command : trying to send data to VIA\n");*/
525525   COPS_send_data_if_possible();
r1980r1981
687687/* this timer callback raises the COPS Ready line, which tells the COPS is about to read a command */
688688static TIMER_CALLBACK(set_COPS_ready)
689689{
690   COPS_Ready = TRUE;
690   COPS_Ready = 1;
691691
692692   /* impulsion width : +/- 20us */
693693   timer_set(ATTOTIME_IN_USEC(20), NULL, 0, read_COPS_command);
r1980r1981
751751/* called at power-up */
752752static void init_COPS(void)
753753{
754   COPS_Ready = FALSE;
754   COPS_Ready = 0;
755755
756756   /* read command every ms (don't know the real value) */
757757   timer_pulse(ATTOTIME_IN_MSEC(1), NULL, 0, set_COPS_ready);
r1980r1981
819819   {
820820      if (COPS_force_unplug)
821821      {
822         COPS_force_unplug = FALSE;
822         COPS_force_unplug = 0;
823823         plug_keyboard();
824824      }
825825   }
r1980r1981
827827   {
828828      if (! COPS_force_unplug)
829829      {
830         COPS_force_unplug = TRUE;
830         COPS_force_unplug = 1;
831831         unplug_keyboard();
832832         //reset_COPS();
833833      }
r1980r1981
844844   if (KBIR != val)
845845   {
846846      KBIR = val;
847      lisa_field_interrupts();
847      lisa_field_interrupts(Machine);
848848   }
849849}
850850
r1980r1981
11431143
11441144   /* init MMU */
11451145
1146   setup = TRUE;
1146   setup = 1;
11471147
11481148   seg = 0;
11491149
11501150   /* init parity */
11511151
1152   diag2 = FALSE;
1153   test_parity = FALSE;
1154   parity_error_pending = FALSE;
1152   diag2 = 0;
1153   test_parity = 0;
1154   parity_error_pending = 0;
11551155
11561156   bad_parity_count = 0;
11571157   memset(bad_parity_table, 0, 0x40000);   /* Clear */
11581158
11591159   /* init video */
11601160
1161   VTMSK = FALSE;
1162   set_VTIR(FALSE);
1161   VTMSK = 0;
1162   set_VTIR(machine, 0);
11631163
11641164   video_address_latch = 0;
11651165   videoram_ptr = (UINT16 *) lisa_ram_ptr;
r1980r1981
12961296
12971297   /* set VBI */
12981298   if (VTMSK)
1299      set_VTIR(TRUE);
1299      set_VTIR(machine, 1);
13001300
13011301   /* do keyboard scan */
13021302   scan_keyboard();
r1980r1981
13091309   cannot support 2 floppy drives)...
13101310*/
13111311
1312INLINE void lisa_fdc_ttl_glue_access(offs_t offset)
1312INLINE void lisa_fdc_ttl_glue_access(running_machine *machine, offs_t offset)
13131313{
13141314   switch ((offset & 0x000E) >> 1)
13151315   {
r1980r1981
13531353      break;
13541354   case 7:
13551355      FDIR = offset & 1;   /* Interrupt request to 68k */
1356      lisa_field_interrupts();
1356      lisa_field_interrupts(machine);
13571357      break;
13581358   }
13591359}
r1980r1981
13691369      break;
13701370
13711371   case 1:   /* TTL glue */
1372      lisa_fdc_ttl_glue_access(offset);
1372      lisa_fdc_ttl_glue_access(machine, offset);
13731373      answer = 0;   /* ??? */
13741374      break;
13751375
r1980r1981
13941394      break;
13951395
13961396   case 1:   /* TTL glue */
1397      lisa_fdc_ttl_glue_access(offset);
1397      lisa_fdc_ttl_glue_access(machine, offset);
13981398      break;
13991399
14001400   case 2:   /* writes the PWM register */
r1980r1981
15461546               && (bad_parity_table[address >> 3] & (0x3 << (address & 0x7))))
15471547         {
15481548            mem_err_addr_latch = address >> 5;
1549            set_parity_error_pending(TRUE);
1549            set_parity_error_pending(machine, 1);
15501550         }
15511551         break;
15521552
r1980r1981
15631563               && (bad_parity_table[address >> 3] & (0x3 << (address & 0x7))))
15641564         {
15651565            mem_err_addr_latch = address >> 5;
1566            set_parity_error_pending(TRUE);
1566            set_parity_error_pending(machine, 1);
15671567         }
15681568         break;
15691569
r1980r1981
18791879*                                                                                      *
18801880\**************************************************************************************/
18811881
1882INLINE void cpu_board_control_access(offs_t offset)
1882INLINE void cpu_board_control_access(running_machine *machine, offs_t offset)
18831883{
18841884   switch ((offset & 0x03ff) << 1)
18851885   {
r1980r1981
18871887   case 0x0000:   /* Reset DIAG1 Latch */
18881888      break;
18891889   case 0x0006:   /* Set Diag2 Latch */
1890      diag2 = TRUE;
1890      diag2 = 1;
18911891      break;
18921892   case 0x0004:   /* ReSet Diag2 Latch */
1893      diag2 = FALSE;
1893      diag2 = 0;
18941894      break;
18951895   case 0x000A:   /* SEG1 Context Selection bit SET */
18961896      /*logerror("seg bit 0 set\n");*/
r1980r1981
19091909      seg &= ~2;
19101910      break;
19111911   case 0x0010:   /* SETUP register SET */
1912      setup = TRUE;
1912      setup = 1;
19131913      break;
19141914   case 0x0012:   /* SETUP register RESET */
1915      setup = FALSE;
1915      setup = 0;
19161916      break;
19171917   case 0x001A:   /* Enable Vertical Retrace Interrupt */
1918      VTMSK = TRUE;
1918      VTMSK = 1;
19191919      break;
19201920   case 0x0018:   /* Disable Vertical Retrace Interrupt */
1921      VTMSK = FALSE;
1922      set_VTIR(FALSE);
1921      VTMSK = 0;
1922      set_VTIR(machine, 0);
19231923      break;
19241924   case 0x0016:   /* Enable Soft Error Detect. */
19251925   case 0x0014:   /* Disable Soft Error Detect. */
19261926      break;
19271927   case 0x001E:   /* Enable Hard Error Detect */
1928      test_parity = TRUE;
1928      test_parity = 1;
19291929      break;
19301930   case 0x001C:   /* Disable Hard Error Detect */
1931      test_parity = FALSE;
1932      set_parity_error_pending(FALSE);
1931      test_parity = 0;
1932      set_parity_error_pending(machine, 0);
19331933      break;
19341934   }
19351935}
r1980r1981
20042004      switch ((offset & 0x0C00) >> 10)
20052005      {
20062006      case 0x0:   /* cpu board control */
2007         cpu_board_control_access(offset & 0x03ff);
2007         cpu_board_control_access(machine, offset & 0x03ff);
20082008         break;
20092009
20102010      case 0x1:   /* Video Address Latch */
r1980r1981
20942094      switch ((offset & 0x0C00) >> 10)
20952095      {
20962096      case 0x0:   /* cpu board control */
2097         cpu_board_control_access(offset & 0x03ff);
2097         cpu_board_control_access(machine, offset & 0x03ff);
20982098         break;
20992099
21002100      case 0x1:   /* Video Address Latch */
src/mess/machine/cgenie.c
r1980r1981
77
88***************************************************************************/
99
10#include <stdarg.h>
1110#include "driver.h"
12#include "deprecat.h"
1311#include "cpu/z80/z80.h"
1412#include "includes/cgenie.h"
1513#include "machine/wd17xx.h"
r1980r1981
491489 * tape_put_bit
492490 * port FF tape status bit changed. Figure out what to do with it ;-)
493491 *******************************************************************/
494static void tape_put_bit(void)
492static void tape_put_bit(running_machine *machine)
495493{
496494   int now_cycles = activecpu_gettotalcycles();
497495   int diff = now_cycles - put_cycles;
r1980r1981
502500   if( diff > 4000 )
503501   {
504502      /* reset tape output */
505      tape_put_close(Machine);
503      tape_put_close(machine);
506504      put_bit_count = tape_bits = in_sync = 0;
507505   }
508506   else
r1980r1981
748746   {
749747      /* virtual tape ? */
750748      if( readinputport(0) & 0x08 )
751         tape_put_bit();
749         tape_put_bit(machine);
752750      else
753751         DAC_data_w(0,(data & FF_CAS) ? 127:0 );
754752   }
src/mess/machine/mc6846.h
r1980r1981
5050extern void mc6846_set_input_cp2 ( int data );
5151
5252/* polling from outside world */
53extern UINT8  mc6846_get_output_port ( void );
53extern UINT8  mc6846_get_output_port ( running_machine *machine );
5454extern UINT8  mc6846_get_output_cto ( void );
5555extern UINT8  mc6846_get_output_cp2 ( void );
5656
src/mess/machine/spectrum.c
r1980r1981
3737
3838
3939static unsigned long TapePosition = 0;
40static void spectrum_setup_sna(unsigned char *pSnapshot, unsigned long SnapshotSize);
41static void spectrum_setup_z80(unsigned char *pSnapshot, unsigned long SnapshotSize);
42static void spectrum_setup_sp(unsigned char *pSnapshot, unsigned long SnapshotSize);
40static void spectrum_setup_sna(running_machine *machine, unsigned char *pSnapshot, unsigned long SnapshotSize);
41static void spectrum_setup_z80(running_machine *machine, unsigned char *pSnapshot, unsigned long SnapshotSize);
42static void spectrum_setup_sp(running_machine *machine, unsigned char *pSnapshot, unsigned long SnapshotSize);
4343static int spectrum_setup_tap(offs_t address, UINT8 *snapshot_data, int snapshot_length);
4444
4545TIMEX_CART_TYPE timex_cart_type = TIMEX_CART_NONE;
r1980r1981
110110         logerror("Invalid .SNA file size.\n");
111111         goto error;
112112      }
113      spectrum_setup_sna(snapshot_data, snapshot_size);
113      spectrum_setup_sna(Machine, snapshot_data, snapshot_size);
114114   }
115115   else if (!mame_stricmp(file_type, "sp"))
116116   {
r1980r1981
119119         logerror("Invalid .SP signature.\n");
120120         goto error;
121121      }
122      spectrum_setup_sp(snapshot_data, snapshot_size);
122      spectrum_setup_sp(Machine, snapshot_data, snapshot_size);
123123   }
124124   else
125125   {
126      spectrum_setup_z80(snapshot_data, snapshot_size);
126      spectrum_setup_z80(Machine, snapshot_data, snapshot_size);
127127   }
128128   free(snapshot_data);
129129   logerror("Snapshot loaded - new PC = %04x\n", (unsigned) cpunum_get_reg(0, Z80_PC) & 0x0ffff);
r1980r1981
394394 *   0   IFF1: 0=DI/1=EI
395395 *
396396 *******************************************************************/
397void spectrum_setup_sp(unsigned char *pSnapshot, unsigned long SnapshotSize)
397void spectrum_setup_sp(running_machine *machine, unsigned char *pSnapshot, unsigned long SnapshotSize)
398398{
399399   int i;
400400   UINT8 lo, hi, data;
r1980r1981
489489   }
490490
491491   data = (status & 0x10)>>4;
492   cpunum_set_input_line(Machine, 0, 0, data);
493   cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, data);
494   cpunum_set_input_line(Machine, 0, INPUT_LINE_HALT, 0);
492   cpunum_set_input_line(machine, 0, 0, data);
493   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, data);
494   cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, 0);
495495
496496   spectrum_page_basicrom();
497497
r1980r1981
531531 *      in which case it is included twice.
532532 *
533533 *******************************************************************/
534void spectrum_setup_sna(unsigned char *pSnapshot, unsigned long SnapshotSize)
534void spectrum_setup_sna(running_machine *machine, unsigned char *pSnapshot, unsigned long SnapshotSize)
535535{
536536   int i, j, usedbanks[8];
537537   long bank_offset;
r1980r1981
592592   set_last_border_color(pSnapshot[26] & 0x07);
593593   force_border_redraw();
594594
595   cpunum_set_input_line(Machine, 0, 0, data);
596   cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, data);
597   cpunum_set_input_line(Machine, 0, INPUT_LINE_HALT, 0);
595   cpunum_set_input_line(machine, 0, 0, data);
596   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, data);
597   cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, 0);
598598
599599   if (SnapshotSize == 49179)
600600      /* 48K Snapshot */
r1980r1981
787787}
788788
789789/* now supports 48k & 128k .Z80 files */
790void spectrum_setup_z80(unsigned char *pSnapshot, unsigned long SnapshotSize)
790void spectrum_setup_z80(running_machine *machine, unsigned char *pSnapshot, unsigned long SnapshotSize)
791791{
792792   int i;
793793   unsigned char lo, hi, data;
794794   SPECTRUM_Z80_SNAPSHOT_TYPE z80_type;
795   running_machine *machine = Machine;
796795
797796   z80_type = spectrum_identify_z80(pSnapshot, SnapshotSize);
798797
r1980r1981
804803      case SPECTRUM_Z80_SNAPSHOT_48K_OLD:
805804      case SPECTRUM_Z80_SNAPSHOT_48K:
806805            logerror("48K .Z80 file\n");
807            if (!strcmp(Machine->gamedrv->name,"ts2068"))
806            if (!strcmp(machine->gamedrv->name,"ts2068"))
808807               logerror("48K .Z80 file in TS2068\n");
809808            break;
810809      case SPECTRUM_Z80_SNAPSHOT_128K:
r1980r1981
814813               logerror("Not a 48K .Z80 file\n");
815814               return;
816815            }
817            if (!strcmp(Machine->gamedrv->name,"ts2068"))
816            if (!strcmp(machine->gamedrv->name,"ts2068"))
818817            {
819818               logerror("Not a TS2068 .Z80 file\n");
820819               return;
821820            }
822821            break;
823822      case SPECTRUM_Z80_SNAPSHOT_TS2068:
824            logerror("TS2068 .Z80 file\n");            if (strcmp(Machine->gamedrv->name,"ts2068"))
825            if (strcmp(Machine->gamedrv->name,"ts2068"))
823            logerror("TS2068 .Z80 file\n");
824            if (strcmp(machine->gamedrv->name,"ts2068"))
826825               logerror("Not a TS2068 machine\n");
827826            break;
828827      case SPECTRUM_Z80_SNAPSHOT_SAMRAM:
r1980r1981
901900      /* cpunum_set_reg(0, Z80_IRQ_STATE, 1); */
902901   }
903902
904   cpunum_set_input_line(Machine, 0, 0, data);
905   cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, data);
906   cpunum_set_input_line(Machine, 0, INPUT_LINE_HALT, 0);
903   cpunum_set_input_line(machine, 0, 0, data);
904   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, data);
905   cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, 0);
907906
908907   /* IFF2 */
909908   if (pSnapshot[28] != 0)
r1980r1981
950949      hi = pSnapshot[33] & 0x0ff;
951950      cpunum_set_reg(0, Z80_PC, (hi << 8) | lo);
952951
953      if ((z80_type == SPECTRUM_Z80_SNAPSHOT_128K) || ((z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068) && !strcmp(Machine->gamedrv->name,"ts2068")))
952      if ((z80_type == SPECTRUM_Z80_SNAPSHOT_128K) || ((z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068) && !strcmp(machine->gamedrv->name,"ts2068")))
954953      {
955954         /* Only set up sound registers for 128K machine or TS2068! */
956955         for (i = 0; i < 16; i++)
r1980r1981
10321031         spectrum_128_port_7ffd_data = (pSnapshot[35] & 0x0ff);
10331032         spectrum_update_paging();
10341033      }
1035      if ((z80_type == SPECTRUM_Z80_SNAPSHOT_48K) && !strcmp(Machine->gamedrv->name,"ts2068"))
1034      if ((z80_type == SPECTRUM_Z80_SNAPSHOT_48K) && !strcmp(machine->gamedrv->name,"ts2068"))
10361035      {
10371036         ts2068_port_f4_data = 0x03;
10381037         ts2068_port_ff_data = 0x00;
10391038         ts2068_update_memory();
10401039      }
1041      if (z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068 && !strcmp(Machine->gamedrv->name,"ts2068"))
1040      if (z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068 && !strcmp(machine->gamedrv->name,"ts2068"))
10421041      {
10431042         ts2068_port_f4_data = pSnapshot[35];
10441043         ts2068_port_ff_data = pSnapshot[36];
src/mess/machine/kaypro.c
r1980r1981
133133   for( i = 0; i < 0x2000; i++ )
134134      gfx[0x2000 + i] = gfx[i] ^ 0xff;
135135
136   cpm_init(4, disk_ids);
136   cpm_init(machine, 4, disk_ids);
137137}
138138
139139MACHINE_RESET( kaypro )
src/mess/machine/geneve.c
r1980r1981
213213        ti99_ide_init();
214214        ti99_rs232_init();
215215   ti99_usbsm_init();
216   mm58274c_init(0, 1);
216   mm58274c_init(machine, 0, 1);
217217   add_exit_callback(machine, machine_stop_geneve);
218218}
219219
r1980r1981
300300      ti99_rs232_reset();
301301
302302   if (has_usb_sm)
303      ti99_usbsm_reset(TRUE);
303      ti99_usbsm_reset(machine, TRUE);
304304}
305305
306306static void machine_stop_geneve(running_machine *machine)
src/mess/machine/tx0.c
r1980r1981
443443/*
444444   Write a character to typewriter
445445*/
446static void typewriter_out(UINT8 data)
446static void typewriter_out(running_machine *machine, UINT8 data)
447447{
448   tx0_typewriter_drawchar(Machine, data);
448   tx0_typewriter_drawchar(machine, data);
449449   if (typewriter.fd)
450450      image_fwrite(typewriter.fd, & data, 1);
451451}
r1980r1981
470470   ac = cpunum_get_reg(0, TX0_AC);
471471   /* shuffle and print 6-bit word */
472472   ch = ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5);
473   typewriter_out(ch);
473   typewriter_out(Machine, ch);
474474
475475   timer_adjust_oneshot(typewriter.prt_timer, ATTOTIME_IN_MSEC(100), 0);
476476}
r1980r1981
11111111/*
11121112   typewriter keyboard handler
11131113*/
1114static void tx0_keyboard(void)
1114static void tx0_keyboard(running_machine *machine)
11151115{
11161116   int i;
11171117   int j;
r1980r1981
11401140         lr = (1 << 17) | ((charcode & 040) << 10) | ((charcode & 020) << 8) | ((charcode & 010) << 6) | ((charcode & 004) << 4) | ((charcode & 002) << 2) | ((charcode & 001) << 1);
11411141         /* write modified LR */
11421142         cpunum_set_reg(0, TX0_LR, lr);
1143         tx0_typewriter_drawchar(Machine, charcode);   /* we want to echo input */
1143         tx0_typewriter_drawchar(machine, charcode);   /* we want to echo input */
11441144         break;
11451145      }
11461146   }
r1980r1981
12521252      old_control_keys = 0;
12531253      old_tsr_keys = 0;
12541254
1255      tx0_keyboard();
1255      tx0_keyboard(machine);
12561256   }
12571257}
12581258
src/mess/machine/c128.c
r1980r1981
1212#include "driver.h"
1313#include "includes/c128.h"
1414#include "includes/c64.h"
15#include "deprecat.h"
1615
1716#include "cpu/m6502/m6502.h"
1817#include "sound/sid6581.h"
r1980r1981
162161   }
163162}
164163
165void c128_bankswitch_64 (int reset)
164void c128_bankswitch_64 (running_machine *machine, int reset)
166165{
167166   static int old, exrom, game;
168167   int data, loram, hiram, charen;
r1980r1981
219218      else
220219         memory_set_bankptr(13, c64_memory + 0xd000);
221220   }
222   c128_set_m8502_read_handler(Machine, 0xd000, 0xdfff, rh);
221   c128_set_m8502_read_handler(machine, 0xd000, 0xdfff, rh);
223222
224223   if (!c64_game && c64_exrom)
225224   {
r1980r1981
334333#endif
335334 }
336335
337static void c128_bankswitch_128 (int reset)
336static void c128_bankswitch_128 (running_machine *machine, int reset)
338337{
339338   read8_machine_func rh;
340339
r1980r1981
359358
360359      memory_set_bankptr(12, c64_memory + 0xc000);
361360
362      c128_bankswitch_64 (reset);
361      c128_bankswitch_64 (machine, reset);
363362   }
364363   else
365364   {
r1980r1981
415414      else
416415         c128_ram_top = 0x10000;
417416
418      c128_set_m8502_read_handler(Machine, 0xff00, 0xff04, c128_mmu8722_ff00_r);
417      c128_set_m8502_read_handler(machine, 0xff00, 0xff04, c128_mmu8722_ff00_r);
419418
420419      if (MMU_IO_ON)
421420      {
r1980r1981
427426         c128_write_io = 0;
428427         rh = MRA8_BANK13;
429428      }
430      c128_set_m8502_read_handler(Machine, 0xd000, 0xdfff, rh);
429      c128_set_m8502_read_handler(machine, 0xd000, 0xdfff, rh);
431430
432431      if (MMU_RAM_HI)
433432      {
r1980r1981
500499}
501500
502501
503static void c128_bankswitch (int reset)
502static void c128_bankswitch (running_machine *machine, int reset)
504503{
505504   if (mmu_cpu != MMU_CPU8502)
506505   {
r1980r1981
511510         memory_set_context(0);
512511         c128_bankswitch_z80();
513512         memory_set_context(1);
514         cpunum_set_input_line(Machine, 0, INPUT_LINE_HALT, CLEAR_LINE);
515         cpunum_set_input_line(Machine, 1, INPUT_LINE_HALT, ASSERT_LINE);
513         cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, CLEAR_LINE);
514         cpunum_set_input_line(machine, 1, INPUT_LINE_HALT, ASSERT_LINE);
516515      }
517516      else
518517      {
519518         DBG_LOG (1, "switching to m6502",
520519                  ("active %d\n",cpu_getactivecpu()) );
521520         memory_set_context(1);
522         c128_bankswitch_128(reset);
521         c128_bankswitch_128(machine, reset);
523522         memory_set_context(0);
524         cpunum_set_input_line(Machine, 0, INPUT_LINE_HALT, ASSERT_LINE);
525         cpunum_set_input_line(Machine, 1, INPUT_LINE_HALT, CLEAR_LINE);
523         cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, ASSERT_LINE);
524         cpunum_set_input_line(machine, 1, INPUT_LINE_HALT, CLEAR_LINE);
526525
527526         /* NPW 19-Nov-2005 - In the C128, CPU #0 starts out and hands over
528527          * control to CPU #1.  CPU #1 seems to execute garbage from 0x0000
r1980r1981
545544   if (!MMU_CPU8502)
546545      c128_bankswitch_z80();
547546   else
548      c128_bankswitch_128(reset);
547      c128_bankswitch_128(machine, reset);
549548}
550549
551static void c128_mmu8722_reset (void)
550static void c128_mmu8722_reset (running_machine *machine)
552551{
553552   memset(c128_mmu, 0, sizeof (c128_mmu));
554553   c128_mmu[5] |= 0x38;
r1980r1981
556555   mmu_cpu = 0;
557556    mmu_page0 = 0;
558557    mmu_page1 = 0x0100;
559   c128_bankswitch (1);
558   c128_bankswitch (machine, 1);
560559}
561560
562561WRITE8_HANDLER( c128_mmu8722_port_w )
r1980r1981
576575   case 5:
577576   case 6:
578577      c128_mmu[offset] = data;
579      c128_bankswitch (0);
578      c128_bankswitch (machine, 0);
580579      break;
581580   case 7:
582581      c128_mmu[offset] = data;
r1980r1981
585584   case 9:
586585      c128_mmu[offset] = data;
587586      mmu_page1=MMU_PAGE1;
588      c128_bankswitch (0);
587      c128_bankswitch (machine, 0);
589588      break;
590589   case 0xb:
591590      break;
r1980r1981
639638   {
640639   case 0:
641640      c128_mmu[offset] = data;
642      c128_bankswitch (0);
641      c128_bankswitch (machine, 0);
643642      break;
644643   case 1:
645644   case 2:
r1980r1981
650649#else
651650      c128_mmu[0]|= c128_mmu[offset];
652651#endif
653      c128_bankswitch (0);
652      c128_bankswitch (machine, 0);
654653      break;
655654   }
656655}
r1980r1981
822821
823822MACHINE_RESET( c128 )
824823{
825   c64_common_init_machine ();
824   c64_common_init_machine(machine);
826825   c128_vicaddr = c64_vicaddr = c64_memory;
827826
828827   sndti_reset(SOUND_SID6581, 0);
r1980r1981
831830   c64_rom_load();
832831
833832   c64mode = 0;
834   c128_mmu8722_reset ();
833   c128_mmu8722_reset (machine);
835834   cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, CLEAR_LINE);
836835   cpunum_set_input_line(machine, 1, INPUT_LINE_HALT, ASSERT_LINE);
837836}
src/mess/machine/ds1315.c
r1980r1981
66
77#include "driver.h"
88#include "ds1315.h"
9#include "deprecat.h"
109
1110
1211enum
r1980r1981
1514   ds_calendar_io
1615};
1716
18static void ds1315_fill_raw_data( void );
17static void ds1315_fill_raw_data( running_machine *machine );
1918static void ds1315_input_raw_data( void );
2019
2120static int ds1315_count;
r1980r1981
4544         /* entire pattern matched */
4645         ds1315_count = 0;
4746         ds1315_mode = ds_calendar_io;
48         ds1315_fill_raw_data();
47         ds1315_fill_raw_data(machine);
4948      }
5049
5150      return 0;
r1980r1981
109108   return;
110109}
111110
112static void ds1315_fill_raw_data( void )
111static void ds1315_fill_raw_data( running_machine *machine )
113112{
114113   /* This routine will (hopefully) call a standard 'C' library routine to get the current
115114      date and time and then fill in the raw data struct.
r1980r1981
119118   int raw[8], i, j;
120119
121120   /* get the current date/time from the core */
122   mame_get_current_datetime(Machine, &systime);
121   mame_get_current_datetime(machine, &systime);
123122
124123   raw[0] = 0;   /* tenths and hundreths of seconds are always zero */
125124   raw[1] = dec_2_bcd(systime.local_time.second);
src/mess/machine/pc8801.c
r1980r1981
5959  /* UOP3 (bit 7 -- not yet) */
6060}
6161
62static void calender_strobe(void)
62static void calender_strobe(running_machine *machine)
6363{
6464   mame_system_time systime;
6565
r1980r1981
7777         break;
7878      case 3:
7979         /* get the current date/time from the core */
80         mame_get_current_datetime(Machine, &systime);
80         mame_get_current_datetime(machine, &systime);
8181
8282         calender_reg[4] = (systime.local_time.month + 1) * 16 + systime.local_time.weekday;
8383         calender_reg[3] = dec_2_bcd(systime.local_time.mday);
r1980r1981
111111static int interrupt_mask_reg;
112112static int interrupt_trig_reg;
113113
114static void pc8801_update_interrupt(void)
114static void pc8801_update_interrupt(running_machine *machine)
115115{
116116   int level, i;
117117
r1980r1981
123123   }
124124   if (level >= 0 && level<interrupt_level_reg)
125125   {
126      cpunum_set_input_line(Machine, 0, 0, HOLD_LINE);
126      cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
127127   }
128128}
129129
r1980r1981
144144WRITE8_HANDLER(pc8801_write_interrupt_level)
145145{
146146   interrupt_level_reg = data&0x0f;
147   pc8801_update_interrupt();
147   pc8801_update_interrupt(machine);
148148}
149149
150150WRITE8_HANDLER(pc8801_write_interrupt_mask)
r1980r1981
153153      | ((data&0x04)>>2) | 0xf8;
154154}
155155
156static void pc8801_raise_interrupt(int level)
156static void pc8801_raise_interrupt(running_machine *machine, int level)
157157{
158158  interrupt_trig_reg |= interrupt_mask_reg & (1<<level);
159  pc8801_update_interrupt();
159  pc8801_update_interrupt(machine);
160160}
161161
162162INTERRUPT_GEN( pc8801_interrupt )
163163{
164   pc8801_raise_interrupt(1);
164   pc8801_raise_interrupt(machine, 1);
165165}
166166
167167static TIMER_CALLBACK(pc8801_timer_interrupt)
168168{
169   pc8801_raise_interrupt(2);
169   pc8801_raise_interrupt(machine, 2);
170170}
171171
172172static void pc8801_init_interrupt(void)
r1980r1981
190190{
191191  static int port_save;
192192
193  if((port_save&0x02) == 0x00 && (data&0x02) != 0x00) calender_strobe();
193  if((port_save&0x02) == 0x00 && (data&0x02) != 0x00) calender_strobe(machine);
194194  if((port_save&0x04) == 0x00 && (data&0x04) != 0x00) calender_shift();
195195  port_save=data;
196196
r1980r1981
502502  maptvram=((data&0x10)==0);
503503  no4throm2=(data&3);
504504  enable_FM_IRQ=((data & 0x80) == 0x00);
505  if(FM_IRQ_save && enable_FM_IRQ) pc8801_raise_interrupt(FM_IRQ_LEVEL);
505  if(FM_IRQ_save && enable_FM_IRQ) pc8801_raise_interrupt(machine, FM_IRQ_LEVEL);
506506  pc88sr_disp_32(machine, offset,data);
507507  pc8801_update_bank();
508508}
r1980r1981
551551  pc8801_update_bank();
552552}
553553
554static void pc8801_init_bank(int hireso)
554static void pc8801_init_bank(running_machine *machine, int hireso)
555555{
556556   int i,j;
557557   int num80,num88,numIO;
r1980r1981
570570
571571   extmem_ctrl[0]=extmem_ctrl[1]=0;
572572   pc8801_update_bank();
573   pc8801_video_init(Machine, hireso);
573   pc8801_video_init(machine, hireso);
574574
575575  if(extmem_mode!=readinputport(19)) {
576576    extmem_mode=readinputport(19);
r1980r1981
691691  }
692692}
693693
694static void pc88sr_ch_reset (int hireso)
694static void pc88sr_ch_reset (running_machine *machine, int hireso)
695695{
696696  int a;
697697
r1980r1981
701701  pc88sr_is_highspeed = ((a&0x04)!=0x00);
702702  is_8MHz = ((a&0x08)!=0x00);
703703  fix_V1V2();
704  pc8801_init_bank(hireso);
704  pc8801_init_bank(machine, hireso);
705705  pc8801_init_5fd();
706706  pc8801_init_interrupt();
707707  beep_set_state(0, 0);
r1980r1981
711711
712712MACHINE_RESET( pc88srl )
713713{
714  pc88sr_ch_reset(0);
714  pc88sr_ch_reset(machine, 0);
715715}
716716
717717MACHINE_RESET( pc88srh )
718718{
719   pc88sr_ch_reset(1);
719   pc88sr_ch_reset(machine, 1);
720720}
721721
722722/* 5 inch floppy drive */
r1980r1981
837837void pc88sr_sound_interupt(int irq)
838838{
839839  FM_IRQ_save=irq;
840  if(FM_IRQ_save && enable_FM_IRQ) pc8801_raise_interrupt(FM_IRQ_LEVEL);
840  if(FM_IRQ_save && enable_FM_IRQ) pc8801_raise_interrupt(Machine, FM_IRQ_LEVEL);
841841}
842842
843843/*
src/mess/machine/c16.c
r1980r1981
88
99***************************************************************************/
1010
11#include <ctype.h>
1211#include "driver.h"
1312#include "image.h"
14#include "deprecat.h"
1513#include "cpu/m6502/m6502.h"
1614#include "sound/sid6581.h"
1715
r1980r1981
369367   return mess_ram[offset % mess_ram_size];
370368}
371369
372void c16_interrupt (int level)
370void c16_interrupt (running_machine *machine, int level)
373371{
374372   static int old_level;
375373
376374   if (level != old_level)
377375   {
378376      DBG_LOG (3, "mos7501", ("irq %s\n", level ? "start" : "end"));
379      cpunum_set_input_line(Machine, 0, M6510_IRQ_LINE, level);
377      cpunum_set_input_line(machine, 0, M6510_IRQ_LINE, level);
380378      old_level = level;
381379   }
382380}
src/mess/machine/oric.c
r1980r1981
6767};
6868
6969/* called when ints are changed - cleared/set */
70static void oric_refresh_ints(void)
70static void oric_refresh_ints(running_machine *machine)
7171{
7272   /* telestrat has floppy hardware built-in! */
7373   if (oric_is_telestrat==0)
r1980r1981
8484   /* any irq set? */
8585   if ((oric_irqs & 0x0f)!=0)
8686   {
87      cpunum_set_input_line(Machine, 0,0, HOLD_LINE);
87      cpunum_set_input_line(machine, 0,0, HOLD_LINE);
8888   }
8989   else
9090   {
91      cpunum_set_input_line(Machine, 0,0, CLEAR_LINE);
91      cpunum_set_input_line(machine, 0,0, CLEAR_LINE);
9292   }
9393}
9494
r1980r1981
197197
198198
199199/* read/write data depending on state of bdir, bc1 pins and data output to psg */
200static void oric_psg_connection_refresh(void)
200static void oric_psg_connection_refresh(running_machine *machine)
201201{
202   running_machine *machine = Machine;
203
204202   if (oric_psg_control!=0)
205203   {
206204      switch (oric_psg_control)
r1980r1981
239237{
240238   oric_via_port_a_data = data;
241239
242   oric_psg_connection_refresh();
240   oric_psg_connection_refresh(machine);
243241
244242
245243   if (oric_psg_control==0)
r1980r1981
342340   centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET);
343341   centronics_write_handshake(0, printer_handshake, CENTRONICS_STROBE);
344342
345   oric_psg_connection_refresh();
343   oric_psg_connection_refresh(machine);
346344   previous_portb_data = data;
347345
348346}
r1980r1981
391389      oric_psg_control |=1;
392390   }
393391
394   oric_psg_connection_refresh();
392   oric_psg_connection_refresh(machine);
395393}
396394
397395static WRITE8_HANDLER ( oric_via_out_cb2_func )
r1980r1981
403401      oric_psg_control |=2;
404402   }
405403
406   oric_psg_connection_refresh();
404   oric_psg_connection_refresh(machine);
407405}
408406
409407
r1980r1981
421419      oric_irqs |=(1<<0);
422420   }
423421
424   oric_refresh_ints();
422   oric_refresh_ints(Machine);
425423}
426424
427425
r1980r1981
585583
586584
587585/* APPLE 2 INTERFACE V2 */
588static void oric_install_apple2_v2_interface(void)
586static void oric_install_apple2_v2_interface(running_machine *machine)
589587{
590588   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0300, 0x030f, 0, 0, oric_IO_r);
591589   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0310, 0x031f, 0, 0, applefdc_r);
r1980r1981
595593   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0310, 0x031f, 0, 0, applefdc_w);
596594   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0380, 0x0383, 0, 0, apple2_v2_interface_w);
597595
598   apple2_v2_interface_w(Machine, 0, 0);
596   apple2_v2_interface_w(machine, 0, 0);
599597}
600598
601599/********************/
r1980r1981
690688   }
691689}
692690
693static void oric_jasmin_wd179x_callback(int State)
691static void oric_jasmin_wd179x_callback(running_machine *machine, int State)
694692{
695693   switch (State)
696694   {
r1980r1981
699697      {
700698         oric_irqs &=~(1<<1);
701699
702         oric_refresh_ints();
700         oric_refresh_ints(machine);
703701      }
704702      break;
705703
r1980r1981
707705      {
708706         oric_irqs |= (1<<1);
709707
710         oric_refresh_ints();
708         oric_refresh_ints(machine);
711709      }
712710      break;
713711
r1980r1981
825823static unsigned char port_314_w;
826824
827825
828static void oric_microdisc_refresh_wd179x_ints(void)
826static void oric_microdisc_refresh_wd179x_ints(running_machine *machine)
829827{
830828   oric_irqs &=~(1<<1);
831829
r1980r1981
836834      oric_irqs |=(1<<1);
837835   }
838836
839   oric_refresh_ints();
837   oric_refresh_ints(machine);
840838}
841839
842static void oric_microdisc_wd179x_callback(int State)
840static void oric_microdisc_wd179x_callback(running_machine *machine, int State)
843841{
844842   switch (State)
845843   {
r1980r1981
849847
850848         oric_wd179x_int_state = 0;
851849
852         oric_microdisc_refresh_wd179x_ints();
850         oric_microdisc_refresh_wd179x_ints(machine);
853851      }
854852      break;
855853
r1980r1981
859857
860858         oric_wd179x_int_state = 1;
861859
862         oric_microdisc_refresh_wd179x_ints();
860         oric_microdisc_refresh_wd179x_ints(machine);
863861      }
864862      break;
865863
r1980r1981
10281026         wd17xx_set_density(density);
10291027
10301028         oric_microdisc_set_mem_0x0c000();
1031         oric_microdisc_refresh_wd179x_ints();
1029         oric_microdisc_refresh_wd179x_ints(machine);
10321030      }
10331031      break;
10341032
r1980r1981
10691067      case ORIC_FLOPPY_INTERFACE_APPLE2:
10701068         return;
10711069      case ORIC_FLOPPY_INTERFACE_MICRODISC:
1072         oric_microdisc_wd179x_callback(State);
1070         oric_microdisc_wd179x_callback(machine, State);
10731071         return;
10741072      case ORIC_FLOPPY_INTERFACE_JASMIN:
1075         oric_jasmin_wd179x_callback(State);
1073         oric_jasmin_wd179x_callback(machine, State);
10761074         return;
10771075   }
10781076}
r1980r1981
11741172
11751173      case ORIC_FLOPPY_INTERFACE_APPLE2_V2:
11761174      {
1177         oric_install_apple2_v2_interface();
1175         oric_install_apple2_v2_interface(machine);
11781176      }
11791177      break;
11801178
r1980r1981
14411439        oric_irqs |=(1<<2);
14421440   }
14431441
1444    oric_refresh_ints();
1442    oric_refresh_ints(Machine);
14451443}
14461444static const struct via6522_interface telestrat_via2_interface=
14471445{
r1980r1981
14711469      oric_irqs |= (1<<3);
14721470   }
14731471
1474   oric_refresh_ints();
1472   oric_refresh_ints(Machine);
14751473}
14761474#endif
14771475
src/mess/machine/europc.c
r1980r1981
44#include "machine/pit8253.h"
55#include "video/pc_aga.h"
66#include "audio/pc.h"
7#include "deprecat.h"
87
98
109/*
r1980r1981
229228   emu_timer *timer;
230229} europc_rtc;
231230
232void europc_rtc_set_time(void)
231void europc_rtc_set_time(running_machine *machine)
233232{
234233   mame_system_time systime;
235234
236235   /* get the current date/time from the core */
237   mame_get_current_datetime(Machine, &systime);
236   mame_get_current_datetime(machine, &systime);
238237
239238   europc_rtc.data[0] = dec_2_bcd(systime.utc_time.second);
240239   europc_rtc.data[1] = dec_2_bcd(systime.utc_time.minute);
r1980r1981
333332   if (file == NULL)
334333   {
335334      /* init only */
336      /* europc_rtc_set_time(); */
335      /* europc_rtc_set_time(machine); */
337336   }
338337   else if (read_or_write)
339338   {
r1980r1981
342341   else
343342   {
344343      europc_rtc_load_stream(file);
345      europc_rtc_set_time();
344      europc_rtc_set_time(machine);
346345   }
347346}
348347
src/mess/machine/99_usbsm.c
r1980r1981
7979/*
8080   Reset USB-SmartMedia card, set up handlers
8181*/
82int ti99_usbsm_reset(int in_tms9995_mode)
82int ti99_usbsm_reset(running_machine *machine, int in_tms9995_mode)
8383{
84   if (strataflash_init(0))
84   if (strataflash_init(machine, 0))
8585      return 1;
8686   if (smartmedia_machine_init(0))
8787      return 1;
src/mess/machine/99_usbsm.h
r1980r1981
33DEVICE_UNLOAD( ti99_sm );*/
44
55void ti99_usbsm_init(void);
6int ti99_usbsm_reset(int in_tms9995_mode);
6int ti99_usbsm_reset(running_machine *machine, int in_tms9995_mode);
src/mess/machine/mm58274c.c
r1980r1981
1919***************************************************************************/
2020
2121#include "driver.h"
22#include "deprecat.h"
2322#include "mm58274c.h"
2423
2524
r1980r1981
9190};
9291
9392
94void mm58274c_init(int which, int mode24)
93void mm58274c_init(running_machine *machine, int which, int mode24)
9594{
9695   memset(&rtc[which], 0, sizeof(rtc[which]));
9796
r1980r1981
102101      mame_system_time systime;
103102
104103      /* get the current date/time from the core */
105      mame_get_current_datetime(Machine, &systime);
104      mame_get_current_datetime(machine, &systime);
106105
107106      rtc[which].clk_set = systime.local_time.year & 3 << 2;
108107      if (mode24)
src/mess/machine/mm58274c.h
r1980r1981
22#define MM58274C_H
33
44
5extern void mm58274c_init(int which, int mode24);
5extern void mm58274c_init(running_machine *machine, int which, int mode24);
66extern int mm58274c_r(int which, int offset);
77extern void mm58274c_w(int which, int offset, int data);
88
src/mess/machine/z80dart.c
r1980r1981
88***************************************************************************/
99
1010#include "driver.h"
11#include "deprecat.h"
1211#include "z80dart.h"
1312#include "cpu/z80/z80.h"
1413#include "cpu/z80/z80daisy.h"
r1980r1981
339338    z80dart_c_w - write to a control register
340339-------------------------------------------------*/
341340
342void z80dart_c_w(int which, int ch, UINT8 data)
341void z80dart_c_w(running_machine *machine, int which, int ch, UINT8 data)
343342{
344343   z80dart *dart = darts + which;
345344   dart_channel *chan = &dart->chan[ch];
346345   int reg = chan->regs[0] & 7;
347346   UINT8 old = chan->regs[reg];
348   running_machine *machine = Machine;
349347
350348   if (reg != 0 || (reg & 0xf8))
351349      VPRINTF(("%04X:dart_reg_w(%c,%d) = %02X\n", activecpu_get_pc(), 'A' + ch, reg, data));
src/mess/machine/bebox.c
r1980r1981
126126 *
127127 *************************************/
128128
129static void bebox_update_interrupts(void);
129static void bebox_update_interrupts(running_machine *machine);
130130
131131static void bebox_mbreg32_w(UINT32 *target, UINT64 data, UINT64 mem_mask)
132132{
r1980r1981
162162         logerror("BeBox CPU #0 pc=0x%08X imask=0x%08x\n",
163163            (unsigned) activecpu_get_reg(REG_PC), bebox_cpu_imask[0]);
164164      }
165      bebox_update_interrupts();
165      bebox_update_interrupts(machine);
166166   }
167167}
168168
r1980r1981
179179         logerror("BeBox CPU #1 pc=0x%08X imask=0x%08x\n",
180180            (unsigned) activecpu_get_reg(REG_PC), bebox_cpu_imask[1]);
181181      }
182      bebox_update_interrupts();
182      bebox_update_interrupts(machine);
183183   }
184184}
185185
r1980r1981
246246}
247247
248248
249static void bebox_update_interrupts(void)
249static void bebox_update_interrupts(running_machine *machine)
250250{
251251   int cpunum;
252252   UINT32 interrupt;
r1980r1981
261261            bebox_interrupts, bebox_cpu_imask[cpunum], interrupt ? "on" : "off");
262262      }
263263
264      cpunum_set_input_line(Machine, cpunum, INPUT_LINE_IRQ0, interrupt ? ASSERT_LINE : CLEAR_LINE);
264      cpunum_set_input_line(machine, cpunum, INPUT_LINE_IRQ0, interrupt ? ASSERT_LINE : CLEAR_LINE);
265265   }
266266}
267267
268268
269static void bebox_set_irq_bit(unsigned int interrupt_bit, int val)
269static void bebox_set_irq_bit(running_machine *machine, unsigned int interrupt_bit, int val)
270270{
271271   static const char *const interrupt_names[32] =
272272   {
r1980r1981
325325
326326   /* if interrupt values have changed, update the lines */
327327   if (bebox_interrupts != old_interrupts)
328      bebox_update_interrupts();
328      bebox_update_interrupts(machine);
329329}
330330
331331
r1980r1981
369369
370370static void bebox_fdc_interrupt(int state)
371371{
372   bebox_set_irq_bit(13, state);
372   bebox_set_irq_bit(Machine, 13, state);
373373   pic8259_set_irq_line(0, 6, state);
374374}
375375
r1980r1981
409409   result = pic8259_acknowledge(0);
410410   if (result == 2)
411411      result = pic8259_acknowledge(1);
412   bebox_set_irq_bit(5, 0);   /* HACK */
412   bebox_set_irq_bit(machine, 5, 0);   /* HACK */
413413   return ((UINT64) result) << 56;
414414}
415415
r1980r1981
421421   {
422422      case 0:
423423         /* Master */
424         bebox_set_irq_bit(5, interrupt);
424         bebox_set_irq_bit(Machine, 5, interrupt);
425425         break;
426426
427427      case 1:
r1980r1981
479479
480480static void bebox_ide_interrupt(int state)
481481{
482   bebox_set_irq_bit(7, state);
482   bebox_set_irq_bit(Machine, 7, state);
483483   pic8259_set_irq_line(1, 6, state);
484484}
485485
r1980r1981
766766
767767static void bebox_keyboard_interrupt(int state)
768768{
769   bebox_set_irq_bit(16, state);
769   bebox_set_irq_bit(Machine, 16, state);
770770   pic8259_set_irq_line(0, 1, state);
771771}
772772
r1980r1981
865865
866866static void scsi53c810_irq_callback(void)
867867{
868   bebox_set_irq_bit(21, 1);
869   bebox_set_irq_bit(21, 0);
868   bebox_set_irq_bit(Machine, 21, 1);
869   bebox_set_irq_bit(Machine, 21, 0);
870870}
871871
872872
src/mess/machine/z80dart.h
r1980r1981
4646    CONTROL REGISTER READ/WRITE
4747***************************************************************************/
4848
49void z80dart_c_w(int which, int ch, UINT8 data);
49void z80dart_c_w(running_machine *machine, int which, int ch, UINT8 data);
5050UINT8 z80dart_c_r(int which, int ch);
5151
5252
src/mess/machine/mtx.c
r1980r1981
263263
264264WRITE8_HANDLER( mtx_dart_control_w )
265265{
266   z80dart_c_w(0, offset, data);
266   z80dart_c_w(machine, 0, offset, data);
267267}
268268
269269static const z80dart_interface mtx_dart_intf =
src/mess/machine/microtan.c
r1980r1981
135135    },
136136};
137137
138static void microtan_set_irq_line(void)
138static void microtan_set_irq_line(running_machine *machine)
139139{
140140    /* The 6502 IRQ line is active low and probably driven
141141       by open collector outputs (guess). Since MAME/MESS use
142142       a non-0 value for ASSERT_LINE we OR the signals here */
143    cpunum_set_input_line(Machine, 0, 0, via_0_irq_line | via_1_irq_line | kbd_irq_line);
143    cpunum_set_input_line(machine, 0, 0, via_0_irq_line | via_1_irq_line | kbd_irq_line);
144144}
145145
146146static mess_image *cassette_device_image(void)
r1980r1981
219219{
220220    LOG(("microtan_via_0_irq %d\n", state));
221221    via_0_irq_line = state;
222    microtan_set_irq_line();
222    microtan_set_irq_line(Machine);
223223}
224224
225225/**************************************************************
r1980r1981
291291{
292292    LOG(("microtan_via_1_irq %d\n", state));
293293    via_1_irq_line = state;
294    microtan_set_irq_line();
294    microtan_set_irq_line(Machine);
295295}
296296
297297/**************************************************************
r1980r1981
381381        LOG(("microtan_bff0_w: %d <- %02x (keyboard IRQ clear )\n", offset, data));
382382        microtan_keyboard_ascii &= ~0x80;
383383        kbd_irq_line = CLEAR_LINE;
384        microtan_set_irq_line();
384        microtan_set_irq_line(machine);
385385        break;
386386    case 1: /* BFF1: write delayed NMI */
387387        LOG(("microtan_bff1_w: %d <- %02x (delayed NMI)\n", offset, data));
r1980r1981
580580    return INIT_PASS;
581581}
582582
583static void store_key(int key)
583static void store_key(running_machine *machine, int key)
584584{
585585    LOG(("microtan: store key '%c'\n", key));
586586    microtan_keyboard_ascii = key | 0x80;
587587    kbd_irq_line = ASSERT_LINE;
588    microtan_set_irq_line();
588    microtan_set_irq_line(machine);
589589}
590590
591591INTERRUPT_GEN( microtan_interrupt )
r1980r1981
657657            if( key )   /* normal key */
658658            {
659659                repeater = 30;
660                store_key(key);
660                store_key(machine, key);
661661            }
662662            else
663663            if( (row == 0) && (chg == 0x04) ) /* Ctrl-@ (NUL) */
664                store_key(0);
664                store_key(machine, 0);
665665            keyrows[row] |= new;
666666        }
667667        else
r1980r1981
673673    else
674674    if ( key && (keyrows[lastrow] & mask) && repeat == 0 )
675675    {
676        store_key(key);
676        store_key(machine, key);
677677    }
678678}
679679
r1980r1981
690690    activecpu_set_reg(M6502_S, snapshot_buff[base+6]);
691691}
692692
693static void microtan_snapshot_copy(UINT8 *snapshot_buff, int snapshot_size)
693static void microtan_snapshot_copy(running_machine *machine, UINT8 *snapshot_buff, int snapshot_size)
694694{
695   running_machine *machine = Machine;
696695    UINT8 *RAM = memory_region(REGION_CPU1);
697696
698697    /* check for .DMP file format */
r1980r1981
801800   if (microtan_varify_snapshot(snapshot_buff, snapshot_size)==IMAGE_VERIFY_FAIL)
802801      return INIT_FAIL;
803802
804   microtan_snapshot_copy(snapshot_buff, snapshot_size);
803   microtan_snapshot_copy(Machine, snapshot_buff, snapshot_size);
805804   return INIT_PASS;
806805}
807806
r1980r1981
836835   else
837836      rc = parse_zillion_hex(snapshot_buff, buff);
838837   if (rc == INIT_PASS)
839      microtan_snapshot_copy(snapshot_buff, snapshot_size);
838      microtan_snapshot_copy(Machine, snapshot_buff, snapshot_size);
840839   free(snapshot_buff);
841840   return rc;
842841}
src/mess/machine/amigacrt.c
r1980r1981
1111
1212
1313#include "driver.h"
14#include "deprecat.h"
1514#include "amiga.h"
1615#include "cpu/m68000/m68k.h"
1716#include "machine/6526cia.h"
r1980r1981
186185
187186static UINT16 amiga_ar23_mode;
188187
189static void amiga_ar23_freeze( void );
188static void amiga_ar23_freeze( running_machine *machine );
190189
191190static READ16_HANDLER( amiga_ar23_cia_r )
192191{
r1980r1981
194193
195194   if ( ACCESSING_LSB && offset == 2048 && pc >= 0x40 && pc < 0x120 )
196195   {
197      amiga_ar23_freeze();
196      amiga_ar23_freeze(machine);
198197   }
199198
200199   return amiga_cia_r( machine, offset, mem_mask );
r1980r1981
250249   if ( offset == (0x08/2) )
251250   {
252251      if ( amiga_ar23_mode & 1 )
253         amiga_ar23_freeze();
252         amiga_ar23_freeze(machine);
254253   }
255254
256255   amiga_chip_ram_w( offset * 2, data );
257256}
258257
259static void amiga_ar23_freeze( void )
258static void amiga_ar23_freeze( running_machine *machine )
260259{
261260   int pc = safe_activecpu_get_pc();
262261
r1980r1981
281280      memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x000000, amiga_chip_ram_size - 1, 0, 0, amiga_ar23_chipmem_w);
282281
283282      /* trigger NMI irq */
284      cpunum_set_input_line(Machine, 0, 7, PULSE_LINE);
283      cpunum_set_input_line(machine, 0, 7, PULSE_LINE);
285284   }
286285}
287286
288static void amiga_ar23_nmi( void )
287static void amiga_ar23_nmi( running_machine *machine )
289288{
290289   amiga_ar23_mode = 0;
291   amiga_ar23_freeze();
290   amiga_ar23_freeze(machine);
292291}
293292
294293#if 0
r1980r1981
453452
454453      case ACTION_REPLAY_MKII:
455454      case ACTION_REPLAY_MKIII:
456         amiga_ar23_nmi();
455         amiga_ar23_nmi(Machine);
457456      break;
458457   }
459458}
src/mess/machine/osborne1.c
r1980r1981
226226static void osborne1_z80_irq_reti(int param) {
227227}
228228
229static void osborne1_update_irq_state(void) {
229static void osborne1_update_irq_state(running_machine *machine) {
230230   //logerror("Changing irq state; pia_0_irq_state = %s, pia_1_irq_state = %s\n", osborne1.pia_0_irq_state ? "SET" : "CLEARED", osborne1.pia_1_irq_state ? "SET" : "CLEARED" );
231231
232232   if ( osborne1.pia_1_irq_state ) {
233      cpunum_set_input_line(Machine, 0, 0, ASSERT_LINE );
233      cpunum_set_input_line(machine, 0, 0, ASSERT_LINE );
234234   } else {
235      cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE );
235      cpunum_set_input_line(machine, 0, 0, CLEAR_LINE );
236236   }
237237}
238238
239239static void ieee_pia_irq_a_func(int state) {
240240   osborne1.pia_0_irq_state = state;
241   osborne1_update_irq_state();
241   osborne1_update_irq_state(Machine);
242242}
243243
244244static const pia6821_interface osborne1_ieee_pia_config = {
r1980r1981
279279
280280static void video_pia_irq_a_func(int state) {
281281   osborne1.pia_1_irq_state = state;
282   osborne1_update_irq_state();
282   osborne1_update_irq_state(Machine);
283283}
284284
285285static const pia6821_interface osborne1_video_pia_config = {
src/mess/machine/cpm_bios.c
r1980r1981
1111
1212#include "driver.h"
1313#include "memory.h"
14#include "deprecat.h"
1514#include "cpu/z80/z80.h"
1615#include "machine/wd17xx.h"
1716#include "cpm_bios.h"
r1980r1981
131130 *   cpm_init
132131 *   Initialize the BIOS simulation for 'n' drives of types stored in 'ids'
133132 *****************************************************************************/
134int cpm_init(int n, const char *const ids[])
133int cpm_init( running_machine *machine, int n, const char *const ids[])
135134{
136135   UINT8 * RAM = memory_get_write_ptr(0, ADDRESS_SPACE_PROGRAM, 0x0000);
137136   const dsk_fmt *f;
r1980r1981
261260
262261   cpm_jumptable();
263262
264   add_exit_callback(Machine, cpm_exit);
263   add_exit_callback(machine, cpm_exit);
265264   return 0;
266265}
267266
src/mess/machine/cpm_bios.h
r1980r1981
148148
149149/* these are in cpm_bios.c */
150150DEVICE_LOAD( cpm_floppy );
151extern int cpm_init(int n, const char *const ids[]);
151extern int cpm_init(running_machine *machine, int n, const char *const ids[]);
152152
153153extern READ8_HANDLER ( cpm_bios_command_r );
154154extern WRITE8_HANDLER ( cpm_bios_command_w );
src/mess/machine/sms.c
r1980r1981
1#include <stdio.h>
21#include "driver.h"
2#include "deprecat.h"
33#include "image.h"
44#include "includes/sms.h"
55#include "video/smsvdp.h"
r1980r1981
468468
469469   logerror("bios write %02x, pc: %04x\n", data, activecpu_get_pc());
470470
471   setup_rom();
471   setup_rom(machine);
472472}
473473
474474WRITE8_HANDLER(sms_cartram2_w) {
r1980r1981
585585   }
586586}
587587
588void setup_rom(void)
588void setup_rom(running_machine *machine)
589589{
590590   /* 1. set up bank pointers to point to nothing */
591591   memory_set_bankptr( 1, sms_banking_none[1] );
r1980r1981
737737}
738738
739739DEVICE_INIT( sms_cart ) {
740   running_machine *machine = Machine;
740741   int i;
741742
742743   for ( i = 0; i < MAX_CARTRIDGES; i++ ) {
r1980r1981
765766
766767DEVICE_LOAD( sms_cart )
767768{
769   running_machine *machine = Machine;
768770   int size = image_length(image);
769771   int index = image_index_in_device( image );
770772   const char *fname = image_filename( image );
r1980r1981
938940
939941   setup_banks();
940942
941   setup_rom();
943   setup_rom(machine);
942944
943945   rapid_fire_state_1 = 0;
944946   rapid_fire_state_2 = 0;
r1980r1981
975977   }
976978   setup_cart_banks();
977979   memory_set_bankptr( 10, sms_banking_cart[3] + 0x2000 );
978   setup_rom();
980   setup_rom(machine);
979981}
980982
981983READ8_HANDLER(sms_store_select1) {
src/mess/machine/primo.c
r1980r1981
1111
1212/* Core includes */
1313#include "driver.h"
14#include "deprecat.h"
1514#include "includes/primo.h"
1615
1716/* Components */
r1980r1981
239238
240239*******************************************************************************/
241240
242static void primo_common_machine_init (void)
241static void primo_common_machine_init (running_machine *machine)
243242{
244243   if (readinputport(6))
245244      primo_port_FD = 0x00;
246245   primo_update_memory();
247   cpunum_set_clockscale(Machine, 0, readinputport(5) ? 1.5 : 1.0);
246   cpunum_set_clockscale(machine, 0, readinputport(5) ? 1.5 : 1.0);
248247}
249248
250249MACHINE_RESET( primoa )
251250{
252   primo_common_machine_init();
251   primo_common_machine_init(machine);
253252}
254253
255254MACHINE_RESET( primob )
256255{
257   primo_common_machine_init();
256   primo_common_machine_init(machine);
258257
259258   cbm_serial_reset_write (0);
260259   cbm_drive_0_config (SERIAL, 8);
src/mess/machine/ti85.c
r1980r1981
102102static int ti85_send_serial (UINT8*, UINT32);
103103
104104static void ti85_reset_serial (running_machine *machine);
105static void ti85_update_serial (void);
106static void ti85_send_variables (void);
107static void ti85_send_backup (void);
108static void ti85_receive_variables (void);
109static void ti85_receive_backup (void);
110static void ti85_receive_screen (void);
105static void ti85_update_serial (running_machine *machine);
106static void ti85_send_variables (running_machine *machine);
107static void ti85_send_backup (running_machine *machine);
108static void ti85_receive_variables (running_machine *machine);
109static void ti85_receive_backup (running_machine *machine);
110static void ti85_receive_screen (running_machine *machine);
111111
112112static TIMER_CALLBACK(ti85_timer_callback)
113113{
r1980r1981
336336
337337 READ8_HANDLER ( ti85_port_0007_r )
338338{
339   ti85_update_serial();
339   ti85_update_serial(machine);
340340        return  (ti85_white_out<<3) |
341341      (ti85_red_out<<2)|
342342                ((ti85_white_in&(1-ti85_white_out))<<1)|
r1980r1981
406406   speaker_level_w(0,( (data>>2)|(data>>3) )&0x01 );
407407        ti85_red_out=(data>>2)&0x01;
408408        ti85_white_out=(data>>3)&0x01;
409   ti85_update_serial();
409   ti85_update_serial(machine);
410410   ti85_PCR = data&0xf0;
411411}
412412
r1980r1981
478478  TI calculators snapshot files (SAV)
479479***************************************************************************/
480480
481static void ti8x_snapshot_setup_registers (UINT8 * data)
481static void ti8x_snapshot_setup_registers (running_machine *machine, UINT8 * data)
482482{
483483   unsigned char lo,hi;
484484   unsigned char * reg = data + 0x40;
r1980r1981
530530
531531   activecpu_set_input_line(0, 0);
532532   activecpu_set_input_line(INPUT_LINE_NMI, 0);
533   cpunum_set_input_line(Machine, 0, INPUT_LINE_HALT, 0);
533   cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, 0);
534534}
535535
536static void ti85_setup_snapshot (UINT8 * data)
536static void ti85_setup_snapshot (running_machine *machine, UINT8 * data)
537537{
538538   int i;
539539   unsigned char lo,hi;
540540   unsigned char * hdw = data + 0x8000 + 0x94;
541541
542   ti8x_snapshot_setup_registers (data);
542   ti8x_snapshot_setup_registers (machine, data);
543543
544544   /* Memory dump */
545545   for (i = 0; i < 0x8000; i++)
r1980r1981
572572   ti85_interrupt_speed = 0x03;
573573}
574574
575static void ti86_setup_snapshot (UINT8 * data)
575static void ti86_setup_snapshot (running_machine *machine, UINT8 * data)
576576{
577577   unsigned char lo,hi;
578578   unsigned char * hdw = data + 0x20000 + 0x94;
579579
580   ti8x_snapshot_setup_registers (data);
580   ti8x_snapshot_setup_registers (machine, data);
581581
582582   /* Memory dump */
583583   memcpy(ti86_ram, data+0x94, 0x20000);
r1980r1981
638638
639639   switch (ti_calculator_model)
640640   {
641      case TI_85: ti85_setup_snapshot(ti8x_snapshot_data); break;
642      case TI_86: ti86_setup_snapshot(ti8x_snapshot_data); break;
641      case TI_85: ti85_setup_snapshot(Machine, ti8x_snapshot_data); break;
642      case TI_86: ti86_setup_snapshot(Machine, ti8x_snapshot_data); break;
643643   }
644644   free(ti8x_snapshot_data);
645645   return INIT_PASS;
r1980r1981
792792   return 1;
793793}
794794
795void ti85_update_serial (void)
795void ti85_update_serial (running_machine *machine)
796796{
797797   if (ti85_serial_status == TI85_SEND_STOP)
798798   {
r1980r1981
814814      else
815815      {
816816         ti85_receive_serial(NULL, 0);
817         ti85_free_serial_data_memory(Machine);
817         ti85_free_serial_data_memory(machine);
818818         if (readinputport(10)&0x01)
819819         {
820820            ti85_serial_status = TI85_PREPARE_SCREEN_REQUEST;
r1980r1981
827827   switch (ti85_serial_transfer_type)
828828   {
829829      case TI85_SEND_VARIABLES:
830         ti85_send_variables();
830         ti85_send_variables(machine);
831831         break;
832832      case TI85_SEND_BACKUP:
833         ti85_send_backup();
833         ti85_send_backup(machine);
834834         break;
835835      case TI85_RECEIVE_BACKUP:
836         ti85_receive_backup();
836         ti85_receive_backup(machine);
837837         break;
838838      case TI85_RECEIVE_VARIABLES:
839         ti85_receive_variables();
839         ti85_receive_variables(machine);
840840         break;
841841      case TI85_RECEIVE_SCREEN:
842         ti85_receive_screen();
842         ti85_receive_screen(machine);
843843         break;
844844   }
845845}
r1980r1981
855855   ti85_white_out = 0x00;
856856   ti85_PCR = 0xc0;
857857   ti85_serial_status = TI85_SEND_RESET;
858   ti85_send_variables();
859   ti85_send_backup();
860   ti85_receive_variables();
861   ti85_receive_backup();
858   ti85_send_variables(machine);
859   ti85_send_backup(machine);
860   ti85_receive_variables(machine);
861   ti85_receive_backup(machine);
862862   ti85_serial_status = TI85_SEND_STOP;
863863}
864static void ti85_send_variables (void)
864static void ti85_send_variables (running_machine *machine)
865865{
866866   static UINT16 variable_number = 0;
867867
r1980r1981
914914                  break;
915915               case 0x03:   //out of memory
916916                  variable_number = 0;
917                  ti85_free_serial_data_memory(Machine);
917                  ti85_free_serial_data_memory(machine);
918918                  ti85_serial_status = TI85_SEND_STOP;
919919                  break;
920920            }
r1980r1981
928928            {
929929               case 0x01:   //exit
930930                  variable_number = 0;
931                  ti85_free_serial_data_memory(Machine);
931                  ti85_free_serial_data_memory(machine);
932932                  ti85_serial_status = TI85_SEND_STOP;
933933                  break;
934934               case 0x02:   //skip
r1980r1981
970970         {
971971            logerror ("OK received\n");
972972            ti85_convert_stream_to_data (ti85_receive_buffer, 4*8, ti85_receive_data);
973            ti85_free_serial_data_memory(Machine);
973            ti85_free_serial_data_memory(machine);
974974            ti85_serial_status = TI85_SEND_STOP;
975975         }
976976         break;
r1980r1981
980980   }
981981}
982982
983static void ti85_send_backup (void)
983static void ti85_send_backup (running_machine *machine)
984984{
985985   static UINT16 variable_number = 0;
986986
r1980r1981
10201020         {
10211021            ti85_convert_stream_to_data (ti85_receive_buffer, 5*8, ti85_receive_data);
10221022            variable_number = 0;
1023            ti85_free_serial_data_memory(Machine);
1023            ti85_free_serial_data_memory(machine);
10241024            ti85_serial_status = TI85_SEND_STOP;
10251025         }
10261026         break;
r1980r1981
10441044         if(!ti85_send_serial(ti85_serial_stream.end,ti85_serial_stream.end_size))
10451045         {
10461046            variable_number = 0;
1047            ti85_free_serial_data_memory(Machine);
1047            ti85_free_serial_data_memory(machine);
10481048            ti85_serial_status = TI85_SEND_STOP;
10491049         }
10501050         break;
r1980r1981
10541054   }
10551055}
10561056
1057static void ti85_receive_variables (void)
1057static void ti85_receive_variables (running_machine *machine)
10581058{
10591059   static UINT8* var_data = NULL;
10601060   static UINT32 var_file_number = 0;
r1980r1981
10801080         if(!var_data)
10811081            ti85_serial_status = TI85_SEND_STOP;
10821082         memcpy (var_data, ti85_receive_data+2, 5);
1083         ti85_free_serial_data_memory(Machine);
1083         ti85_free_serial_data_memory(machine);
10841084         if (!ti85_alloc_serial_data_memory(var_data[0]-1))
10851085         {
10861086            free(var_data); var_data = NULL;
r1980r1981
10941094         {
10951095            ti85_convert_stream_to_data (ti85_receive_buffer, (var_data[0]-1)*8, ti85_receive_data);
10961096            memcpy (var_data+5, ti85_receive_data, var_data[0]-3);
1097            ti85_free_serial_data_memory(Machine);
1097            ti85_free_serial_data_memory(machine);
10981098            if(!ti85_alloc_serial_data_memory (8))
10991099            {
11001100               free(var_data); var_data = NULL;
r1980r1981
11141114      case TI85_SEND_CONTINUE:
11151115         if(!ti85_send_serial(ti85_receive_buffer+4*8, 4*8))
11161116         {
1117            ti85_free_serial_data_memory(Machine);
1117            ti85_free_serial_data_memory(machine);
11181118            if(!ti85_alloc_serial_data_memory(4))
11191119            {
11201120               free(var_data); var_data = NULL;
r1980r1981
11291129         if(!ti85_receive_serial (ti85_receive_buffer, 4*8))
11301130         {
11311131            ti85_convert_stream_to_data (ti85_receive_buffer, 4*8, ti85_receive_data);
1132            ti85_free_serial_data_memory(Machine);
1132            ti85_free_serial_data_memory(machine);
11331133            if(!ti85_alloc_serial_data_memory(var_data[2]+var_data[3]*256+6))
11341134            {
11351135               free(var_data); var_data = NULL;
r1980r1981
11451145         {
11461146            ti85_convert_stream_to_data (ti85_receive_buffer, (var_data[2]+var_data[3]*256+6)*8, ti85_receive_data);
11471147            memcpy (var_data+var_data[0]+2, ti85_receive_data+2, var_data[2]+var_data[3]*256+2);
1148            ti85_free_serial_data_memory(Machine);
1148            ti85_free_serial_data_memory(machine);
11491149            if(!ti85_alloc_serial_data_memory (4))
11501150            {
11511151               free(var_data); var_data = NULL;
r1980r1981
11601160      case TI85_SEND_OK_2:
11611161         if(!ti85_send_serial(ti85_receive_buffer, 4*8))
11621162         {
1163            ti85_free_serial_data_memory(Machine);
1163            ti85_free_serial_data_memory(machine);
11641164            if(!ti85_alloc_serial_data_memory(7))
11651165            {
11661166               free(var_data); var_data = NULL;
r1980r1981
12131213               ti85_serial_status = TI85_RECEIVE_HEADER_1;
12141214            else
12151215            {
1216               ti85_free_serial_data_memory(Machine);
1216               ti85_free_serial_data_memory(machine);
12171217               if(!ti85_alloc_serial_data_memory (4))
12181218               {
12191219                  free(var_data); var_data = NULL;
r1980r1981
12291229      case TI85_SEND_OK_3:
12301230         if(!ti85_send_serial(ti85_receive_buffer, 4*8))
12311231         {
1232            ti85_free_serial_data_memory(Machine);
1232            ti85_free_serial_data_memory(machine);
12331233            variable_number = 0;
12341234            ti85_serial_status =  TI85_SEND_STOP;
12351235            sprintf (var_file_name, "%08d.85g", var_file_number);
r1980r1981
12601260   }
12611261}
12621262
1263static void ti85_receive_backup (void)
1263static void ti85_receive_backup (running_machine *machine)
12641264{
12651265   static int backup_variable_number = 0;
12661266   static int backup_data_size[3];
r1980r1981
12931293            backup_file_data[0x35] = (backup_data_size[0]+backup_data_size[1]+backup_data_size[2]+0x11)&0x00ff;
12941294            backup_file_data[0x36] = ((backup_data_size[0]+backup_data_size[1]+backup_data_size[2]+0x11)&0xff00)>>8;
12951295            memcpy(backup_file_data+0x37, ti85_receive_data+0x02, 0x0b);
1296            ti85_free_serial_data_memory(Machine);
1296            ti85_free_serial_data_memory(machine);
12971297            if(!ti85_alloc_serial_data_memory (8))
12981298            {
12991299               free(backup_file_data); backup_file_data = NULL;
r1980r1981
13131313      case TI85_SEND_CONTINUE:
13141314         if(!ti85_send_serial(ti85_receive_buffer+4*8, 4*8))
13151315         {
1316            ti85_free_serial_data_memory(Machine);
1316            ti85_free_serial_data_memory(machine);
13171317            if(!ti85_alloc_serial_data_memory(4))
13181318            {
13191319               free(backup_file_data); backup_file_data = NULL;
r1980r1981
13281328         if(!ti85_receive_serial (ti85_receive_buffer, 4*8))
13291329         {
13301330            ti85_convert_stream_to_data (ti85_receive_buffer, 4*8, ti85_receive_data);
1331            ti85_free_serial_data_memory(Machine);
1331            ti85_free_serial_data_memory(machine);
13321332            if(!ti85_alloc_serial_data_memory(backup_data_size[backup_variable_number]+6))
13331333            {
13341334               free(backup_file_data); backup_file_data = NULL;
r1980r1981
13551355                  memcpy(backup_file_data+0x42+backup_data_size[0]+backup_data_size[1]+0x04, ti85_receive_data+0x02, backup_data_size[2]+0x02);
13561356                  break;
13571357            }
1358            ti85_free_serial_data_memory(Machine);
1358            ti85_free_serial_data_memory(machine);
13591359            if(!ti85_alloc_serial_data_memory (4))
13601360            {
13611361               free(backup_file_data); backup_file_data = NULL;
r1980r1981
13701370      case TI85_SEND_OK_2:
13711371         if(!ti85_send_serial(ti85_receive_buffer, 4*8))
13721372         {
1373            ti85_free_serial_data_memory(Machine);
1373            ti85_free_serial_data_memory(machine);
13741374            backup_variable_number++;
13751375            if (backup_variable_number<3)
13761376            {
r1980r1981
14111411   }
14121412}
14131413
1414static void ti85_receive_screen (void)
1414static void ti85_receive_screen (running_machine *machine)
14151415{
14161416   static UINT32 image_file_number = 0;
14171417   char image_file_name[] = "00000000.85i";
r1980r1981
14331433      case TI85_SEND_SCREEN_REQUEST:
14341434         if(!ti85_send_serial(ti85_receive_buffer, 4*8))
14351435         {
1436            ti85_free_serial_data_memory(Machine);
1436            ti85_free_serial_data_memory(machine);
14371437            if(!ti85_alloc_serial_data_memory (4))
14381438            {
14391439               ti85_serial_status = TI85_SEND_STOP;
r1980r1981
14461446         if(!ti85_receive_serial (ti85_receive_buffer, 4*8))
14471447         {
14481448            ti85_convert_stream_to_data (ti85_receive_buffer, 4*8, ti85_receive_data);
1449            ti85_free_serial_data_memory(Machine);
1449            ti85_free_serial_data_memory(machine);
14501450            if(!ti85_alloc_serial_data_memory (1030))
14511451            {
14521452               ti85_serial_status = TI85_SEND_STOP;
r1980r1981
14661466               image_file_data = malloc (0x49+1008);
14671467               if(!image_file_data)
14681468               {
1469                  ti85_free_serial_data_memory(Machine);
1469                  ti85_free_serial_data_memory(machine);
14701470                  ti85_serial_status = TI85_SEND_OK;
14711471                  return;
14721472               }
r1980r1981
14941494               free(image_file_data);
14951495               image_file_number++;
14961496            }
1497            ti85_free_serial_data_memory(Machine);
1497            ti85_free_serial_data_memory(machine);
14981498            if(!ti85_alloc_serial_data_memory (4))
14991499            {
15001500               ti85_serial_status = TI85_SEND_STOP;
r1980r1981
15071507      case TI85_SEND_OK:
15081508         if(!ti85_send_serial(ti85_receive_buffer, 4*8))
15091509         {
1510            ti85_free_serial_data_memory(Machine);
1510            ti85_free_serial_data_memory(machine);
15111511            ti85_serial_status = TI85_SEND_STOP;
15121512         }
15131513         break;
src/mess/machine/c64.c
r1980r1981
1212    (program write some short test code into the vic sprite register)
1313 */
1414
15#include <ctype.h>
1615#include "driver.h"
1716
1817#include "cpu/m6502/m6502.h"
r1980r1981
8079static UINT8 serial_clock, serial_data, serial_atn;
8180static UINT8 vicirq = 0;
8281
83static int is_c65(void)
82static int is_c65(running_machine *machine)
8483{
85   return !strncmp(Machine->gamedrv->name, "c65", 3);
84   return !strncmp(machine->gamedrv->name, "c65", 3);
8685}
8786
88static int is_c128(void)
87static int is_c128(running_machine *machine)
8988{
90   return !strncmp(Machine->gamedrv->name, "c128", 4);
89   return !strncmp(machine->gamedrv->name, "c128", 4);
9190}
9291
93static void c64_nmi(void)
92static void c64_nmi(running_machine *machine)
9493{
9594   static int nmilevel = 0;
9695   int cia1irq = cia_get_irq(1);
9796
9897   if (nmilevel != KEY_RESTORE||cia1irq)
9998   {
100      if (is_c128())
99      if (is_c128(machine))
101100      {
102101         if (cpu_getactivecpu()==0)
103102         {
104103            /* z80 */
105            cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, KEY_RESTORE||cia1irq);
104            cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, KEY_RESTORE||cia1irq);
106105         }
107106         else
108107         {
109            cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, KEY_RESTORE||cia1irq);
108            cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, KEY_RESTORE||cia1irq);
110109         }
111110      }
112111      else
113112      {
114         cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, KEY_RESTORE||cia1irq);
113         cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, KEY_RESTORE||cia1irq);
115114      }
116115      nmilevel = KEY_RESTORE||cia1irq;
117116   }
r1980r1981
269268    if (JOYSTICK_SWAP) value &= c64_keyline[9];
270269    else value &= c64_keyline[8];
271270
272    if (is_c128())
271    if (is_c128(Machine))
273272    {
274273      if (!vic2e_k0_r ())
275274         value &= c128_keyline[0];
r1980r1981
278277      if (!vic2e_k2_r ())
279278         value &= c128_keyline[2];
280279    }
281    if (is_c65())
280    if (is_c65(Machine))
282281   {
283282      if (!(c65_6511_port&2))
284283         value&=c65_keyline;
r1980r1981
292291    vic2_lightpen_write (data & 0x10);
293292}
294293
295static void c64_irq (int level)
294static void c64_irq (running_machine *machine, int level)
296295{
297296   static int old_level = 0;
298297
299298   if (level != old_level)
300299   {
301300      DBG_LOG (3, "mos6510", ("irq %s\n", level ? "start" : "end"));
302      if (is_c128())
301      if (is_c128(machine))
303302      {
304303         if (0&&(cpu_getactivecpu()==0))
305304         {
306            cpunum_set_input_line(Machine, 0, 0, level);
305            cpunum_set_input_line(machine, 0, 0, level);
307306         }
308307         else
309308         {
310            cpunum_set_input_line(Machine, 1, M6510_IRQ_LINE, level);
309            cpunum_set_input_line(machine, 1, M6510_IRQ_LINE, level);
311310         }
312311      }
313312      else
314313      {
315         cpunum_set_input_line(Machine, 0, M6510_IRQ_LINE, level);
314         cpunum_set_input_line(machine, 0, M6510_IRQ_LINE, level);
316315      }
317316      old_level = level;
318317   }
r1980r1981
325324
326325static void c64_cia0_interrupt (int level)
327326{
328   c64_irq (level || vicirq);
327   c64_irq (Machine, level || vicirq);
329328}
330329
331330void c64_vic_interrupt (int level)
r1980r1981
333332#if 1
334333   if (level != vicirq)
335334   {
336      c64_irq (level || cia_get_irq(0));
335      c64_irq (Machine, level || cia_get_irq(0));
337336      vicirq = level;
338337   }
339338#endif
r1980r1981
381380   cbm_serial_data_write (serial_data = !(data & 0x20));
382381   cbm_serial_atn_write (serial_atn = !(data & 8));
383382   c64_vicaddr = c64_memory + helper[data & 3];
384   if (is_c128())
383   if (is_c128(Machine))
385384   {
386385      c128_vicaddr = c64_memory + helper[data & 3] + c128_va1617;
387386   }
r1980r1981
389388
390389static void c64_cia1_interrupt (int level)
391390{
392   c64_nmi();
391   c64_nmi(Machine);
393392}
394393
395394const cia6526_interface c64_cia0 =
r1980r1981
417416};
418417
419418static void c64_bankswitch (int reset);
420static void c64_robocop2_w(int offset, int value)
419static void c64_robocop2_w(running_machine *machine, int offset, int value)
421420{
422421   /* robocop2 0xe00
423422    * 80 94 80 94 80
r1980r1981
435434      c64_game = c64_exrom = 1;
436435   }
437436
438   if (is_c128())
439      c128_bankswitch_64(0);
437   if (is_c128(machine))
438      c128_bankswitch_64(machine, 0);
440439   else
441440      c64_bankswitch(0);
442441}
443442
444static void c64_supergames_w(int offset, int value)
443static void c64_supergames_w(running_machine *machine, int offset, int value)
445444{
446445   /* supergam 0xf00
447446    * 4 9 4
r1980r1981
463462      c64_game = c64_exrom = 0;
464463   }
465464
466   if (is_c128())
467      c128_bankswitch_64 (0);
465   if (is_c128(machine))
466      c128_bankswitch_64 (machine, 0);
468467   else
469468      c64_bankswitch (0);
470469}
r1980r1981
492491      /* i/o 1 */
493492      if (cartridge && (cartridgetype == CartridgeRobocop2))
494493      {
495         c64_robocop2_w(offset&0xff, data);
494         c64_robocop2_w(machine, offset&0xff, data);
496495      }
497496      else
498497         DBG_LOG (1, "io write", ("%.3x %.2x\n", offset, data));
r1980r1981
502501      /* i/o 2 */
503502      if (cartridge && (cartridgetype == CartridgeSuperGames))
504503      {
505         c64_supergames_w(offset&0xff, data);
504         c64_supergames_w(machine, offset&0xff, data);
506505      }
507506      else
508507         DBG_LOG (1, "io write", ("%.3x %.2x\n", offset, data));
r1980r1981
741740         vc20_tape_motor (data & 0x20);
742741      }
743742   }
744   if (is_c128())
745      c128_bankswitch_64 (0);
746   else if (is_c65())
743   if (is_c128(Machine))
744      c128_bankswitch_64 (Machine, 0);
745   else if (is_c65(Machine))
747746   {
748747      // NPW 8-Feb-2004 - Don't know why I have to do this
749748      //c65_bankswitch();
r1980r1981
762761      data &= ~0x10;
763762   /* WP: motor is always marked as on??? */
764763   data &= ~0x20;
765   if (is_c128() && !c128_capslock_r ())
764   if (is_c128(Machine) && !c128_capslock_r ())
766765      data &= ~0x40;
767   if (is_c65() && C65_KEY_DIN)
766   if (is_c65(Machine) && C65_KEY_DIN)
768767      data &= ~0x40; /*? */
769768   return data;
770769}
r1980r1981
853852   return c64_colorram[offset & 0x3ff] & 0xf;
854853}
855854
856static void c64_common_driver_init (void)
855static void c64_common_driver_init (running_machine *machine)
857856{
858857   /* configure the M6510 port */
859858   cpunum_set_info_fct(0, CPUINFO_PTR_M6510_PORTREAD, (genf *) c64_m6510_port_read);
r1980r1981
905904                 c64_vic_interrupt);
906905   }
907906   cia_reset();
908   add_exit_callback(Machine, c64_driver_shutdown);
907   add_exit_callback(machine, c64_driver_shutdown);
909908}
910909
911910DRIVER_INIT( c64 )
912911{
913   c64_common_driver_init ();
912   c64_common_driver_init (machine);
914913}
915914
916915DRIVER_INIT( c64pal )
917916{
918917   c64_pal = 1;
919   c64_common_driver_init ();
918   c64_common_driver_init (machine);
920919}
921920
922921DRIVER_INIT( ultimax )
923922{
924923   ultimax = 1;
925924    c64_cia1_on = 0;
926   c64_common_driver_init ();
925   c64_common_driver_init (machine);
927926}
928927
929928DRIVER_INIT( c64gs )
r1980r1981
931930   c64_pal = 1;
932931   c64_tape_on = 0;
933932    c64_cia1_on = 1;
934   c64_common_driver_init ();
933   c64_common_driver_init (machine);
935934}
936935
937936DRIVER_INIT( sx64 )
r1980r1981
939938   VC1541_CONFIG vc1541 = { 1, 8 };
940939   c64_tape_on = 0;
941940   c64_pal = 1;
942   c64_common_driver_init ();
941   c64_common_driver_init (machine);
943942   vc1541_config (0, 0, &vc1541);
944943}
945944
r1980r1981
949948      vc20_tape_close ();
950949}
951950
952void c64_common_init_machine (void)
951void c64_common_init_machine (running_machine *machine)
953952{
954953#ifdef VC1541
955954   vc1541_reset ();
r1980r1981
958957   if (c64_cia1_on)
959958   {
960959      cbm_serial_reset_write (0);
961      cbm_drive_0_config (SERIAL, is_c65() ? 10 : 8);
962      cbm_drive_1_config (SERIAL, is_c65() ? 11 : 9);
960      cbm_drive_0_config (SERIAL, is_c65(machine) ? 10 : 8);
961      cbm_drive_1_config (SERIAL, is_c65(machine) ? 11 : 9);
963962      serial_clock = serial_data = serial_atn = 1;
964963   }
965964   c64_vicaddr = c64_memory;
r1980r1981
992991   c64_port_data = 0x17;
993992
994993   c64_io_mirror = auto_malloc( 0x1000 );
995   c64_common_init_machine ();
994   c64_common_init_machine (machine);
996995
997996   c64_rom_recognition ();
998997   c64_rom_load();
999998
1000   if (is_c128())
1001      c128_bankswitch_64 (1);
999   if (is_c128(machine))
1000      c128_bankswitch_64 (machine, 1);
10021001   if (!ultimax)
10031002      c64_bankswitch (1);
10041003   memory_set_opbase_handler( 0, c64_opbase );
r1980r1981
11371136   static int monitor=-1;
11381137   int value, value2;
11391138
1140   c64_nmi();
1139   c64_nmi(machine);
11411140
1142   if (is_c128())
1141   if (is_c128(machine))
11431142   {
11441143      if (MONITOR_TV!=monitor)
11451144      {
r1980r1981
11601159   }
11611160
11621161   value = 0xff;
1163   if (is_c128())
1162   if (is_c128(machine))
11641163   {
11651164      if (C128_KEY_CURSOR_DOWN)
11661165         value &= ~0x80;
r1980r1981
11741173         value &= ~8;
11751174      if (C128_KEY_CURSOR_RIGHT)
11761175         value &= ~4;
1177   } else if (is_c65()) {
1176   } else if (is_c65(machine)) {
11781177      if (C65_KEY_CURSOR_DOWN)
11791178         value &= ~0x80;
11801179      if (C65_KEY_F5)
r1980r1981
13041303      value &= ~0x40;
13051304   if (KEY_EQUALS)
13061305      value &= ~0x20;
1307   if (is_c128())
1306   if (is_c128(machine))
13081307   {
13091308      if (C128_KEY_RIGHT_SHIFT)
13101309      value &= ~0x10;
13111310   }
1312   else if (is_c65())
1311   else if (is_c65(machine))
13131312   {
13141313      if (C65_KEY_RIGHT_SHIFT)
13151314      value &= ~0x10;
r1980r1981
13301329   c64_keyline[6] = value;
13311330
13321331   value = 0xff;
1333   if (is_c65()) {
1332   if (is_c65(machine)) {
13341333      if (C65_KEY_STOP)
13351334         value &= ~0x80;
13361335      if (C65_KEY_SPACE)
r1980r1981
14051404   }
14061405   c64_keyline[9] = value2;
14071406
1408   if (is_c128())
1407   if (is_c128(machine))
14091408   {
14101409      value = 0xff;
14111410      if (KEY_NUM1)
r1980r1981
14651464      c128_keyline[2] = value;
14661465   }
14671466
1468   if (is_c65()) {
1467   if (is_c65(machine)) {
14691468      value = 0xff;
14701469      if (C65_KEY_ESCAPE)
14711470         value &= ~0x80;
src/mess/machine/hd63450.c
r1980r1981
116116      {
117117         dmac.reg[channel].ccr = data & 0x00ff;
118118         if((data & 0x0080))// && !dmac.intf->dma_read[channel] && !dmac.intf->dma_write[channel])
119            dma_transfer_start(channel,0);
119            dma_transfer_start(Machine, channel,0);
120120         if(data & 0x0010)  // software abort
121121            dma_transfer_abort(channel);
122122         if(data & 0x0020)  // halt operation
r1980r1981
189189   }
190190}
191191
192void dma_transfer_start(int channel, int dir)
192void dma_transfer_start(running_machine *machine, int channel, int dir)
193193{
194194   dmac.in_progress[channel] = 1;
195195   dmac.reg[channel].csr &= ~0xe0;
r1980r1981
206206   // Burst transfers will halt the CPU until the transfer is complete
207207   if((dmac.reg[channel].dcr & 0xc0) == 0x00)  // Burst transfer
208208   {
209      cpunum_set_input_line(Machine, dmac.intf->cpu,INPUT_LINE_HALT,ASSERT_LINE);
209      cpunum_set_input_line(machine, dmac.intf->cpu,INPUT_LINE_HALT,ASSERT_LINE);
210210      timer_adjust_periodic(dmac.timer[channel], attotime_zero, channel, dmac.intf->burst_clock[channel]);
211211   }
212212   else
r1980r1981
220220
221221static TIMER_CALLBACK(dma_transfer_timer)
222222{
223   hd63450_single_transfer(param);
223   hd63450_single_transfer(machine, param);
224224}
225225
226226static void dma_transfer_abort(int channel)
r1980r1981
248248   }
249249}
250250
251void hd63450_single_transfer(int x)
251void hd63450_single_transfer(running_machine *machine, int x)
252252{
253253   int data;
254254   int datasize = 1;
r1980r1981
369369            dmac.reg[x].csr |= 0xe0;  // channel operation complete, block transfer complete
370370            dmac.reg[x].csr &= ~0x08;  // channel no longer active
371371            if((dmac.reg[x].dcr & 0xc0) == 0x00)  // Burst transfer
372               cpunum_set_input_line(Machine, dmac.intf->cpu,INPUT_LINE_HALT,CLEAR_LINE);
372               cpunum_set_input_line(machine, dmac.intf->cpu,INPUT_LINE_HALT,CLEAR_LINE);
373373
374374            if(dmac.intf->dma_end)
375375               dmac.intf->dma_end(x,dmac.reg[x].ccr & 0x08);
src/mess/machine/genesis.c
r1980r1981
2121*/
2222
2323#include "driver.h"
24#include "deprecat.h"
2524#include "includes/genesis.h"
2625#include "sound/2612intf.h"
2726#include "sound/sn76496.h"
r1980r1981
8483};
8584
8685
87void genesis_vdp_start (genvdp *current_vdp)
86static void genesis_vdp_start (running_machine *machine, genvdp *current_vdp)
8887{
8988   int gfx_index=0;
9089
r1980r1981
108107
109108   /* find first empty slot to decode gfx */
110109   for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++)
111      if (Machine->gfx[gfx_index] == 0)
110      if (machine->gfx[gfx_index] == 0)
112111         break;
113112
114113//   if (gfx_index == MAX_GFX_ELEMENTS)
115114//      return 1;
116115
117116   /* create the char set (gfx will then be updated dynamically from RAM) */
118   Machine->gfx[gfx_index] = allocgfx(&charlayout);
119   decodegfx(Machine->gfx[gfx_index] , (UINT8 *)&current_vdp->genesis_vdp_vram, 0, 1);
117   machine->gfx[gfx_index] = allocgfx(&charlayout);
118   decodegfx(machine->gfx[gfx_index] , (UINT8 *)&current_vdp->genesis_vdp_vram, 0, 1);
120119
121120   /* set the color information */
122   Machine->gfx[gfx_index]->total_colors = 0x4;
121   machine->gfx[gfx_index]->total_colors = 0x4;
123122   current_vdp -> genesis_vdp_index = gfx_index;
124123
125124}
r1980r1981
179178}
180179
181180
182void genesis_vdp_spritebuffer_scanline (genvdp *current_vdp, int line, int reqpri)
181static void genesis_vdp_spritebuffer_scanline (running_machine *machine, genvdp *current_vdp, int line, int reqpri)
183182{
184   const gfx_element *gfx = Machine->gfx[0];
183   const gfx_element *gfx = machine->gfx[0];
185184   UINT8 *srcgfx = gfx->gfxdata;
186185   int shadowmode = genesis_vdp.genesis_vdp_regs[0x0c]&0x08;
187186   int sbr = genesis_vdp.genesis_vdp_regs[0x05]<<9;
r1980r1981
339338c0-ff are unused
340339*/
341340
342void genesis_vdp_render_scanline (genvdp *current_vdp, int line)
341static void genesis_vdp_render_scanline (running_machine *machine, genvdp *current_vdp, int line)
343342{
344   const gfx_element *gfx = Machine->gfx[0];
343   const gfx_element *gfx = machine->gfx[0];
345344
346345   int _2tileblock;
347346   UINT8 *srcgfx = gfx->gfxdata;
r1980r1981
738737      }
739738   }
740739
741   genesis_vdp_spritebuffer_scanline(current_vdp, line, 0);
740   genesis_vdp_spritebuffer_scanline(machine,current_vdp, line, 0);
742741
743742   /* Scroll B High */
744743   renderto = current_vdp->genesis_vdp_bg_render_buffer;
r1980r1981
10171016      }
10181017   }
10191018
1020   genesis_vdp_spritebuffer_scanline(current_vdp, line, 1);
1019   genesis_vdp_spritebuffer_scanline(machine, current_vdp, line, 1);
10211020
10221021
10231022}
r1980r1981
10251024
10261025VIDEO_START(genesis)
10271026{
1028   genesis_vdp_start (&genesis_vdp);
1027   genesis_vdp_start (machine, &genesis_vdp);
10291028   oldscreenmode = 0xff; // driver specific
10301029   VIDEO_START_CALL(generic_bitmapped);
10311030}
r1980r1981
22152214
22162215*/
22172216
2218void genesis_init_frame(void)
2217static void genesis_init_frame(running_machine *machine)
22192218{
22202219   int i;
22212220   if ((genesis_vdp.genesis_vdp_regs[0x0c]&0x81) != oldscreenmode)
r1980r1981
22382237   {
22392238      if (genesis_vdp.genesis_vdp_vram_is_dirty[i])
22402239      {
2241         decodechar(Machine->gfx[genesis_vdp.genesis_vdp_index], i,(UINT8 *)genesis_vdp.genesis_vdp_vram);
2240         decodechar(machine->gfx[genesis_vdp.genesis_vdp_index], i,(UINT8 *)genesis_vdp.genesis_vdp_vram);
22422241         genesis_vdp.genesis_vdp_vram_is_dirty[i] = 0;
22432242      }
22442243   }
r1980r1981
22532252
22542253   genesis_vdp.irq4_counter--;
22552254
2256   if (scan == 0) genesis_init_frame(); // decode gfx tiles etc.
2255   if (scan == 0) genesis_init_frame(machine); // decode gfx tiles etc.
22572256
22582257   if (scan==0) genesis_vdp.irq4_counter = genesis_vdp.genesis_vdp_regs[0x0a];
22592258
r1980r1981
22812280
22822281   if (( scan>=0 ) && ( genesis_vdp.sline <224))
22832282   {
2284      genesis_vdp_render_scanline(&genesis_vdp,genesis_vdp.sline);
2283      genesis_vdp_render_scanline(machine, &genesis_vdp,genesis_vdp.sline);
22852284      genesis_vdp_draw_scanline(&genesis_vdp,genesis_vdp.sline);
22862285   }
22872286
src/mess/machine/svi318.c
r1980r1981
482482}
483483
484484/* 80 column card init */
485static void svi318_80col_init(void)
485static void svi318_80col_init(running_machine *machine)
486486{
487487   /* 2K RAM, but allocating 4KB to make banking easier */
488488   /* The upper 2KB will be set to FFs and will never be written to */
489   svi.svi806_ram = new_memory_region( Machine, REGION_GFX2, 0x1000, 0 );
489   svi.svi806_ram = new_memory_region( machine, REGION_GFX2, 0x1000, 0 );
490490   memset( svi.svi806_ram, 0x00, 0x800 );
491491   memset( svi.svi806_ram + 0x800, 0xFF, 0x800 );
492492   svi.svi806_gfx = memory_region(REGION_GFX1);
r1980r1981
519519{
520520   MACHINE_RESET_CALL(svi318);
521521
522   svi318_80col_init();
522   svi318_80col_init(machine);
523523   svi.svi806_present = 1;
524524   svi318_set_banks();
525525
src/mess/machine/hd63450.h
r1980r1981
4848void hd63450_init(const struct hd63450_interface* intf);
4949int hd63450_read(int offset, UINT16 mem_mask);
5050void hd63450_write(int offset, int data, UINT16 mem_mask);
51void hd63450_single_transfer(int x);
51void hd63450_single_transfer(running_machine *machine, int x);
5252
53void dma_transfer_start(int channel, int dir);
53void dma_transfer_start(running_machine *machine, int channel, int dir);
5454
5555int hd63450_get_vector(int channel);
5656int hd63450_get_error_vector(int channel);
src/mess/machine/pc.c
r1980r1981
9393   init_pc_common(PCCOMMON_KEYBOARD_PC | PCCOMMON_DMA8237_PC | PCCOMMON_TIMER_8253);
9494
9595   europc_rtc_init();
96//   europc_rtc_set_time();
96//   europc_rtc_set_time(machine);
9797}
9898
9999DRIVER_INIT( t1000hx )
src/mess/machine/pce.c
r1980r1981
9595
9696/* prototypes */
9797static void pce_cd_init( void );
98static void pce_cd_set_irq_line( int num, int state );
98static void pce_cd_set_irq_line( running_machine *machine, int num, int state );
9999static TIMER_CALLBACK( pce_cd_adpcm_dma_timer_callback );
100100
101101
r1980r1981
397397   }
398398
399399   pce_cd_reply_status_byte( SCSI_STATUS_OK );
400   pce_cd_set_irq_line( PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE );
400   pce_cd_set_irq_line( Machine, PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE );
401401}
402402
403403/* 0xD9 - SET AUDIO PLAYBACK END POSITION (NEC) */
r1980r1981
442442   }
443443
444444   pce_cd_reply_status_byte( SCSI_STATUS_OK );
445   pce_cd_set_irq_line( PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE );
445   pce_cd_set_irq_line( Machine, PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE );
446446}
447447
448448/* 0xDA - PAUSE (NEC) */
r1980r1981
648648
649649      if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK ) {
650650         if ( pce_cd.data_buffer_index == pce_cd.data_buffer_size ) {
651            pce_cd_set_irq_line( PCE_CD_IRQ_TRANSFER_READY, CLEAR_LINE );
651            pce_cd_set_irq_line( Machine, PCE_CD_IRQ_TRANSFER_READY, CLEAR_LINE );
652652            if ( pce_cd.data_transferred ) {
653653               pce_cd.data_transferred = 0;
654654               pce_cd_reply_status_byte( SCSI_STATUS_OK );
655               pce_cd_set_irq_line( PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE );
655               pce_cd_set_irq_line( Machine, PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE );
656656            }
657657         } else {
658658            logerror("Transfer byte from offset %d\n", pce_cd.data_buffer_index);
r1980r1981
683683}
684684
685685/* Update internal CD statuses */
686static void pce_cd_update( void ) {
686static void pce_cd_update( running_machine *machine ) {
687687   /* Check for reset of CD unit */
688688   if ( pce_cd.scsi_RST != pce_cd.scsi_last_RST ) {
689689      if ( pce_cd.scsi_RST ) {
r1980r1981
702702      logerror( "freeing bus\n" );
703703      pce_cd.selected = 0;
704704      pce_cd.scsi_CD = pce_cd.scsi_MSG = pce_cd.scsi_IO = pce_cd.scsi_REQ = 0;
705      pce_cd_set_irq_line( PCE_CD_IRQ_TRANSFER_DONE, CLEAR_LINE );
705      pce_cd_set_irq_line( machine, PCE_CD_IRQ_TRANSFER_DONE, CLEAR_LINE );
706706   }
707707
708708   /* Select the CD device */
r1980r1981
740740   }
741741}
742742
743static void pce_cd_set_irq_line( int num, int state ) {
743static void pce_cd_set_irq_line( running_machine *machine, int num, int state ) {
744744   switch( num ) {
745745   case PCE_CD_IRQ_TRANSFER_DONE:
746746      if ( state == ASSERT_LINE ) {
r1980r1981
761761   }
762762
763763   if ( pce_cd.regs[0x02] & pce_cd.regs[0x03] & ( PCE_CD_IRQ_TRANSFER_DONE | PCE_CD_IRQ_TRANSFER_READY ) ) {
764      cpunum_set_input_line(Machine, 0, 1, ASSERT_LINE );
764      cpunum_set_input_line(machine, 0, 1, ASSERT_LINE );
765765   } else {
766      cpunum_set_input_line(Machine, 0, 1, CLEAR_LINE );
766      cpunum_set_input_line(machine, 0, 1, CLEAR_LINE );
767767   }
768768}
769769
r1980r1981
846846
847847WRITE8_HANDLER( pce_cd_intf_w ) {
848848   logerror("%04X: write to CD interface offset %02X, data %02X\n", activecpu_get_pc(), offset, data );
849   pce_cd_update();
849   pce_cd_update(machine);
850850
851851   switch( offset ) {
852852   case 0x00:   /* CDC status */
853853      /* select device (which bits??) */
854854      pce_cd.scsi_SEL = 1;
855      pce_cd_update();
855      pce_cd_update(machine);
856856      pce_cd.scsi_SEL = 0;
857857      break;
858858   case 0x01:   /* CDC command / status / data */
r1980r1981
865865            /* bit 2 - ?? irq */
866866      pce_cd.scsi_ACK = data & 0x80;
867867      /* Don't set or reset any irq lines, but just verify the current state */
868      pce_cd_set_irq_line( 0, 0 );
868      pce_cd_set_irq_line( machine, 0, 0 );
869869      break;
870870   case 0x03:   /* BRAM lock / CD status / IRQ - Read Only register */
871871      break;
r1980r1981
925925      return;
926926   }
927927   pce_cd.regs[offset] = data;
928   pce_cd_update();
928   pce_cd_update(machine);
929929}
930930
931931static TIMER_CALLBACK( pce_cd_clear_ack ) {
932   pce_cd_update();
932   pce_cd_update(machine);
933933   pce_cd.scsi_ACK = 0;
934   pce_cd_update();
934   pce_cd_update(machine);
935935   if ( pce_cd.scsi_CD ) {
936936      pce_cd.regs[0x0B] &= 0xFE;
937937   }
r1980r1981
958958READ8_HANDLER( pce_cd_intf_r ) {
959959   UINT8 data = pce_cd.regs[offset & 0x0F];
960960
961   pce_cd_update();
961   pce_cd_update(machine);
962962
963963   logerror("%04X: read from CD interface offset %02X\n", activecpu_get_pc(), offset );
964964   switch( offset ) {
src/mess/machine/ti99_4x.c
r1980r1981
901901      hsgpl_crdena = 0;
902902
903903   if (has_usb_sm)
904      ti99_usbsm_reset(ti99_model == model_99_8);
904      ti99_usbsm_reset(machine, ti99_model == model_99_8);
905905
906906   if (has_evpc)
907907      ti99_evpc_reset();
src/mess/machine/atarifdc.c
r1980r1981
1616#include "sound/pokey.h"
1717#include "machine/6821pia.h"
1818#include "image.h"
19#include "deprecat.h"
2019
2120#define VERBOSE_SERIAL   0
2221#define VERBOSE_CHKSUM   0
r1980r1981
403402      make_chksum(&atari_fdc.serin_chksum, data);
404403}
405404
406static void a800_serial_command(void)
405static void a800_serial_command(running_machine *machine)
407406{
408   int i, drive, sector, offset;
407   int i, drive, sector, offset;
409408
410409   if( !atari_fdc.serout_offs )
411410   {
r1980r1981
434433      {
435434         logerror("atari unsupported drive #%d\n", drive+1);
436435         sprintf(atari_frame_message, "DRIVE #%d not supported", drive+1);
437         atari_frame_counter = Machine->screen[0].refresh/2;
436         atari_frame_counter = machine->screen[0].refresh/2;
438437         return;
439438      }
440439
r1980r1981
445444      {
446445         case 'S':   /* status */
447446            sprintf(atari_frame_message, "DRIVE #%d STATUS", drive+1);
448            atari_frame_counter = Machine->screen[0].refresh/2;
447            atari_frame_counter = machine->screen[0].refresh/2;
449448
450449            if (VERBOSE_SERIAL)
451450               logerror("atari status\n");
r1980r1981
488487            if( sector < 1 || sector > drv[drive].sectors )
489488            {
490489               sprintf(atari_frame_message, "DRIVE #%d READ SECTOR #%3d - ERR", drive+1, sector);
491               atari_frame_counter = Machine->screen[0].refresh/2;
490               atari_frame_counter = machine->screen[0].refresh/2;
492491
493492               if (VERBOSE_SERIAL)
494493                  logerror("atari bad sector #\n");
r1980r1981
501500            if (sector < 4)    /* sector 1 .. 3 might be different length */
502501            {
503502               sprintf(atari_frame_message, "DRIVE #%d READ SECTOR #%3d - SD", drive+1, sector);
504                    atari_frame_counter = Machine->screen[0].refresh/2;
503                    atari_frame_counter = machine->screen[0].refresh/2;
505504                    offset = (sector - 1) * drv[drive].bseclen + drv[drive].header_skip;
506505               for (i = 0; i < 128; i++)
507506                  add_serin(drv[drive].image[offset++],1);
r1980r1981
509508            else
510509            {
511510               sprintf(atari_frame_message, "DRIVE #%d READ SECTOR #%3d - %cD", drive+1, sector, (drv[drive].seclen == 128) ? 'S' : 'D');
512                    atari_frame_counter = Machine->screen[0].refresh/2;
511                    atari_frame_counter = machine->screen[0].refresh/2;
513512                    offset = (sector - 1) * drv[drive].seclen + drv[drive].header_skip;
514513               for (i = 0; i < drv[drive].seclen; i++)
515514                  add_serin(drv[drive].image[offset++],1);
r1980r1981
526525            {
527526               add_serout(drv[drive].bseclen);
528527               sprintf(atari_frame_message, "DRIVE #%d WRITE SECTOR #%3d - SD", drive+1, sector);
529               atari_frame_counter = Machine->screen[0].refresh/2;
528               atari_frame_counter = machine->screen[0].refresh/2;
530529                }
531530            else
532531            {
533532               add_serout(drv[drive].seclen);
534533               sprintf(atari_frame_message, "DRIVE #%d WRITE SECTOR #%3d - %cD", drive+1, sector, (drv[drive].seclen == 128) ? 'S' : 'D');
535                    atari_frame_counter = Machine->screen[0].refresh/2;
534                    atari_frame_counter = machine->screen[0].refresh/2;
536535                }
537536            break;
538537
r1980r1981
545544            {
546545               add_serout(drv[drive].bseclen);
547546               sprintf(atari_frame_message, "DRIVE #%d PUT SECTOR #%3d - SD", drive+1, sector);
548                    atari_frame_counter = Machine->screen[0].refresh/2;
547                    atari_frame_counter = machine->screen[0].refresh/2;
549548                }
550549            else
551550            {
552551               add_serout(drv[drive].seclen);
553552               sprintf(atari_frame_message, "DRIVE #%d PUT SECTOR #%3d - %cD", drive+1, sector, (drv[drive].seclen == 128) ? 'S' : 'D');
554                    atari_frame_counter = Machine->screen[0].refresh/2;
553                    atari_frame_counter = machine->screen[0].refresh/2;
555554                }
556555            break;
557556
r1980r1981
560559               logerror("atari format SD drive #%d\n", drive+1);
561560
562561            sprintf(atari_frame_message, "DRIVE #%d FORMAT SD", drive+1);
563            atari_frame_counter = Machine->screen[0].refresh/2;
562            atari_frame_counter = machine->screen[0].refresh/2;
564563                add_serin('A',0);   /* acknowledge */
565564            add_serin('C',0);   /* completed */
566565            for (i = 0; i < 128; i++)
r1980r1981
573572               logerror("atari format DD drive #%d\n", drive+1);
574573
575574            sprintf(atari_frame_message, "DRIVE #%d FORMAT DD", drive+1);
576                atari_frame_counter = Machine->screen[0].refresh/2;
575                atari_frame_counter = machine->screen[0].refresh/2;
577576                add_serin('A',0);   /* acknowledge */
578577            add_serin('C',0);   /* completed */
579578            for (i = 0; i < 256; i++)
r1980r1981
586585               logerror("atari unknown command #%c\n", atari_fdc.serout_buff[1]);
587586
588587            sprintf(atari_frame_message, "DRIVE #%d UNKNOWN CMD '%c'", drive+1, atari_fdc.serout_buff[1]);
589                atari_frame_counter = Machine->screen[0].refresh/2;
588                atari_frame_counter = machine->screen[0].refresh/2;
590589                add_serin('N',0);   /* negative acknowledge */
591590      }
592591   }
593592   else
594593   {
595594      sprintf(atari_frame_message, "serial cmd chksum error");
596      atari_frame_counter = Machine->screen[0].refresh/2;
595      atari_frame_counter = machine->screen[0].refresh/2;
597596      if (VERBOSE_SERIAL)
598597         logerror("BAD\n");
599598
r1980r1981
603602      logerror("atari %d bytes to read\n", atari_fdc.serin_count);
604603}
605604
606static void a800_serial_write(void)
605static void a800_serial_write(running_machine *machine)
607606{
608607   int i, drive, sector, offset;
609608
r1980r1981
637636            for (i = 0; i < 128; i++)
638637               drv[drive].image[offset++] = atari_fdc.serout_buff[5+i];
639638            sprintf(atari_frame_message, "DRIVE #%d WROTE SECTOR #%3d - SD", drive+1, sector);
640            atari_frame_counter = Machine->screen[0].refresh/2;
639            atari_frame_counter = machine->screen[0].refresh/2;
641640            }
642641         else
643642         {
r1980r1981
649648            for (i = 0; i < drv[drive].seclen; i++)
650649               drv[drive].image[offset++] = atari_fdc.serout_buff[5+i];
651650            sprintf(atari_frame_message, "DRIVE #%d WROTE SECTOR #%3d - %cD", drive+1, sector, (drv[drive].seclen == 128) ? 'S' : 'D');
652                atari_frame_counter = Machine->screen[0].refresh/2;
651                atari_frame_counter = machine->screen[0].refresh/2;
653652            }
654653         add_serin('C',0);
655654      }
r1980r1981
715714         atari_fdc.serout_chksum ^= data;
716715         /* if the attention line is high, this should be data */
717716         if (pia_get_irq_b(0))
718            a800_serial_write();
717            a800_serial_write(machine);
719718      }
720719      else
721720      {
r1980r1981
735734   else
736735   {
737736      atari_fdc.serin_delay = 0;
738      a800_serial_command();
737      a800_serial_command(machine);
739738   }
740739}
src/mess/machine/sgi.c
r1980r1981
88
99#include "driver.h"
1010#include "sgi.h"
11#include "deprecat.h"
1211
1312
1413#define VERBOSE_LEVEL ( 1 )
r1980r1981
532531   mc_update();
533532}
534533
535void mc_init()
534void mc_init(running_machine *machine)
536535{
537536   nMC_CPUControl0 = 0;
538537   nMC_CPUControl1 = 0;
r1980r1981
579578   timer_adjust_periodic(tMC_UpdateTimer, ATTOTIME_IN_HZ(10000), 0, ATTOTIME_IN_HZ(10000));
580579
581580   // if Indigo2, ID appropriately
582   if (!strcmp(Machine->gamedrv->name, "ip244415"))
581   if (!strcmp(machine->gamedrv->name, "ip244415"))
583582   {
584583      nMC_SysID = 0x11;   // rev. B MC, EISA bus present
585584   }
src/mess/machine/galaxy.c
r1980r1981
6363#define GALAXY_SNAPSHOT_V1_SIZE   8268
6464#define GALAXY_SNAPSHOT_V2_SIZE   8244
6565
66static void galaxy_setup_snapshot (const UINT8 * data, UINT32 size)
66static void galaxy_setup_snapshot (running_machine *machine, const UINT8 * data, UINT32 size)
6767{
6868   switch (size)
6969   {
r1980r1981
119119         break;
120120   }
121121
122   cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, CLEAR_LINE);
123   cpunum_set_input_line(Machine, 0, INPUT_LINE_IRQ0, CLEAR_LINE);
122   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, CLEAR_LINE);
123   cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ0, CLEAR_LINE);
124124}
125125
126126SNAPSHOT_LOAD( galaxy )
r1980r1981
139139
140140   image_fread(image, snapshot_data, snapshot_size);
141141
142   galaxy_setup_snapshot(snapshot_data, snapshot_size);
142   galaxy_setup_snapshot(Machine, snapshot_data, snapshot_size);
143143
144144   return INIT_PASS;
145145}
src/mess/machine/bbc.c
r1980r1981
4646static int MC6850_irq=0;
4747static int ACCCON_IRR=0;
4848
49static void bbc_setirq(void)
49static void bbc_setirq(running_machine *machine)
5050{
51   cpunum_set_input_line(Machine, 0, M6502_IRQ_LINE, via_system_irq|via_user_irq|MC6850_irq|ACCCON_IRR);
51   cpunum_set_input_line(machine, 0, M6502_IRQ_LINE, via_system_irq|via_user_irq|MC6850_irq|ACCCON_IRR);
5252}
5353
5454/************************
r1980r1981
396396
397397     if (tempIRR!=ACCCON_IRR)
398398     {
399      bbc_setirq();
399      bbc_setirq(machine);
400400   }
401401
402402   if (ACCCON_Y)
r1980r1981
11671167{
11681168//  logerror("SYSTEM via irq %d %d %d\n",via_system_irq,via_user_irq,level);
11691169  via_system_irq=level;
1170  bbc_setirq();
1170  bbc_setirq(Machine);
11711171}
11721172
11731173
r1980r1981
12561256static void bbc_via_user_irq(int level)
12571257{
12581258  via_user_irq=level;
1259  bbc_setirq();
1259  bbc_setirq(Machine);
12601260}
12611261
12621262
r1980r1981
13591359static void Serial_interrupt(int level)
13601360{
13611361  MC6850_irq=level;
1362  bbc_setirq();
1362  bbc_setirq(Machine);
13631363  //logerror("Set SIO irq  %01x\n",level);
13641364}
13651365
src/mess/machine/sgi.h
r1980r1981
1010#define _SGIMC_H
1111
1212
13void mc_init(void);
13void mc_init(running_machine *machine);
1414void mc_update(void);
1515
1616READ32_HANDLER(mc_r);
src/mess/machine/compis.c
r1980r1981
603603}
604604
605605
606static void update_interrupt_state(void)
606static void update_interrupt_state(running_machine *machine)
607607{
608608   int i, j, new_vector = 0;
609609
r1980r1981
682682   /* generate the appropriate interrupt */
683683   i186.intr.poll_status = 0x8000 | new_vector;
684684   if (!i186.intr.pending)
685      cpunum_set_input_line(Machine, 2, 0, ASSERT_LINE);
685      cpunum_set_input_line(machine, 2, 0, ASSERT_LINE);
686686   i186.intr.pending = 1;
687   cpu_trigger(Machine, CPU_RESUME_TRIGGER);
687   cpu_trigger(machine, CPU_RESUME_TRIGGER);
688688   if (LOG_OPTIMIZATION) logerror("  - trigger due to interrupt pending\n");
689689   if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", attotime_to_double(timer_get_time()), new_vector);
690690}
r1980r1981
770770   if (t->control & 0x2000)
771771   {
772772      i186.intr.status |= 0x01 << which;
773      update_interrupt_state();
773      update_interrupt_state(machine);
774774      if (LOG_TIMER) logerror("  Generating timer interrupt\n");
775775   }
776776
r1980r1981
963963   {
964964      if (LOG_DMA) logerror("DMA%d timer callback - requesting interrupt: count = %04X, source = %04X\n", which, d->count, d->source);
965965      i186.intr.request |= 0x04 << which;
966      update_interrupt_state();
966      update_interrupt_state(machine);
967967   }
968968}
969969
r1980r1981
12791279         if (LOG_PORTS)
12801280            logerror("%05X:80186 EOI = %04X\n", activecpu_get_pc(), data16);
12811281         handle_eoi(0x8000);
1282         update_interrupt_state();
1282         update_interrupt_state(machine);
12831283         break;
12841284
12851285      case 0x24:
r1980r1981
13031303         i186.intr.ext[1] = (i186.intr.ext[1] & ~0x08) | ((data16 >> 2) & 0x08);
13041304         i186.intr.ext[2] = (i186.intr.ext[2] & ~0x08) | ((data16 >> 3) & 0x08);
13051305         i186.intr.ext[3] = (i186.intr.ext[3] & ~0x08) | ((data16 >> 4) & 0x08);
1306         update_interrupt_state();
1306         update_interrupt_state(machine);
13071307         break;
13081308
13091309      case 0x2a:
13101310         if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", activecpu_get_pc(), data16);
13111311         i186.intr.priority_mask = data16 & 0x0007;
1312         update_interrupt_state();
1312         update_interrupt_state(machine);
13131313         break;
13141314
13151315      case 0x2c:
13161316         if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", activecpu_get_pc(), data16);
13171317         i186.intr.in_service = data16 & 0x00ff;
1318         update_interrupt_state();
1318         update_interrupt_state(machine);
13191319         break;
13201320
13211321      case 0x2e:
13221322         if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", activecpu_get_pc(), data16);
13231323         i186.intr.request = (i186.intr.request & ~0x00c0) | (data16 & 0x00c0);
1324         update_interrupt_state();
1324         update_interrupt_state(machine);
13251325         break;
13261326
13271327      case 0x30:
13281328         if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", activecpu_get_pc(), data16);
13291329         i186.intr.status = (i186.intr.status & ~0x8007) | (data16 & 0x8007);
1330         update_interrupt_state();
1330         update_interrupt_state(machine);
13311331         break;
13321332
13331333      case 0x32:
r1980r1981
15921592   compis_fdc_reset();
15931593
15941594   /* RTC */
1595   mm58274c_init(0, 0);
1595   mm58274c_init(machine, 0, 0);
15961596
15971597   /* Setup the USART */
15981598   msm8251_init(&compis_usart_interface);
src/mess/machine/kc.c
r1980r1981
237237   cpunum_set_reg(0, REG_PC, 0x0f000);
238238}
239239
240static void kc_disc_interface_init(void)
240static void kc_disc_interface_init(running_machine *machine)
241241{
242242   timer_set(attotime_zero, NULL, 0, kc85_disk_reset_timer_callback);
243243
r1980r1981
247247   z80ctc_reset(1);
248248
249249   /* hold cpu at reset */
250   cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, ASSERT_LINE);
250   cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, ASSERT_LINE);
251251}
252252
253253/*****************/
r1980r1981
18841884MACHINE_RESET( kc85_4d )
18851885{
18861886   MACHINE_RESET_CALL(kc85_4);
1887   kc_disc_interface_init();
1887   kc_disc_interface_init(machine);
18881888}
18891889
18901890MACHINE_RESET( kc85_3 )
src/mess/drivers/x68k.c
r1980r1981
19811981   nec765_reset(0);
19821982   mfp_init();
19831983   scc_init(&scc_interface);
1984   rp5c15_init(&rtc_intf);
1984   rp5c15_init(machine, &rtc_intf);
19851985
19861986   memset(&sys,0,sizeof(sys));
19871987
src/mess/drivers/atarist.c
r1980r1981
15441544static MACHINE_START( megast )
15451545{
15461546   MACHINE_START_CALL(atarist);
1547   rp5c15_init(&rtc_intf);
1547   rp5c15_init(machine, &rtc_intf);
15481548}
15491549
15501550static READ8_HANDLER( atariste_mfp_gpio_r )
r1980r1981
16331633{
16341634   machine_start_atariste(machine);
16351635   state_save_register_global(megaste_cache);
1636   rp5c15_init(&rtc_intf);
1636   rp5c15_init(machine, &rtc_intf);
16371637}
16381638
16391639static void stbook_configure_memory(void)
r1980r1981
17611761   acia6850_config(0, &stbook_acia_ikbd_intf);
17621762   acia6850_config(1, &acia_midi_intf);
17631763   state->mfp = devtag_get_token(machine, MC68901, "mfp");
1764   rp5c15_init(&rtc_intf);
1764   rp5c15_init(machine, &rtc_intf);
17651765
17661766   cpunum_set_irq_callback(0, atarist_int_ack);
17671767}
src/mess/drivers/ip22.c
r1980r1981
12391239
12401240static MACHINE_RESET( ip225015 )
12411241{
1242   mc_init();
1242   mc_init(machine);
12431243   nHPC3_enetr_nbdp = 0x80000000;
12441244   nHPC3_enetr_cbp = 0x80000000;
12451245   nIntCounter = 0;
src/mess/drivers/abc80x.c
r1980r1981
184184      z80dart_d_w(0, 0, data);
185185      break;
186186   case 1:
187      z80dart_c_w(0, 0, data);
187      z80dart_c_w(machine, 0, 0, data);
188188      break;
189189   case 2:
190190      z80dart_d_w(0, 1, data);
191191      break;
192192   case 3:
193      z80dart_c_w(0, 1, data);
193      z80dart_c_w(machine, 0, 1, data);
194194      break;
195195   }
196196}
src/mess/drivers/acrnsys1.c
r1980r1981
7878
7979static DRIVER_INIT( acrnsys1 )
8080{
81   ins8154_config(0, &ins8154_b1);
81   ins8154_config(machine, 0, &ins8154_b1);
8282   ttl74145_config(0, &ic8_7445);
8383}
8484
src/mess/drivers/ip20.c
r1980r1981
547547
548548static MACHINE_RESET( ip204415 )
549549{
550   mc_init();
550   mc_init(machine);
551551
552552   nHPC_MiscStatus = 0;
553553   nHPC_ParBufPtr = 0;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team