Memories are 16bits, but can only address 15bits?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Memories are 16bits, but can only address 15bits?

seamuswc
On page 63, chapter 4, the book says that

    'Both memories are 16-bit wide and have 15-bit address space, meaning that the maximum addressable              
    size of each memory is 32K 16-bit words.'

Why does it only have a 15-bit address space, if it is 16-bits wide.
Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Memories are 16bits, but can only address 15bits?

cadet1620
Administrator
The reason that the Hack Computer only has a 15-bit address space is that it is problematic to deal with addresses that have bit 15 set.

For example, consider if the SCREEN was at 0xC000 (49152). Since this number is too big to load into the A register using the @ command, you would need to do something like
    @16384
    A=-A
every time you needed to access the screen.

This is even more problematic for code labels. Think about what the assembler will need to do to handle
    @WHEREVER
    0;JMP
It won't know during pass 1 where WHEREVER will be so it must assume that it will need 2 ROM locations for all @SYMBOL instructions.

--Mark