Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <avr/pgmspace.h>
#include <avr/pgmspace.h>
#include "cpu.h"
#include "hw.h"
#include "hal.h"
Expand Down Expand Up @@ -835,7 +835,7 @@ static void op_retd_cb(u8_t arg0, u8_t arg1)
sp = (sp + 3) & 0xFF;
SET_M(x, arg0 & 0xF);
SET_M(x + 1, (arg0 >> 4) & 0xF);
x = (x + 2) & 0xFFF;
x = ((x + 2) & 0xFF) | (XP << 8);
call_depth--;
}

Expand All @@ -854,12 +854,12 @@ static void op_halt_cb(u8_t arg0, u8_t arg1)

static void op_inc_x_cb(u8_t arg0, u8_t arg1)
{
x = (x + 1) & 0xFFF;
x = ((x + 1) & 0xFF) | (XP << 8);
}

static void op_inc_y_cb(u8_t arg0, u8_t arg1)
{
y = (y + 1) & 0xFFF;
y = ((y + 1) & 0xFF) | (YP << 8);
}

static void op_ld_x_cb(u8_t arg0, u8_t arg1)
Expand Down Expand Up @@ -1029,32 +1029,32 @@ static void op_ld_mn_b_cb(u8_t arg0, u8_t arg1)
static void op_ldpx_mx_cb(u8_t arg0, u8_t arg1)
{
SET_M(x, arg0);
x = (x + 1) & 0xFFF;
x = ((x + 1) & 0xFF) | (XP << 8);
}

static void op_ldpx_r_cb(u8_t arg0, u8_t arg1)
{
SET_RQ(arg0, RQ(arg1));
x = (x + 1) & 0xFFF;
x = ((x + 1) & 0xFF) | (XP << 8);
}

static void op_ldpy_my_cb(u8_t arg0, u8_t arg1)
{
SET_M(y, arg0);
y = (y + 1) & 0xFFF;
y = ((y + 1) & 0xFF) | (YP << 8);
}

static void op_ldpy_r_cb(u8_t arg0, u8_t arg1)
{
SET_RQ(arg0, RQ(arg1));
y = (y + 1) & 0xFFF;
y = ((y + 1) & 0xFF) | (YP << 8);
}

static void op_lbpx_cb(u8_t arg0, u8_t arg1)
{
SET_M(x, arg0 & 0xF);
SET_M(x + 1, (arg0 >> 4) & 0xF);
x = (x + 2) & 0xFFF;
x = ((x + 2) & 0xFF) | (XP << 8);
}

static void op_set_cb(u8_t arg0, u8_t arg1)
Expand Down Expand Up @@ -1483,7 +1483,7 @@ static void op_acpx_cb(u8_t arg0, u8_t arg1)
if (tmp >> 4) { SET_C(); } else { CLEAR_C(); }
}
if (!M(x)) { SET_Z(); } else { CLEAR_Z(); }
x = (x + 1) & 0xFFF;
x = ((x + 1) & 0xFF) | (XP << 8);
}

static void op_acpy_cb(u8_t arg0, u8_t arg1)
Expand All @@ -1504,7 +1504,7 @@ static void op_acpy_cb(u8_t arg0, u8_t arg1)
if (tmp >> 4) { SET_C(); } else { CLEAR_C(); }
}
if (!M(y)) { SET_Z(); } else { CLEAR_Z(); }
y = (y + 1) & 0xFFF;
y = ((y + 1) & 0xFF) | (YP << 8);
}

static void op_scpx_cb(u8_t arg0, u8_t arg1)
Expand All @@ -1523,7 +1523,7 @@ static void op_scpx_cb(u8_t arg0, u8_t arg1)
}
if (tmp >> 4) { SET_C(); } else { CLEAR_C(); }
if (!M(x)) { SET_Z(); } else { CLEAR_Z(); }
x = (x + 1) & 0xFFF;
x = ((x + 1) & 0xFF) | (XP << 8);
}

static void op_scpy_cb(u8_t arg0, u8_t arg1)
Expand All @@ -1542,7 +1542,7 @@ static void op_scpy_cb(u8_t arg0, u8_t arg1)
}
if (tmp >> 4) { SET_C(); } else { CLEAR_C(); }
if (!M(y)) { SET_Z(); } else { CLEAR_Z(); }
y = (y + 1) & 0xFFF;
y = ((y + 1) & 0xFF) | (YP << 8);
}

static void op_not_cb(u8_t arg0, u8_t arg1)
Expand Down