本文整理汇总了C++中address_space::machine方法的典型用法代码示例。如果您正苦于以下问题:C++ address_space::machine方法的具体用法?C++ address_space::machine怎么用?C++ address_space::machine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类address_space
的用法示例。
在下文中一共展示了address_space::machine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void tms34061_device::write(address_space &space, int col, int row, int func, UINT8 data)
{
offs_t offs;
/* the function code determines what to do */
switch (func)
{
/* both 0 and 2 map to register access */
case 0:
case 2:
register_w(space, col, data);
break;
/* function 1 maps to XY access; col is the address adjustment */
case 1:
xypixel_w(space, col, data);
break;
/* function 3 maps to direct access */
case 3:
offs = ((row << m_rowshift) | col) & m_vrammask;
if (m_regs[TMS34061_CONTROL2] & 0x0040)
offs |= (m_regs[TMS34061_CONTROL2] & 3) << 16;
if (VERBOSE) logerror("%s:tms34061 direct (%04x) = %02x/%02x\n", space.machine().describe_context(), offs, data, m_latchdata);
if (m_vram[offs] != data || m_latchram[offs] != m_latchdata)
{
m_vram[offs] = data;
m_latchram[offs] = m_latchdata;
}
break;
/* function 4 performs a shift reg transfer to VRAM */
case 4:
offs = col << m_rowshift;
if (m_regs[TMS34061_CONTROL2] & 0x0040)
offs |= (m_regs[TMS34061_CONTROL2] & 3) << 16;
offs &= m_vrammask;
if (VERBOSE) logerror("%s:tms34061 shiftreg write (%04x)\n", space.machine().describe_context(), offs);
memcpy(&m_vram[offs], m_shiftreg, (size_t)1 << m_rowshift);
memset(&m_latchram[offs], m_latchdata, (size_t)1 << m_rowshift);
break;
/* function 5 performs a shift reg transfer from VRAM */
case 5:
offs = col << m_rowshift;
if (m_regs[TMS34061_CONTROL2] & 0x0040)
offs |= (m_regs[TMS34061_CONTROL2] & 3) << 16;
offs &= m_vrammask;
if (VERBOSE) logerror("%s:tms34061 shiftreg read (%04x)\n", space.machine().describe_context(), offs);
m_shiftreg = &m_vram[offs];
break;
/* log anything else */
default:
logerror("%s:Unsupported TMS34061 function %d\n", space.machine().describe_context(), func);
break;
}
}
示例2:
INLINE UINT16 galpani2_bg8_regs_r(address_space &space, offs_t offset, int n)
{
galpani2_state *state = space.machine().driver_data<galpani2_state>();
switch (offset * 2)
{
case 0x16: return space.machine().rand() & 1;
default:
logerror("CPU #0 PC %06X : Warning, bg8 #%d screen reg %04X read\n",space.cpu->safe_pc(),_n_,offset*2);
}
return state->m_bg8_regs[_n_][offset];
}
示例3: dragrace_update_misc_flags
static void dragrace_update_misc_flags( address_space &space )
{
dragrace_state *state = space.machine().driver_data<dragrace_state>();
/* 0x0900 = set 3SPEED1 0x00000001
* 0x0901 = set 4SPEED1 0x00000002
* 0x0902 = set 5SPEED1 0x00000004
* 0x0903 = set 6SPEED1 0x00000008
* 0x0904 = set 7SPEED1 0x00000010
* 0x0905 = set EXPLOSION1 0x00000020
* 0x0906 = set SCREECH1 0x00000040
* 0x0920 - 0x0927 = clear 0x0900 - 0x0907
* 0x0909 = set KLEXPL1 0x00000200
* 0x090b = set MOTOR1 0x00000800
* 0x090c = set ATTRACT 0x00001000
* 0x090d = set LOTONE 0x00002000
* 0x090f = set Player 1 Start Lamp 0x00008000
* 0x0928 - 0x092f = clear 0x0908 - 0x090f
* 0x0910 = set 3SPEED2 0x00010000
* 0x0911 = set 4SPEED2 0x00020000
* 0x0912 = set 5SPEED2 0x00040000
* 0x0913 = set 6SPEED2 0x00080000
* 0x0914 = set 7SPEED2 0x00100000
* 0x0915 = set EXPLOSION2 0x00200000
* 0x0916 = set SCREECH2 0x00400000
* 0x0930 = clear 0x0910 - 0x0917
* 0x0919 = set KLEXPL2 0x02000000
* 0x091b = set MOTOR2 0x08000000
* 0x091d = set HITONE 0x20000000
* 0x091f = set Player 2 Start Lamp 0x80000000
* 0x0938 = clear 0x0918 - 0x091f
*/
set_led_status(space.machine(), 0, state->m_misc_flags & 0x00008000);
set_led_status(space.machine(), 1, state->m_misc_flags & 0x80000000);
discrete_sound_w(state->m_discrete, space, DRAGRACE_MOTOR1_DATA, ~state->m_misc_flags & 0x0000001f); // Speed1 data*
discrete_sound_w(state->m_discrete, space, DRAGRACE_EXPLODE1_EN, (state->m_misc_flags & 0x00000020) ? 1: 0); // Explosion1 enable
discrete_sound_w(state->m_discrete, space, DRAGRACE_SCREECH1_EN, (state->m_misc_flags & 0x00000040) ? 1: 0); // Screech1 enable
discrete_sound_w(state->m_discrete, space, DRAGRACE_KLEXPL1_EN, (state->m_misc_flags & 0x00000200) ? 1: 0); // KLEXPL1 enable
discrete_sound_w(state->m_discrete, space, DRAGRACE_MOTOR1_EN, (state->m_misc_flags & 0x00000800) ? 1: 0); // Motor1 enable
discrete_sound_w(state->m_discrete, space, DRAGRACE_MOTOR2_DATA, (~state->m_misc_flags & 0x001f0000) >> 0x10); // Speed2 data*
discrete_sound_w(state->m_discrete, space, DRAGRACE_EXPLODE2_EN, (state->m_misc_flags & 0x00200000) ? 1: 0); // Explosion2 enable
discrete_sound_w(state->m_discrete, space, DRAGRACE_SCREECH2_EN, (state->m_misc_flags & 0x00400000) ? 1: 0); // Screech2 enable
discrete_sound_w(state->m_discrete, space, DRAGRACE_KLEXPL2_EN, (state->m_misc_flags & 0x02000000) ? 1: 0); // KLEXPL2 enable
discrete_sound_w(state->m_discrete, space, DRAGRACE_MOTOR2_EN, (state->m_misc_flags & 0x08000000) ? 1: 0); // Motor2 enable
discrete_sound_w(state->m_discrete, space, DRAGRACE_ATTRACT_EN, (state->m_misc_flags & 0x00001000) ? 1: 0); // Attract enable
discrete_sound_w(state->m_discrete, space, DRAGRACE_LOTONE_EN, (state->m_misc_flags & 0x00002000) ? 1: 0); // LoTone enable
discrete_sound_w(state->m_discrete, space, DRAGRACE_HITONE_EN, (state->m_misc_flags & 0x20000000) ? 1: 0); // HiTone enable
}
示例4: if
static UINT8 srtc_read( address_space &space, UINT16 addr )
{
addr &= 0xffff;
if (addr == 0x2800)
{
if (rtc_state.mode != RTCM_Read)
{
return 0x00;
}
if (rtc_state.index < 0)
{
srtc_update_time(space.machine());
rtc_state.index++;
return 0x0f;
}
else if (rtc_state.index > 12)
{
rtc_state.index = -1;
return 0x0f;
}
else
{
return rtc_state.ram[rtc_state.index++];
}
}
return snes_open_bus_r(space, 0);
}
示例5: artmagic_from_shiftreg
void artmagic_from_shiftreg(address_space &space, offs_t address, UINT16 *data)
{
artmagic_state *state = space.machine().driver_data<artmagic_state>();
UINT16 *vram = address_to_vram(state, &address);
if (vram)
memcpy(&vram[address], data, TOBYTE(0x2000));
}
示例6:
/* read status port */
static int I8741_status_r(address_space &space, int num)
{
I8741 *st = &taito8741[num];
taito8741_update(space, num);
LOG(("%s:8741-%d ST Read %02x\n",space.machine().describe_context(),num,st->status));
return st->status;
}
示例7:
static UINT16 exterm_trackball_port_r(address_space &space, int which, UINT16 mem_mask)
{
exterm_state *state = space.machine().driver_data<exterm_state>();
UINT16 port;
/* Read the fake input port */
UINT8 trackball_pos = state->ioport(which ? "DIAL1" : "DIAL0")->read();
/* Calculate the change from the last position. */
UINT8 trackball_diff = state->m_trackball_old[which] - trackball_pos;
/* Store the new position for the next comparision. */
state->m_trackball_old[which] = trackball_pos;
/* Move the sign bit to the high bit of the 6-bit trackball count. */
if (trackball_diff & 0x80)
trackball_diff |= 0x20;
/* Keep adding the changes. The counters will be reset later by a hardware write. */
state->m_aimpos[which] = (state->m_aimpos[which] + trackball_diff) & 0x3f;
/* Combine it with the standard input bits */
port = state->ioport(which ? "P2" : "P1")->read();
return (port & 0xc0ff) | (state->m_aimpos[which] << 8);
}
示例8: console_write
static void console_write(address_space &space, UINT8 data)
{
dac_device *dac = space.machine().device<dac_device>("dac");
if (data & 0x08)
dac->write_unsigned8((UINT8)-120);
else
dac->write_unsigned8(+120);
}
示例9: io_rw
/* Read/Write common */
void psion_state::io_rw(address_space &space, UINT16 offset)
{
if (space.debugger_access())
return;
switch (offset & 0xffc0)
{
case 0xc0:
/* switch off, CPU goes into standby mode */
m_enable_nmi = 0;
m_stby_pwr = 1;
space.machine().device<cpu_device>("maincpu")->suspend(SUSPEND_REASON_HALT, 1);
break;
case 0x100:
m_pulse = 1;
break;
case 0x140:
m_pulse = 0;
break;
case 0x200:
m_kb_counter = 0;
break;
case 0x180:
beep_set_state(m_beep, 1);
break;
case 0x1c0:
beep_set_state(m_beep, 0);
break;
case 0x240:
if (offset == 0x260 && (m_rom_bank_count || m_ram_bank_count))
{
m_ram_bank=0;
m_rom_bank=0;
update_banks(machine());
}
else
m_kb_counter++;
break;
case 0x280:
if (offset == 0x2a0 && m_ram_bank_count)
{
m_ram_bank++;
update_banks(machine());
}
else
m_enable_nmi = 1;
break;
case 0x2c0:
if (offset == 0x2e0 && m_rom_bank_count)
{
m_rom_bank++;
update_banks(machine());
}
else
m_enable_nmi = 0;
break;
}
}
示例10: leland_video_addr_w
static void leland_video_addr_w(address_space &space, int offset, int data, int num)
{
leland_state *drvstate = space.machine().driver_data<leland_state>();
struct vram_state_data *state = drvstate->m_vram_state + num;
if (!offset)
state->m_addr = (state->m_addr & 0xfe00) | ((data << 1) & 0x01fe);
else
state->m_addr = ((data << 9) & 0xfe00) | (state->m_addr & 0x01fe);
}
示例11: log_protection
static void log_protection( address_space &space, const char *warning )
{
quizpun2_state *state = space.machine().driver_data<quizpun2_state>();
struct prot_t &prot = state->m_prot;
logerror("%04x: protection - %s (state %x, wait %x, param %02x, cmd %02x, addr %02x)\n", space.device().safe_pc(), warning,
prot.state,
prot.wait_param,
prot.param,
prot.cmd,
prot.addr
);
}
示例12: amerdart_trackball_direction
static int amerdart_trackball_direction(address_space &space, int num, int data)
{
coolpool_state *state = space.machine().driver_data<coolpool_state>();
UINT16 result_x = (data & 0x0c) >> 2;
UINT16 result_y = (data & 0x03) >> 0;
if ((state->m_dx[num] == 0) && (state->m_dy[num] < 0)) { /* Up */
state->m_oldy[num]--;
result_x = amerdart_trackball_inc(result_x);
result_y = amerdart_trackball_inc(result_y);
}
if ((state->m_dx[num] == 0) && (state->m_dy[num] > 0)) { /* Down */
state->m_oldy[num]++;
result_x = amerdart_trackball_dec(result_x);
result_y = amerdart_trackball_dec(result_y);
}
if ((state->m_dx[num] < 0) && (state->m_dy[num] == 0)) { /* Left */
state->m_oldx[num]--;
result_x = amerdart_trackball_inc(result_x);
result_y = amerdart_trackball_dec(result_y);
}
if ((state->m_dx[num] > 0) && (state->m_dy[num] == 0)) { /* Right */
state->m_oldx[num]++;
result_x = amerdart_trackball_dec(result_x);
result_y = amerdart_trackball_inc(result_y);
}
if ((state->m_dx[num] < 0) && (state->m_dy[num] < 0)) { /* Left & Up */
state->m_oldx[num]--;
state->m_oldy[num]--;
result_x = amerdart_trackball_inc(result_x);
}
if ((state->m_dx[num] < 0) && (state->m_dy[num] > 0)) { /* Left & Down */
state->m_oldx[num]--;
state->m_oldy[num]++;
result_y = amerdart_trackball_dec(result_y);
}
if ((state->m_dx[num] > 0) && (state->m_dy[num] < 0)) { /* Right & Up */
state->m_oldx[num]++;
state->m_oldy[num]--;
result_y = amerdart_trackball_inc(result_y);
}
if ((state->m_dx[num] > 0) && (state->m_dy[num] > 0)) { /* Right & Down */
state->m_oldx[num]++;
state->m_oldy[num]++;
result_x = amerdart_trackball_dec(result_x);
}
data = ((result_x << 2) & 0x0c) | ((result_y << 0) & 0x03);
return data;
}
示例13: esb_slapstic_tweak
static void esb_slapstic_tweak(address_space &space, offs_t offset)
{
starwars_state *state = space.machine().driver_data<starwars_state>();
int new_bank = slapstic_tweak(space, offset);
/* update for the new bank */
if (new_bank != state->m_slapstic_current_bank)
{
state->m_slapstic_current_bank = new_bank;
memcpy(state->m_slapstic_base, &state->m_slapstic_source[state->m_slapstic_current_bank * 0x2000], 0x2000);
}
}
示例14:
inline void ti8x_update_bank(address_space &space, UINT8 bank, UINT8 *base, UINT8 page, bool is_ram)
{
ti85_state *state = space.machine().driver_data<ti85_state>();
static const char *const tag[] = {"bank1", "bank2", "bank3", "bank4"};
state->membank(tag[bank&3])->set_base(base + (0x4000 * page));
if (is_ram)
space.install_write_bank(bank * 0x4000, bank * 0x4000 + 0x3fff, tag[bank&3]);
else
space.nop_write(bank * 0x4000, bank * 0x4000 + 0x3fff);
}
示例15: if
static UINT32 pm_io(address_space &space, int reg, int write, UINT32 d)
{
mdsvp_state *state = space.machine().driver_data<mdsvp_state>();
if (state->m_emu_status & SSP_PMC_SET)
{
state->m_pmac_read[write ? reg + 6 : reg] = state->m_pmc.d;
state->m_emu_status &= ~SSP_PMC_SET;
return 0;
}
// just in case
if (state->m_emu_status & SSP_PMC_HAVE_ADDR) {
state->m_emu_status &= ~SSP_PMC_HAVE_ADDR;
}
if (reg == 4 || (space.device().state().state_int(SSP_ST) & 0x60))
{
#define CADDR ((((mode<<16)&0x7f0000)|addr)<<1)
UINT16 *dram = (UINT16 *)state->m_dram;
if (write)
{
int mode = state->m_pmac_write[reg]>>16;
int addr = state->m_pmac_write[reg]&0xffff;
if ((mode & 0x43ff) == 0x0018) // DRAM
{
int inc = get_inc(mode);
if (mode & 0x0400) {
overwrite_write(&dram[addr], d);
} else dram[addr] = d;
state->m_pmac_write[reg] += inc;
}
else if ((mode & 0xfbff) == 0x4018) // DRAM, cell inc
{
if (mode & 0x0400) {
overwrite_write(&dram[addr], d);
} else dram[addr] = d;
state->m_pmac_write[reg] += (addr&1) ? 31 : 1;
}
else if ((mode & 0x47ff) == 0x001c) // IRAM
{
int inc = get_inc(mode);
((UINT16 *)state->m_iram)[addr&0x3ff] = d;
state->m_pmac_write[reg] += inc;
}
else
{
logerror("ssp FIXME: PM%i unhandled write mode %04x, [%06x] %04x\n",
reg, mode, CADDR, d);
}
}
else
{