X-Git-Url: http://git.joshuawise.com/fpgaboy.git/blobdiff_plain/e7fe9dc201afb96f401fb2d3cf5aa19aa7e8e796..refs/heads/master:/core/insn_incdec_hl.v 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