Re: How could direct memory access be implemented?
To include a memory address would require a longer instruction word. RISC computers generally do this with a fixed size instruction. For the Hack computer, that would mean all instructions would be 32-bits and programs would be twice as long.
Other computers, for example the x86 family use variable length instructions; their length depends upon addressing modes in the initial byte(s) of the instruction. Depending on the instruction, it can take multiple clock cycles to read the entire instruction.
One of the unused C-instruction bits could be used to mean "direct addressing" which would cause the CPU to read the address to be used from the following word. The instruction, therefore, would require two words of RAM and two clocks to execute.
This direct addressing instruction would not be much different than an an A-instruction, C-instruction sequence, except that it would not disrupt the A register.
It would be a lot of work to add this to the current CPU design.
(Very similar to direct addressing mode is immediate addressing mode, where the address field in the instruction is used as a data value. This would allow instructions like D=D+42. It would be almost free to add immediate mode when adding direct addressing.)