Loading 16-bit Memory Addresses

Today I have achieved a very important milestone in my CPU project: I’m able to load 16-bit Memory Addresses (into registers) from my 8-bit wide data bus. Huh, how should that work? 16-bit addresses with an 8-bit wide data bus? To accomplish this goal I’m using here a technique that I have “borrowed” from the Intel x86 architecture:

My CPU has a 16-bit wide X register, which is internally split into two 8-bit wide registers: XL (the lower 8 bits) and XH (the upper 8 bits). It’s the same as the AX register on the x86 platform, which internally uses the AL and AH register:

The X Register in action!

The X register can be therefore accessed in 3 different ways (it uses internally multiple 2-to-1 selectors to switch between the data and address bus):

  • X (connected to the 16-bit wide address bus)
  • XL (connected to the 8-bit wide data bus)
  • XH (connected to the 8-bit wide data bus)

All my other 16-bit wide registers are only accessed through the 16-bit wide address bus (the 2 internal used 8-bit wide registers can’t be accessed directly for simplification). When you now want to initialize e.g. the stack pointer (which is stored in the SP register), you just need to execute the following code:

This code can be already physically executed on my CPU. The only thing that is currently not yet implemented is the MOV operation between the individual 16-bit wide registers (but this is only a soldering task…)

Thanks for your time,

-Klaus

 

Comments are closed.