# INeedSomeExplanation

 Classic List Threaded
4 messages
Reply | Threaded
Open this post in threaded view
|

## INeedSomeExplanation

 Why is the memory address space dedicated to only 15 bits rather than 16?Thanks for the answer..
Reply | Threaded
Open this post in threaded view
|

## Re: INeedSomeExplanation

 Administrator 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
Reply | Threaded
Open this post in threaded view
|

## Re: INeedSomeExplanation

 Thx. for the answer. I think i understand it now.
Reply | Threaded
Open this post in threaded view
|

## Re: INeedSomeExplanation

 In reply to this post by cadet1620 Could this be solved by creating a third register? We would have the Instruction (I), D and A Registers. This way it wouldn't have to use the MSB as anything in I would always be an instruction. Maybe I'm missing the point... Thanks