summaryrefslogtreecommitdiff
path: root/sux.c
diff options
context:
space:
mode:
Diffstat (limited to 'sux.c')
-rw-r--r--sux.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sux.c b/sux.c
index 70b8a92..96068a8 100644
--- a/sux.c
+++ b/sux.c
@@ -4,8 +4,8 @@
#include <string.h>
#include <pthread.h>
#define bench 0
-#define debug 0
-#define IO 1
+#define debug 1
+#define IO 0
#define keypoll 0
#if bench
#include <sys/time.h>
@@ -222,7 +222,9 @@ void *run(void *args) {
case TYA: /* Transfer Y to Accumulator. */
case TXA: /* Transfer X to Accumulator. */
case TXY: /* Transfer X to Y. */
+ case TAB: /* Transfer Accumulator to B. */
case TSX: /* Transfer Stack pointer to X. */
+ case TBA: /* Transfer B to Accumulator. */
case TXS: /* Transfer X to Stack pointer. */
if (opcode == TAY)
cpu->y[thread] = cpu->a[thread];
@@ -236,10 +238,17 @@ void *run(void *args) {
cpu->a[thread] = cpu->x[thread];
if (opcode == TXY)
cpu->y[thread] = cpu->x[thread];
+ if (opcode == TAB) {
+ cpu->b[thread] = cpu->a[thread];
+ cpu->z[thread] = (cpu->b[thread] == 0);
+ cpu->n[thread] = (cpu->b[thread] >> 63);
+ }
if (opcode == TSX) {
cpu->x[thread] = cpu->sp[thread] & 0xFFFF;
cpu->x[thread] = cpu->stk_st[thread] << 16;
}
+ if (opcode == TBA)
+ cpu->a[thread] = cpu->b[thread];
if (opcode == TXS) {
cpu->sp[thread] = cpu->x[thread];
if (prefix == 0x17 && (value == thread+1 || value > 8)) {
@@ -248,7 +257,7 @@ void *run(void *args) {
cpu->pc[thread]+=2;
}
}
- if (opcode == TYA || opcode == TXA) {
+ if (opcode == TYA || opcode == TXA || opcode == TBA) {
cpu->z[thread] = (cpu->a[thread] == 0);
cpu->n[thread] = (cpu->a[thread] >> 63);
}
@@ -1207,6 +1216,7 @@ void *run(void *args) {
value += (uint64_t)addr[address+6] << 48;
value += (uint64_t)addr[address+7] << 56;
}
+ cpu->b[thread] = cpu->a[thread] % value;
sum = cpu->a[thread]/value;
cpu->a[thread] = sum;
cpu->z[thread] = (sum == 0);