diff options
author | Michael Pavone <pavone@retrodev.com> | 2014-12-29 21:36:17 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2014-12-29 21:36:17 -0800 |
commit | c6beba019312aaaf7bd8718bb239b7c632477852 (patch) | |
tree | 158b37537a9ce1af9d541676e1a6049e384e21ba | |
parent | ef7df44f69080781c0e2e22977ef3cf2877b5337 (diff) |
Added support for JR and JRcc in Z80 test generator
-rw-r--r-- | ztestgen.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -289,7 +289,7 @@ void z80_gen_test(z80inst * inst, uint8_t *instbuf, uint8_t instlen) reg_usage[inst->reg] = 1; } uint8_t counter_reg = Z80_UNUSED; - if (inst->op == Z80_JP || inst->op == Z80_JPCC) { + if (inst->op >= Z80_JP && inst->op <= Z80_JRCC) { counter_reg = alloc_reg8(reg_usage, reg_values, 0); } puts("--------------"); @@ -366,6 +366,8 @@ void z80_gen_test(z80inst * inst, uint8_t *instbuf, uint8_t instlen) uint16_t address = cur - prog + 3 + i; //2 for immed address, 1/2 for instruction(s) to skip *(cur++) = address; *(cur++) = address >> 8; + } else if(inst->op == Z80_JR || inst->op == Z80_JRCC) { + *(cur++) = 1 + i; //skip one or 2 instructions based on value of i } else if (addr_mode == Z80_IMMED & inst->op != Z80_IM) { *(cur++) = inst->immed & 0xFF; if (word_sized) { @@ -381,7 +383,7 @@ void z80_gen_test(z80inst * inst, uint8_t *instbuf, uint8_t instlen) if (instlen == 3) { *(cur++) = instbuf[2]; } - if (inst->op == Z80_JP || inst->op == Z80_JPCC) { + if (inst->op >= Z80_JP && inst->op <= Z80_JRCC) { cur = inc_r(cur, counter_reg); if (i) { //inc twice on second iteration so we can differentiate the two @@ -462,7 +464,7 @@ void z80_gen_test(z80inst * inst, uint8_t *instbuf, uint8_t instlen) uint8_t should_skip(z80inst * inst) { - return inst->op >= Z80_JR || (inst->op >= Z80_LDI && inst->op <= Z80_CPDR) || inst->op == Z80_HALT + return inst->op >= Z80_DJNZ || (inst->op >= Z80_LDI && inst->op <= Z80_CPDR) || inst->op == Z80_HALT || inst->op == Z80_DAA || inst->op == Z80_RLD || inst->op == Z80_RRD || inst->op == Z80_NOP || inst->op == Z80_DI || inst->op == Z80_EI; } |