whoa... I think you need to review the
Project 5 slides and book pdf's. The CPU chip was the most difficult for me, and this Memory chip was, I think, the second hardest to get my head around. (and it probably helps to do the CPU first, if you haven't already)
I tried to diagram what you've implemented, and I can't tell what its trying to do. (and when you say "works", for your smaller Chip, Copy -- what exactly do you mean by "works"? In what way does it work?)
To start with, let's looks at slide 5 (or 18)...
Notice that the Memory chip has information flowing both to and from the bus(es). That's what the "load" bit is for, to control when to read and when to write. Now see slide 22-25 (will probably make more sense with the video).
Now, let's look at Dia 5.6 on p17 in the book...
Notice the address space is divided into sections
0-16,383 -- addresses the 16K RAM
16,384-24,575 -- addresses the screen
24576 -- addresses the keyboard
It also shows those same values as Hex:
0x0000-0x5FFF: accessing an address in this range results in accessing the RAM.
0x4000-0x5FFF: accessing an address in this range results in accessing the Screen.
0x6000: accessing this address results in accessing the Keyboard. (anything above in invalid)
But I actually find it easier to view these values in binary:
// 16-bit address [0..15] bx0000 0000 0000 0000 -- not used (reference only)
// 15-bit address [0..14] bx000 0000 0000 0000 -- this memory chip in/out 0x0000 - 0x7fff
// 14-bit address [0..13] bx00 0000 0000 0000 -- Ram16k in/out 0x0000 - 0x3fff
// 13-bit address [0..12] bx0 0000 0000 0000 -- Screen in/out 0x4000 - 0x5fff
// 0000 0000 0000 0000 -- start 0x0000 -
// 0011 1111 1111 1111 -- end - 0x3fff
// 0100 0000 0000 0000 -- start 0x4000 -
// 0101 1111 1111 1111 -- end - 0x5fff
// 1-bit address ~~~~~~~ 0110 0000 0000 0000 -- Keyboard out 0x6000
// ^^
// truth table 00 -- ram16K (low8K)
// bits 15 and 14 01 -- ram16K (high8K)
// address[13..14] 10 -- screen
// 11 -- kbd
Notice bits 14 and 15, looking up the columns, looks like a truth table, no? (think about how to use these to
select which sections of memory to read or write to and from.)
Finally, looks at Dia 5.9 on p24 to see how the CPU and Memory chips connect together. Pay attention to the various inputs and outputs and control bits.
I hope this helps.