Fix insn_bit. HOLY SHIT THE BOOT ROM WORKS c.c
[fpgaboy.git] / insn_call-callcc.v
1 `ifdef EXECUTE
2         `INSN_CALL,`INSN_CALLCC: begin
3                 case (cycle)
4                 0:      begin
5                                 `EXEC_INC_PC
6                                 `EXEC_READ(`_PC + 1)
7                         end
8                 1:      begin
9                                 `EXEC_INC_PC
10                                 `EXEC_READ(`_PC + 1)
11                         end
12                 2:      begin
13                                 `EXEC_INC_PC
14                                 if (!opcode[0]) // i.e., is callcc
15                                         /* We need to check the condition code to bail out. */
16                                         case (opcode[4:3])
17                                         `INSN_cc_NZ:    if (`_F[7]) `EXEC_NEWCYCLE
18                                         `INSN_cc_Z:     if (~`_F[7]) `EXEC_NEWCYCLE
19                                         `INSN_cc_NC:    if (`_F[4]) `EXEC_NEWCYCLE
20                                         `INSN_cc_C:     if (~`_F[4]) `EXEC_NEWCYCLE
21                                         endcase
22                         end
23                 3:      `EXEC_WRITE(`_SP - 1, `_PCH)
24                 4:      `EXEC_WRITE(`_SP - 2, `_PCL)
25                 5:      `EXEC_NEWCYCLE
26                 endcase
27         end
28 `endif
29
30 `ifdef WRITEBACK
31         `INSN_CALL,`INSN_CALLCC: begin
32                 case (cycle)
33                 0:      begin /* type F */ end
34                 1:      tmp <= rdata;   // tmp contains newpcl
35                 2:      tmp2 <= rdata;  // tmp2 contains newpch
36                 3:      begin /* type F */ end
37                 4:      `_PCH <= tmp2;
38                 5:      begin
39                                 `_PCL <= tmp;
40                                 `_SP <= `_SP - 2;
41                         end
42                 endcase
43         end
44 `endif
This page took 0.019243 seconds and 4 git commands to generate.