]> Joshua Wise's Git repositories - fpgaboy.git/blame - core/insn_ldm16_a.v
Fix some flag bugs in INC and DEC
[fpgaboy.git] / core / insn_ldm16_a.v
CommitLineData
e7fe9dc2
JW
1`define INSN_LD16M_A 9'b0111x1010 // 1111 for ld A, x; 1110 for ld x, A; bit 1 specifies 16m8 or 8m8
2
f9000d73
JW
3// If opcode[4], then ld A, x, else ld x, A
4// If opcode[1], then ld 16m8, else ld 8m8
5
6`ifdef EXECUTE
fe3dc890 7 `INSN_LD16M_A: begin
f9000d73
JW
8 case (cycle)
9 0: begin
10 `EXEC_INC_PC
11 `EXEC_READ(`_PC + 16'h0001)
12 end
13 1: begin
14 `EXEC_INC_PC // we only hit here if 16m8
15 `EXEC_READ(`_PC + 16'h0001)
16 end
17 2: if (opcode[4]) // LD A,x
f6fa1d6e 18 `EXEC_READ(({rdata, tmp}))
f9000d73 19 else
f6fa1d6e 20 `EXEC_WRITE(({rdata, tmp}), `_A)
f9000d73
JW
21 3: begin
22 `EXEC_NEWCYCLE
23 `EXEC_INC_PC
24 end
25 endcase
26 end
27`endif
28
29`ifdef WRITEBACK
fe3dc890 30 `INSN_LD16M_A: begin
f9000d73 31 case (cycle)
fe3dc890 32 0: begin end
f6fa1d6e
JW
33 1: tmp <= rdata;
34 2: begin end
f9000d73
JW
35 3: if (opcode[4]) `_A <= rdata;
36 endcase
37 end
38`endif
39
This page took 0.03526 seconds and 4 git commands to generate.