kimusichesed wrote
Why is the memory address space dedicated to only 15 bits rather than 16?
The architecture of the Hack Computer requires that the target address for jumps be in the A register. Since the MSB of the instructions is used to identify the type of instruction, only 15 bits of data are available in A-instructions. This means that two instructions are required to load a 16-bit constant into the A register.
Limiting the address space to 15 bits keeps thing as simple as possible.
If the address space was 16 bits, then a simple instruction sequence like
@Target
0;JMP
must be expanded by the assembler if Target has its MSB set. The generated code will need to be
@!Target
A=!A
0;JMP
A simple 2-pass assembler will need to assume that all A-commands might need two instructions, so the vast majority of them will be wasting a memory word. The alternative is to make an optimizing assembler that determines which A-commands need the extra instruction. This is a rather complex operation that occurs between pass 1 and pass 2.
--Mark