]> Joshua Wise's Git repositories - fpgaboy.git/blobdiff - core/insn_incdec_hl.v
Fix flags bugs in tests 6 and 8
[fpgaboy.git] / core / insn_incdec_hl.v
index 1406fd8b9890e77a3ff7065663001c440ebd9954..656353a0fd754f369676b5c12333b5516140639d 100644 (file)
@@ -4,7 +4,10 @@
        `INSN_INCDEC_HL: begin
                case (cycle)
                0:      `EXEC_READ(`_HL)
        `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
                2:      begin
                                `EXEC_INC_PC
                                `EXEC_NEWCYCLE
 
 `ifdef WRITEBACK
        `INSN_INCDEC_HL: begin
 
 `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
        end
 `endif
This page took 0.023976 seconds and 4 git commands to generate.