]> Joshua Wise's Git repositories - fpgaboy.git/blob - core/insn_ldm16_a.v
First attempt at fixing DAA. Add ld (nn), sp.
[fpgaboy.git] / core / insn_ldm16_a.v
1 `define INSN_LD16M_A            9'b0111x1010    // 1111 for ld A, x; 1110 for ld x, A; bit 1 specifies 16m8 or 8m8
2
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
7         `INSN_LD16M_A: begin
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
18                                 `EXEC_READ(({rdata, tmp}))
19                         else
20                                 `EXEC_WRITE(({rdata, tmp}), `_A)
21                 3:      begin
22                                 `EXEC_NEWCYCLE
23                                 `EXEC_INC_PC
24                         end
25                 endcase
26         end
27 `endif
28
29 `ifdef WRITEBACK
30         `INSN_LD16M_A: begin
31                 case (cycle)
32                 0:      begin end
33                 1:      tmp <= rdata;
34                 2:      begin end
35                 3:      if (opcode[4]) `_A <= rdata;
36                 endcase
37         end
38 `endif
39
This page took 0.026312 seconds and 4 git commands to generate.