Incorporated 2OP CMPSKIP instructions
This commit is contained in:
parent
d7bab06902
commit
558392977f
|
@ -8,6 +8,7 @@
|
|||
+ Renamed xeh1 files to match current naming standard
|
||||
+ created roms/ to store previously built roms and expanded .gitignore to prevent binary blobs from being checked in.
|
||||
+ Revised stage0 Monitor to utilize ANDI and updated the Hex0 version to incorporate the enhancements made previously
|
||||
+ Imported CMPSKIP instructions that operate on 2 registers
|
||||
|
||||
** Fixed
|
||||
+ Fixed leading char bug in M0
|
||||
|
|
|
@ -286,6 +286,17 @@ void assemble(struct Token* p)
|
|||
setExpression(p, "POPU16", "090284", 4);
|
||||
setExpression(p, "POP32", "090285", 4);
|
||||
setExpression(p, "POPU32", "090286", 4);
|
||||
setExpression(p, "CMPSKIP.G", "090300", 4);
|
||||
setExpression(p, "CMPSKIP.GE", "090301", 4);
|
||||
setExpression(p, "CMPSKIP.E", "090302", 4);
|
||||
setExpression(p, "CMPSKIP.NE", "090303", 4);
|
||||
setExpression(p, "CMPSKIP.LE", "090304", 4);
|
||||
setExpression(p, "CMPSKIP.L", "090305", 4);
|
||||
setExpression(p, "CMPSKIPU.G", "090380", 4);
|
||||
setExpression(p, "CMPSKIPU.GE", "090381", 4);
|
||||
setExpression(p, "CMPSKIPU.LE", "090384", 4);
|
||||
setExpression(p, "CMPSKIPU.L", "090385", 4);
|
||||
|
||||
|
||||
/* 1OP Group */
|
||||
setExpression(p, "READPC", "0D00000", 4);
|
||||
|
|
|
@ -116,6 +116,16 @@ DEFINE POP16 090283
|
|||
DEFINE POPU16 090284
|
||||
DEFINE POP32 090285
|
||||
DEFINE POPU32 090286
|
||||
DEFINE CMPSKIP.G 090300
|
||||
DEFINE CMPSKIP.GE 090301
|
||||
DEFINE CMPSKIP.E 090302
|
||||
DEFINE CMPSKIP.NE 090303
|
||||
DEFINE CMPSKIP.LE 090304
|
||||
DEFINE CMPSKIP.L 090305
|
||||
DEFINE CMPSKIPU.G 090380
|
||||
DEFINE CMPSKIPU.GE 090381
|
||||
DEFINE CMPSKIPU.LE 090384
|
||||
DEFINE CMPSKIPU.L 090385
|
||||
|
||||
# 1OP Group
|
||||
DEFINE READPC 0D00000
|
||||
|
|
|
@ -612,6 +612,56 @@ void decode_Integer_2OP(struct Instruction* c)
|
|||
strncpy(Name, "POPU32", 19);
|
||||
break;
|
||||
}
|
||||
case 0x0300: /* CMPSKIP.G */
|
||||
{
|
||||
strncpy(Name, "CMPSKIP.G", 19);
|
||||
break;
|
||||
}
|
||||
case 0x0301: /* CMPSKIP.GE */
|
||||
{
|
||||
strncpy(Name, "CMPSKIP.GE", 19);
|
||||
break;
|
||||
}
|
||||
case 0x0302: /* CMPSKIP.E */
|
||||
{
|
||||
strncpy(Name, "CMPSKIP.E", 19);
|
||||
break;
|
||||
}
|
||||
case 0x0303: /* CMPSKIP.NE */
|
||||
{
|
||||
strncpy(Name, "CMPSKIP.NE", 19);
|
||||
break;
|
||||
}
|
||||
case 0x0304: /* CMPSKIP.LE */
|
||||
{
|
||||
strncpy(Name, "CMPSKIP.LE", 19);
|
||||
break;
|
||||
}
|
||||
case 0x0305: /* CMPSKIP.L */
|
||||
{
|
||||
strncpy(Name, "CMPSKIP.L", 19);
|
||||
break;
|
||||
}
|
||||
case 0x0380: /* CMPSKIPU.G */
|
||||
{
|
||||
strncpy(Name, "CMPSKIPU.G", 19);
|
||||
break;
|
||||
}
|
||||
case 0x0381: /* CMPSKIPU.GE */
|
||||
{
|
||||
strncpy(Name, "CMPSKIPU.GE", 19);
|
||||
break;
|
||||
}
|
||||
case 0x0384: /* CMPSKIPU.LE */
|
||||
{
|
||||
strncpy(Name, "CMPSKIPU.LE", 19);
|
||||
break;
|
||||
}
|
||||
case 0x0385: /* CMPSKIPU.L */
|
||||
{
|
||||
strncpy(Name, "CMPSKIPU.L", 19);
|
||||
break;
|
||||
}
|
||||
default: /* Unknown 2OP*/
|
||||
{
|
||||
break;
|
||||
|
|
|
@ -222,20 +222,44 @@
|
|||
**** Stack group
|
||||
| Hex | Name | Comment |
|
||||
|-------------+------------+-----------------------------------------------------------|
|
||||
| 09 02 00 ab | PUSHR a b | MEM[b] = a; b = b + (register size in bytes) |
|
||||
| 09 02 01 ab | PUSH8 a b | MEM[b] = bottom_8_bits(a); b = b + 1 |
|
||||
| 09 02 02 ab | PUSH16 a b | MEM[b] = bottome_16_bits(a); b = b + 2 |
|
||||
| 09 02 03 ab | PUSH32 a b | MEM[b] = bottome_32_bits(a); b = b + 4 |
|
||||
| 09 02 00 ab | PUSHR a b | MEM[b] = a; b = b + (register size in bytes) |
|
||||
| 09 02 01 ab | PUSH8 a b | MEM[b] = bottom_8_bits(a); b = b + 1 |
|
||||
| 09 02 02 ab | PUSH16 a b | MEM[b] = bottome_16_bits(a); b = b + 2 |
|
||||
| 09 02 03 ab | PUSH32 a b | MEM[b] = bottome_32_bits(a); b = b + 4 |
|
||||
| 09 02 04 xx | Reserved | |
|
||||
| ... | Reserved | |
|
||||
| 09 02 7F xx | Reserved | |
|
||||
| 09 02 80 ab | POPR a b | a = MEM[b]; MEM[b] = 0; b = b - (register size in bytes) |
|
||||
| 09 02 81 ab | POP8 a b | a = MEM[b] (signed); MEM[b] = 0; b = b - 1 |
|
||||
| 09 02 82 ab | POPU8 a b | a = MEM[b] (unsigned); MEM[b] = 0; b = b - 1 |
|
||||
| 09 02 83 ab | POP16 a b | a = MEM[b] (signed); MEM[b] = 0; b = b - 2 |
|
||||
| 09 02 84 ab | POPU16 a b | a = MEM[b] (unsigned); MEM[b] = 0; b = b - 2 |
|
||||
| 09 02 85 ab | POP32 a b | a = MEM[b] (signed); MEM[b] = 0; b = b - 4 |
|
||||
| 09 02 86 ab | POPU32 a b | a = MEM[b] (signed); MEM[b] = 0; b = b - 4 |
|
||||
| 09 02 81 ab | POP8 a b | a = MEM[b] (signed); MEM[b] = 0; b = b - 1 |
|
||||
| 09 02 82 ab | POPU8 a b | a = MEM[b] (unsigned); MEM[b] = 0; b = b - 1 |
|
||||
| 09 02 83 ab | POP16 a b | a = MEM[b] (signed); MEM[b] = 0; b = b - 2 |
|
||||
| 09 02 84 ab | POPU16 a b | a = MEM[b] (unsigned); MEM[b] = 0; b = b - 2 |
|
||||
| 09 02 85 ab | POP32 a b | a = MEM[b] (signed); MEM[b] = 0; b = b - 4 |
|
||||
| 09 02 86 ab | POPU32 a b | a = MEM[b] (signed); MEM[b] = 0; b = b - 4 |
|
||||
| ... | Reserved | |
|
||||
| 09 02 FF xx | Reserved | |
|
||||
|
||||
**** CMPSKIP group
|
||||
| Hex | Name | Comment |
|
||||
|-------------+-----------------+--------------------------------|
|
||||
| 09 03 00 ab | CMPSKIP.G a b | a > b ? Skip Next instruction |
|
||||
| 09 03 01 ab | CMPSKIP.GE a b | a >= b ? Skip Next instruction |
|
||||
| 09 03 02 ab | CMPSKIP.E a b | a == b ? Skip Next instruction |
|
||||
| 09 03 03 ab | CMPSKIP.NE a b | a != b ? Skip Next instruction |
|
||||
| 09 03 04 ab | CMPSKIP.LE a b | a <= b ? Skip Next instruction |
|
||||
| 09 03 05 ab | CMPSKIP.L a b | a < b ? Skip Next instruction |
|
||||
| 09 03 06 xx | Reserved | |
|
||||
| ... | Reserved | |
|
||||
| 09 03 7F ab | Reserved | |
|
||||
| 09 03 80 ab | CMPSKIPU.G a b | a > b ? Skip Next instruction |
|
||||
| 09 03 81 ab | CMPSKIPU.GE a b | a >= b ? Skip Next instruction |
|
||||
| 09 03 82 ab | Reserved | |
|
||||
| 09 03 83 ab | Reserved | |
|
||||
| 09 03 84 ab | CMPSKIPU.LE a b | a <= b ? Skip Next instruction |
|
||||
| 09 03 85 ab | CMPSKIPU.L a b | a < b ? Skip Next instruction |
|
||||
| 09 03 86 xx | Reserved | |
|
||||
| ... | Reserved | |
|
||||
| 09 03 FF ab | Reserved | |
|
||||
|
||||
**** Reserved Block 1
|
||||
| Hex | Name |
|
||||
|
|
11
vm.h
11
vm.h
|
@ -221,6 +221,17 @@ void NANDI(struct lilith* vm, struct Instruction* c);
|
|||
void NORI(struct lilith* vm, struct Instruction* c);
|
||||
void XNORI(struct lilith* vm, struct Instruction* c);
|
||||
void NOT(struct lilith* vm, struct Instruction* c);
|
||||
void CMPSKIP_G(struct lilith* vm, struct Instruction* c);
|
||||
void CMPSKIP_GE(struct lilith* vm, struct Instruction* c);
|
||||
void CMPSKIP_E(struct lilith* vm, struct Instruction* c);
|
||||
void CMPSKIP_NE(struct lilith* vm, struct Instruction* c);
|
||||
void CMPSKIP_LE(struct lilith* vm, struct Instruction* c);
|
||||
void CMPSKIP_L(struct lilith* vm, struct Instruction* c);
|
||||
void CMPSKIPU_G(struct lilith* vm, struct Instruction* c);
|
||||
void CMPSKIPU_GE(struct lilith* vm, struct Instruction* c);
|
||||
void CMPSKIPU_LE(struct lilith* vm, struct Instruction* c);
|
||||
void CMPSKIPU_L(struct lilith* vm, struct Instruction* c);
|
||||
|
||||
|
||||
/* Prototypes for functions in vm_decode.c*/
|
||||
struct lilith* create_vm(size_t size);
|
||||
|
|
110
vm_decode.c
110
vm_decode.c
|
@ -1343,6 +1343,116 @@ bool eval_2OP_Int(struct lilith* vm, struct Instruction* c)
|
|||
POPU32(vm, c);
|
||||
break;
|
||||
}
|
||||
case 0x0300: /* CMPSKIP.G */
|
||||
{
|
||||
#ifdef DEBUG
|
||||
strncpy(Name, "CMPSKIP.G", 19);
|
||||
#elif TRACE
|
||||
record_trace("CMPSKIP.G");
|
||||
#endif
|
||||
|
||||
CMPSKIP_G(vm, c);
|
||||
break;
|
||||
}
|
||||
case 0x0301: /* CMPSKIP.GE */
|
||||
{
|
||||
#ifdef DEBUG
|
||||
strncpy(Name, "CMPSKIP.GE", 19);
|
||||
#elif TRACE
|
||||
record_trace("CMPSKIP.GE");
|
||||
#endif
|
||||
|
||||
CMPSKIP_GE(vm, c);
|
||||
break;
|
||||
}
|
||||
case 0x0302: /* CMPSKIP.E */
|
||||
{
|
||||
#ifdef DEBUG
|
||||
strncpy(Name, "CMPSKIP.E", 19);
|
||||
#elif TRACE
|
||||
record_trace("CMPSKIP.E");
|
||||
#endif
|
||||
|
||||
CMPSKIP_E(vm, c);
|
||||
break;
|
||||
}
|
||||
case 0x0303: /* CMPSKIP.NE */
|
||||
{
|
||||
#ifdef DEBUG
|
||||
strncpy(Name, "CMPSKIP.NE", 19);
|
||||
#elif TRACE
|
||||
record_trace("CMPSKIP.NE");
|
||||
#endif
|
||||
|
||||
CMPSKIP_NE(vm, c);
|
||||
break;
|
||||
}
|
||||
case 0x0304: /* CMPSKIP.LE */
|
||||
{
|
||||
#ifdef DEBUG
|
||||
strncpy(Name, "CMPSKIP.LE", 19);
|
||||
#elif TRACE
|
||||
record_trace("CMPSKIP.LE");
|
||||
#endif
|
||||
|
||||
CMPSKIP_LE(vm, c);
|
||||
break;
|
||||
}
|
||||
case 0x0305: /* CMPSKIP.L */
|
||||
{
|
||||
#ifdef DEBUG
|
||||
strncpy(Name, "CMPSKIP.L", 19);
|
||||
#elif TRACE
|
||||
record_trace("CMPSKIP.L");
|
||||
#endif
|
||||
|
||||
CMPSKIP_L(vm, c);
|
||||
break;
|
||||
}
|
||||
case 0x0380: /* CMPSKIPU.G */
|
||||
{
|
||||
#ifdef DEBUG
|
||||
strncpy(Name, "CMPSKIPU.G", 19);
|
||||
#elif TRACE
|
||||
record_trace("CMPSKIPU.G");
|
||||
#endif
|
||||
|
||||
CMPSKIPU_G(vm, c);
|
||||
break;
|
||||
}
|
||||
case 0x0381: /* CMPSKIPU.GE */
|
||||
{
|
||||
#ifdef DEBUG
|
||||
strncpy(Name, "CMPSKIPU.GE", 19);
|
||||
#elif TRACE
|
||||
record_trace("CMPSKIPU.GE");
|
||||
#endif
|
||||
|
||||
CMPSKIPU_GE(vm, c);
|
||||
break;
|
||||
}
|
||||
case 0x0384: /* CMPSKIPU.LE */
|
||||
{
|
||||
#ifdef DEBUG
|
||||
strncpy(Name, "CMPSKIPU.LE", 19);
|
||||
#elif TRACE
|
||||
record_trace("CMPSKIPU.LE");
|
||||
#endif
|
||||
|
||||
CMPSKIPU_LE(vm, c);
|
||||
break;
|
||||
}
|
||||
case 0x0385: /* CMPSKIPU.L */
|
||||
{
|
||||
#ifdef DEBUG
|
||||
strncpy(Name, "CMPSKIPU.L", 19);
|
||||
#elif TRACE
|
||||
record_trace("CMPSKIPU.L");
|
||||
#endif
|
||||
|
||||
CMPSKIPU_L(vm, c);
|
||||
break;
|
||||
}
|
||||
default: return true;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -1958,3 +1958,107 @@ void NOT(struct lilith* vm, struct Instruction* c)
|
|||
{
|
||||
vm->reg[c->reg0] = ~(vm->reg[c->reg1]);
|
||||
}
|
||||
|
||||
void CMPSKIP_G(struct lilith* vm, struct Instruction* c)
|
||||
{
|
||||
int32_t tmp1, tmp2;
|
||||
tmp1 = (int32_t)(vm->reg[c->reg0]);
|
||||
tmp2 = (int32_t)(vm->reg[c->reg1]);
|
||||
|
||||
if(tmp1 > tmp2)
|
||||
{
|
||||
vm->ip = vm->ip + 4;
|
||||
}
|
||||
}
|
||||
|
||||
void CMPSKIP_GE(struct lilith* vm, struct Instruction* c)
|
||||
{
|
||||
int32_t tmp1, tmp2;
|
||||
tmp1 = (int32_t)(vm->reg[c->reg0]);
|
||||
tmp2 = (int32_t)(vm->reg[c->reg1]);
|
||||
|
||||
if(tmp1 >= tmp2)
|
||||
{
|
||||
vm->ip = vm->ip + 4;
|
||||
}
|
||||
}
|
||||
|
||||
void CMPSKIP_E(struct lilith* vm, struct Instruction* c)
|
||||
{
|
||||
int32_t tmp1, tmp2;
|
||||
tmp1 = (int32_t)(vm->reg[c->reg0]);
|
||||
tmp2 = (int32_t)(vm->reg[c->reg1]);
|
||||
|
||||
if(tmp1 == tmp2)
|
||||
{
|
||||
vm->ip = vm->ip + 4;
|
||||
}
|
||||
}
|
||||
|
||||
void CMPSKIP_NE(struct lilith* vm, struct Instruction* c)
|
||||
{
|
||||
int32_t tmp1, tmp2;
|
||||
tmp1 = (int32_t)(vm->reg[c->reg0]);
|
||||
tmp2 = (int32_t)(vm->reg[c->reg1]);
|
||||
|
||||
if(tmp1 != tmp2)
|
||||
{
|
||||
vm->ip = vm->ip + 4;
|
||||
}
|
||||
}
|
||||
|
||||
void CMPSKIP_LE(struct lilith* vm, struct Instruction* c)
|
||||
{
|
||||
int32_t tmp1, tmp2;
|
||||
tmp1 = (int32_t)(vm->reg[c->reg0]);
|
||||
tmp2 = (int32_t)(vm->reg[c->reg1]);
|
||||
|
||||
if(tmp1 <= tmp2)
|
||||
{
|
||||
vm->ip = vm->ip + 4;
|
||||
}
|
||||
}
|
||||
|
||||
void CMPSKIP_L(struct lilith* vm, struct Instruction* c)
|
||||
{
|
||||
int32_t tmp1, tmp2;
|
||||
tmp1 = (int32_t)(vm->reg[c->reg0]);
|
||||
tmp2 = (int32_t)(vm->reg[c->reg1]);
|
||||
|
||||
if(tmp1 < tmp2)
|
||||
{
|
||||
vm->ip = vm->ip + 4;
|
||||
}
|
||||
}
|
||||
|
||||
void CMPSKIPU_G(struct lilith* vm, struct Instruction* c)
|
||||
{
|
||||
if((vm->reg[c->reg0]) > vm->reg[c->reg1])
|
||||
{
|
||||
vm->ip = vm->ip + 4;
|
||||
}
|
||||
}
|
||||
|
||||
void CMPSKIPU_GE(struct lilith* vm, struct Instruction* c)
|
||||
{
|
||||
if((vm->reg[c->reg0]) >= vm->reg[c->reg1])
|
||||
{
|
||||
vm->ip = vm->ip + 4;
|
||||
}
|
||||
}
|
||||
|
||||
void CMPSKIPU_LE(struct lilith* vm, struct Instruction* c)
|
||||
{
|
||||
if((vm->reg[c->reg0]) <= vm->reg[c->reg1])
|
||||
{
|
||||
vm->ip = vm->ip + 4;
|
||||
}
|
||||
}
|
||||
|
||||
void CMPSKIPU_L(struct lilith* vm, struct Instruction* c)
|
||||
{
|
||||
if((vm->reg[c->reg0]) < vm->reg[c->reg1])
|
||||
{
|
||||
vm->ip = vm->ip + 4;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue