]> Joshua Wise's Git repositories - fpgaboy.git/blobdiff - insn_ldx_ahl.v
Split out more insns
[fpgaboy.git] / insn_ldx_ahl.v
diff --git a/insn_ldx_ahl.v b/insn_ldx_ahl.v
new file mode 100644 (file)
index 0000000..a16d6ba
--- /dev/null
@@ -0,0 +1,35 @@
+`ifdef EXECUTE
+       `INSN_LDx_AHL: begin
+               case (cycle)
+               0:      begin
+                               address <= {registers[`REG_H],registers[`REG_L]};
+                               if (opcode[3]) begin    // LDx A, (HL)
+                                       rd <= 1;
+                               end else begin
+                                       wr <= 1;
+                                       wdata <= registers[`REG_A];
+                               end
+                       end
+               1:      begin
+                               `EXEC_NEWCYCLE;
+                               `EXEC_INC_PC;
+                       end
+               endcase
+       end
+`endif
+
+`ifdef WRITEBACK
+       `INSN_LDx_AHL: begin
+               case (cycle)
+               0:      begin /* Type F */ end
+               1:      begin
+                               if (opcode[3])
+                                       registers[`REG_A] <= rdata;
+                               {registers[`REG_H],registers[`REG_L]} <=
+                                       opcode[4] ? // if set, LDD, else LDI
+                                       ({registers[`REG_H],registers[`REG_L]} - 1) :
+                                       ({registers[`REG_H],registers[`REG_L]} + 1);
+                       end
+               endcase
+       end
+`endif
This page took 0.022869 seconds and 4 git commands to generate.