X-Git-Url: http://git.joshuawise.com/fpgaboy.git/blobdiff_plain/eaec80f24007825c7abba2affd76f74d520ce4cd..6c1f3ad98ccd156be88c4011206605d127abee74:/core/insn_incdec_hl.v?ds=sidebyside diff --git a/core/insn_incdec_hl.v b/core/insn_incdec_hl.v index 1406fd8..656353a 100644 --- a/core/insn_incdec_hl.v +++ b/core/insn_incdec_hl.v @@ -4,7 +4,10 @@ `INSN_INCDEC_HL: begin case (cycle) 0: `EXEC_READ(`_HL) - 1: `EXEC_WRITE(`_HL, rdata + (opcode[0] ? 8'hFF : 8'h01)) + 1: begin + `EXEC_WRITE(`_HL, rdata + (opcode[0] ? 8'hFF : 8'h01)) + tmp <= rdata + (opcode[0] ? 8'hFF : 8'h01); + end 2: begin `EXEC_INC_PC `EXEC_NEWCYCLE @@ -15,6 +18,12 @@ `ifdef WRITEBACK `INSN_INCDEC_HL: begin - /* meh meh */ + if (cycle == 1) + `_F <= { + (tmp == 8'h00) ? 1'b1 : 1'b0, /* Z */ + opcode[0], /* N */ + (tmp[3:0] == (opcode[0] ? 4'hF : 4'h0)) ? 1'b1 : 1'b0, + `_F[4:0] + }; end `endif