]> Joshua Wise's Git repositories - fpgaboy.git/blobdiff - core/insn_add_hl.v
Move the core to core/
[fpgaboy.git] / core / insn_add_hl.v
diff --git a/core/insn_add_hl.v b/core/insn_add_hl.v
new file mode 100644 (file)
index 0000000..8ff25f4
--- /dev/null
@@ -0,0 +1,33 @@
+`ifdef EXECUTE
+       `INSN_ADD_HL: begin
+               case (cycle)
+               0:      case (opcode[5:4])
+                       `INSN_reg16_BC: {tmp,tmp2} <= `_BC;
+                       `INSN_reg16_DE: {tmp,tmp2} <= `_DE;
+                       `INSN_reg16_HL: {tmp,tmp2} <= `_HL;
+                       `INSN_reg16_SP: {tmp,tmp2} <= `_SP;
+                       endcase
+               1:      begin
+                               `EXEC_INC_PC
+                               `EXEC_NEWCYCLE
+                       end
+               endcase
+       end
+`endif
+
+`ifdef WRITEBACK
+       `INSN_ADD_HL: begin
+               case (cycle)
+               0:      {tmp,tmp2} <= `_HL + {tmp,tmp2};
+               1:      begin
+                               `_F <=  { /* Z */ `_F[7],
+                                         /* N */ 1'b0,
+                                         /* H */ (({`_HL} + {tmp,tmp2}) & 16'h1000) ? 1'b1 : 1'b0,
+                                         /* C */ (({1'b0,`_HL} + {1'b0,tmp,tmp2}) >> 16 == 1) ? 1'b1 : 1'b0,
+                                         `_F[3:0]
+                                       };
+                               `_HL <= {tmp, tmp2};
+                       end
+               endcase
+       end
+`endif
This page took 0.016579 seconds and 4 git commands to generate.