Incorporated the Compare and Skip instructions to the VM, assembler and disassembler
This commit is contained in:
parent
5ea2d1b455
commit
a257945bd6
|
@ -506,6 +506,37 @@ DO NOT USE.
|
||||||
|-------------+----------|
|
|-------------+----------|
|
||||||
| 43 00 00 00 | Reserved |
|
| 43 00 00 00 | Reserved |
|
||||||
| ... | Reserved |
|
| ... | Reserved |
|
||||||
|
| 9F FF FF FF | Reserved |
|
||||||
|
|
||||||
|
** CMPSKIP Group
|
||||||
|
| Hex | Name | Comment |
|
||||||
|
|-------------+-------------+------------------------------------|
|
||||||
|
| A0 0a ii ii | CMPSKIP.G | a > ii ii ? Skip Next instruction |
|
||||||
|
| A0 1a ii ii | CMPSKIP.GE | a >= ii ii ? Skip Next instruction |
|
||||||
|
| A0 2a ii ii | CMPSKIP.E | a == ii ii ? Skip Next instruction |
|
||||||
|
| A0 3a ii ii | CMPSKIP.NE | a != ii ii ? Skip Next instruction |
|
||||||
|
| A0 4a ii ii | CMPSKIP.LE | a <= ii ii ? Skip Next instruction |
|
||||||
|
| A0 5a ii ii | CMPSKIP.L | a < ii ii ? Skip Next instruction |
|
||||||
|
| A0 6a ii ii | Reserved | |
|
||||||
|
| ... | Reserved | |
|
||||||
|
| A0 Fa ii ii | Reserved | |
|
||||||
|
| A1 0a ii ii | CMPSKIPU.G | a > ii ii ? Skip Next instruction |
|
||||||
|
| A1 1a ii ii | CMPSKIPU.GE | a >= ii ii ? Skip Next instruction |
|
||||||
|
| A1 2a ii ii | Reserved | |
|
||||||
|
| A1 3a ii ii | Reserved | |
|
||||||
|
| A1 4a ii ii | CMPSKIPU.LE | a <= ii ii ? Skip Next instruction |
|
||||||
|
| A1 5a ii ii | CMPSKIPU.L | a < ii ii ? Skip Next instruction |
|
||||||
|
| A1 6a ii ii | Reserved | |
|
||||||
|
| ... | Reserved | |
|
||||||
|
| A1 Fa ii ii | Reserved | |
|
||||||
|
|
||||||
|
** Reserved Block 2
|
||||||
|
At this time these instructions only produce a warning; but could do anything.
|
||||||
|
DO NOT USE.
|
||||||
|
| Hex | Name |
|
||||||
|
|-------------+----------|
|
||||||
|
| B0 00 00 00 | Reserved |
|
||||||
|
| ... | Reserved |
|
||||||
| BF FF FF FF | Reserved |
|
| BF FF FF FF | Reserved |
|
||||||
|
|
||||||
** CMPJUMP Group
|
** CMPJUMP Group
|
||||||
|
@ -530,7 +561,7 @@ DO NOT USE.
|
||||||
| ... | Reserved | |
|
| ... | Reserved | |
|
||||||
| DF ab ii ii | Reserved | |
|
| DF ab ii ii | Reserved | |
|
||||||
|
|
||||||
** Reserved Block 2
|
** Reserved Block 3
|
||||||
At this time these instructions only produce a warning; but could do anything.
|
At this time these instructions only produce a warning; but could do anything.
|
||||||
DO NOT USE.
|
DO NOT USE.
|
||||||
| Hex | Name |
|
| Hex | Name |
|
||||||
|
|
10
asm.c
10
asm.c
|
@ -327,6 +327,16 @@ void assemble(struct Token* p)
|
||||||
setExpression(p, "STORER8", "2F1", 4);
|
setExpression(p, "STORER8", "2F1", 4);
|
||||||
setExpression(p, "STORER16", "2F2", 4);
|
setExpression(p, "STORER16", "2F2", 4);
|
||||||
setExpression(p, "STORER32", "2F3", 4);
|
setExpression(p, "STORER32", "2F3", 4);
|
||||||
|
setExpression(p, "CMPSKIP.G", "A00", 4);
|
||||||
|
setExpression(p, "CMPSKIP.GE", "A01", 4);
|
||||||
|
setExpression(p, "CMPSKIP.E", "A02", 4);
|
||||||
|
setExpression(p, "CMPSKIP.NE", "A03", 4);
|
||||||
|
setExpression(p, "CMPSKIP.LE", "A04", 4);
|
||||||
|
setExpression(p, "CMPSKIP.L", "A05", 4);
|
||||||
|
setExpression(p, "CMPSKIPU.G", "A10", 4);
|
||||||
|
setExpression(p, "CMPSKIPU.GE", "A11", 4);
|
||||||
|
setExpression(p, "CMPSKIPU.LE", "A14", 4);
|
||||||
|
setExpression(p, "CMPSKIPU.L", "A15", 4);
|
||||||
|
|
||||||
/* 0OPI Group */
|
/* 0OPI Group */
|
||||||
setExpression(p, "JUMP", "3C00", 4);
|
setExpression(p, "JUMP", "3C00", 4);
|
||||||
|
|
223
disasm.c
223
disasm.c
|
@ -845,259 +845,226 @@ void decode_1OPI(struct Instruction* c)
|
||||||
c->reg0 = c->raw1%16;
|
c->reg0 = c->raw1%16;
|
||||||
|
|
||||||
char Name[20] = "ILLEGAL_1OPI";
|
char Name[20] = "ILLEGAL_1OPI";
|
||||||
|
uint32_t Opcode = (c->raw0 * 16) + c->raw_XOP;
|
||||||
|
|
||||||
/* Convert to Human readable form */
|
/* Convert to Human readable form */
|
||||||
switch(c->raw_XOP)
|
switch(Opcode)
|
||||||
{
|
{
|
||||||
case 0x0: /* JUMP.C */
|
case 0x2C0: /* JUMP.C */
|
||||||
{
|
{
|
||||||
strncpy(Name, "JUMP.C", 19);
|
strncpy(Name, "JUMP.C", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x1: /* JUMP.B */
|
case 0x2C1: /* JUMP.B */
|
||||||
{
|
{
|
||||||
strncpy(Name, "JUMP.B", 19);
|
strncpy(Name, "JUMP.B", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x2: /* JUMP.O */
|
case 0x2C2: /* JUMP.O */
|
||||||
{
|
{
|
||||||
strncpy(Name, "JUMP.O", 19);
|
strncpy(Name, "JUMP.O", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x3: /* JUMP.G */
|
case 0x2C3: /* JUMP.G */
|
||||||
{
|
{
|
||||||
strncpy(Name, "JUMP.G", 19);
|
strncpy(Name, "JUMP.G", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x4: /* JUMP.GE */
|
case 0x2C4: /* JUMP.GE */
|
||||||
{
|
{
|
||||||
strncpy(Name, "JUMP.GE", 19);
|
strncpy(Name, "JUMP.GE", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x5: /* JUMP.E */
|
case 0x2C5: /* JUMP.E */
|
||||||
{
|
{
|
||||||
strncpy(Name, "JUMP.E", 19);
|
strncpy(Name, "JUMP.E", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x6: /* JUMP.NE */
|
case 0x2C6: /* JUMP.NE */
|
||||||
{
|
{
|
||||||
strncpy(Name, "JUMP.NE", 19);
|
strncpy(Name, "JUMP.NE", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x7: /* JUMP.LE */
|
case 0x2C7: /* JUMP.LE */
|
||||||
{
|
{
|
||||||
strncpy(Name, "JUMP.LE", 19);
|
strncpy(Name, "JUMP.LE", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x8: /* JUMP.L */
|
case 0x2C8: /* JUMP.L */
|
||||||
{
|
{
|
||||||
strncpy(Name, "JUMP.L", 19);
|
strncpy(Name, "JUMP.L", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x9: /* JUMP.Z */
|
case 0x2C9: /* JUMP.Z */
|
||||||
{
|
{
|
||||||
strncpy(Name, "JUMP.Z", 19);
|
strncpy(Name, "JUMP.Z", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0xA: /* JUMP.NZ */
|
case 0x2CA: /* JUMP.NZ */
|
||||||
{
|
{
|
||||||
strncpy(Name, "JUMP.NZ", 19);
|
strncpy(Name, "JUMP.NZ", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0xB: /* JUMP.P */
|
case 0x2CB: /* JUMP.P */
|
||||||
{
|
{
|
||||||
strncpy(Name, "JUMP.P", 19);
|
strncpy(Name, "JUMP.P", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0xC: /* JUMP.NP */
|
case 0x2CC: /* JUMP.NP */
|
||||||
{
|
{
|
||||||
strncpy(Name, "JUMP.NP", 19);
|
strncpy(Name, "JUMP.NP", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: /* Unknown 1OPI*/
|
case 0x2D0: /* CALLI */
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stdout, "%s reg%u %d\t", Name, c->reg0, c->raw_Immediate);
|
|
||||||
fprintf(stdout, "# %s\n", c->operation);
|
|
||||||
}
|
|
||||||
|
|
||||||
void decode_Branch_1OPI(struct Instruction* c)
|
|
||||||
{
|
|
||||||
/* Parse Raw Data */
|
|
||||||
c->raw_Immediate = c->raw2*0x100 + c->raw3;
|
|
||||||
c->Immediate[0] = c->operation[3];
|
|
||||||
c->Immediate[1] = c->operation[4];
|
|
||||||
c->Immediate[2] = c->operation[5];
|
|
||||||
c->Immediate[3] = c->operation[6];
|
|
||||||
c->Immediate[4] = c->operation[7];
|
|
||||||
c->HAL_CODE = 0;
|
|
||||||
c->raw_XOP = c->raw1/16;
|
|
||||||
c->reg0 = c->raw1%16;
|
|
||||||
|
|
||||||
char Name[20] = "ILLEGAL_1OPI";
|
|
||||||
|
|
||||||
/* Convert to Human readable form */
|
|
||||||
switch(c->raw_XOP)
|
|
||||||
{
|
|
||||||
case 0x0: /* CALLI */
|
|
||||||
{
|
{
|
||||||
strncpy(Name, "CALLI", 19);
|
strncpy(Name, "CALLI", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x1: /* LOADI */
|
case 0x2D1: /* LOADI */
|
||||||
{
|
{
|
||||||
strncpy(Name, "LOADI", 19);
|
strncpy(Name, "LOADI", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x2: /* LOADUI */
|
case 0x2D2: /* LOADUI*/
|
||||||
{
|
{
|
||||||
strncpy(Name, "LOADUI", 19);
|
strncpy(Name, "LOADUI", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x3: /* SALI */
|
case 0x2D3: /* SALI */
|
||||||
{
|
{
|
||||||
strncpy(Name, "SALI", 19);
|
strncpy(Name, "SALI", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x4: /* SARI */
|
case 0x2D4: /* SARI */
|
||||||
{
|
{
|
||||||
strncpy(Name, "SARI", 19);
|
strncpy(Name, "SARI", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x5: /* SL0I */
|
case 0x2D5: /* SL0I */
|
||||||
{
|
{
|
||||||
strncpy(Name, "SL0I", 19);
|
strncpy(Name, "SL0I", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x6: /* SR0I */
|
case 0x2D6: /* SR0I */
|
||||||
{
|
{
|
||||||
strncpy(Name, "SR0I", 19);
|
strncpy(Name, "SR0I", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x7: /* SL1I */
|
case 0x2D7: /* SL1I */
|
||||||
{
|
{
|
||||||
strncpy(Name, "SL1I", 19);
|
strncpy(Name, "SL1I", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x8: /* SR1I */
|
case 0x2D8: /* SR1I */
|
||||||
{
|
{
|
||||||
strncpy(Name, "SR1I", 19);
|
strncpy(Name, "SR1I", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: /* Unknown 1OPI*/
|
case 0x2E0: /* LOADR */
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stdout, "%s reg%u %d\t", Name, c->reg0, c->raw_Immediate);
|
|
||||||
fprintf(stdout, "# %s\n", c->operation);
|
|
||||||
}
|
|
||||||
|
|
||||||
void decode_Load_1OPI(struct Instruction* c)
|
|
||||||
{
|
|
||||||
/* Parse Raw Data */
|
|
||||||
c->raw_Immediate = c->raw2*0x100 + c->raw3;
|
|
||||||
c->Immediate[0] = c->operation[3];
|
|
||||||
c->Immediate[1] = c->operation[4];
|
|
||||||
c->Immediate[2] = c->operation[5];
|
|
||||||
c->Immediate[3] = c->operation[6];
|
|
||||||
c->Immediate[4] = c->operation[7];
|
|
||||||
c->HAL_CODE = 0;
|
|
||||||
c->raw_XOP = c->raw1/16;
|
|
||||||
c->reg0 = c->raw1%16;
|
|
||||||
|
|
||||||
char Name[20] = "ILLEGAL_1OPI";
|
|
||||||
|
|
||||||
/* Convert to Human readable form */
|
|
||||||
switch(c->raw_XOP)
|
|
||||||
{
|
|
||||||
case 0x0: /* LOADR */
|
|
||||||
{
|
{
|
||||||
strncpy(Name, "LOADR", 19);
|
strncpy(Name, "LOADR", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x1: /* LOADR8 */
|
case 0x2E1: /* LOADR8 */
|
||||||
{
|
{
|
||||||
strncpy(Name, "LOADR8", 19);
|
strncpy(Name, "LOADR8", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x2: /* LOADRU8 */
|
case 0x2E2: /* LOADRU8 */
|
||||||
{
|
{
|
||||||
strncpy(Name, "LOADRU8", 19);
|
strncpy(Name, "LOADRU8", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x3: /* LOADR16 */
|
case 0x2E3: /* LOADR16 */
|
||||||
{
|
{
|
||||||
strncpy(Name, "LOADR16", 19);
|
strncpy(Name, "LOADR16", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x4: /* LOADRU16 */
|
case 0x2E4: /* LOADRU16 */
|
||||||
{
|
{
|
||||||
strncpy(Name, "LOADRU16", 19);
|
strncpy(Name, "LOADRU16", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x5: /* LOADR32 */
|
case 0x2E5: /* LOADR32 */
|
||||||
{
|
{
|
||||||
strncpy(Name, "LOADR32", 19);
|
strncpy(Name, "LOADR32", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x6: /* LOADRU32 */
|
case 0x2E6: /* LOADRU32 */
|
||||||
{
|
{
|
||||||
strncpy(Name, "LOADRU32", 19);
|
strncpy(Name, "LOADRU32", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: /* Unknown 1OPI*/
|
case 0x2F0: /* STORER */
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stdout, "%s reg%u %d\t", Name, c->reg0, c->raw_Immediate);
|
|
||||||
fprintf(stdout, "# %s\n", c->operation);
|
|
||||||
}
|
|
||||||
|
|
||||||
void decode_Store_1OPI(struct Instruction* c)
|
|
||||||
{
|
|
||||||
/* Parse Raw Data */
|
|
||||||
c->raw_Immediate = c->raw2*0x100 + c->raw3;
|
|
||||||
c->Immediate[0] = c->operation[3];
|
|
||||||
c->Immediate[1] = c->operation[4];
|
|
||||||
c->Immediate[2] = c->operation[5];
|
|
||||||
c->Immediate[3] = c->operation[6];
|
|
||||||
c->Immediate[4] = c->operation[7];
|
|
||||||
c->HAL_CODE = 0;
|
|
||||||
c->raw_XOP = c->raw1/16;
|
|
||||||
c->reg0 = c->raw1%16;
|
|
||||||
|
|
||||||
char Name[20] = "ILLEGAL_1OPI";
|
|
||||||
|
|
||||||
/* Convert to Human readable form */
|
|
||||||
switch(c->raw_XOP)
|
|
||||||
{
|
|
||||||
case 0x0: /* STORER */
|
|
||||||
{
|
{
|
||||||
strncpy(Name, "STORER", 19);
|
strncpy(Name, "STORER", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x1: /* STORER8 */
|
case 0x2F1: /* STORER8 */
|
||||||
{
|
{
|
||||||
strncpy(Name, "STORER8", 19);
|
strncpy(Name, "STORER8", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x2: /* STORER16 */
|
case 0x2F2: /* STORER16 */
|
||||||
{
|
{
|
||||||
strncpy(Name, "STORER16", 19);
|
strncpy(Name, "STORER16", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x3: /* STORER32 */
|
case 0x2F3: /* STORER32 */
|
||||||
{
|
{
|
||||||
strncpy(Name, "STORER32", 19);
|
strncpy(Name, "STORER32", 19);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 0xA00: /* CMPSKIP.G */
|
||||||
|
{
|
||||||
|
strncpy(Name, "CMPSKIP.G", 19);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA01: /* CMPSKIP.GE */
|
||||||
|
{
|
||||||
|
strncpy(Name, "CMPSKIP.GE", 19);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA02: /* CMPSKIP.E */
|
||||||
|
{
|
||||||
|
strncpy(Name, "CMPSKIP.E", 19);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA03: /* CMPSKIP.NE */
|
||||||
|
{
|
||||||
|
strncpy(Name, "CMPSKIP.NE", 19);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA04: /* CMPSKIP.LE */
|
||||||
|
{
|
||||||
|
strncpy(Name, "CMPSKIP.LE", 19);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA05: /* CMPSKIP.L */
|
||||||
|
{
|
||||||
|
strncpy(Name, "CMPSKIP.L", 19);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA10: /* CMPSKIPU.G */
|
||||||
|
{
|
||||||
|
strncpy(Name, "CMPSKIPU.G", 19);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA11: /* CMPSKIPU.GE */
|
||||||
|
{
|
||||||
|
strncpy(Name, "CMPSKIPU.GE", 19);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA14: /* CMPSKIPU.LE */
|
||||||
|
{
|
||||||
|
strncpy(Name, "CMPSKIPU.LE", 19);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA15: /* CMPSKIPU.L */
|
||||||
|
{
|
||||||
|
strncpy(Name, "CMPSKIPU.L", 19);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: /* Unknown 1OPI*/
|
default: /* Unknown 1OPI*/
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -1220,32 +1187,18 @@ void eval_instruction(struct Instruction* c)
|
||||||
decode_1OP(c);
|
decode_1OP(c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x0E ... 0x2B: /* Core 2OPI */
|
case 0x0E ... 0x2B: /* 2OPI */
|
||||||
case 0xC0 ... 0xDF:
|
case 0xC0 ... 0xDF:
|
||||||
{
|
{
|
||||||
decode_Integer_2OPI(c);
|
decode_Integer_2OPI(c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x2C: /* Core 1OPI */
|
case 0x2C ... 0x2F: /* 1OPI */
|
||||||
|
case 0xA0 ... 0xA1:
|
||||||
{
|
{
|
||||||
decode_1OPI(c);
|
decode_1OPI(c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x2D: /* Branch 1OPI*/
|
|
||||||
{
|
|
||||||
decode_Branch_1OPI(c);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 0x2E: /* LOADR 1OPI */
|
|
||||||
{
|
|
||||||
decode_Load_1OPI(c);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 0x2F: /* STORER 1OPI*/
|
|
||||||
{
|
|
||||||
decode_Store_1OPI(c);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 0x3C: /* Core 0OPI */
|
case 0x3C: /* Core 0OPI */
|
||||||
{
|
{
|
||||||
decode_0OPI(c);
|
decode_0OPI(c);
|
||||||
|
|
101
vm.c
101
vm.c
|
@ -162,6 +162,16 @@ void CMPJUMPU_G(struct lilith* vm, struct Instruction* c);
|
||||||
void CMPJUMPU_GE(struct lilith* vm, struct Instruction* c);
|
void CMPJUMPU_GE(struct lilith* vm, struct Instruction* c);
|
||||||
void CMPJUMPU_LE(struct lilith* vm, struct Instruction* c);
|
void CMPJUMPU_LE(struct lilith* vm, struct Instruction* c);
|
||||||
void CMPJUMPU_L(struct lilith* vm, struct Instruction* c);
|
void CMPJUMPU_L(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);
|
||||||
|
|
||||||
/* Allocate and intialize memory/state */
|
/* Allocate and intialize memory/state */
|
||||||
struct lilith* create_vm(size_t size)
|
struct lilith* create_vm(size_t size)
|
||||||
|
@ -1871,6 +1881,96 @@ bool eval_Integer_1OPI(struct lilith* vm, struct Instruction* c)
|
||||||
STORER32(vm, c);
|
STORER32(vm, c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 0xA00: /* CMPSKIP.G */
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
strncpy(Name, "CMPSKIP.G", 19);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CMPSKIP_G(vm, c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA01: /* CMPSKIP.GE */
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
strncpy(Name, "CMPSKIP.GE", 19);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CMPSKIP_GE(vm, c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA02: /* CMPSKIP.E */
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
strncpy(Name, "CMPSKIP.E", 19);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CMPSKIP_E(vm, c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA03: /* CMPSKIP.NE */
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
strncpy(Name, "CMPSKIP.NE", 19);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CMPSKIP_NE(vm, c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA04: /* CMPSKIP.LE */
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
strncpy(Name, "CMPSKIP.LE", 19);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CMPSKIP_LE(vm, c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA05: /* CMPSKIP.L */
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
strncpy(Name, "CMPSKIP.L", 19);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CMPSKIP_L(vm, c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA10: /* CMPSKIPU.G */
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
strncpy(Name, "CMPSKIPU.G", 19);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CMPSKIPU_G(vm, c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA11: /* CMPSKIPU.GE */
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
strncpy(Name, "CMPSKIPU.GE", 19);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CMPSKIPU_GE(vm, c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA14: /* CMPSKIPU.LE */
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
strncpy(Name, "CMPSKIPU.LE", 19);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CMPSKIPU_LE(vm, c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0xA15: /* CMPSKIPU.L */
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
strncpy(Name, "CMPSKIPU.L", 19);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CMPSKIPU_L(vm, c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: return true;
|
default: return true;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -1959,6 +2059,7 @@ void eval_instruction(struct lilith* vm, struct Instruction* current)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x2C ... 0x2F: /* Integer 1OPI */
|
case 0x2C ... 0x2F: /* Integer 1OPI */
|
||||||
|
case 0xA0 ... 0xA1:
|
||||||
{
|
{
|
||||||
decode_1OPI(current);
|
decode_1OPI(current);
|
||||||
invalid = eval_Integer_1OPI(vm, current);
|
invalid = eval_Integer_1OPI(vm, current);
|
||||||
|
|
|
@ -1728,3 +1728,123 @@ void CMPJUMPU_L(struct lilith* vm, struct Instruction* c)
|
||||||
vm->ip = vm->ip + c->raw_Immediate - 4;
|
vm->ip = vm->ip + c->raw_Immediate - 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMPSKIP_G(struct lilith* vm, struct Instruction* c)
|
||||||
|
{
|
||||||
|
int32_t tmp1, tmp2;
|
||||||
|
tmp1 = (int32_t)(vm->reg[c->reg0]);
|
||||||
|
tmp2 = (int32_t)(c->raw_Immediate);
|
||||||
|
|
||||||
|
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)(c->raw_Immediate);
|
||||||
|
|
||||||
|
if(tmp1 >= tmp2)
|
||||||
|
{
|
||||||
|
vm->ip = vm->ip + 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMPSKIP_E(struct lilith* vm, struct Instruction* c)
|
||||||
|
{
|
||||||
|
uint16_t utmp1;
|
||||||
|
|
||||||
|
utmp1 = (uint16_t)(c->raw_Immediate);
|
||||||
|
|
||||||
|
if((vm->reg[c->reg0]) == utmp1)
|
||||||
|
{
|
||||||
|
vm->ip = vm->ip + 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMPSKIP_NE(struct lilith* vm, struct Instruction* c)
|
||||||
|
{
|
||||||
|
uint16_t utmp1;
|
||||||
|
|
||||||
|
utmp1 = (uint16_t)(c->raw_Immediate);
|
||||||
|
|
||||||
|
if((vm->reg[c->reg0]) != utmp1)
|
||||||
|
{
|
||||||
|
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)(c->raw_Immediate);
|
||||||
|
|
||||||
|
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)(c->raw_Immediate);
|
||||||
|
|
||||||
|
if(tmp1 < tmp2)
|
||||||
|
{
|
||||||
|
vm->ip = vm->ip + 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMPSKIPU_G(struct lilith* vm, struct Instruction* c)
|
||||||
|
{
|
||||||
|
uint16_t utmp1;
|
||||||
|
|
||||||
|
utmp1 = (uint16_t)(c->raw_Immediate);
|
||||||
|
|
||||||
|
if((vm->reg[c->reg0]) > utmp1)
|
||||||
|
{
|
||||||
|
vm->ip = vm->ip + 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMPSKIPU_GE(struct lilith* vm, struct Instruction* c)
|
||||||
|
{
|
||||||
|
uint16_t utmp1;
|
||||||
|
|
||||||
|
utmp1 = (uint16_t)(c->raw_Immediate);
|
||||||
|
|
||||||
|
if((vm->reg[c->reg0]) >= utmp1)
|
||||||
|
{
|
||||||
|
vm->ip = vm->ip + 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMPSKIPU_LE(struct lilith* vm, struct Instruction* c)
|
||||||
|
{
|
||||||
|
uint16_t utmp1;
|
||||||
|
|
||||||
|
utmp1 = (uint16_t)(c->raw_Immediate);
|
||||||
|
|
||||||
|
if((vm->reg[c->reg0]) <= utmp1)
|
||||||
|
{
|
||||||
|
vm->ip = vm->ip + 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMPSKIPU_L(struct lilith* vm, struct Instruction* c)
|
||||||
|
{
|
||||||
|
uint16_t utmp1;
|
||||||
|
|
||||||
|
utmp1 = (uint16_t)(c->raw_Immediate);
|
||||||
|
|
||||||
|
if((vm->reg[c->reg0]) < utmp1)
|
||||||
|
{
|
||||||
|
vm->ip = vm->ip + 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue