Previous 15994 Revisions Next

r2817 Thursday 5th June, 2008 at 15:58:48 UTC by Firewave
Machine -> machine cleanups
[src/mess/devices]thomflop.c
[src/mess/drivers]amiga.c avigo.c einstein.c glasgow.c nc.c pcw.c pcw16.c psx.c saturn.c ssystem3.c
[src/mess/includes]apple2.h
[src/mess/machine]amigacrt.c amigacrt.h amigafdc.c amigafdc.h apple2.c apple2gs.c at.c b2m.c c128.c c64.c dgn_beta.c i82439tx.c i82439tx.h kc.c lynx.c mac.c mc6843.c mc6843.h nes.c oric.c pc_mouse.c pdp1.c samcoupe.c spectrum.c ti99_4x.c vtech2.c

src/mess/devices/thomflop.c
r2816r2817
438438   int i;
439439   LOG(( "to7_5p14sd_reset: CD 90-015 controller\n" ));
440440   thom_floppy_set_density( DEN_FM_LO );
441   mc6843_reset();
441   mc6843_reset(machine);
442442   for ( i = 0; i < device_count( machine, IO_FLOPPY ); i++ )
443443   {
444444      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
r2816r2817
454454
455455
456456
457static void to7_5p14sd_init( void )
457static void to7_5p14sd_init( running_machine *machine )
458458{
459459   LOG(( "to7_5p14sd_init: CD 90-015 controller\n" ));
460   mc6843_config( &to7_6843_itf );
460   mc6843_config( machine, &to7_6843_itf );
461461   state_save_register_global( to7_5p14sd_select );
462462}
463463
r2816r2817
17631763   memory_configure_bank( THOM_FLOP_BANK, 0, TO7_NB_FLOP_BANK, base, 0x800 );
17641764   state_save_register_global( to7_controller_type );
17651765   state_save_register_global( to7_floppy_bank );
1766   to7_5p14sd_init();
1766   to7_5p14sd_init(machine);
17671767   to7_5p14_init(machine);
17681768   to7_qdd_init();
17691769   thmfc_floppy_init();
src/mess/includes/apple2.h
r2816r2817
4545
4646extern const applefdc_interface apple2_fdc_interface;
4747
48void apple2_iwm_setdiskreg(UINT8 data);
48void apple2_iwm_setdiskreg(running_machine *machine, UINT8 data);
4949UINT8 apple2_iwm_getdiskreg(void);
5050
5151void apple2_init_common(running_machine *machine);
src/mess/machine/dgn_beta.c
r2816r2817
5959#include <assert.h>
6060
6161#include "driver.h"
62#include "deprecat.h"
6362#include "debug/debugcon.h"
6463#include "cpu/m6809/m6809.h"
6564#include "machine/6821pia.h"
r2816r2817
235234// this should probably be considdered a hack !
236235//
237236
238static void UpdateBanks(int first, int last)
237static void UpdateBanks(running_machine *machine, int first, int last)
239238{
240239   int      Page;
241240   UINT8       *readbank;
r2816r2817
292291
293292      PageRegs[TaskReg][Page].memory=readbank;
294293      memory_set_bankptr(Page+1,readbank);
295      memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, bank_start, bank_end,0,0,writebank);
296      memory_install_write8_handler(Machine, 1, ADDRESS_SPACE_PROGRAM, bank_start, bank_end,0,0,writebank);
294      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, bank_start, bank_end,0,0,writebank);
295      memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, bank_start, bank_end,0,0,writebank);
297296
298297      LOG_BANK_UPDATE(("UpdateBanks:MapPage=$%02X readbank=$%X\n",MapPage,(int)(FPTR)readbank));
299298      LOG_BANK_UPDATE(("PageRegsSet Task=%X Page=%x\n",TaskReg,Page));
r2816r2817
304303}
305304
306305//
307static void SetDefaultTask(void)
306static void SetDefaultTask(running_machine *machine)
308307{
309308   int      Idx;
310309
r2816r2817
334333   PageRegs[TaskReg][IOPage].value=IOPageValue;
335334   PageRegs[TaskReg][IOPage+1].value=IOPageValue;
336335
337   UpdateBanks(0,IOPage+1);
336   UpdateBanks(machine, 0,IOPage+1);
338337
339338   /* Map video ram to base of area it can use, that way we can take the literal RA */
340339   /* from the 6845 without having to mask it ! */
r2816r2817
359358
360359   if (EnableMapRegs)
361360   {
362      UpdateBanks(offset,offset);
361      UpdateBanks(machine, offset,offset);
363362      if (offset==15)
364         UpdateBanks(offset+1,offset+1);
363         UpdateBanks(machine, offset+1,offset+1);
365364   }
366365}
367366
r2816r2817
807806      {
808807         TaskReg=NoPagingTask;
809808      }
810      UpdateBanks(0,IOPage+1);
809      UpdateBanks(machine, 0,IOPage+1);
811810   }
812811   else
813812   {
r2816r2817
815814      if ((PIATaskReg!=OldTask) && (EnableMapRegs))
816815      {
817816         TaskReg=PIATaskReg;
818         UpdateBanks(0,IOPage+1);
817         UpdateBanks(machine, 0,IOPage+1);
819818      }
820819   }
821820   LOG_TASK(("TaskReg=$%02X PIATaskReg=$%02X\n",TaskReg,PIATaskReg));
r2816r2817
10451044   PIATaskReg=0;
10461045   EnableMapRegs=0;
10471046   memset(PageRegs,0,sizeof(PageRegs));   /* Reset page registers to 0 */
1048   SetDefaultTask();
1047   SetDefaultTask(machine);
10491048
10501049   pia_reset();
10511050
src/mess/machine/pdp1.c
r2816r2817
12881288      old_typewriter_keys[i] = typewriter_keys[i];
12891289}
12901290
1291static void pdp1_lightpen(void)
1291static void pdp1_lightpen(running_machine *machine)
12921292{
1293   running_machine *machine = Machine;
12941293   int x_delta, y_delta;
12951294   int current_state;
12961295   static int previous_state;
r2816r2817
14891488      pdp1_keyboard(machine);
14901489   }
14911490
1492   pdp1_lightpen();
1491   pdp1_lightpen(machine);
14931492}
src/mess/machine/b2m.c
r2816r2817
150150}
151151static PIT8253_FREQUENCY_CHANGED(bm2_pit_clk)
152152{
153   pit8253_set_clockin((device_config*)device_list_find_by_tag( Machine->config->devicelist, PIT8253, "pit8253"), 0, frequency);
153   pit8253_set_clockin((device_config*)device_list_find_by_tag( device->machine->config->devicelist, PIT8253, "pit8253"), 0, frequency);
154154}
155155
156156static PIT8253_OUTPUT_CHANGED(bm2_pit_irq)
157157{
158   pic8259_set_irq_line((device_config*)device_list_find_by_tag( Machine->config->devicelist, PIC8259, "pic8259"),1,state);   
158   pic8259_set_irq_line((device_config*)device_list_find_by_tag( device->machine->config->devicelist, PIC8259, "pic8259"),1,state);   
159159}
160160
161161
r2816r2817
320320
321321static PIC8259_SET_INT_LINE( b2m_pic_set_int_line )
322322{     
323   cpunum_set_input_line(Machine, 0, 0,interrupt ?  HOLD_LINE : CLEAR_LINE); 
323   cpunum_set_input_line(device->machine, 0, 0,interrupt ?  HOLD_LINE : CLEAR_LINE); 
324324}
325325UINT8 vblank_state = 0;
326326
r2816r2817
380380
381381IRQ_CALLBACK(b2m_irq_callback)
382382{   
383   return pic8259_acknowledge((device_config*)device_list_find_by_tag( Machine->config->devicelist, PIC8259, "pic8259"));   
383   return pic8259_acknowledge((device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259"));   
384384}
385385
386386
r2816r2817
392392{   
393393   //vblank_state++;
394394   //if (vblank_state>1) vblank_state=0;
395   //pic8259_set_irq_line((device_config*)device_list_find_by_tag( Machine->config->devicelist, PIC8259, "pic8259"),0,vblank_state);     
395   //pic8259_set_irq_line((device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259"),0,vblank_state);     
396396}
397397static TIMER_CALLBACK (b2m_callback)
398398{   
399399   vblank_state++;
400400   if (vblank_state>1) vblank_state=0;
401   pic8259_set_irq_line((device_config*)device_list_find_by_tag( Machine->config->devicelist, PIC8259, "pic8259"),0,vblank_state);     
401   pic8259_set_irq_line((device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259"),0,vblank_state);     
402402}
403403
404404MACHINE_RESET(b2m)
src/mess/machine/spectrum.c
r2816r2817
2424***************************************************************************/
2525
2626#include "driver.h"
27#include "deprecat.h"
2827#include "cpu/z80/z80.h"
2928#include "includes/spectrum.h"
3029#include "eventlst.h"
r2816r2817
126125 *      value for the ROM paging.
127126 *
128127 *******************************************************************/
129static void spectrum_update_paging(void)
128static void spectrum_update_paging(running_machine *machine)
130129{
131130   if (spectrum_128_port_7ffd_data == -1)
132131      return;
133132   if (spectrum_plus3_port_1ffd_data == -1)
134      spectrum_128_update_memory(Machine);
133      spectrum_128_update_memory(machine);
135134
136135   else
137136   {
r2816r2817
140139         spectrum_plus3_port_1ffd_data = 0x04;
141140      else
142141         spectrum_plus3_port_1ffd_data = 0;
143      spectrum_plus3_update_memory(Machine);
142      spectrum_plus3_update_memory(machine);
144143   }
145144}
146145
147146/* Page in the 48K Basic ROM. Used when running 48K snapshots on a 128K machine. */
148static void spectrum_page_basicrom(void)
147static void spectrum_page_basicrom(running_machine *machine)
149148{
150149   if (spectrum_128_port_7ffd_data == -1)
151150      return;
152151   spectrum_128_port_7ffd_data |= 0x10;
153   spectrum_update_paging();
152   spectrum_update_paging(machine);
154153}
155154
156155/*******************************************************************
r2816r2817
286285   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, data);
287286   cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, 0);
288287
289   spectrum_page_basicrom();
288   spectrum_page_basicrom(machine);
290289
291290   /* memory dump */
292291   for (i = 0; i < size; i++)
r2816r2817
333332
334333   if ((SnapshotSize != 49179) && (spectrum_128_port_7ffd_data == -1))
335334   {
336      logerror("Can't load 128K .SNA file into 48K Machine\n");
335      logerror("Can't load 128K .SNA file into 48K machine\n");
337336      return;
338337   }
339338
r2816r2817
391390
392391   if (SnapshotSize == 49179)
393392      /* 48K Snapshot */
394      spectrum_page_basicrom();
393      spectrum_page_basicrom(machine);
395394   else
396395   {
397396      /* 128K Snapshot */
398397      spectrum_128_port_7ffd_data = (pSnapshot[49181] & 0x0ff);
399      spectrum_update_paging();
398      spectrum_update_paging(machine);
400399   }
401400
402401   /* memory dump */
r2816r2817
437436            logerror("Loading bank %d from offset %ld\n", i, bank_offset);
438437            spectrum_128_port_7ffd_data &= 0xf8;
439438            spectrum_128_port_7ffd_data += i;
440            spectrum_update_paging();
439            spectrum_update_paging(machine);
441440            for (j = 0; j < 16384; j++)
442441               program_write_byte(j + 49152, pSnapshot[bank_offset + j]);
443442            bank_offset += 16384;
r2816r2817
446445
447446      /* Reset paging */
448447      spectrum_128_port_7ffd_data = (pSnapshot[49181] & 0x0ff);
449      spectrum_update_paging();
448      spectrum_update_paging(machine);
450449
451450      /* program counter */
452451      lo = pSnapshot[49179] & 0x0ff;
r2816r2817
717716      hi = pSnapshot[7] & 0x0ff;
718717      cpunum_set_reg(0, Z80_PC, (hi << 8) | lo);
719718
720      spectrum_page_basicrom();
719      spectrum_page_basicrom(machine);
721720
722721      if ((pSnapshot[12] & 0x020) == 0)
723722      {
r2816r2817
757756
758757      if (z80_type == SPECTRUM_Z80_SNAPSHOT_48K)
759758         /* Ensure 48K Basic ROM is used */
760         spectrum_page_basicrom();
759         spectrum_page_basicrom(machine);
761760
762761      do
763762      {
r2816r2817
785784            {
786785               /* Page the appropriate bank into 0xc000 - 0xfff */
787786               spectrum_128_port_7ffd_data = page - 3;
788               spectrum_update_paging();
787               spectrum_update_paging(machine);
789788               Dest = 0x0c000;
790789            }
791790            else
r2816r2817
822821      {
823822         /* Set up paging */
824823         spectrum_128_port_7ffd_data = (pSnapshot[35] & 0x0ff);
825         spectrum_update_paging();
824         spectrum_update_paging(machine);
826825      }
827826      if ((z80_type == SPECTRUM_Z80_SNAPSHOT_48K) && !strcmp(machine->gamedrv->name,"ts2068"))
828827      {
829828         ts2068_port_f4_data = 0x03;
830829         ts2068_port_ff_data = 0x00;
831         ts2068_update_memory(Machine);
830         ts2068_update_memory(machine);
832831      }
833832      if (z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068 && !strcmp(machine->gamedrv->name,"ts2068"))
834833      {
835834         ts2068_port_f4_data = pSnapshot[35];
836835         ts2068_port_ff_data = pSnapshot[36];
837         ts2068_update_memory(Machine);
836         ts2068_update_memory(machine);
838837      }
839838   }
840839}
src/mess/machine/c128.c
r2816r2817
1010***************************************************************************/
1111
1212#include "driver.h"
13#include "deprecat.h"
1413
1514#include "cpu/m6502/m6502.h"
1615#include "sound/sid6581.h"
r2816r2817
145144      return c64_colorram[offset & 0x3ff];
146145   else if (offset == 0xc00)
147146      {
148         cia_set_port_mask_value(0, 0, input_port_read(Machine, "DSW0") & 0x0100 ? c64_keyline[8] : c64_keyline[9] );
147         cia_set_port_mask_value(0, 0, input_port_read(machine, "DSW0") & 0x0100 ? c64_keyline[8] : c64_keyline[9] );
149148         return cia_0_r(machine, offset);
150149      }
151150   else if (offset == 0xc01)
152151      {
153         cia_set_port_mask_value(0, 1, input_port_read(Machine, "DSW0") & 0x0100 ? c64_keyline[9] : c64_keyline[8] );
152         cia_set_port_mask_value(0, 1, input_port_read(machine, "DSW0") & 0x0100 ? c64_keyline[9] : c64_keyline[8] );
154153         return cia_0_r(machine, offset);
155154      }
156155   else if (offset < 0xd00)
r2816r2817
285284
286285/* typical z80 configuration
287286   0x3f 0x3f 0x7f 0x3e 0x7e 0xb0 0x0b 0x00 0x00 0x01 0x00 */
288 static void c128_bankswitch_z80 (void)
289 {
287static void c128_bankswitch_z80 (running_machine *machine)
288{
290289    c128_ram = c64_memory + MMU_RAM_ADDR;
291290    c128_va1617 = MMU_VIC_ADDR;
292291#if 1
293292    memory_set_bankptr(10, c128_z80);
294293    memory_set_bankptr(11, c128_ram + 0x1000);
295    if ( (( (input_port_read(Machine, "CFG") & 0x300) == 0x100 ) && (MMU_RAM_ADDR >= 0x40000))
296        || (( (input_port_read(Machine, "CFG") & 0x300) == 0x000) && (MMU_RAM_ADDR >= 0x20000)) )
294    if ( (( (input_port_read(machine, "CFG") & 0x300) == 0x100 ) && (MMU_RAM_ADDR >= 0x40000))
295        || (( (input_port_read(machine, "CFG") & 0x300) == 0x000) && (MMU_RAM_ADDR >= 0x20000)) )
297296       c128_ram = NULL;
298297#else
299298    if (MMU_BOTTOM)
r2816r2817
359358      memory_set_bankptr(9, c64_memory + 0xff05);
360359    }
361360
362    if ( (( (input_port_read(Machine, "CFG") & 0x300) == 0x100 ) && (MMU_RAM_ADDR >= 0x40000))
363        || (( (input_port_read(Machine, "CFG") & 0x300) == 0x000) && (MMU_RAM_ADDR >= 0x20000)) )
361    if ( (( (input_port_read(machine, "CFG") & 0x300) == 0x100 ) && (MMU_RAM_ADDR >= 0x40000))
362        || (( (input_port_read(machine, "CFG") & 0x300) == 0x000) && (MMU_RAM_ADDR >= 0x20000)) )
364363       c128_ram = NULL;
365364#endif
366 }
365}
367366
368367static void c128_bankswitch_128 (running_machine *machine, int reset)
369368{
r2816r2817
526525         memory_set_bankptr(16, c128_external_function + 0x3f05);
527526      }
528527
529      if ( (( (input_port_read(Machine, "CFG") & 0x300) == 0x100 ) && (MMU_RAM_ADDR >= 0x40000))
530            || (( (input_port_read(Machine, "CFG") & 0x300) == 0x000) && (MMU_RAM_ADDR >= 0x20000)) )
528      if ( (( (input_port_read(machine, "CFG") & 0x300) == 0x100 ) && (MMU_RAM_ADDR >= 0x40000))
529            || (( (input_port_read(machine, "CFG") & 0x300) == 0x000) && (MMU_RAM_ADDR >= 0x20000)) )
531530         c128_ram = NULL;
532531   }
533532}
r2816r2817
542541         DBG_LOG (1, "switching to z80",
543542                  ("active %d\n",cpu_getactivecpu()) );
544543         memory_set_context(0);
545         c128_bankswitch_z80();
544         c128_bankswitch_z80(machine);
546545         memory_set_context(1);
547546         cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, CLEAR_LINE);
548547         cpunum_set_input_line(machine, 1, INPUT_LINE_HALT, ASSERT_LINE);
r2816r2817
576575      return;
577576   }
578577   if (!MMU_CPU8502)
579      c128_bankswitch_z80();
578      c128_bankswitch_z80(machine);
580579   else
581580      c128_bankswitch_128(machine, reset);
582581}
r2816r2817
630629   }
631630}
632631
633 READ8_HANDLER( c128_mmu8722_port_r )
632READ8_HANDLER( c128_mmu8722_port_r )
634633{
635634   int data;
636635
r2816r2817
645644         data &= ~0x10;
646645      if (!c64_exrom)
647646         data &= ~0x20;
648      if (input_port_read(Machine, "SPECIAL") & 0x10)
647      if (input_port_read(machine, "SPECIAL") & 0x10)
649648         data &= ~0x80;
650649      break;
651650   case 0xb:
652651      /* hinybble number of 64 kb memory blocks */
653      if ((input_port_read(Machine, "CFG") & 0x300) == 0x100)         // 256KB RAM
652      if ((input_port_read(machine, "CFG") & 0x300) == 0x100)         // 256KB RAM
654653         data = 0x4f;
655      else if ((input_port_read(Machine, "CFG") & 0x300) == 0x200)   //   1MB
654      else if ((input_port_read(machine, "CFG") & 0x300) == 0x200)   //   1MB
656655         data = 0xf;
657656      else
658657         data = 0x2f;
src/mess/machine/oric.c
r2816r2817
1919
2020#include <stdio.h>
2121#include "driver.h"
22#if 0
2223#include "deprecat.h"
24#endif
2325#include "includes/oric.h"
2426#include "machine/wd17xx.h"
2527#include "machine/6522via.h"
r2816r2817
108110
109111
110112/* refresh keyboard sense */
111static void oric_keyboard_sense_refresh(void)
113static void oric_keyboard_sense_refresh(running_machine *machine)
112114{
113115   /* The following assumes that if a 0 is written, it can be used to detect if any key
114116   has been pressed.. */
r2816r2817
122124   char port[6];
123125
124126   sprintf(port, "ROW%d", oric_keyboard_line);
125    input_port_data = input_port_read(Machine, port);
127    input_port_data = input_port_read(machine, port);
126128
127129   /* go through all bits in line */
128130   for (i=0; i<8; i++)
r2816r2817
184186   return oric_via_port_a_data;
185187}
186188
187static READ8_HANDLER ( oric_via_in_b_func )
189static READ8_HANDLER ( oric_via_in_b_func )
188190{
189191   int data;
190192
191   oric_keyboard_sense_refresh();
193   oric_keyboard_sense_refresh(machine);
192194
193195   data = oric_key_sense_bit;
194196   data |= oric_keyboard_line & 0x07;
src/mess/machine/at.c
r2816r2817
425425DRIVER_INIT( at586 )
426426{
427427   DRIVER_INIT_CALL(at386);
428   intel82439tx_init();
428   intel82439tx_init(machine);
429429}
430430
431431
src/mess/machine/amigafdc.c
r2816r2817
1515#include "amiga.h"
1616#include "amigafdc.h"
1717#include "machine/6526cia.h"
18#include "deprecat.h"
1918
2019
2120#define MAX_TRACK_BYTES         12500
r2816r2817
361360   timer_reset( fdc_status[drive].dma_timer, attotime_never );
362361}
363362
364void amiga_fdc_setup_dma( void ) {
363void amiga_fdc_setup_dma( running_machine *machine ) {
365364   int i, cur_pos, drive = -1, len_words = 0;
366365   int time = 0;
367366
r2816r2817
372371
373372   if ( drive == -1 ) {
374373      logerror("Disk DMA started with no drive selected!\n" );
375      amiga_custom_w(Machine, REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0xffff);
374      amiga_custom_w(machine, REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0xffff);
376375      return;
377376   }
378377
src/mess/machine/amigafdc.h
r2816r2817
44void amiga_fdc_control_w( UINT8 data );
55int amiga_fdc_status_r( void );
66unsigned short amiga_fdc_get_byte( void );
7void amiga_fdc_setup_dma( void );
7void amiga_fdc_setup_dma( running_machine *machine );
88
99void amiga_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
1010
src/mess/machine/amigacrt.c
r2816r2817
127127   amiga_chip_ram_w( offset * 2, data );
128128}
129129
130static void amiga_ar1_check_overlay( void )
130static void amiga_ar1_check_overlay( running_machine *machine )
131131{
132   memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x00007f, 0, 0, amiga_ar1_chipmem_w);
132   memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x00007f, 0, 0, amiga_ar1_chipmem_w);
133133}
134134
135static void amiga_ar1_init( void )
135static void amiga_ar1_init( running_machine *machine )
136136{
137137   void *ar_ram;
138138
r2816r2817
148148   memset(ar_ram, 0, 0x4000);
149149
150150   /* Install ROM */
151   memory_install_read16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xf00000, 0xf7ffff, 0, 0, SMH_BANK2);
152   memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xf00000, 0xf7ffff, 0, 0, SMH_ROM);
151   memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf00000, 0xf7ffff, 0, 0, SMH_BANK2);
152   memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf00000, 0xf7ffff, 0, 0, SMH_ROM);
153153
154154   /* Install RAM */
155   memory_install_read16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x9fc000, 0x9fffff, 0, 0, SMH_BANK3);
156   memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x9fc000, 0x9fffff, 0, 0, SMH_BANK3);
155   memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9fc000, 0x9fffff, 0, 0, SMH_BANK3);
156   memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9fc000, 0x9fffff, 0, 0, SMH_BANK3);
157157
158158   /* Configure Banks */
159159   memory_set_bankptr(2, memory_region(REGION_USER2));
r2816r2817
333333}
334334#endif
335335
336static void amiga_ar23_check_overlay( void )
336static void amiga_ar23_check_overlay( running_machine *machine )
337337{
338338   amiga_ar23_mode = 3;
339   memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x00000f, 0, 0, amiga_ar23_chipmem_w);
339   memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x00000f, 0, 0, amiga_ar23_chipmem_w);
340340}
341341
342static void amiga_ar23_init( int ar3 )
342static void amiga_ar23_init( running_machine *machine, int ar3 )
343343{
344344   UINT32 mirror = 0x20000, size = 0x1ffff;
345345   void *ar_ram;
r2816r2817
363363   }
364364
365365   /* Install ROM */
366   memory_install_read16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400000+size, 0, mirror, SMH_BANK2);
367   memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400000+size, 0, mirror, SMH_ROM);
366   memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400000+size, 0, mirror, SMH_BANK2);
367   memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400000+size, 0, mirror, SMH_ROM);
368368
369369   /* Install RAM */
370   memory_install_read16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x440000, 0x44ffff, 0, 0, SMH_BANK3);
371   memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x440000, 0x44ffff, 0, 0, SMH_BANK3);
370   memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x440000, 0x44ffff, 0, 0, SMH_BANK3);
371   memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x440000, 0x44ffff, 0, 0, SMH_BANK3);
372372
373373   /* Install Custom chip monitor */
374//   memory_install_read16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_r);
375//   memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_w);
374//   memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_r);
375//   memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_w);
376376
377377   /* Install status/mode handlers */
378   memory_install_read16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400007, 0, mirror, amiga_ar23_mode_r);
379   memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400003, 0, mirror, amiga_ar23_mode_w);
378   memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400007, 0, mirror, amiga_ar23_mode_r);
379   memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400003, 0, mirror, amiga_ar23_mode_w);
380380
381381   /* Configure Banks */
382382   memory_set_bankptr(2, memory_region(REGION_USER2));
r2816r2817
395395
396396***************************************************************************/
397397
398void amiga_cart_init( void )
398void amiga_cart_init( running_machine *machine )
399399{
400400   /* see what is there */
401401   UINT16 *mem = (UINT16 *)memory_region( REGION_USER2 );
r2816r2817
407407      if ( mem[0x00] == 0x1111 )
408408      {
409409         amiga_cart_type = ACTION_REPLAY;
410         amiga_ar1_init();
410         amiga_ar1_init(machine);
411411      }
412412      else if ( mem[0x0C] == 0x4D6B )
413413      {
414414         amiga_cart_type = ACTION_REPLAY_MKII;
415         amiga_ar23_init(0);
415         amiga_ar23_init(machine, 0);
416416      }
417417      else if ( mem[0x0C] == 0x4D4B )
418418      {
419419         amiga_cart_type = ACTION_REPLAY_MKIII;
420         amiga_ar23_init(1);
420         amiga_ar23_init(machine, 1);
421421      }
422422   }
423423}
424424
425void amiga_cart_check_overlay( void )
425void amiga_cart_check_overlay( running_machine *machine )
426426{
427427   if ( amiga_cart_type < 0 )
428428      return;
r2816r2817
430430   switch( amiga_cart_type )
431431   {
432432      case ACTION_REPLAY:
433         amiga_ar1_check_overlay();
433         amiga_ar1_check_overlay(machine);
434434      break;
435435
436436      case ACTION_REPLAY_MKII:
437437      case ACTION_REPLAY_MKIII:
438         amiga_ar23_check_overlay();
438         amiga_ar23_check_overlay(machine);
439439      break;
440440   }
441441}
src/mess/machine/amigacrt.h
r2816r2817
11#ifndef AMIGACRT_H
22#define AMIGACRT_H
33
4void amiga_cart_init( void );
5void amiga_cart_check_overlay( void );
4void amiga_cart_init( running_machine *machine );
5void amiga_cart_check_overlay( running_machine *machine );
66void amiga_cart_nmi( void );
77
88#endif /* AMIGACRT_H */
src/mess/machine/samcoupe.c
r2816r2817
88***************************************************************************/
99
1010#include "driver.h"
11#include "deprecat.h"
1211#include "includes/samcoupe.h"
1312#include "devices/basicdsk.h"
1413#include "machine/wd17xx.h"
r2816r2817
2322struct samcoupe_asic samcoupe_regs;
2423
2524
26static void samcoupe_update_bank(int bank, UINT8 *memory, int is_readonly)
25static void samcoupe_update_bank(running_machine *machine, int bank, UINT8 *memory, int is_readonly)
2726{
2827   read8_machine_func rh = SMH_NOP;
2928   write8_machine_func wh = SMH_NOP;
r2816r2817
3534      wh = is_readonly ? SMH_UNMAP : (write8_machine_func) (STATIC_BANK1 + (FPTR)bank - 1);
3635   }
3736
38   memory_install_read8_handler(Machine, 0,  ADDRESS_SPACE_PROGRAM, ((bank-1) * 0x4000), ((bank-1) * 0x4000) + 0x3FFF, 0, 0, rh);
39   memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, ((bank-1) * 0x4000), ((bank-1) * 0x4000) + 0x3FFF, 0, 0, wh);
37   memory_install_read8_handler(machine, 0,  ADDRESS_SPACE_PROGRAM, ((bank-1) * 0x4000), ((bank-1) * 0x4000) + 0x3FFF, 0, 0, rh);
38   memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, ((bank-1) * 0x4000), ((bank-1) * 0x4000) + 0x3FFF, 0, 0, wh);
4039}
4140
4241
43static void samcoupe_install_ext_mem(void)
42static void samcoupe_install_ext_mem(running_machine *machine)
4443{
4544   UINT8 *mem;
4645
r2816r2817
5049   else
5150      mem = NULL;
5251
53   samcoupe_update_bank(3, mem, FALSE);
52   samcoupe_update_bank(machine, 3, mem, FALSE);
5453
5554   /* bank 4 */
5655   if (samcoupe_regs.hext >> 6 < mess_ram_size >> 20)
r2816r2817
5857   else
5958      mem = NULL;
6059
61   samcoupe_update_bank(4, mem, FALSE);
60   samcoupe_update_bank(machine, 4, mem, FALSE);
6261}
6362
6463
r2816r2817
8382      memory = rom;   /* Rom0 paged in */
8483      is_readonly = TRUE;
8584   }
86   samcoupe_update_bank(1, memory, is_readonly);
85   samcoupe_update_bank(machine, 1, memory, is_readonly);
8786
8887
8988   /* BANK2 */
r2816r2817
9190      memory = &mess_ram[((samcoupe_regs.lmpr + 1) & PAGE_MASK) * 0x4000];
9291   else
9392      memory = NULL;   /* Attempt to page in non existant ram region */
94   samcoupe_update_bank(2, memory, FALSE);
93   samcoupe_update_bank(machine, 2, memory, FALSE);
9594
9695   /* only update bank 3 and 4 when external memory is not enabled */
9796   if (samcoupe_regs.hmpr & HMPR_MCNTRL)
9897   {
99      samcoupe_install_ext_mem();
98      samcoupe_install_ext_mem(machine);
10099   }
101100   else
102101   {
r2816r2817
105104         memory = &mess_ram[(samcoupe_regs.hmpr & PAGE_MASK)*0x4000];
106105      else
107106         memory = NULL;   /* Attempt to page in non existant ram region */
108      samcoupe_update_bank(3, memory, FALSE);
107      samcoupe_update_bank(machine, 3, memory, FALSE);
109108
110109
111110      /* BANK4 */
r2816r2817
122121            memory = NULL;   /* Attempt to page in non existant ram region */
123122         is_readonly = FALSE;
124123      }
125      samcoupe_update_bank(4, memory, FALSE);
124      samcoupe_update_bank(machine, 4, memory, FALSE);
126125   }
127126
128127   /* video memory location */
r2816r2817
143142   /* external RAM enabled? */
144143   if (samcoupe_regs.hmpr & HMPR_MCNTRL)
145144   {
146      samcoupe_install_ext_mem();
145      samcoupe_install_ext_mem(machine);
147146   }
148147}
149148
src/mess/machine/vtech2.c
r2816r2817
1414****************************************************************************/
1515
1616#include "driver.h"
17#include "deprecat.h"
1817#include "includes/vtech2.h"
1918#include "devices/cassette.h"
2019#include "sound/speaker.h"
r2816r2817
5453static WRITE8_HANDLER ( mwa_bank4 ) { mwa_bank(3,offset,data); }
5554
5655/* read from banked memory (handle memory mapped i/o) */
57static int mra_bank(int bank, int offs);
56static int mra_bank(running_machine *machine, int bank, int offs);
5857
5958/* wrappers for bank #1 to #4 */
60static  READ8_HANDLER ( mra_bank1) { return mra_bank(0,offset); }
61static  READ8_HANDLER ( mra_bank2) { return mra_bank(1,offset); }
62static  READ8_HANDLER ( mra_bank3) { return mra_bank(2,offset); }
63static  READ8_HANDLER ( mra_bank4) { return mra_bank(3,offset); }
59static READ8_HANDLER ( mra_bank1) { return mra_bank(machine,0,offset); }
60static READ8_HANDLER ( mra_bank2) { return mra_bank(machine,1,offset); }
61static READ8_HANDLER ( mra_bank3) { return mra_bank(machine,2,offset); }
62static READ8_HANDLER ( mra_bank4) { return mra_bank(machine,3,offset); }
6463
6564/* read banked memory (handle memory mapped i/o) */
6665static const read8_machine_func mra_bank_soft[4] =
r2816r2817
214213 * 1   column 1
215214 * 0   column 0
216215 ************************************************/
217static int mra_bank(int bank, int offs)
216static int mra_bank(running_machine *machine, int bank, int offs)
218217{
219218   static int level_old = 0, cassette_bit = 0;
220219    int level, data = 0xff;
r2816r2817
225224      static int row_a,row_b,row_c,row_d;
226225      if( (offs & 0x0300) == 0x0000 ) /* keyboard row A */
227226      {
228         if( input_port_read(Machine, "ROWA") != row_a )
227         if( input_port_read(machine, "ROWA") != row_a )
229228         {
230            row_a = input_port_read(Machine, "ROWA");
229            row_a = input_port_read(machine, "ROWA");
231230            data &= row_a;
232231         }
233232      }
234233      if( (offs & 0x0300) == 0x0100 ) /* keyboard row B */
235234      {
236         if( input_port_read(Machine, "ROWB") != row_b )
235         if( input_port_read(machine, "ROWB") != row_b )
237236         {
238            row_b = input_port_read(Machine, "ROWB");
237            row_b = input_port_read(machine, "ROWB");
239238            data &= row_b;
240239         }
241240      }
242241      if( (offs & 0x0300) == 0x0200 ) /* keyboard row C */
243242      {
244         if( input_port_read(Machine, "ROWC") != row_c )
243         if( input_port_read(machine, "ROWC") != row_c )
245244         {
246            row_c = input_port_read(Machine, "ROWC");
245            row_c = input_port_read(machine, "ROWC");
247246            data &= row_c;
248247         }
249248      }
250249      if( (offs & 0x0300) == 0x0300 ) /* keyboard row D */
251250      {
252         if( input_port_read(Machine, "ROWD") != row_d )
251         if( input_port_read(machine, "ROWD") != row_d )
253252         {
254            row_d = input_port_read(Machine, "ROWD");
253            row_d = input_port_read(machine, "ROWD");
255254            data &= row_d;
256255         }
257256      }
r2816r2817
260259   {
261260      /* All Lasers keyboard rows 0 through 7 */
262261        if( !(offs & 0x01) )
263         data &= input_port_read(Machine, "ROW0");
262         data &= input_port_read(machine, "ROW0");
264263      if( !(offs & 0x02) )
265         data &= input_port_read(Machine, "ROW1");
264         data &= input_port_read(machine, "ROW1");
266265      if( !(offs & 0x04) )
267         data &= input_port_read(Machine, "ROW2");
266         data &= input_port_read(machine, "ROW2");
268267      if( !(offs & 0x08) )
269         data &= input_port_read(Machine, "ROW3");
268         data &= input_port_read(machine, "ROW3");
270269      if( !(offs & 0x10) )
271         data &= input_port_read(Machine, "ROW4");
270         data &= input_port_read(machine, "ROW4");
272271      if( !(offs & 0x20) )
273         data &= input_port_read(Machine, "ROW5");
272         data &= input_port_read(machine, "ROW5");
274273      if( !(offs & 0x40) )
275         data &= input_port_read(Machine, "ROW6");
274         data &= input_port_read(machine, "ROW6");
276275      if( !(offs & 0x80) )
277         data &= input_port_read(Machine, "ROW7");
276         data &= input_port_read(machine, "ROW7");
278277   }
279278
280279    /* what's bit 7 good for? tape input maybe? */
src/mess/machine/apple2gs.c
r2816r2817
11481148         break;
11491149
11501150      case 0x31:   /* C031 - DISKREG */
1151         apple2_iwm_setdiskreg(data);
1151         apple2_iwm_setdiskreg(machine, data);
11521152         break;
11531153
11541154      case 0x32:   /* C032 - SCANINT */
src/mess/machine/mac.c
r2816r2817
104104
105105
106106
107static void mac_install_memory(offs_t memory_begin, offs_t memory_end,
107static void mac_install_memory(running_machine *machine, offs_t memory_begin, offs_t memory_end,
108108   offs_t memory_size, void *memory_data, int is_rom, int bank)
109109{
110110   offs_t memory_mask;
r2816r2817
117117   rh = (read16_machine_func) (FPTR)bank;
118118   wh = is_rom ? SMH_UNMAP : (write16_machine_func) (FPTR)bank;
119119
120   memory_install_read16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, memory_begin,
120   memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, memory_begin,
121121      memory_end, memory_mask, 0, rh);
122   memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, memory_begin,
122   memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, memory_begin,
123123      memory_end, memory_mask, 0, wh);
124124
125125   memory_set_bankptr(bank, memory_data);
r2816r2817
227227      }
228228
229229      /* install the memory */
230      mac_install_memory(0x000000, 0x3fffff, memory_size, memory_data, is_rom, 1);
230      mac_install_memory(machine, 0x000000, 0x3fffff, memory_size, memory_data, is_rom, 1);
231231
232232      mac_overlay = overlay;
233233
r2816r2817
13431343   mac_model = model;
13441344
13451345   /* set up RAM mirror at 0x600000-0x6fffff (0x7fffff ???) */
1346   mac_install_memory(0x600000, 0x6fffff, mess_ram_size, mess_ram, FALSE, 2);
1346   mac_install_memory(machine, 0x600000, 0x6fffff, mess_ram_size, mess_ram, FALSE, 2);
13471347
13481348   /* set up ROM at 0x400000-0x43ffff (-0x5fffff for mac 128k/512k/512ke) */
1349   mac_install_memory(0x400000, (model >= MODEL_MAC_PLUS) ? 0x43ffff : 0x5fffff,
1349   mac_install_memory(machine, 0x400000, (model >= MODEL_MAC_PLUS) ? 0x43ffff : 0x5fffff,
13501350      memory_region_length(REGION_USER1), memory_region(REGION_USER1), TRUE, 3);
13511351
13521352   set_memory_overlay(machine, 1);
r2816r2817
13641364
13651365   /* save state stuff */
13661366   state_save_register_global(mac_overlay);
1367   state_save_register_postload(Machine, mac_state_load, NULL);
1367   state_save_register_postload(machine, mac_state_load, NULL);
13681368}
13691369
13701370
src/mess/machine/nes.c
r2816r2817
11#include "driver.h"
2#include "deprecat.h"
32#include "cpu/m6502/m6502.h"
43#include "video/ppu2c0x.h"
54#include "includes/nes.h"
r2816r2817
299298
300299
301300
302static void nes_read_input_device(int cfg, nes_input *vals, int pad_port,
301static void nes_read_input_device(running_machine *machine, int cfg, nes_input *vals, int pad_port,
303302   int supports_zapper, int paddle_port)
304303{
305304   char port[5];
r2816r2817
314313         if (pad_port >= 0)
315314         {
316315            sprintf(port, "PAD%d", pad_port+1);
317            vals->i0 = input_port_read(Machine, port);
316            vals->i0 = input_port_read(machine, port);
318317         }
319318         break;
320319
321320      case 0x02:   /* zapper 1 */
322321         if (supports_zapper)
323322         {
324            vals->i0 = input_port_read(Machine, "ZAPPER1_T");
325            vals->i1 = input_port_read(Machine, "ZAPPER1_X");
326            vals->i2 = input_port_read(Machine, "ZAPPER1_Y");
323            vals->i0 = input_port_read(machine, "ZAPPER1_T");
324            vals->i1 = input_port_read(machine, "ZAPPER1_X");
325            vals->i2 = input_port_read(machine, "ZAPPER1_Y");
327326         }
328327         break;
329328
330329      case 0x03:   /* zapper 2 */
331330         if (supports_zapper)
332331         {
333            vals->i0 = input_port_read(Machine, "ZAPPER2_T");
334            vals->i1 = input_port_read(Machine, "ZAPPER2_X");
335            vals->i2 = input_port_read(Machine, "ZAPPER2_Y");
332            vals->i0 = input_port_read(machine, "ZAPPER2_T");
333            vals->i1 = input_port_read(machine, "ZAPPER2_X");
334            vals->i2 = input_port_read(machine, "ZAPPER2_Y");
336335         }
337336         break;
338337
339338      case 0x04:   /* arkanoid paddle */
340339         if (paddle_port >= 0)
341            vals->i0 = (UINT8) ((UINT8) input_port_read(Machine, "PADDLE") + (UINT8)0x52) ^ 0xff;
340            vals->i0 = (UINT8) ((UINT8) input_port_read(machine, "PADDLE") + (UINT8)0x52) ^ 0xff;
342341         break;
343342   }
344343}
r2816r2817
364363   cfg = input_port_read(machine, "CONTROLLERS");
365364
366365   /* Read the input devices */
367   nes_read_input_device(cfg >>  0, &in_0, 0,  TRUE, -1);
368   nes_read_input_device(cfg >>  4, &in_1, 1,  TRUE,  1);
369   nes_read_input_device(cfg >>  8, &in_2, 2, FALSE, -1);
370   nes_read_input_device(cfg >> 12, &in_3, 3, FALSE, -1);
366   nes_read_input_device(machine, cfg >>  0, &in_0, 0,  TRUE, -1);
367   nes_read_input_device(machine, cfg >>  4, &in_1, 1,  TRUE,  1);
368   nes_read_input_device(machine, cfg >>  8, &in_2, 2, FALSE, -1);
369   nes_read_input_device(machine, cfg >> 12, &in_3, 3, FALSE, -1);
371370
372371   if (cfg & 0x0f00)
373372      in_0.i0 |= (in_2.i0 << 8) | (0x08 << 16);
src/mess/machine/lynx.c
r2816r2817
33******************************************************************************/
44
55#include "driver.h"
6#include "deprecat.h"
76#include "includes/lynx.h"
87#include "cpu/m6502/m6502.h"
98
r2816r2817
12081207
12091208static STATE_POSTLOAD( lynx_postload )
12101209{
1211   lynx_memory_config_w(Machine, 0, lynx_memory_config);
1210   lynx_memory_config_w(machine, 0, lynx_memory_config);
12121211}
12131212
12141213MACHINE_START( lynx )
src/mess/machine/i82439tx.c
r2816r2817
199199   }
200200
201201   /* hack to compensate for weird issue (maybe the Pentium core needs to support caching? */
202   if ((cpunum_get_reg(0, REG_PC) == 0xFCB01) && !strcmp(Machine->gamedrv->name, "at586"))
202   if ((cpunum_get_reg(0, REG_PC) == 0xFCB01) && !strcmp(machine->gamedrv->name, "at586"))
203203   {
204204      memory_region(REGION_USER1)[0x3CB01] = 0xF3;
205205      memory_region(REGION_USER1)[0x3CB02] = 0xA4;
r2816r2817
218218
219219
220220
221void intel82439tx_init(void)
221void intel82439tx_init(running_machine *machine)
222222{
223223   /* setup PCI */
224224   pci_init();
r2816r2817
232232   i82439tx->regs[0x04] = 0x02020202;
233233   i82439tx->regs[0x05] = 0x00000002;
234234
235   intel82439tx_configure_memory(Machine, 0, 0xF0000, 0xFFFFF, BANK_F0000_R, bank_f0000_w);
236   intel82439tx_configure_memory(Machine, 0, 0xC0000, 0xC3FFF, BANK_C0000_R, bank_c0000_w);
237   intel82439tx_configure_memory(Machine, 0, 0xC4000, 0xC7FFF, BANK_C4000_R, bank_c4000_w);
238   intel82439tx_configure_memory(Machine, 0, 0xC8000, 0xCCFFF, BANK_C8000_R, bank_c8000_w);
239   intel82439tx_configure_memory(Machine, 0, 0xCC000, 0xCFFFF, BANK_CC000_R, bank_cc000_w);
240   intel82439tx_configure_memory(Machine, 0, 0xD0000, 0xD3FFF, BANK_D0000_R, bank_d0000_w);
241   intel82439tx_configure_memory(Machine, 0, 0xD4000, 0xD7FFF, BANK_D4000_R, bank_d4000_w);
242   intel82439tx_configure_memory(Machine, 0, 0xD8000, 0xDBFFF, BANK_D8000_R, bank_d8000_w);
243   intel82439tx_configure_memory(Machine, 0, 0xDC000, 0xDFFFF, BANK_DC000_R, bank_dc000_w);
244   intel82439tx_configure_memory(Machine, 0, 0xE0000, 0xE3FFF, BANK_E0000_R, bank_e0000_w);
245   intel82439tx_configure_memory(Machine, 0, 0xE4000, 0xE7FFF, BANK_E4000_R, bank_e4000_w);
246   intel82439tx_configure_memory(Machine, 0, 0xE8000, 0xECFFF, BANK_E8000_R, bank_e8000_w);
247   intel82439tx_configure_memory(Machine, 0, 0xEC000, 0xEFFFF, BANK_EC000_R, bank_ec000_w);
235   intel82439tx_configure_memory(machine, 0, 0xF0000, 0xFFFFF, BANK_F0000_R, bank_f0000_w);
236   intel82439tx_configure_memory(machine, 0, 0xC0000, 0xC3FFF, BANK_C0000_R, bank_c0000_w);
237   intel82439tx_configure_memory(machine, 0, 0xC4000, 0xC7FFF, BANK_C4000_R, bank_c4000_w);
238   intel82439tx_configure_memory(machine, 0, 0xC8000, 0xCCFFF, BANK_C8000_R, bank_c8000_w);
239   intel82439tx_configure_memory(machine, 0, 0xCC000, 0xCFFFF, BANK_CC000_R, bank_cc000_w);
240   intel82439tx_configure_memory(machine, 0, 0xD0000, 0xD3FFF, BANK_D0000_R, bank_d0000_w);
241   intel82439tx_configure_memory(machine, 0, 0xD4000, 0xD7FFF, BANK_D4000_R, bank_d4000_w);
242   intel82439tx_configure_memory(machine, 0, 0xD8000, 0xDBFFF, BANK_D8000_R, bank_d8000_w);
243   intel82439tx_configure_memory(machine, 0, 0xDC000, 0xDFFFF, BANK_DC000_R, bank_dc000_w);
244   intel82439tx_configure_memory(machine, 0, 0xE0000, 0xE3FFF, BANK_E0000_R, bank_e0000_w);
245   intel82439tx_configure_memory(machine, 0, 0xE4000, 0xE7FFF, BANK_E4000_R, bank_e4000_w);
246   intel82439tx_configure_memory(machine, 0, 0xE8000, 0xECFFF, BANK_E8000_R, bank_e8000_w);
247   intel82439tx_configure_memory(machine, 0, 0xEC000, 0xEFFFF, BANK_EC000_R, bank_ec000_w);
248248}
249249
src/mess/machine/i82439tx.h
r2816r2817
99#ifndef I82439TX_H
1010#define I82439TX_H
1111
12void intel82439tx_init(void);
12void intel82439tx_init(running_machine *machine);
1313
1414#endif /* I82439TX_H */
src/mess/machine/mc6843.c
r2816r2817
3131
3232
3333#include "driver.h"
34#include "deprecat.h"
3534#include "mc6843.h"
3635#include "devices/flopdrv.h"
3736
r2816r2817
753752
754753
755754
756void mc6843_reset ( void )
755void mc6843_reset ( running_machine *machine )
757756{
758757   int i;
759758   LOG (( "mc6843 reset\n" ));
760759
761760   /* setup/reset floppy drive */
762   for ( i = 0; i < device_count( Machine, IO_FLOPPY ); i++ )
761   for ( i = 0; i < device_count( machine, IO_FLOPPY ); i++ )
763762   {
764763      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
765764      floppy_drive_set_index_pulse_callback( img, mc6843_index_pulse_callback );
r2816r2817
787786
788787
789788
790void mc6843_config ( const mc6843_interface* iface )
789void mc6843_config ( running_machine *machine, const mc6843_interface* iface )
791790{
792791   assert( iface );
793792   mc6843 = auto_malloc( sizeof( * mc6843 ) );
r2816r2817
814813   state_save_register_item( "mc6843", 0, mc6843->data_id );
815814   state_save_register_item( "mc6843", 0, mc6843->index_pulse );
816815
817   mc6843_reset();
816   mc6843_reset(machine);
818817}
src/mess/machine/mc6843.h
r2816r2817
2121
2222/* ---------- functions ------------ */
2323
24extern void mc6843_config ( const mc6843_interface *func );
24extern void mc6843_config ( running_machine *machine, const mc6843_interface *func );
2525
2626/* reset by external signal */
27extern void mc6843_reset ( void );
27extern void mc6843_reset ( running_machine *machine );
2828
2929/* interface to CPU via address/data bus */
3030extern READ8_HANDLER  ( mc6843_r );
src/mess/machine/pc_mouse.c
r2816r2817
77***************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1110#include "machine/ins8250.h"
1211#include "includes/pc_mouse.h"
1312
r2816r2817
221220         /* reset mouse */
222221         pc_mouse.head = pc_mouse.tail = pc_mouse.mb = 0;
223222
224         if ((input_port_read(Machine, "pc_mouse_misc") & 0x80) == 0 )
223         if ((input_port_read(device->machine, "pc_mouse_misc") & 0x80) == 0 )
225224         {
226225            /* Identify as Microsoft 3 Button Mouse */
227226            pc_mouse.queue[pc_mouse.head] = 'M';
src/mess/machine/apple2.c
r2816r2817
194194
195195         /* install the actual handlers */
196196         if (begin <= end_r)
197            memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, begin, end_r, 0, 0, rh);
197            memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, begin, end_r, 0, 0, rh);
198198
199199         /* did we 'go past the end?' */
200200         if (end_r < apple2_mem_config.memmap[i].end)
201            memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, end_r + 1, apple2_mem_config.memmap[i].end, 0, 0, SMH_NOP);
201            memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, end_r + 1, apple2_mem_config.memmap[i].end, 0, 0, SMH_NOP);
202202
203203         /* set the memory bank */
204204         if (rbase)
r2816r2817
269269
270270         /* install the actual handlers */
271271         if (begin <= end_w)
272            memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, begin, end_w, 0, 0, wh);
272            memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, begin, end_w, 0, 0, wh);
273273
274274         /* did we 'go past the end?' */
275275         if (end_w < apple2_mem_config.memmap[i].end)
276            memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, end_w + 1, apple2_mem_config.memmap[i].end, 0, 0, SMH_NOP);
276            memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, end_w + 1, apple2_mem_config.memmap[i].end, 0, 0, SMH_NOP);
277277
278278         /* set the memory bank */
279279         if (wbase)
r2816r2817
11011101
11021102static int apple2_fdc_diskreg;
11031103
1104static int apple2_fdc_has_35(void)
1104static int apple2_fdc_has_35(running_machine *machine)
11051105{
1106   return device_count_tag_from_machine(Machine, "sonydriv") > 0;
1106   return device_count_tag_from_machine(machine, "sonydriv") > 0;
11071107}
11081108
1109static int apple2_fdc_has_525(void)
1109static int apple2_fdc_has_525(running_machine *machine)
11101110{
1111   return device_count_tag_from_machine(Machine, "apple525driv") > 0;
1111   return device_count_tag_from_machine(machine, "apple525driv") > 0;
11121112}
11131113
11141114static void apple2_fdc_set_lines(UINT8 lines)
11151115{
11161116   if (apple2_fdc_diskreg & 0x40)
11171117   {
1118      if (apple2_fdc_has_35())
1118      if (apple2_fdc_has_35(Machine))
11191119      {
11201120         /* slot 5: 3.5" disks */
11211121         sony_set_lines(lines);
r2816r2817
11231123   }
11241124   else
11251125   {
1126      if (apple2_fdc_has_525())
1126      if (apple2_fdc_has_525(Machine))
11271127      {
11281128         /* slot 6: 5.25" disks */
11291129         apple525_set_lines(lines);
r2816r2817
11431143   else
11441144      slot6_enable_mask = enable_mask;
11451145
1146   if (apple2_fdc_has_35())
1146   if (apple2_fdc_has_35(Machine))
11471147   {
11481148      /* set the 3.5" enable lines */
11491149      sony_set_enable_lines(slot5_enable_mask);
11501150   }
11511151
1152   if (apple2_fdc_has_525())
1152   if (apple2_fdc_has_525(Machine))
11531153   {
11541154      /* set the 5.25" enable lines */
11551155      apple525_set_enable_lines(slot6_enable_mask);
r2816r2817
11641164
11651165   if (apple2_fdc_diskreg & 0x40)
11661166   {
1167      if (apple2_fdc_has_35())
1167      if (apple2_fdc_has_35(Machine))
11681168      {
11691169         /* slot 5: 3.5" disks */
11701170         result = sony_read_data();
r2816r2817
11721172   }
11731173   else
11741174   {
1175      if (apple2_fdc_has_525())
1175      if (apple2_fdc_has_525(Machine))
11761176      {
11771177         /* slot 6: 5.25" disks */
11781178         result = apple525_read_data();
r2816r2817
11871187{
11881188   if (apple2_fdc_diskreg & 0x40)
11891189   {
1190      if (apple2_fdc_has_35())
1190      if (apple2_fdc_has_35(Machine))
11911191      {
11921192         /* slot 5: 3.5" disks */
11931193         sony_write_data(data);
r2816r2817
11951195   }
11961196   else
11971197   {
1198      if (apple2_fdc_has_525())
1198      if (apple2_fdc_has_525(Machine))
11991199      {
12001200         /* slot 6: 5.25" disks */
12011201         apple525_write_data(data);
r2816r2817
12111211
12121212   if (apple2_fdc_diskreg & 0x40)
12131213   {
1214      if (apple2_fdc_has_35())
1214      if (apple2_fdc_has_35(Machine))
12151215      {
12161216         /* slot 5: 3.5" disks */
12171217         result = sony_read_status();
r2816r2817
12191219   }
12201220   else
12211221   {
1222      if (apple2_fdc_has_525())
1222      if (apple2_fdc_has_525(Machine))
12231223      {
12241224         /* slot 6: 5.25" disks */
12251225         result = apple525_read_status();
r2816r2817
12301230
12311231
12321232
1233void apple2_iwm_setdiskreg(UINT8 data)
1233void apple2_iwm_setdiskreg(running_machine *machine, UINT8 data)
12341234{
12351235   apple2_fdc_diskreg = data & 0xC0;
1236   if (apple2_fdc_has_35())
1236   if (apple2_fdc_has_35(machine))
12371237      sony_set_sel_line(apple2_fdc_diskreg & 0x80);
12381238}
12391239
src/mess/machine/c64.c
r2816r2817
473473      return c64_colorram[offset & 0x3ff];
474474   else if (offset == 0xc00)
475475      {
476         cia_set_port_mask_value(0, 0, input_port_read(Machine, "DSW0") & 0x0100 ? c64_keyline[8] : c64_keyline[9] );
476         cia_set_port_mask_value(0, 0, input_port_read(machine, "DSW0") & 0x0100 ? c64_keyline[8] : c64_keyline[9] );
477477         return cia_0_r(machine, offset);
478478      }
479479   else if (offset == 0xc01)
480480      {
481         cia_set_port_mask_value(0, 1, input_port_read(Machine, "DSW0") & 0x0100 ? c64_keyline[9] : c64_keyline[8] );
481         cia_set_port_mask_value(0, 1, input_port_read(machine, "DSW0") & 0x0100 ? c64_keyline[9] : c64_keyline[8] );
482482         return cia_0_r(machine, offset);
483483      }
484484   else if (offset < 0xd00)
r2816r2817
11081108
11091109    if (is_c128(machine))
11101110    {
1111       if ((input_port_read(Machine, "CFG") & 0x20) != monitor)
1111       if ((input_port_read(machine, "CFG") & 0x20) != monitor)
11121112      {
1113         if (input_port_read(Machine, "CFG") & 0x20)
1113         if (input_port_read(machine, "CFG") & 0x20)
11141114         {
11151115            vic2_set_rastering(0);
11161116            vdc8563_set_rastering(1);
r2816r2817
11221122            vdc8563_set_rastering(0);
11231123            video_screen_set_visarea(machine->primary_screen, 0, 335, 0, 215);
11241124         }
1125         monitor = input_port_read(Machine, "CFG") & 0x20;
1125         monitor = input_port_read(machine, "CFG") & 0x20;
11261126      }
11271127   }
11281128
src/mess/machine/ti99_4x.c
r2816r2817
8484static int ti99_R9901_3(int offset);
8585
8686static void ti99_handset_set_ack(int offset, int data);
87static void ti99_handset_task(void);
88static void mecmouse_poll(void);
87static void ti99_handset_task(running_machine *machine);
88static void mecmouse_poll(running_machine *machine);
8989static void ti99_KeyC(int offset, int data);
9090static void ti99_AlphaW(int offset, int data);
9191
r2816r2817
946946{
947947   TMS9928A_interrupt(machine);
948948   if (has_handset)
949      ti99_handset_task();
949      ti99_handset_task(machine);
950950   has_mecmouse = (input_port_read(machine, "CFG") >> config_mecmouse_bit) & config_mecmouse_mask;
951951   if (has_mecmouse)
952      mecmouse_poll();
952      mecmouse_poll(machine);
953953}
954954
955955INTERRUPT_GEN( ti99_4ev_hblank_interrupt )
r2816r2817
961961      line_count = 0;
962962      has_mecmouse = (input_port_read(machine, "CFG") >> config_mecmouse_bit) & config_mecmouse_mask;
963963      if (has_mecmouse)
964         mecmouse_poll();
964         mecmouse_poll(machine);
965965   }
966966}
967967
r2816r2817
17671767
17681768   if (handset_buflen == 0)
17691769      /* See if we need to post a new event */
1770      ti99_handset_task();
1770      ti99_handset_task(machine);
17711771}
17721772
17731773/*
r2816r2817
18131813
18141814   Returns TRUE if the handset state has changed and a message was posted.
18151815*/
1816static int ti99_handset_poll_keyboard(int num)
1816static int ti99_handset_poll_keyboard(running_machine *machine, int num)
18171817{
1818   running_machine *machine = Machine;
18191818   static UINT8 previous_key[max_handsets];
18201819
18211820   UINT32 key_buf;
r2816r2817
18971896
18981897   Returns TRUE if the handset state has changed and a message was posted.
18991898*/
1900static int ti99_handset_poll_joystick(int num)
1899static int ti99_handset_poll_joystick(running_machine *machine, int num)
19011900{
19021901   static UINT8 previous_joy[max_handsets];
1903   running_machine *machine = Machine;
19041902   UINT8 current_joy;
19051903   int current_joy_x, current_joy_y;
19061904   int message;
r2816r2817
19691967
19701968   Manage handsets, posting an event if the state of any handset has changed.
19711969*/
1972static void ti99_handset_task(void)
1970static void ti99_handset_task(running_machine *machine)
19731971{
19741972   int i;
19751973
19761974   if (handset_buflen == 0)
19771975   {   /* poll every handset */
19781976      for (i=0; i<max_handsets; i++)
1979         if (ti99_handset_poll_joystick(i))
1977         if (ti99_handset_poll_joystick(machine, i))
19801978            return;
19811979      for (i=0; i<max_handsets; i++)
1982         if (ti99_handset_poll_keyboard(i))
1980         if (ti99_handset_poll_keyboard(machine, i))
19831981            return;
19841982   }
19851983   else if (handset_buflen == 3)
19861984   {   /* update messages after they have been posted */
19871985      if (handset_buf & 1)
19881986      {   /* keyboard */
1989         ti99_handset_poll_keyboard((~ (handset_buf >> 1)) & 0x3);
1987         ti99_handset_poll_keyboard(machine, (~ (handset_buf >> 1)) & 0x3);
19901988      }
19911989      else
19921990      {   /* joystick */
1993         ti99_handset_poll_joystick((~ (handset_buf >> 1)) & 0x3);
1991         ti99_handset_poll_joystick(machine, (~ (handset_buf >> 1)) & 0x3);
19941992      }
19951993   }
19961994}
r2816r2817
20892087   }
20902088}
20912089
2092static void mecmouse_poll(void)
2090static void mecmouse_poll(running_machine *machine)
20932091{
20942092   static int last_mx = 0, last_my = 0;
2095   running_machine *machine = Machine;
20962093   int new_mx, new_my;
20972094   int delta_x, delta_y;
20982095
src/mess/machine/kc.c
r2816r2817
11/* Core includes */
22#include "driver.h"
3#include "deprecat.h"
43#include "includes/kc.h"
54
65/* Components */
r2816r2817
846845*/
847846
848847static kc_keyboard keyboard_data;
849static void kc_keyboard_attempt_transmit(void);
848static void kc_keyboard_attempt_transmit(running_machine *machine);
850849static TIMER_CALLBACK(kc_keyboard_update);
851850
852851/* this is called at a regular interval */
r2816r2817
899898
900899
901900/* initialise keyboard queue */
902static void kc_keyboard_init(void)
901static void kc_keyboard_init(running_machine *machine)
903902{
904903   int i;
905904   char port[6];
r2816r2817
928927   {
929928      sprintf(port, "KEY%d", i);
930929      /* read input port */
931      kc_previous_keyboard[i] = input_port_read(Machine, port);
930      kc_previous_keyboard[i] = input_port_read(machine, port);
932931   }
933932}
934933
r2816r2817
969968}
970969
971970
972static void kc_keyboard_begin_transmit(int scan_code)
971static void kc_keyboard_begin_transmit(running_machine *machine, int scan_code)
973972{
974973   int i;
975974   int scan;
r2816r2817
983982   scan = scan_code;
984983
985984   /* state of shift key */
986   kc_keyboard_add_bit(((input_port_read(Machine, "SHIFT") & 0x01)^0x01));
985   kc_keyboard_add_bit(((input_port_read(machine, "SHIFT") & 0x01)^0x01));
987986
988987   for (i=0; i<6; i++)
989988   {
r2816r2817
10161015}
10171016
10181017/* attempt to transmit a new keycode to the base unit */
1019static void kc_keyboard_attempt_transmit(void)
1018static void kc_keyboard_attempt_transmit(running_machine *machine)
10201019{
10211020   /* is the keyboard transmit is idle */
10221021   if (keyboard_data.transmit_state == KC_KEYBOARD_TRANSMIT_IDLE)
r2816r2817
10341033         keyboard_data.head = (keyboard_data.head + 1) % KC_KEYCODE_QUEUE_LENGTH;
10351034
10361035         /* setup transmit buffer with scan-code */
1037         kc_keyboard_begin_transmit(code);
1036         kc_keyboard_begin_transmit(machine, code);
10381037      }
10391038   }
10401039}
r2816r2817
10871086      }
10881087   }
10891088
1090   kc_keyboard_attempt_transmit();
1089   kc_keyboard_attempt_transmit(machine);
10911090}
10921091
10931092/*********************************************************************/
r2816r2817
18341833    kc85_zc2_callback
18351834};
18361835
1837static void   kc85_common_init(void)
1836static void   kc85_common_init(running_machine *machine)
18381837{
18391838   z80pio_init(0, &kc85_pio_intf);
18401839   z80ctc_init(0, &kc85_ctc_intf);
r2816r2817
18431842   z80pio_reset(0);
18441843
18451844   kc_cassette_init();
1846   kc_keyboard_init();
1845   kc_keyboard_init(machine);
18471846
18481847   /* kc85 has a 50hz input to the ctc channel 2 and 3 */
18491848   /* channel 2 this controls the video colour flash */
r2816r2817
18731872   kc85_4_update_0x0c000(machine);
18741873   kc85_4_update_0x0e000(machine);
18751874
1876   kc85_common_init();
1875   kc85_common_init(machine);
18771876
18781877   kc85_4_update_0x00000(machine);
18791878
r2816r2817
19061905   kc85_3_update_0x0c000(machine);
19071906   kc85_3_update_0x0e000(machine);
19081907
1909   kc85_common_init();
1908   kc85_common_init(machine);
19101909
19111910   kc85_3_update_0x00000(machine);
19121911
src/mess/drivers/nc.c
r2816r2817
338338static const write8_machine_func nc_bankhandler_w[]={
339339SMH_BANK5, SMH_BANK6, SMH_BANK7, SMH_BANK8};
340340
341static void nc_refresh_memory_bank_config(int bank)
341static void nc_refresh_memory_bank_config(running_machine *machine, int bank)
342342{
343343   int mem_type;
344344   int mem_bank;
r2816r2817
400400            memory_set_bankptr(bank+1, addr);
401401
402402            /* write enabled? */
403            if (input_port_read(Machine, "EXTRA") & 0x02)
403            if (input_port_read(machine, "EXTRA") & 0x02)
404404            {
405405               /* yes */
406406               memory_set_bankptr(bank+5, addr);
r2816r2817
425425      break;
426426   }
427427
428   memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM,
428   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM,
429429      (bank * 0x4000), (bank * 0x4000) + 0x3fff, 0, 0, read_handler);
430430
431431   if (write_handler)
432432   {
433      memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM,
433      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM,
434434         (bank * 0x4000), (bank * 0x4000) + 0x3fff, 0, 0, write_handler);
435435   }
436436}
437437
438static void nc_refresh_memory_config(void)
438static void nc_refresh_memory_config(running_machine *machine)
439439{
440   nc_refresh_memory_bank_config(0);
441   nc_refresh_memory_bank_config(1);
442   nc_refresh_memory_bank_config(2);
443   nc_refresh_memory_bank_config(3);
440   nc_refresh_memory_bank_config(machine, 0);
441   nc_refresh_memory_bank_config(machine, 1);
442   nc_refresh_memory_bank_config(machine, 2);
443   nc_refresh_memory_bank_config(machine, 3);
444444}
445445
446446
r2816r2817
552552   if (changed_bits & 0x02)
553553   {
554554      /* yes refresh memory config */
555      nc_refresh_memory_config();
555      nc_refresh_memory_config(machine);
556556   }
557557
558558   previous_inputport_10_state = inputport_10_state;
r2816r2817
588588    /* at reset set to 1 */
589589    nc_poweroff_control = 1;
590590
591    nc_refresh_memory_config();
591    nc_refresh_memory_config(machine);
592592   nc_update_interrupts(machine);
593593
594594   /* keyboard timer */
r2816r2817
623623   LOG(("Memory management W: %02x %02x\n",offset,data));
624624        nc_memory_config[offset] = data;
625625
626        nc_refresh_memory_config();
626        nc_refresh_memory_config(machine);
627627}
628628
629629static WRITE8_HANDLER(nc_irq_mask_w)
src/mess/drivers/pcw16.c
r2816r2817
374374   return 0x0ff;
375375}
376376
377static void pcw16_set_bank_handlers(int bank, PCW16_RAM_TYPE type)
377static void pcw16_set_bank_handlers(running_machine *machine, int bank, PCW16_RAM_TYPE type)
378378{
379379   read8_machine_func read_handler;
380380   write8_machine_func write_handler;
r2816r2817
410410      break;
411411   }
412412
413   memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM,
413   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM,
414414      (bank * 0x4000), (bank * 0x4000) + 0x3fff, 0, 0, read_handler);
415   memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM,
415   memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM,
416416      (bank * 0x4000), (bank * 0x4000) + 0x3fff, 0, 0, write_handler);
417417}
418418
r2816r2817
469469      if (bank_id<4)
470470      {
471471         /* rom */
472         pcw16_set_bank_handlers(bank, PCW16_MEM_ROM);
472         pcw16_set_bank_handlers(machine, bank, PCW16_MEM_ROM);
473473      }
474474      else
475475      {
r2816r2817
477477            64-128 are for flash-rom 1 */
478478         if ((bank_id & 0x040)==0)
479479         {
480            pcw16_set_bank_handlers(bank, PCW16_MEM_FLASH_1);
480            pcw16_set_bank_handlers(machine, bank, PCW16_MEM_FLASH_1);
481481         }
482482         else
483483         {
484            pcw16_set_bank_handlers(bank, PCW16_MEM_FLASH_2);
484            pcw16_set_bank_handlers(machine, bank, PCW16_MEM_FLASH_2);
485485         }
486486      }
487487   }
488488   else
489489   {
490      pcw16_set_bank_handlers(bank, PCW16_MEM_DRAM);
490      pcw16_set_bank_handlers(machine, bank, PCW16_MEM_DRAM);
491491   }
492492}
493493
r2816r2817
12521252   new_inputs = 0;
12531253
12541254   /* Power switch is connected to Ring indicator */
1255   if (input_port_read(Machine, "EXTRA") & 0x040)
1255   if (input_port_read(device->machine, "EXTRA") & 0x040)
12561256   {
12571257      new_inputs = UART8250_INPUTS_RING_INDICATOR;
12581258   }
src/mess/drivers/glasgow.c
r2816r2817
2323***************************************************************************/
2424
2525#include "driver.h"
26#include "deprecat.h"
2726#include "cpu/m68000/m68k.h"
2827#include "cpu/m68000/m68000.h"
2928#include "glasgow.lh"
r2816r2817
175174
176175  static view_item *my_cursor;
177176
178  static void set_cursor (view_item *view_cursor);
177  static void set_cursor (running_machine *machine, view_item *view_cursor);
179178
180179  static view_item *get_view_item(render_target *target, const char *v_name);
181180
r2816r2817
604603// Mouse movement
605604//
606605   if (my_cursor != NULL)
607      set_cursor (my_cursor);
606      set_cursor (screen->machine, my_cursor);
608607
609608    m_button1=input_port_read(screen->machine, "BUTTON_L");
610609    m_button2=input_port_read(screen->machine, "BUTTON_R");
r2816r2817
967966
968967
969968
970static void set_cursor (view_item *view_cursor)
969static void set_cursor (running_machine *machine, view_item *view_cursor)
971970  {
972971
973972   static INT16 save_x, save_y;
r2816r2817
976975    save_x = m_x;
977976    save_y = m_y;
978977
979    m_x=input_port_read(Machine, "MOUSE_X");
980    m_y=input_port_read(Machine, "MOUSE_Y");
978    m_x=input_port_read(machine, "MOUSE_X");
979    m_y=input_port_read(machine, "MOUSE_Y");
981980
982981//    logerror("m_x   = %d \n  ",m_x);
983982//    logerror("m_y   = %d \n  ",m_y);
src/mess/drivers/pcw.c
r2816r2817
258258 * PCW Banking
259259 * ----------------------------------------------------------------------- */
260260
261static void pcw_update_read_memory_block(int block, int bank)
261static void pcw_update_read_memory_block(running_machine *machine, int block, int bank)
262262{
263263   memory_set_bankptr(block + 1, mess_ram + ((bank * 0x4000) % mess_ram_size));
264264
r2816r2817
267267   {
268268      /* when upper 16 bytes are accessed use keyboard read
269269           handler */
270      memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM,
270      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM,
271271         block * 0x04000 + 0x3ff0, block * 0x04000 + 0x3fff, 0, 0,
272272         pcw_keyboard_r);
273273   }
274274   else
275275   {
276276      /* restore bank handler across entire block */
277      memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM,
277      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM,
278278         block * 0x04000 + 0x0000, block * 0x04000 + 0x3fff, 0, 0,
279279         (read8_machine_func) (STATIC_BANK1 + (FPTR)block));
280280   }
r2816r2817
293293/* &F4 O  b7-b4: when set, force memory reads to access the same bank as
294294writes for &C000, &0000, &8000, and &4000 respectively */
295295
296static void pcw_update_mem(int block, int data)
296static void pcw_update_mem(running_machine *machine, int block, int data)
297297{
298298   /* expansion ram select.
299299        if block is 0-7, selects internal ram instead for read/write
r2816r2817
305305      /* same bank for reading and writing */
306306      bank = data & 0x7f;
307307
308      pcw_update_read_memory_block(block, bank);
308      pcw_update_read_memory_block(machine, block, bank);
309309      pcw_update_write_memory_block(block, bank);
310310   }
311311   else
r2816r2817
351351         read_bank = (data>>4) & 0x07;
352352      }
353353
354      pcw_update_read_memory_block(block, read_bank);
354      pcw_update_read_memory_block(machine, block, read_bank);
355355
356356      write_bank = data & 0x07;
357357      pcw_update_write_memory_block(block, write_bank);
r2816r2817
369369}
370370
371371/* from Jacob Nevins docs */
372static int pcw_get_sys_status(void)
372static int pcw_get_sys_status(running_machine *machine)
373373{
374   return pcw_interrupt_counter | (input_port_read(Machine, "EXTRA") & (0x040 | 0x010)) | pcw_system_status;
374   return pcw_interrupt_counter | (input_port_read(machine, "EXTRA") & (0x040 | 0x010)) | pcw_system_status;
375375}
376376
377377static READ8_HANDLER(pcw_interrupt_counter_r)
r2816r2817
381381   /* from Jacob Nevins docs */
382382
383383   /* get data */
384   data = pcw_get_sys_status();
384   data = pcw_get_sys_status(machine);
385385   /* clear int counter */
386386   pcw_interrupt_counter = 0;
387387   /* update interrupt */
r2816r2817
396396   LOG(("BANK: %2x %x\n",offset, data));
397397   pcw_banks[offset] = data;
398398
399   pcw_update_mem(offset, data);
399   pcw_update_mem(machine, offset, data);
400400}
401401
402402static WRITE8_HANDLER(pcw_bank_force_selection_w)
403403{
404404   pcw_bank_force = data;
405405
406   pcw_update_mem(0, pcw_banks[0]);
407   pcw_update_mem(1, pcw_banks[1]);
408   pcw_update_mem(2, pcw_banks[2]);
409   pcw_update_mem(3, pcw_banks[3]);
406   pcw_update_mem(machine, 0, pcw_banks[0]);
407   pcw_update_mem(machine, 1, pcw_banks[1]);
408   pcw_update_mem(machine, 2, pcw_banks[2]);
409   pcw_update_mem(machine, 3, pcw_banks[3]);
410410}
411411
412412
r2816r2817
439439      case 0:
440440      {
441441         pcw_boot = 0;
442         pcw_update_mem(0, pcw_banks[0]);
442         pcw_update_mem(machine, 0, pcw_banks[0]);
443443      }
444444      break;
445445
r2816r2817
579579   }
580580}
581581
582static READ8_HANDLER(pcw_system_status_r)
582static READ8_HANDLER(pcw_system_status_r)
583583{
584584   /* from Jacob Nevins docs */
585   return pcw_get_sys_status();
585   return pcw_get_sys_status(machine);
586586}
587587
588588/* read from expansion hardware - additional hardware not part of
r2816r2817
763763   pcw_banks[2] = 2;
764764   pcw_banks[3] = 3;
765765
766   pcw_update_mem(0, pcw_banks[0]);
767   pcw_update_mem(1, pcw_banks[1]);
768   pcw_update_mem(2, pcw_banks[2]);
769   pcw_update_mem(3, pcw_banks[3]);
766   pcw_update_mem(machine, 0, pcw_banks[0]);
767   pcw_update_mem(machine, 1, pcw_banks[1]);
768   pcw_update_mem(machine, 2, pcw_banks[2]);
769   pcw_update_mem(machine, 3, pcw_banks[3]);
770770
771771   /* lower 4 bits are interrupt counter */
772772   pcw_system_status = 0x000;
src/mess/drivers/saturn.c
r2816r2817
464464   /*Order is surely wrong but whatever...*/
465465}
466466
467static void smpc_intbackhelper(void)
467static void smpc_intbackhelper(running_machine *machine)
468468{
469469   int pad;
470470   char port[5];
r2816r2817
476476   }
477477
478478   sprintf(port, "JOY%d", intback_stage-1);   // intback_stage will be 2 or 3, 2 = player 1, 3 = player 2
479   pad = input_port_read(Machine, port);
479   pad = input_port_read(machine, port);
480480
481481//  if (LOG_SMPC) logerror("SMPC: providing PAD data for intback, pad %d\n", intback_stage-2);
482482   smpc_ram[33] = 0xf1;   // no tap, direct connect
r2816r2817
540540      {
541541         intback_stage = 2;
542542      }
543      smpc_intbackhelper();
543      smpc_intbackhelper(machine);
544544      cpunum_set_input_line_and_vector(machine, 0, 8, HOLD_LINE , 0x47);
545545   }
546546
r2816r2817
698698         //  if(!(stv_scu[40] & 0x0080)) /*System Manager(SMPC) irq*/ /* we can't check this .. breaks controls .. probably issues elsewhere? */
699699            {
700700//                  if(LOG_SMPC) logerror ("Interrupt: System Manager (SMPC) at scanline %04x, Vector 0x47 Level 0x08\n",scanline);
701               smpc_intbackhelper();
701               smpc_intbackhelper(machine);
702702               cpunum_set_input_line_and_vector(machine, 0, 8, HOLD_LINE , 0x47);
703703            }
704704         break;
src/mess/drivers/amiga.c
r2816r2817
303303      /* overlay disabled, map RAM on 0x000000 */
304304      memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, amiga_chip_ram_size - 1, 0, mirror_mask, SMH_BANK1);
305305
306      amiga_cart_check_overlay();
306      amiga_cart_check_overlay(Machine);
307307   }
308308   else
309309      /* overlay enabled, map Amiga system ROM on 0x000000 */
r2816r2817
350350{
351351   if ( data & 0x8000 ) {
352352      if ( CUSTOM_REG(REG_DSKLEN) & 0x8000 )
353         amiga_fdc_setup_dma();
353         amiga_fdc_setup_dma(Machine);
354354   }
355355}
356356
r2816r2817
395395   memory_configure_bank(1, 1, 1, memory_region(REGION_USER1), 0);
396396
397397   /* initialize cartridge (if present) */
398   amiga_cart_init();
398   amiga_cart_init(machine);
399399
400400   /* initialize keyboard */
401401   amigakbd_init();
r2816r2817
428428   memory_configure_bank(1, 1, 1, memory_region(REGION_USER1), 0);
429429
430430   /* initialize Action Replay (if present) */
431   amiga_cart_init();
431   amiga_cart_init(machine);
432432
433433   /* initialize keyboard */
434434   amigakbd_init();
src/mess/drivers/einstein.c
r2816r2817
333333}
334334
335335/* refresh keyboard data. It is refreshed when the keyboard line is written */
336static void einstein_scan_keyboard(void)
336static void einstein_scan_keyboard(running_machine *machine)
337337{
338338   unsigned char data = 0x0ff;
339339   int i;
r2816r2817
344344      if ((einstein_keyboard_line & (1<<i))==0)
345345      {
346346         sprintf(port, "LINE%d", i);
347         data &= input_port_read(Machine, port);
347         data &= input_port_read(machine, port);
348348      }
349349   }
350350
r2816r2817
374374
375375static TIMER_CALLBACK(einstein_keyboard_timer_callback)
376376{
377   einstein_scan_keyboard();
377   einstein_scan_keyboard(machine);
378378
379379   /* if /fire1 or /fire2 is 0, then trigger a fire interrupt if the interrupt is enabled */
380380   if ((input_port_read(machine, "BUTTONS") & 0x03)!=0)
r2816r2817
15941594//  logerror("line: %02x\n",einstein_keyboard_line);
15951595
15961596   /* re-scan the keyboard */
1597   einstein_scan_keyboard();
1597   einstein_scan_keyboard(machine);
15981598}
15991599
1600static READ8_HANDLER(einstein_port_b_read)
1600static READ8_HANDLER(einstein_port_b_read)
16011601{
1602   einstein_scan_keyboard();
1602   einstein_scan_keyboard(machine);
16031603
16041604//  logerror("key: %02x\n",einstein_keyboard_data);
16051605
src/mess/drivers/ssystem3.c
r2816r2817
3434*/
3535
3636#include "driver.h"
37#include "deprecat.h"
3837
3938#include "includes/ssystem3.h"
4039#include "machine/6522via.h"
r2816r2817
128127  playfield.signal=signal;
129128}
130129
131static void ssystem3_playfield_read(int *on, int *ready)
130static void ssystem3_playfield_read(running_machine *machine, int *on, int *ready)
132131{
133   running_machine *machine = Machine;
134132   *on=!(input_port_read(machine, "Configuration")&1);
135133   //  *on=!playfield.on;
136134   *ready=FALSE;
r2816r2817
206204   bit 5: input low x/$37 4 (else 1)
207205
208206 */
209UINT8 ssystem3_via_read_b(ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset)
207UINT8 ssystem3_via_read_b(running_machine *machine, ATTR_UNUSED offs_t offset)
210208{
211209  UINT8 data=0xff;
212210  int on, ready;
213  ssystem3_playfield_read(&on, &ready);
211  ssystem3_playfield_read(machine, &on, &ready);
214212  if (!on) data&=~0x20;
215213  if (!ready) data&=~0x10;
216214  return data;
src/mess/drivers/avigo.c
r2816r2817
9494   }
9595}
9696
97static void avigo_setbank(int bank, void *address, read8_machine_func rh, write8_machine_func wh)
97static void avigo_setbank(running_machine *machine, int bank, void *address, read8_machine_func rh, write8_machine_func wh)
9898{
9999   if (address)
100100   {
r2816r2817
104104   }
105105   if (rh)
106106   {
107      memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, (bank * 0x4000),
107      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, (bank * 0x4000),
108108         (bank * 0x4000) + 0x3FFF, 0, 0, rh);
109109   }
110110   if (wh)
111111   {
112      memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, (bank * 0x4000),
112      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, (bank * 0x4000),
113113         (bank * 0x4000) + 0x3FFF, 0, 0, wh);
114114   }
115115}
r2816r2817
292292   avigo_tc8521_alarm_int
293293};
294294
295static void avigo_refresh_memory(void)
295static void avigo_refresh_memory(running_machine *machine)
296296{
297297   unsigned char *addr;
298298
r2816r2817
319319
320320   addr = (unsigned char *)intelflash_getmemptr(avigo_flash_at_0x4000);
321321   addr = addr + (avigo_rom_bank_l<<14);
322   avigo_setbank(1, addr, avigo_flash_0x4000_read_handler, avigo_flash_0x4000_write_handler);
322   avigo_setbank(machine, 1, addr, avigo_flash_0x4000_read_handler, avigo_flash_0x4000_write_handler);
323323
324324   switch (avigo_ram_bank_h)
325325   {
326326      /* %101 */
327327      /* screen */
328328      case 0x06:
329         avigo_setbank(2, NULL, avigo_vid_memory_r, avigo_vid_memory_w);
329         avigo_setbank(machine, 2, NULL, avigo_vid_memory_r, avigo_vid_memory_w);
330330         break;
331331
332332      /* %001 */
333333      /* ram */
334334      case 0x01:
335335         addr = mess_ram + ((avigo_ram_bank_l & 0x07)<<14);
336         avigo_setbank(2, addr, SMH_BANK3, SMH_BANK7);
336         avigo_setbank(machine, 2, addr, SMH_BANK3, SMH_BANK7);
337337         break;
338338
339339      /* %111 */
r2816r2817
343343
344344         addr = (unsigned char *)intelflash_getmemptr(avigo_flash_at_0x8000);
345345         addr = addr + (avigo_ram_bank_l<<14);
346         avigo_setbank(2, addr, avigo_flash_0x8000_read_handler,
346         avigo_setbank(machine, 2, addr, avigo_flash_0x8000_read_handler,
347347            SMH_NOP /* avigo_flash_0x8000_write_handler */);
348348         break;
349349
r2816r2817
352352
353353         addr = (unsigned char *)intelflash_getmemptr(avigo_flash_at_0x8000);
354354         addr = addr + (avigo_ram_bank_l<<14);
355         avigo_setbank(2, addr, avigo_flash_0x8000_read_handler,
355         avigo_setbank(machine, 2, addr, avigo_flash_0x8000_read_handler,
356356            SMH_NOP /* avigo_flash_0x8000_write_handler */);
357357         break;
358358   }
r2816r2817
371371      avigo_irq |= (1<<3);
372372   }
373373
374   avigo_refresh_ints(Machine);
374   avigo_refresh_ints(device->machine);
375375}
376376
377377
r2816r2817
442442   memory_set_opbase_handler(0, avigo_opbase_handler);
443443
444444   addr = (unsigned char *)intelflash_getmemptr(0);
445   avigo_setbank(0, addr, avigo_flash_0x0000_read_handler, avigo_flash_0x0000_write_handler);
445   avigo_setbank(machine, 0, addr, avigo_flash_0x0000_read_handler, avigo_flash_0x0000_write_handler);
446446
447   avigo_setbank(3, mess_ram, NULL, NULL);
447   avigo_setbank(machine, 3, mess_ram, NULL, NULL);
448448
449449   /* 0x08000 is specially banked! */
450   avigo_refresh_memory();
450   avigo_refresh_memory(machine);
451451}
452452
453453static MACHINE_START( avigo )
r2816r2817
544544
545545        avigo_rom_bank_l = data & 0x03f;
546546
547        avigo_refresh_memory();
547        avigo_refresh_memory(machine);
548548}
549549
550550static WRITE8_HANDLER(avigo_rom_bank_h_w)
r2816r2817
564564   avigo_rom_bank_h = data;
565565
566566
567        avigo_refresh_memory();
567        avigo_refresh_memory(machine);
568568}
569569
570570static WRITE8_HANDLER(avigo_ram_bank_l_w)
r2816r2817
573573
574574        avigo_ram_bank_l = data & 0x03f;
575575
576        avigo_refresh_memory();
576        avigo_refresh_memory(machine);
577577}
578578
579579static WRITE8_HANDLER(avigo_ram_bank_h_w)
r2816r2817
582582
583583   avigo_ram_bank_h = data;
584584
585        avigo_refresh_memory();
585        avigo_refresh_memory(machine);
586586}
587587
588588static  READ8_HANDLER(avigo_ad_control_status_r)
src/mess/drivers/psx.c
r2816r2817
189189   }
190190}
191191
192static void psx_pad( int n_port, int n_data )
192static void psx_pad( running_machine *machine, int n_port, int n_data )
193193{
194   running_machine *machine = Machine;
195194   int b_sel;
196195   int b_clock;
197196   int b_data;
r2816r2817
312311static void psx_sio0( int n_data )
313312{
314313   /* todo: raise data & ack when nothing is driving it low */
315   psx_pad( 0, n_data );
314   psx_pad( Machine, 0, n_data );
316315   psx_mcd( 0, n_data );
317   psx_pad( 1, n_data ^ PSX_SIO_OUT_DTR );
316   psx_pad( Machine, 1, n_data ^ PSX_SIO_OUT_DTR );
318317   psx_mcd( 1, n_data ^ PSX_SIO_OUT_DTR );
319318}
320319

Previous 15994 Revisions Next


© 1998-2018 The MESS Team