Author Topic: Opcodes and Memory  (Read 687 times)

This is a question for all you serious computer geeks.

Say I have a 8 bit RAM chip. With 8 address pins, I should be able to access all 256 bytes of data.

However, lets say I also want to store a 3 bit operation code. I want to do a LOAD instruction which in binary is, lets say, 111. This means that if i want to load from the 245th byte I physically cannot due to having only 5 bits free to address the byte that i want, and with 5 bits I can only address 32 bytes.

Help me forums, tell me how the Commodore 64 did it!


Uh, what.

Space:
256 bytes

Usage:
3 bits (LOAD operation)
5 bits (memory address)

3 bits + 5 bits = 8 bits

You're only using a single byte out of those 256 bytes?
Unless you're talking about something completely different (CPU register size)?
« Last Edit: April 12, 2013, 11:05:36 AM by Port »




Uh, what.

Space:
256 bytes

Usage:
3 bits (LOAD operation)
5 bits (memory address)

3 bits + 5 bits = 8 bits

You're only using a single byte out of those 256 bytes?
Unless you're talking about something completely different (CPU register size)?

I dont think you understand. I probably mixed up bytes and bits at some point...

(everything below is fictional)

My cpu is 8 bit and has a total of 8 address pins, so the maximum number of bytes that I can address max out at 256 bytes. I want to do a load function. I want to load the address FF into my only register. The load function takes up the first 3 bits of the available 8 bits in the byte of memory that I am executing. So I have now 5 bits left to tell the CPU from where to load the value into the register (The register is loaded into by default). But I cannot address the value FF with 5 bits! with 5 bits the maximum number that i can create is 1F!

What dooooo
« Last Edit: April 12, 2013, 11:23:10 AM by D3ATH LORD »



Just woke up and someone alerted me of this topic. What CPU are you writing your code for? The only thing that you've told us is that you're seemingly using an 8-bit multiplexed CPU though there should be a few memory cycles to allow you to transfer a full byte of data as well as address using a full byte of data using a latched address set up after a cycle/a few cycles. If that's not possible and you also don't have any segment registers (which wouldn't make sense to have at this point considering that you already have eight bit registers) then what you want just isn't happening.

Just woke up and someone alerted me of this topic. What CPU are you writing your code for? The only thing that you've told us is that you're seemingly using an 8-bit multiplexed CPU though there should be a few memory cycles to allow you to transfer a full byte of data as well as address using a full byte of data using a latched address set up after a cycle/a few cycles. If that's not possible and you also don't have any segment registers (which wouldn't make sense to have at this point considering that you already have eight bit registers) then what you want just isn't happening.

I'm making a CPU in a program called Logisim http://ozark.hendrix.edu/~burch/logisim/

I haven't got much knowledge but slowly I am getting there. Either way I consulted my dad and he said just make the addressing and opcode a few cycles long to make up for the lack of space

Oh haha, that's actually an awesome program. Glad you got everything sorted out though.

Oh haha, that's actually an awesome program. Glad you got everything sorted out though.

If you've used it before for similar projects, then I'd be very glad if you shared some of your creations :)