X-Git-Url: http://git.joshuawise.com/fpgaboy.git/blobdiff_plain/b057a5d6e6db6db06ae33703ca72cd235eec91d6..99b9687942367fd256a797bcd1f67fec07f92a37:/core/insn_incdec_hl.v diff --git a/core/insn_incdec_hl.v b/core/insn_incdec_hl.v index abfe495..656353a 100644 --- a/core/insn_incdec_hl.v +++ b/core/insn_incdec_hl.v @@ -1,8 +1,13 @@ +`define INSN_INCDEC_HL 9'b00011010x + `ifdef EXECUTE `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 @@ -13,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