Fix add sp, imm8 *sweatdrop*
[fpgaboy.git] / core / insn_add_hl.v
CommitLineData
e7fe9dc2
JW
1`define INSN_ADD_HL 9'b000xx1001
2
00a4c19f
JW
3`ifdef EXECUTE
4 `INSN_ADD_HL: begin
5 case (cycle)
6 0: case (opcode[5:4])
7 `INSN_reg16_BC: {tmp,tmp2} <= `_BC;
8 `INSN_reg16_DE: {tmp,tmp2} <= `_DE;
9 `INSN_reg16_HL: {tmp,tmp2} <= `_HL;
10 `INSN_reg16_SP: {tmp,tmp2} <= `_SP;
11 endcase
12 1: begin
13 `EXEC_INC_PC
14 `EXEC_NEWCYCLE
15 end
16 endcase
17 end
18`endif
19
20`ifdef WRITEBACK
21 `INSN_ADD_HL: begin
22 case (cycle)
23 0: {tmp,tmp2} <= `_HL + {tmp,tmp2};
24 1: begin
25 `_F <= { /* Z */ `_F[7],
26 /* N */ 1'b0,
27 /* H */ (({`_HL} + {tmp,tmp2}) & 16'h1000) ? 1'b1 : 1'b0,
28 /* C */ (({1'b0,`_HL} + {1'b0,tmp,tmp2}) >> 16 == 1) ? 1'b1 : 1'b0,
29 `_F[3:0]
30 };
31 `_HL <= {tmp, tmp2};
32 end
33 endcase
34 end
35`endif
This page took 0.018436 seconds and 4 git commands to generate.