]> Joshua Wise's Git repositories - fpgaboy.git/blob - insn_ldm_a.v
Some LCDC IRQ stuffs. Working on fixing ldm_a
[fpgaboy.git] / insn_ldm_a.v
1 // If opcode[4], then ld A, x, else ld x, A
2 // If opcode[1], then ld 16m8, else ld 8m8
3
4 `ifdef EXECUTE
5         `INSN_LD8M_A,`INSN_LD16M_A: begin
6                 case (cycle)
7                 0:      begin
8                                 `EXEC_INC_PC
9                                 `EXEC_READ(`_PC + 16'h0001)
10                         end
11                 1:      begin
12                                 `EXEC_INC_PC                    // we only hit here if 16m8
13                                 `EXEC_READ(`_PC + 16'h0001)
14                         end
15                 2:      if (opcode[4])  // LD A,x
16                                 `EXEC_READ(({tmp, tmp2}))
17                         else
18                                 `EXEC_WRITE(({tmp, tmp2}), `_A)
19                 3:      begin
20                                 `EXEC_NEWCYCLE
21                                 `EXEC_INC_PC
22                         end
23                 endcase
24         end
25 `endif
26
27 `ifdef WRITEBACK
28         `INSN_LD8M_A,`INSN_LD16M_A: begin
29                 case (cycle)
30                 0:      if (!opcode[1]) begin
31                                 tmp <= 8'hFF;
32                                 cycle <= 1;     /* Skip cycle 1 */
33                         end
34                 1:      tmp2 <= rdata;
35                 2:      if (!opcode[1])
36                                 tmp2 <= rdata;
37                         else
38                                 tmp <= rdata; 
39                 3:      if (opcode[4]) `_A <= rdata;
40                 endcase
41         end
42 `endif
43
This page took 0.031074 seconds and 4 git commands to generate.