mirror of
https://github.com/pevans/erc-c.git
synced 2024-12-24 12:29:48 +00:00
Add function to return true if an instruction would write to memory
This commit is contained in:
parent
37f9e627ba
commit
c53c7bfd1d
@ -166,6 +166,7 @@ typedef vm_8bit (*mos6502_address_resolver)(mos6502 *);
|
||||
typedef void (*mos6502_instruction_handler)(mos6502 *, vm_8bit);
|
||||
|
||||
extern bool mos6502_would_jump(int);
|
||||
extern bool mos6502_would_write_mem(int);
|
||||
extern int mos6502_cycles(mos6502 *, vm_8bit);
|
||||
extern int mos6502_instruction(vm_8bit);
|
||||
extern mos6502 *mos6502_create(vm_segment *, vm_segment *);
|
||||
|
@ -404,6 +404,22 @@ mos6502_would_jump(int inst_code)
|
||||
inst_code == RTI;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return true if the given instruction _might_ write to memory, if used
|
||||
* with an appropriate address mode (e.g. anything other than ACC).
|
||||
*/
|
||||
inline bool
|
||||
mos6502_would_write_mem(int inst_code)
|
||||
{
|
||||
return
|
||||
inst_code == ASL ||
|
||||
inst_code == DEC ||
|
||||
inst_code == INC ||
|
||||
inst_code == LSR ||
|
||||
inst_code == ROL ||
|
||||
inst_code == ROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a _kind_ of factory method, except we're obviously not
|
||||
* instantiating an object. Given an address mode, we return the
|
||||
|
Loading…
Reference in New Issue
Block a user