Const-ified the return from cpu_get_address_space.

Fixed a few errors.
This commit is contained in:
Aaron Giles 2008-11-15 03:29:32 +00:00
parent 84f62ff4bf
commit fd5b836964
6 changed files with 50 additions and 45 deletions

View File

@ -234,7 +234,7 @@ OP_HANDLER( bra )
UINT8 t; UINT8 t;
IMMBYTE(t); IMMBYTE(t);
PC+=SIGNED(t); PC+=SIGNED(t);
CHANGE_PC(); CHANGE_PC(m68_state);
/* speed up busy loops */ /* speed up busy loops */
if (t==0xfe) EAT_CYCLES; if (t==0xfe) EAT_CYCLES;
} }
@ -402,7 +402,7 @@ OP_HANDLER( pulx )
OP_HANDLER( rts ) OP_HANDLER( rts )
{ {
PULLWORD(pPC); PULLWORD(pPC);
CHANGE_PC(); CHANGE_PC(m68_state);
} }
/* $3a ABX inherent ----- */ /* $3a ABX inherent ----- */
@ -419,7 +419,7 @@ OP_HANDLER( rti )
PULLBYTE(A); PULLBYTE(A);
PULLWORD(pX); PULLWORD(pX);
PULLWORD(pPC); PULLWORD(pPC);
CHANGE_PC(); CHANGE_PC(m68_state);
CHECK_IRQ_LINES(m68_state); /* HJB 990417 */ CHECK_IRQ_LINES(m68_state); /* HJB 990417 */
} }
@ -466,7 +466,7 @@ OP_HANDLER( swi )
PUSHBYTE(CC); PUSHBYTE(CC);
SEI; SEI;
PCD = RM16(0xfffa); PCD = RM16(0xfffa);
CHANGE_PC(); CHANGE_PC(m68_state);
} }
/* $40 NEGA inherent ?**** */ /* $40 NEGA inherent ?**** */
@ -797,7 +797,7 @@ OP_HANDLER( tst_ix )
/* $6e JMP indexed ----- */ /* $6e JMP indexed ----- */
OP_HANDLER( jmp_ix ) OP_HANDLER( jmp_ix )
{ {
INDEXED; PC=EA; CHANGE_PC(); INDEXED; PC=EA; CHANGE_PC(m68_state);
} }
/* $6f CLR indexed -0100 */ /* $6f CLR indexed -0100 */
@ -946,7 +946,7 @@ OP_HANDLER( tst_ex )
/* $7e JMP extended ----- */ /* $7e JMP extended ----- */
OP_HANDLER( jmp_ex ) OP_HANDLER( jmp_ex )
{ {
EXTENDED; PC=EA; CHANGE_PC(); /* TS 971002 */ EXTENDED; PC=EA; CHANGE_PC(m68_state); /* TS 971002 */
} }
/* $7f CLR extended -0100 */ /* $7f CLR extended -0100 */
@ -1091,7 +1091,7 @@ OP_HANDLER( bsr )
IMMBYTE(t); IMMBYTE(t);
PUSHWORD(pPC); PUSHWORD(pPC);
PC += SIGNED(t); PC += SIGNED(t);
CHANGE_PC(); /* TS 971002 */ CHANGE_PC(m68_state); /* TS 971002 */
} }
/* $8e LDS immediate -**0- */ /* $8e LDS immediate -**0- */
@ -1258,7 +1258,7 @@ OP_HANDLER( jsr_di )
DIRECT; DIRECT;
PUSHWORD(pPC); PUSHWORD(pPC);
PC = EA; PC = EA;
CHANGE_PC(); CHANGE_PC(m68_state);
} }
/* $9e LDS direct -**0- */ /* $9e LDS direct -**0- */
@ -1433,7 +1433,7 @@ OP_HANDLER( jsr_ix )
INDEXED; INDEXED;
PUSHWORD(pPC); PUSHWORD(pPC);
PC = EA; PC = EA;
CHANGE_PC(); CHANGE_PC(m68_state);
} }
/* $ae LDS indexed -**0- */ /* $ae LDS indexed -**0- */
@ -1610,7 +1610,7 @@ OP_HANDLER( jsr_ex )
EXTENDED; EXTENDED;
PUSHWORD(pPC); PUSHWORD(pPC);
PC = EA; PC = EA;
CHANGE_PC(); CHANGE_PC(m68_state);
} }
/* $be LDS extended -**0- */ /* $be LDS extended -**0- */

View File

@ -774,7 +774,7 @@ INLINE int cpu_get_index(const device_config *cpu)
the given CPU's address space the given CPU's address space
-------------------------------------------------*/ -------------------------------------------------*/
INLINE address_space *cpu_get_address_space(const device_config *cpu, int spacenum) INLINE const address_space *cpu_get_address_space(const device_config *cpu, int spacenum)
{ {
cpu_class_header *classheader = cpu->classtoken; cpu_class_header *classheader = cpu->classtoken;
return classheader->space[spacenum]; return classheader->space[spacenum];

View File

@ -71,77 +71,77 @@ static const UINT8 fixeight_cmd_snd[128] =
/*78*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /*78*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}; };
static void play_oki_sound(running_machine *machine, int game_sound, int data) static void play_oki_sound(const address_space *space, int game_sound, int data)
{ {
int status = okim6295_status_0_r(machine,0); int status = okim6295_status_0_r(space,0);
logerror("Playing sample %02x from command %02x\n",game_sound,data); logerror("Playing sample %02x from command %02x\n",game_sound,data);
if (game_sound != 0) if (game_sound != 0)
{ {
if ((status & 0x01) == 0) { if ((status & 0x01) == 0) {
okim6295_data_0_w(machine,0,(0x80 | game_sound)); okim6295_data_0_w(space,0,(0x80 | game_sound));
okim6295_data_0_w(machine,0,0x11); okim6295_data_0_w(space,0,0x11);
} }
else if ((status & 0x02) == 0) { else if ((status & 0x02) == 0) {
okim6295_data_0_w(machine,0,(0x80 | game_sound)); okim6295_data_0_w(space,0,(0x80 | game_sound));
okim6295_data_0_w(machine,0,0x21); okim6295_data_0_w(space,0,0x21);
} }
else if ((status & 0x04) == 0) { else if ((status & 0x04) == 0) {
okim6295_data_0_w(machine,0,(0x80 | game_sound)); okim6295_data_0_w(space,0,(0x80 | game_sound));
okim6295_data_0_w(machine,0,0x41); okim6295_data_0_w(space,0,0x41);
} }
else if ((status & 0x08) == 0) { else if ((status & 0x08) == 0) {
okim6295_data_0_w(machine,0,(0x80 | game_sound)); okim6295_data_0_w(space,0,(0x80 | game_sound));
okim6295_data_0_w(machine,0,0x81); okim6295_data_0_w(space,0,0x81);
} }
} }
} }
void dogyuun_okisnd_w(running_machine *machine, int data) void dogyuun_okisnd_w(const address_space *space, int data)
{ {
/* Need a board to determine the sound commands */ /* Need a board to determine the sound commands */
// popmessage("Writing %04x to Sound CPU",data); // popmessage("Writing %04x to Sound CPU",data);
} }
void kbash_okisnd_w(running_machine *machine, int data) void kbash_okisnd_w(const address_space *space, int data)
{ {
// popmessage("Writing %04x to Sound CPU",data); // popmessage("Writing %04x to Sound CPU",data);
if (data == 0) if (data == 0)
{ {
okim6295_data_0_w(machine,0,0x78); /* Stop playing effects */ okim6295_data_0_w(space,0,0x78); /* Stop playing effects */
} }
else if ((data > 0) && (data < 128)) else if ((data > 0) && (data < 128))
{ {
play_oki_sound(machine, kbash_cmd_snd[data], data); play_oki_sound(space, kbash_cmd_snd[data], data);
} }
} }
void fixeight_okisnd_w(running_machine *machine, int data) void fixeight_okisnd_w(const address_space *space, int data)
{ {
// popmessage("Writing %04x to Sound CPU",data); // popmessage("Writing %04x to Sound CPU",data);
if (data == 0) if (data == 0)
{ {
okim6295_data_0_w(machine,0,0x78); /* Stop playing effects */ okim6295_data_0_w(space,0,0x78); /* Stop playing effects */
} }
else if ((data > 0) && (data < 128)) else if ((data > 0) && (data < 128))
{ {
play_oki_sound(machine, fixeight_cmd_snd[data], data); play_oki_sound(space, fixeight_cmd_snd[data], data);
} }
} }
void batsugun_okisnd_w(running_machine *machine, int data) void batsugun_okisnd_w(const address_space *space, int data)
{ {
// popmessage("Writing %04x to Sound CPU",data); // popmessage("Writing %04x to Sound CPU",data);
if (data == 0) if (data == 0)
{ {
okim6295_data_0_w(machine,0,0x78); /* Stop playing effects */ okim6295_data_0_w(space,0,0x78); /* Stop playing effects */
} }
else if ((data > 0) && (data < 64)) else if ((data > 0) && (data < 64))
{ {
play_oki_sound(machine, batsugun_cmd_snd[data], data); play_oki_sound(space, batsugun_cmd_snd[data], data);
} }
} }

View File

@ -843,7 +843,7 @@ static WRITE16_HANDLER( dogyuun_snd_cpu_w )
if (ACCESSING_BITS_0_7) if (ACCESSING_BITS_0_7)
{ {
mcu_data = data; mcu_data = data;
dogyuun_okisnd_w(space->machine, data); dogyuun_okisnd_w(space, data);
} }
logerror("PC:%06x Writing command (%04x) to the NEC V25+ secondary CPU port\n",cpu_get_previouspc(space->cpu),mcu_data); logerror("PC:%06x Writing command (%04x) to the NEC V25+ secondary CPU port\n",cpu_get_previouspc(space->cpu),mcu_data);
} }
@ -862,7 +862,7 @@ static WRITE16_HANDLER( kbash_snd_cpu_w )
{ {
if (ACCESSING_BITS_0_7) if (ACCESSING_BITS_0_7)
{ {
kbash_okisnd_w(space->machine, data); kbash_okisnd_w(space, data);
} }
logerror("PC:%06x Writing Sound command (%04x) to the NEC V25+ secondary CPU\n",cpu_get_previouspc(space->cpu),data); logerror("PC:%06x Writing Sound command (%04x) to the NEC V25+ secondary CPU\n",cpu_get_previouspc(space->cpu),data);
} }
@ -899,7 +899,7 @@ static WRITE16_HANDLER( fixeight_sec_cpu_w )
if (mcu_data & 0xff00) if (mcu_data & 0xff00)
{ {
mcu_data = (mcu_data & 0xff00) | (data & 0xff); mcu_data = (mcu_data & 0xff00) | (data & 0xff);
fixeight_okisnd_w(space->machine, data); fixeight_okisnd_w(space, data);
} }
else if (mcu_data == 0xff00) else if (mcu_data == 0xff00)
{ {
@ -943,7 +943,7 @@ static WRITE16_HANDLER( batsugun_snd_cpu_w )
if (ACCESSING_BITS_0_7) if (ACCESSING_BITS_0_7)
{ {
mcu_data = data; mcu_data = data;
batsugun_okisnd_w(space->machine, data); batsugun_okisnd_w(space, data);
} }
logerror("PC:%06x Writing command (%04x) to the NEC V25+ secondary CPU port %02x\n",cpu_get_previouspc(space->cpu),mcu_data,(offset*2)); logerror("PC:%06x Writing command (%04x) to the NEC V25+ secondary CPU port %02x\n",cpu_get_previouspc(space->cpu),mcu_data,(offset*2));
} }

View File

@ -1,9 +1,9 @@
/*----------- defined in audio/toaplan2.c -----------*/ /*----------- defined in audio/toaplan2.c -----------*/
void dogyuun_okisnd_w(running_machine *machine, int data); void dogyuun_okisnd_w(const address_space *space, int data);
void kbash_okisnd_w(running_machine *machine, int data); void kbash_okisnd_w(const address_space *space, int data);
void fixeight_okisnd_w(running_machine *machine, int data); void fixeight_okisnd_w(const address_space *space, int data);
void batsugun_okisnd_w(running_machine *machine, int data); void batsugun_okisnd_w(const address_space *space, int data);
/*----------- defined in drivers/toaplan2.c -----------*/ /*----------- defined in drivers/toaplan2.c -----------*/

View File

@ -318,12 +318,14 @@ static void toaplan1_set_scrolls(void)
static STATE_POSTLOAD( rallybik_flipscreen ) static STATE_POSTLOAD( rallybik_flipscreen )
{ {
rallybik_bcu_flipscreen_w(machine, 0, bcu_flipscreen, 0xffff); const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
rallybik_bcu_flipscreen_w(space, 0, bcu_flipscreen, 0xffff);
} }
static STATE_POSTLOAD( toaplan1_flipscreen ) static STATE_POSTLOAD( toaplan1_flipscreen )
{ {
toaplan1_bcu_flipscreen_w(machine, 0, bcu_flipscreen, 0xffff); const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
toaplan1_bcu_flipscreen_w(space, 0, bcu_flipscreen, 0xffff);
} }
@ -599,7 +601,7 @@ WRITE16_HANDLER( toaplan1_bcu_control_w )
if (toaplan1_unk_reset_port && toaplan1_reset) if (toaplan1_unk_reset_port && toaplan1_reset)
{ {
toaplan1_reset = 0; toaplan1_reset = 0;
toaplan1_reset_sound(space->machine,0,0,0); toaplan1_reset_sound(space,0,0,0);
} }
} }
@ -1229,18 +1231,21 @@ VIDEO_UPDATE( demonwld )
VIDEO_EOF( rallybik ) VIDEO_EOF( rallybik )
{ {
buffer_spriteram16_w(machine, 0, 0, 0xffff); const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
buffer_spriteram16_w(space, 0, 0, 0xffff);
} }
VIDEO_EOF( toaplan1 ) VIDEO_EOF( toaplan1 )
{ {
buffer_spriteram16_w(machine, 0, 0, 0xffff); const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
buffer_spriteram16_w(space, 0, 0, 0xffff);
memcpy(toaplan1_buffered_spritesizeram16, toaplan1_spritesizeram16, TOAPLAN1_SPRITESIZERAM_SIZE); memcpy(toaplan1_buffered_spritesizeram16, toaplan1_spritesizeram16, TOAPLAN1_SPRITESIZERAM_SIZE);
} }
VIDEO_EOF( samesame ) VIDEO_EOF( samesame )
{ {
buffer_spriteram16_w(machine, 0, 0, 0xffff); const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
buffer_spriteram16_w(space, 0, 0, 0xffff);
memcpy(toaplan1_buffered_spritesizeram16, toaplan1_spritesizeram16, TOAPLAN1_SPRITESIZERAM_SIZE); memcpy(toaplan1_buffered_spritesizeram16, toaplan1_spritesizeram16, TOAPLAN1_SPRITESIZERAM_SIZE);
cpu_set_input_line(machine->cpu[0], MC68000_IRQ_2, HOLD_LINE); /* Frame done */ cpu_set_input_line(machine->cpu[0], MC68000_IRQ_2, HOLD_LINE); /* Frame done */
} }