mirror of
https://github.com/holub/mame
synced 2025-05-22 21:58:57 +03:00
added m6809 config option to control where opcodes 10 and 11 fetch the second byte.
The disassembler needs to respect the setting too but I don't know how to inform it.
This commit is contained in:
parent
c675126853
commit
6aabfb37cb
@ -374,6 +374,8 @@ CPU_DISASSEMBLE( m6809 )
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
opcode = oprom[p++];
|
opcode = oprom[p++];
|
||||||
|
// FIXME if (m68_state->config->encrypt_only_first_byte) we should to this
|
||||||
|
// opcode = page == 0 ? oprom[p++] : opram[p++];
|
||||||
for (i = 0; i < m6809_numops[page]; i++)
|
for (i = 0; i < m6809_numops[page]; i++)
|
||||||
if (m6809_pgpointers[page][i].opcode == opcode)
|
if (m6809_pgpointers[page][i].opcode == opcode)
|
||||||
break;
|
break;
|
||||||
|
@ -12,7 +12,7 @@ HNZVC
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define OP_HANDLER(_name) INLINE void _name (m68_state_t *m68_state)
|
#define OP_HANDLER(_name) INLINE void _name (m68_state_t *m68_state)
|
||||||
|
|
||||||
#ifdef NEW
|
#ifdef NEW
|
||||||
static void illegal )
|
static void illegal )
|
||||||
@ -2913,7 +2913,7 @@ OP_HANDLER( sts_ex )
|
|||||||
/* $10xx opcodes */
|
/* $10xx opcodes */
|
||||||
OP_HANDLER( pref10 )
|
OP_HANDLER( pref10 )
|
||||||
{
|
{
|
||||||
UINT8 ireg2 = ROP(PCD);
|
UINT8 ireg2 = m68_state->config->encrypt_only_first_byte ? ROP_ARG(PCD) : ROP(PCD);
|
||||||
PC++;
|
PC++;
|
||||||
switch( ireg2 )
|
switch( ireg2 )
|
||||||
{
|
{
|
||||||
@ -2974,7 +2974,7 @@ OP_HANDLER( pref10 )
|
|||||||
/* $11xx opcodes */
|
/* $11xx opcodes */
|
||||||
OP_HANDLER( pref11 )
|
OP_HANDLER( pref11 )
|
||||||
{
|
{
|
||||||
UINT8 ireg2 = ROP(PCD);
|
UINT8 ireg2 = m68_state->config->encrypt_only_first_byte ? ROP_ARG(PCD) : ROP(PCD);
|
||||||
PC++;
|
PC++;
|
||||||
switch( ireg2 )
|
switch( ireg2 )
|
||||||
{
|
{
|
||||||
|
@ -98,6 +98,7 @@ struct _m68_state_t
|
|||||||
int extra_cycles; /* cycles used up by interrupts */
|
int extra_cycles; /* cycles used up by interrupts */
|
||||||
cpu_irq_callback irq_callback;
|
cpu_irq_callback irq_callback;
|
||||||
const device_config *device;
|
const device_config *device;
|
||||||
|
const m6809_config *config;
|
||||||
UINT8 int_state; /* SYNC and CWAI flags */
|
UINT8 int_state; /* SYNC and CWAI flags */
|
||||||
UINT8 nmi_state;
|
UINT8 nmi_state;
|
||||||
};
|
};
|
||||||
@ -279,57 +280,57 @@ static void UpdateState(m68_state_t *m68_state)
|
|||||||
|
|
||||||
static void CHECK_IRQ_LINES(m68_state_t *m68_state)
|
static void CHECK_IRQ_LINES(m68_state_t *m68_state)
|
||||||
{
|
{
|
||||||
if( m68_state->irq_state[M6809_IRQ_LINE] != CLEAR_LINE ||
|
if( m68_state->irq_state[M6809_IRQ_LINE] != CLEAR_LINE ||
|
||||||
m68_state->irq_state[M6809_FIRQ_LINE] != CLEAR_LINE )
|
m68_state->irq_state[M6809_FIRQ_LINE] != CLEAR_LINE )
|
||||||
m68_state->int_state &= ~M6809_SYNC; /* clear SYNC flag */
|
m68_state->int_state &= ~M6809_SYNC; /* clear SYNC flag */
|
||||||
if( m68_state->irq_state[M6809_FIRQ_LINE]!=CLEAR_LINE && !(CC & CC_IF) )
|
if( m68_state->irq_state[M6809_FIRQ_LINE]!=CLEAR_LINE && !(CC & CC_IF) )
|
||||||
{
|
{
|
||||||
/* fast IRQ */
|
/* fast IRQ */
|
||||||
/* HJB 990225: state already saved by CWAI? */
|
/* HJB 990225: state already saved by CWAI? */
|
||||||
if( m68_state->int_state & M6809_CWAI )
|
if( m68_state->int_state & M6809_CWAI )
|
||||||
{
|
{
|
||||||
m68_state->int_state &= ~M6809_CWAI; /* clear CWAI */
|
m68_state->int_state &= ~M6809_CWAI; /* clear CWAI */
|
||||||
m68_state->extra_cycles += 7; /* subtract +7 cycles */
|
m68_state->extra_cycles += 7; /* subtract +7 cycles */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC &= ~CC_E; /* save 'short' state */
|
CC &= ~CC_E; /* save 'short' state */
|
||||||
PUSHWORD(pPC);
|
PUSHWORD(pPC);
|
||||||
PUSHBYTE(CC);
|
PUSHBYTE(CC);
|
||||||
m68_state->extra_cycles += 10; /* subtract +10 cycles */
|
m68_state->extra_cycles += 10; /* subtract +10 cycles */
|
||||||
}
|
}
|
||||||
CC |= CC_IF | CC_II; /* inhibit FIRQ and IRQ */
|
CC |= CC_IF | CC_II; /* inhibit FIRQ and IRQ */
|
||||||
PCD=RM16(0xfff6);
|
PCD=RM16(0xfff6);
|
||||||
CHANGE_PC;
|
CHANGE_PC;
|
||||||
(void)(*m68_state->irq_callback)(m68_state->device, M6809_FIRQ_LINE);
|
(void)(*m68_state->irq_callback)(m68_state->device, M6809_FIRQ_LINE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( m68_state->irq_state[M6809_IRQ_LINE]!=CLEAR_LINE && !(CC & CC_II) )
|
if( m68_state->irq_state[M6809_IRQ_LINE]!=CLEAR_LINE && !(CC & CC_II) )
|
||||||
{
|
{
|
||||||
/* standard IRQ */
|
/* standard IRQ */
|
||||||
/* HJB 990225: state already saved by CWAI? */
|
/* HJB 990225: state already saved by CWAI? */
|
||||||
if( m68_state->int_state & M6809_CWAI )
|
if( m68_state->int_state & M6809_CWAI )
|
||||||
{
|
{
|
||||||
m68_state->int_state &= ~M6809_CWAI; /* clear CWAI flag */
|
m68_state->int_state &= ~M6809_CWAI; /* clear CWAI flag */
|
||||||
m68_state->extra_cycles += 7; /* subtract +7 cycles */
|
m68_state->extra_cycles += 7; /* subtract +7 cycles */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC |= CC_E; /* save entire state */
|
CC |= CC_E; /* save entire state */
|
||||||
PUSHWORD(pPC);
|
PUSHWORD(pPC);
|
||||||
PUSHWORD(pU);
|
PUSHWORD(pU);
|
||||||
PUSHWORD(pY);
|
PUSHWORD(pY);
|
||||||
PUSHWORD(pX);
|
PUSHWORD(pX);
|
||||||
PUSHBYTE(DP);
|
PUSHBYTE(DP);
|
||||||
PUSHBYTE(B);
|
PUSHBYTE(B);
|
||||||
PUSHBYTE(A);
|
PUSHBYTE(A);
|
||||||
PUSHBYTE(CC);
|
PUSHBYTE(CC);
|
||||||
m68_state->extra_cycles += 19; /* subtract +19 cycles */
|
m68_state->extra_cycles += 19; /* subtract +19 cycles */
|
||||||
}
|
}
|
||||||
CC |= CC_II; /* inhibit IRQ */
|
CC |= CC_II; /* inhibit IRQ */
|
||||||
PCD=RM16(0xfff8);
|
PCD=RM16(0xfff8);
|
||||||
CHANGE_PC;
|
CHANGE_PC;
|
||||||
(void)(*m68_state->irq_callback)(m68_state->device, M6809_IRQ_LINE);
|
(void)(*m68_state->irq_callback)(m68_state->device, M6809_IRQ_LINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,8 +363,16 @@ static CPU_SET_CONTEXT( m6809 )
|
|||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
static CPU_INIT( m6809 )
|
static CPU_INIT( m6809 )
|
||||||
{
|
{
|
||||||
|
/* default configuration */
|
||||||
|
static const m6809_config default_config =
|
||||||
|
{
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
const m6809_config *configdata = device->static_config ? device->static_config : &default_config;
|
||||||
m68_state_t *m68_state = device->token;
|
m68_state_t *m68_state = device->token;
|
||||||
|
|
||||||
|
m68_state->config = configdata;
|
||||||
m68_state->irq_callback = irqcallback;
|
m68_state->irq_callback = irqcallback;
|
||||||
m68_state->device = device;
|
m68_state->device = device;
|
||||||
|
|
||||||
@ -388,7 +397,7 @@ static CPU_INIT( m6809 )
|
|||||||
static CPU_RESET( m6809 )
|
static CPU_RESET( m6809 )
|
||||||
{
|
{
|
||||||
m68_state_t *m68_state = device->token;
|
m68_state_t *m68_state = device->token;
|
||||||
|
|
||||||
m68_state->int_state = 0;
|
m68_state->int_state = 0;
|
||||||
m68_state->nmi_state = CLEAR_LINE;
|
m68_state->nmi_state = CLEAR_LINE;
|
||||||
m68_state->irq_state[0] = CLEAR_LINE;
|
m68_state->irq_state[0] = CLEAR_LINE;
|
||||||
@ -467,7 +476,7 @@ static void set_irq_line(m68_state_t *m68_state, int irqline, int state)
|
|||||||
static CPU_EXECUTE( m6809 ) /* NS 970908 */
|
static CPU_EXECUTE( m6809 ) /* NS 970908 */
|
||||||
{
|
{
|
||||||
m68_state_t *m68_state = device->token;
|
m68_state_t *m68_state = device->token;
|
||||||
|
|
||||||
m68_icount = cycles - m68_state->extra_cycles;
|
m68_icount = cycles - m68_state->extra_cycles;
|
||||||
m68_state->extra_cycles = 0;
|
m68_state->extra_cycles = 0;
|
||||||
|
|
||||||
@ -1050,7 +1059,7 @@ INLINE void fetch_effective_address( m68_state_t *m68_state )
|
|||||||
static CPU_SET_INFO( m6809 )
|
static CPU_SET_INFO( m6809 )
|
||||||
{
|
{
|
||||||
m68_state_t *m68_state = device->token;
|
m68_state_t *m68_state = device->token;
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
/* --- the following bits of info are set as 64-bit signed integers --- */
|
/* --- the following bits of info are set as 64-bit signed integers --- */
|
||||||
@ -1081,7 +1090,7 @@ static CPU_SET_INFO( m6809 )
|
|||||||
CPU_GET_INFO( m6809 )
|
CPU_GET_INFO( m6809 )
|
||||||
{
|
{
|
||||||
m68_state_t *m68_state = (device != NULL) ? device->token : NULL;
|
m68_state_t *m68_state = (device != NULL) ? device->token : NULL;
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
/* --- the following bits of info are returned as 64-bit signed integers --- */
|
/* --- the following bits of info are returned as 64-bit signed integers --- */
|
||||||
|
@ -53,4 +53,11 @@ CPU_GET_INFO( m6809e );
|
|||||||
|
|
||||||
CPU_DISASSEMBLE( m6809 );
|
CPU_DISASSEMBLE( m6809 );
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _m6809_config m6809_config;
|
||||||
|
struct _m6809_config
|
||||||
|
{
|
||||||
|
UINT8 encrypt_only_first_byte; /* encrypt only the first byte in 10 xx and 11 xx opcodes */
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* __M6809_H__ */
|
#endif /* __M6809_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user