Rework it all to use the new macros.
[fpgaboy.git] / insn_rst.v
index 8752034..4b65032 100644 (file)
@@ -1,23 +1,12 @@
 `ifdef EXECUTE
        `INSN_RST: begin
                case (cycle)
-               0:      begin
-                               `EXEC_INC_PC;           // This goes FIRST in RST
-                       end
-               1:      begin
-                               wr <= 1;
-                               address <= {registers[`REG_SPH],registers[`REG_SPL]}-1;
-                               wdata <= registers[`REG_PCH];
-                       end
-               2:      begin
-                               wr <= 1;
-                               address <= {registers[`REG_SPH],registers[`REG_SPL]}-2;
-                               wdata <= registers[`REG_PCL];
-                       end
+               0:      `EXEC_INC_PC            // This goes FIRST in RST
+               1:      `EXEC_WRITE(`_SP - 1, `_PCH)
+               2:      `EXEC_WRITE(`_SP - 2, `_PCL)
                3:      begin
-                               `EXEC_NEWCYCLE;
-                               {registers[`REG_PCH],registers[`REG_PCL]} <=
-                                       {10'b0,opcode[5:3],3'b0};
+                               `EXEC_NEWCYCLE
+                               `_PC <= {10'b0,opcode[5:3],3'b0};
                        end
                endcase
        end
@@ -29,8 +18,7 @@
                0:      begin /* type F */ end
                1:      begin /* type F */ end
                2:      begin /* type F */ end
-               3:      {registers[`REG_SPH],registers[`REG_SPL]} <=
-                               {registers[`REG_SPH],registers[`REG_SPL]}-2;
+               3:      `_SP <= `_SP - 2;
                endcase
        end
 `endif
This page took 0.017571 seconds and 4 git commands to generate.