summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-12-08 10:42:10 -0500
committermrb0nk500 <b0nk@b0nk.xyz>2020-12-08 18:07:53 -0500
commit498756102a430d68018ff39502b568f93a110227 (patch)
tree89cda25b9bc95c96ec0e8415e76f99101da1ce0d
parent28202af458a42e83f06415fa33d193258535a86d (diff)
- Implemented support for the Orthogonal extension into
both the assembler, and the emulator. I finally figured out how I could get support for the Ortho extension implemented into the old assembler. The only reason for doing this, is to buy me some while I start work on the new assembler, and to help me get an idea for how to do the same in the new assembler.
-rw-r--r--disasm.c1
-rw-r--r--sux.h26
-rw-r--r--test/ortho.s3
3 files changed, 29 insertions, 1 deletions
diff --git a/disasm.c b/disasm.c
index 18d84bd..010bc2f 100644
--- a/disasm.c
+++ b/disasm.c
@@ -159,7 +159,6 @@ static void disasm_ortho(struct sux *cpu, uint8_t opcode, uint8_t prefix, uint8_
memset(address, 0, sizeof(address));
memset(idx, 0, sizeof(idx));
memset(scale, 0, sizeof(scale));
-
for (int i = 0; i < 2; i++) {
int is_ind = 0;
int is_rind = 0;
diff --git a/sux.h b/sux.h
index d267755..aaeda5f 100644
--- a/sux.h
+++ b/sux.h
@@ -533,20 +533,28 @@ static /*inline*/ uint64_t get_ortho_addr(struct sux *cpu, uint8_t prefix, uint6
}
op[i].scale = (inst_size == 2) ? tmp.u8[0] : 0;
}
+<<<<<<< HEAD
if (addr_size != 0xFF) {
inst_size = addr_size+1;
+=======
+ if (addr_size != 0xFF || (rs && op[i].id == MEM_IMM)) {
+ inst_size = (addr_size != 0xFF) ? addr_size+1 : rs;
+>>>>>>> 673efac... - Implemented support for the Orthogonal extension into
op[i].value = read_value(cpu, 0, address, inst_size-1, inc_clk, 0);
value[i] = op[i].value;
if (inc_pc) {
address += inst_size;
}
}
+<<<<<<< HEAD
if (rs && op[i].id == MEM_IMM) {
value[i] = address;
if (inc_pc) {
address += rs;
}
}
+=======
+>>>>>>> 673efac... - Implemented support for the Orthogonal extension into
if (is_rind) {
for (int j = 0; j < 2 && op[i].rind[j] != 0xFF; j++) {
uint64_t reg;
@@ -906,7 +914,11 @@ static /*inline*/ void exec_ortho_inst(struct sux *cpu, uint8_t opcode, uint8_t
operand op[2];
cpu->pc = get_ortho_addr(cpu, prefix, cpu->pc, op, address, op_type, op_id, 1, 1, thread);
if (op[1].type) {
+<<<<<<< HEAD
src = read_value(cpu, 0, (op[1].id != MEM_IMM) ? op[1].value : address[1], size, 1, 1);
+=======
+ src = read_value(cpu, 0, op[1].value, size, 1, 1);
+>>>>>>> 673efac... - Implemented support for the Orthogonal extension into
} else {
switch (op[1].id) {
case REG_A : src = cpu->a; break;
@@ -928,9 +940,13 @@ static /*inline*/ void exec_ortho_inst(struct sux *cpu, uint8_t opcode, uint8_t
}
}
if (op[0].type) {
+<<<<<<< HEAD
if (op[0].id != MEM_IMM) {
dst = read_value(cpu, 0, op[0].value, size, 1, 1);
}
+=======
+ dst = read_value(cpu, 0, op[0].value, size, 1, 1);
+>>>>>>> 673efac... - Implemented support for the Orthogonal extension into
} else {
switch (op[0].id) {
case REG_A : dst = cpu->a; break;
@@ -1051,10 +1067,16 @@ static /*inline*/ void exec_ortho_inst(struct sux *cpu, uint8_t opcode, uint8_t
case ORTHO_1CC(SET, VC): dst = set(cpu, !getflag(V), thread); break;
}
+<<<<<<< HEAD
if (op[0].type) {
if (op[0].id != MEM_IMM) {
write_value(cpu, dst, op[0].value, size, 1, 1);
}
+=======
+
+ if (op[0].type) {
+ write_value(cpu, dst, op[0].value, size, 1, 1);
+>>>>>>> 673efac... - Implemented support for the Orthogonal extension into
} else {
switch (op[0].id) {
case REG_A : cpu->a = dst; break;
@@ -1077,9 +1099,13 @@ static /*inline*/ void exec_ortho_inst(struct sux *cpu, uint8_t opcode, uint8_t
}
if (isdiv) {
if (op[1].type) {
+<<<<<<< HEAD
if (op[0].id != MEM_IMM) {
write_value(cpu, dst, op[1].value, size, 1, 1);
}
+=======
+ write_value(cpu, rem, op[1].value, size, 1, 1);
+>>>>>>> 673efac... - Implemented support for the Orthogonal extension into
} else {
switch (op[1].id) {
case REG_A : cpu->a = rem; break;
diff --git a/test/ortho.s b/test/ortho.s
index 83f3554..4ca01f3 100644
--- a/test/ortho.s
+++ b/test/ortho.s
@@ -9,7 +9,10 @@ mem:
reset:
cps
lds.d #$3FFFF
+<<<<<<< HEAD
mov a, #10
+=======
+>>>>>>> 673efac... - Implemented support for the Orthogonal extension into
and #0
tay
xor b, b