~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

Viewing changes to src/mame/machine/smpc.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Emmanuel Kasper, Jordi Mallach
  • Date: 2012-06-05 20:02:23 UTC
  • mfrom: (0.3.1) (0.1.4)
  • Revision ID: package-import@ubuntu.com-20120605200223-gnlpogjrg6oqe9md
Tags: 0.146-1
[ Emmanuel Kasper ]
* New upstream release
* Drop patch to fix man pages section and patches to link with flac 
  and jpeg system lib: all this has been pushed upstream by Cesare Falco
* Add DM-Upload-Allowed: yes field.

[ Jordi Mallach ]
* Create a "gnu" TARGETOS stanza that defines NO_AFFINITY_NP.
* Stop setting TARGETOS to "unix" in d/rules. It should be autodetected,
  and set to the appropriate value.
* mame_manpage_section.patch: Change mame's manpage section to 6 (games),
  in the TH declaration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
189
189
 
190
190
        if(state->m_prev_bankswitch != param)
191
191
        {
192
 
                game_region = machine.region(banknames[param])->base();
 
192
                game_region = machine.root_device().memregion(banknames[param])->base();
193
193
 
194
194
                if (game_region)
195
 
                        memcpy(machine.region("abus")->base(), game_region, 0x3000000);
 
195
                        memcpy(machine.root_device().memregion("abus")->base(), game_region, 0x3000000);
196
196
                else
197
 
                        memset(machine.region("abus")->base(), 0x00, 0x3000000);
 
197
                        memset(machine.root_device().memregion("abus")->base(), 0x00, 0x3000000);
198
198
 
199
199
                state->m_prev_bankswitch = param;
200
200
        }
345
345
        static const char *const padnames[] = { "JOY1", "JOY2" };
346
346
        UINT16 pad_data;
347
347
 
348
 
        pad_data = input_port_read(machine, padnames[pad_num]);
 
348
        pad_data = machine.root_device().ioport(padnames[pad_num])->read();
349
349
        state->m_smpc.OREG[0+pad_num*offset] = 0xf1;
350
350
        state->m_smpc.OREG[1+pad_num*offset] = 0x02;
351
351
        state->m_smpc.OREG[2+pad_num*offset] = pad_data>>8;
360
360
                                                                                           { "AN_X2", "AN_Y2", "AN_Z2" }};
361
361
        UINT16 pad_data;
362
362
 
363
 
        pad_data = input_port_read(machine, padnames[pad_num]);
 
363
        pad_data = machine.root_device().ioport(padnames[pad_num])->read();
364
364
        state->m_smpc.OREG[0+pad_num*offset] = 0xf1;
365
365
        state->m_smpc.OREG[1+pad_num*offset] = id;
366
366
        state->m_smpc.OREG[2+pad_num*offset] = pad_data>>8;
367
367
        state->m_smpc.OREG[3+pad_num*offset] = pad_data & 0xff;
368
 
        state->m_smpc.OREG[4+pad_num*offset] = input_port_read(machine, annames[pad_num][0]);
 
368
        state->m_smpc.OREG[4+pad_num*offset] = machine.root_device().ioport(annames[pad_num][0])->read();
369
369
        if(id == 0x15)
370
370
        {
371
 
                state->m_smpc.OREG[5+pad_num*offset] = input_port_read(machine, annames[pad_num][1]);
372
 
                state->m_smpc.OREG[6+pad_num*offset] = input_port_read(machine, annames[pad_num][2]);
 
371
                state->m_smpc.OREG[5+pad_num*offset] = machine.root_device().ioport(annames[pad_num][1])->read();
 
372
                state->m_smpc.OREG[6+pad_num*offset] = machine.root_device().ioport(annames[pad_num][2])->read();
373
373
        }
374
374
}
375
375
 
380
380
 
381
381
        game_key = 0xffff;
382
382
 
383
 
        game_key ^= ((input_port_read(machine, "KEYS_1") & 0x80) << 8); // right
384
 
        game_key ^= ((input_port_read(machine, "KEYS_1") & 0x40) << 8); // left
385
 
        game_key ^= ((input_port_read(machine, "KEYS_1") & 0x20) << 8); // down
386
 
        game_key ^= ((input_port_read(machine, "KEYS_1") & 0x10) << 8); // up
387
 
        game_key ^= ((input_port_read(machine, "KEYF") & 0x80) << 4); // ESC -> START
388
 
        game_key ^= ((input_port_read(machine, "KEY3") & 0x04) << 8); // Z / A trigger
389
 
        game_key ^= ((input_port_read(machine, "KEY4") & 0x02) << 8); // C / C trigger
390
 
        game_key ^= ((input_port_read(machine, "KEY6") & 0x04) << 6); // X / B trigger
391
 
        game_key ^= ((input_port_read(machine, "KEY2") & 0x20) << 2); // Q / R trigger
392
 
        game_key ^= ((input_port_read(machine, "KEY3") & 0x10) << 2); // A / X trigger
393
 
        game_key ^= ((input_port_read(machine, "KEY3") & 0x08) << 2); // S / Y trigger
394
 
        game_key ^= ((input_port_read(machine, "KEY4") & 0x08) << 1); // D / Z trigger
395
 
        game_key ^= ((input_port_read(machine, "KEY4") & 0x10) >> 1); // E / L trigger
 
383
        game_key ^= ((state->ioport("KEYS_1")->read() & 0x80) << 8); // right
 
384
        game_key ^= ((state->ioport("KEYS_1")->read() & 0x40) << 8); // left
 
385
        game_key ^= ((state->ioport("KEYS_1")->read() & 0x20) << 8); // down
 
386
        game_key ^= ((state->ioport("KEYS_1")->read() & 0x10) << 8); // up
 
387
        game_key ^= ((state->ioport("KEYF")->read() & 0x80) << 4); // ESC -> START
 
388
        game_key ^= ((state->ioport("KEY3")->read() & 0x04) << 8); // Z / A trigger
 
389
        game_key ^= ((state->ioport("KEY4")->read() & 0x02) << 8); // C / C trigger
 
390
        game_key ^= ((state->ioport("KEY6")->read() & 0x04) << 6); // X / B trigger
 
391
        game_key ^= ((state->ioport("KEY2")->read() & 0x20) << 2); // Q / R trigger
 
392
        game_key ^= ((state->ioport("KEY3")->read() & 0x10) << 2); // A / X trigger
 
393
        game_key ^= ((state->ioport("KEY3")->read() & 0x08) << 2); // S / Y trigger
 
394
        game_key ^= ((state->ioport("KEY4")->read() & 0x08) << 1); // D / Z trigger
 
395
        game_key ^= ((state->ioport("KEY4")->read() & 0x10) >> 1); // E / L trigger
396
396
 
397
397
        state->m_smpc.OREG[0+pad_num*offset] = 0xf1;
398
398
        state->m_smpc.OREG[1+pad_num*offset] = 0x34;
420
420
        UINT8 mouse_ctrl;
421
421
        INT16 mouse_x, mouse_y;
422
422
 
423
 
        mouse_ctrl = input_port_read(machine, mousenames[pad_num][0]);
424
 
        mouse_x = input_port_read(machine, mousenames[pad_num][1]);
425
 
        mouse_y = input_port_read(machine, mousenames[pad_num][2]);
 
423
        mouse_ctrl = machine.root_device().ioport(mousenames[pad_num][0])->read();
 
424
        mouse_x = machine.root_device().ioport(mousenames[pad_num][1])->read();
 
425
        mouse_y = machine.root_device().ioport(mousenames[pad_num][2])->read();
426
426
 
427
427
        if(mouse_x < 0)
428
428
                mouse_ctrl |= 0x10;
450
450
        static const char *const padnames[] = { "MD_JOY1", "MD_JOY2" };
451
451
        UINT16 pad_data;
452
452
 
453
 
        pad_data = input_port_read(machine, padnames[pad_num]);
 
453
        pad_data = machine.root_device().ioport(padnames[pad_num])->read();
454
454
        state->m_smpc.OREG[0+pad_num*offset] = 0xf1;
455
455
        state->m_smpc.OREG[1+pad_num*offset] = id;
456
456
        state->m_smpc.OREG[2+pad_num*offset] = pad_data>>8;
475
475
 
476
476
//  if (LOG_SMPC) logerror("SMPC: providing PAD data for intback, pad %d\n", intback_stage-2);
477
477
 
478
 
        read_id[0] = (input_port_read(machine, "INPUT_TYPE")) & 0x0f;
479
 
        read_id[1] = (input_port_read(machine, "INPUT_TYPE")) >> 4;
 
478
        read_id[0] = (machine.root_device().ioport("INPUT_TYPE")->read()) & 0x0f;
 
479
        read_id[1] = (machine.root_device().ioport("INPUT_TYPE")->read()) >> 4;
480
480
 
481
481
        /* doesn't work? */
482
482
        //pad_num = state->m_smpc.intback_stage - 1;
744
744
                return_data = state->m_smpc.SF;
745
745
 
746
746
        if (offset == 0x75)//PDR1 read
747
 
                return_data = input_port_read(space->machine(), "DSW1");
 
747
                return_data = state->ioport("DSW1")->read();
748
748
 
749
749
        if (offset == 0x77)//PDR2 read
750
750
                return_data = (0xfe | space->machine().device<eeprom_device>("eeprom")->read_bit());
866
866
                        const int shift_bit[4] = { 4, 12, 8, 0 };
867
867
                        const char *const padnames[] = { "JOY1", "JOY2" };
868
868
 
869
 
                        if(input_port_read(space->machine(), "INPUT_TYPE") && !(space->debugger_access()))
 
869
                        if(space->machine().root_device().ioport("INPUT_TYPE")->read() && !(space->debugger_access()))
870
870
                        {
871
871
                                popmessage("Warning: read with SH-2 direct mode with a non-pad device");
872
872
                                return 0;
879
879
 
880
880
                        if (LOG_SMPC) logerror("SMPC: SH-2 direct mode, returning data for phase %d\n", hshake);
881
881
 
882
 
                        return_data = 0x80 | 0x10 | ((input_port_read(space->machine(), padnames[offset == 0x77])>>shift_bit[hshake]) & 0xf);
 
882
                        return_data = 0x80 | 0x10 | ((space->machine().root_device().ioport(padnames[offset == 0x77])->read()>>shift_bit[hshake]) & 0xf);
883
883
                }
884
884
        }
885
885