• Forum
  • Lounge
  • Any Way to Raise the Size of The PC Regi

 
Any Way to Raise the Size of The PC Register? + More Questions

closed account (N36fSL3A)
I've been screwing around with the 8051 microcontroller recently and I was just wondering if it's possible to somehow raise the size of the PC register since it can only support up to a 64k executable.
Last edited on
Perhaps with a microscope and some very tiny tools; otherwise, no.
Last edited on
closed account (N36fSL3A)
What about ram bank switching? I heard NES games do it so why can't I? How would I do this?
Last edited on
I've been screwing around with the 8051 microcontroller recently and I was just wondering if it's possible to somehow raise the size of the PC register since it can only support up to a 64k executable.


Technically.... it can only address 64K or memory. There's a difference.

For example... the NES had this same limitation and it overcame it by putting swapping hardware on the cartridge. IE: "pages" or "banks" of the program could be swapped out and replaced with different banks.

So while you can't really modify the register itself to make it larger... you can alter the memory mapping behavior so reads can address a larger executable. It'll typically involve some additional logic to transform the Address lines on the bus as well as an additional register.



EDIT: Apparently you ninja'd me with a question asking about what I just mentioned.


NES carts had additional hardware that monitored the address lines on the bus and filtered/changed them before passing it to the memory chip to actually fetch the memory.

Mapper 7 (AxROM) was a simple example of this. It had one additional register used to select a bank.

ROM is typically accessed via addresses $8000-FFFF. AxROM "swapped out" the memory in 32K blocks. So depending on which bank was swapped in, you'd get different results when reading.

IE reading $8000 would get you the below byte in memory depending on the currently selected bank:

Page 0: ROM[0x00000]
Page 1: ROM[0x08000]
Page 2: ROM[0x10000]
Page 3: ROM[0x18000]
... etc

this was accomplished simply by taking the address bits, masking out the high bit, and replacing it with the contents of the page select register.

Pseudocode to give you the idea (of course, this would be done by hardware):
1
2
3
4
5
address = address_requested_by_cpu;
address &= 0x7FFF;  // chop off the $8000 bit
address |= (page_select_register << 15);  // replace upper bits with the selected page

return romchip[ address ];


Last edited on
closed account (N36fSL3A)
Alright I understand. Thanks.
Last edited on
closed account (N36fSL3A)
I have another question, seems like I'd be a waste to make another topic. How can I power this PC fan with this microcontroller?

I've set the black wire to the ground, and I've connected the red wire to a live pin. Each pin outputs ~5 volts DC and the fan normally operates at 12 DC. I ran it off of a 9 volt battery before, I know I'm really pushing it with 5 volts, but it doesn't even move.
Well, get a 5volts fan, or get a 12volts supply.
closed account (N36fSL3A)
I just want to see how to power something with the microcontroller. It doesn't really matter what I use, I just want to power something with it.
Topic archived. No new replies allowed.