X-Git-Url: http://git.joshuawise.com/fpgaboy.git/blobdiff_plain/81358c71b258a72a2777bba0a0b4a82a7cae298a..7254c55153659ca2234262261101e1fe1d3aab78:/insn_push_reg.v?ds=inline diff --git a/insn_push_reg.v b/insn_push_reg.v index 7a32301..6b789e5 100644 --- a/insn_push_reg.v +++ b/insn_push_reg.v @@ -1,30 +1,22 @@ `ifdef EXECUTE `INSN_PUSH_reg: begin /* PUSH is 16 cycles! */ case (cycle) - 0: begin - wr <= 1; - address <= {registers[`REG_SPH],registers[`REG_SPL]}-1; - case (opcode[5:4]) - `INSN_stack_AF: wdata <= registers[`REG_A]; - `INSN_stack_BC: wdata <= registers[`REG_B]; - `INSN_stack_DE: wdata <= registers[`REG_D]; - `INSN_stack_HL: wdata <= registers[`REG_H]; - endcase - end - 1: begin - wr <= 1; - address <= {registers[`REG_SPH],registers[`REG_SPL]}-2; - case (opcode[5:4]) - `INSN_stack_AF: wdata <= registers[`REG_F]; - `INSN_stack_BC: wdata <= registers[`REG_C]; - `INSN_stack_DE: wdata <= registers[`REG_E]; - `INSN_stack_HL: wdata <= registers[`REG_L]; - endcase - end + 0: case (opcode[5:4]) + `INSN_stack_AF: `EXEC_WRITE(`_SP - 1, `_A) + `INSN_stack_BC: `EXEC_WRITE(`_SP - 1, `_B) + `INSN_stack_DE: `EXEC_WRITE(`_SP - 1, `_D) + `INSN_stack_HL: `EXEC_WRITE(`_SP - 1, `_H) + endcase + 1: case (opcode[5:4]) + `INSN_stack_AF: `EXEC_WRITE(`_SP - 2, `_F) + `INSN_stack_BC: `EXEC_WRITE(`_SP - 2, `_C) + `INSN_stack_DE: `EXEC_WRITE(`_SP - 2, `_E) + `INSN_stack_HL: `EXEC_WRITE(`_SP - 2, `_L) + endcase 2: begin /* Twiddle thumbs. */ end 3: begin - `EXEC_NEWCYCLE; - `EXEC_INC_PC; + `EXEC_NEWCYCLE + `EXEC_INC_PC end endcase end @@ -36,8 +28,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