2017-12-02 19:05:53 +00:00
|
|
|
/*
|
|
|
|
* mos6502.stat.c
|
2017-12-09 04:12:31 +00:00
|
|
|
*
|
|
|
|
* The "stat", here, is short for status; these instructions all
|
|
|
|
* directly modify the status (P) register.
|
2017-12-02 19:05:53 +00:00
|
|
|
*/
|
|
|
|
|
2018-04-07 05:26:31 +00:00
|
|
|
#include "mos6502/mos6502.h"
|
|
|
|
#include "mos6502/enums.h"
|
2017-12-02 19:05:53 +00:00
|
|
|
|
2017-12-07 00:01:13 +00:00
|
|
|
/*
|
|
|
|
* Clear the carry bit in the status register.
|
|
|
|
*/
|
2017-12-02 19:05:53 +00:00
|
|
|
DEFINE_INST(clc)
|
|
|
|
{
|
2018-01-05 20:18:39 +00:00
|
|
|
cpu->P &= ~MOS_CARRY;
|
2017-12-02 19:05:53 +00:00
|
|
|
}
|
|
|
|
|
2017-12-07 00:01:13 +00:00
|
|
|
/*
|
|
|
|
* Clear the decimal bit.
|
|
|
|
*/
|
2017-12-02 19:05:53 +00:00
|
|
|
DEFINE_INST(cld)
|
|
|
|
{
|
2018-01-05 20:18:39 +00:00
|
|
|
cpu->P &= ~MOS_DECIMAL;
|
2017-12-02 19:05:53 +00:00
|
|
|
}
|
|
|
|
|
2017-12-07 00:01:13 +00:00
|
|
|
/*
|
|
|
|
* Clear the interrupt bit.
|
|
|
|
*/
|
2017-12-02 19:05:53 +00:00
|
|
|
DEFINE_INST(cli)
|
|
|
|
{
|
2018-01-05 20:18:39 +00:00
|
|
|
cpu->P &= ~MOS_INTERRUPT;
|
2017-12-02 19:05:53 +00:00
|
|
|
}
|
|
|
|
|
2017-12-07 00:01:13 +00:00
|
|
|
/*
|
|
|
|
* Clear the overflow bit.
|
|
|
|
*/
|
2017-12-02 19:05:53 +00:00
|
|
|
DEFINE_INST(clv)
|
|
|
|
{
|
2018-01-05 20:18:39 +00:00
|
|
|
cpu->P &= ~MOS_OVERFLOW;
|
2017-12-02 19:05:53 +00:00
|
|
|
}
|
|
|
|
|
2017-12-07 00:01:13 +00:00
|
|
|
/*
|
|
|
|
* Set the carry bit.
|
|
|
|
*/
|
2017-12-02 19:05:53 +00:00
|
|
|
DEFINE_INST(sec)
|
|
|
|
{
|
2018-01-05 20:18:39 +00:00
|
|
|
cpu->P |= MOS_CARRY;
|
2017-12-02 19:05:53 +00:00
|
|
|
}
|
|
|
|
|
2017-12-07 00:01:13 +00:00
|
|
|
/*
|
|
|
|
* Set the decimal bit.
|
|
|
|
*/
|
2017-12-02 19:05:53 +00:00
|
|
|
DEFINE_INST(sed)
|
|
|
|
{
|
2018-01-05 20:18:39 +00:00
|
|
|
cpu->P |= MOS_DECIMAL;
|
2017-12-02 19:05:53 +00:00
|
|
|
}
|
|
|
|
|
2017-12-07 00:01:13 +00:00
|
|
|
/*
|
|
|
|
* Set the interrupt bit.
|
|
|
|
*/
|
2017-12-02 19:05:53 +00:00
|
|
|
DEFINE_INST(sei)
|
|
|
|
{
|
2018-01-05 20:18:39 +00:00
|
|
|
cpu->P |= MOS_INTERRUPT;
|
2017-12-02 19:05:53 +00:00
|
|
|
}
|