# HG changeset patch # User Michael Pavone # Date 1419917777 28800 # Node ID 3072fb746601565ea5714abcb7d49b806ad6c188 # Parent abc834e4a52081271bb34edea7cf8c390a063410 Added support for JR and JRcc in Z80 test generator diff -r abc834e4a520 -r 3072fb746601 ztestgen.c --- a/ztestgen.c Mon Dec 29 21:24:12 2014 -0800 +++ b/ztestgen.c Mon Dec 29 21:36:17 2014 -0800 @@ -289,7 +289,7 @@ 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 @@ 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 @@ 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 @@ 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; }