I am aware that we can set only one active bank at a time for 8051 using PSW.4
and PSW.3
, but is it in some way or trick possible to achieve selection of all banks at once?
You can't, at least address the register's name directly in an instruction. That's because 8051 instructions were designed to be encoded with a single byte, or a byte plus an immediate. That byte contains the opcode and 3 bits for the register number. Thus you can only encode 8 registers in the instruction
The registers are put in the general purpose memory region though, so you can access them at any time using memory access instructions. Of course that limits what you can do with registers in a different bank. For example you can move the R5 in bank 0 to the current R3 with MOV R3, 05h
because bank 0 lies in the address range 00h-07h
8 general-purpose registers R0–R7 may be accessed with instructions 1 byte shorter than others. They are mapped to IRAM between 0x00 and 0x1F. Only 8 bytes of that range are used at any given time, determined by the two bank select bits in the PSW.
Banking is a simple way to increase the total addressable memory with a limited address range. Here Intel used it to address 32 registers with 3 bits, but of course you can access only 8 of them at a time. But some instructions have even fewer bits to encode the registers and you can only specify R0 or R1 like MOV @R0/1,#data
See also