• Home
  • Help
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search

 
  • 0 Vote(s) - 0 Average

Indirect addressing

#1
01-05-2021, 11:44 PM
You recall how processors fetch data from memory using different modes. I tried explaining indirect addressing to my buddy last week and he got it quick. It lets an instruction point to a spot holding the real address instead of the data itself. You end up with an extra memory access that way. That extra step slows things down sometimes but gives flexibility in code.
I see you nodding along so far. Indirect addressing hides the actual location behind another pointer. You load an address into a register or memory cell first. Then the instruction grabs that value to reach the target. Processors like older x86 chips used this trick often for dynamic jumps. It helps when programs swap data blocks around without rewriting every command.
Now think about loops that handle varying arrays. You set up a base pointer and let indirect mode fetch offsets from it. The CPU reads the pointer value then jumps to wherever it points. This avoids hardcoding locations every time the array shifts. I messed up my first assembly project by forgetting that second fetch. But you learn fast once errors pop up in the debugger.
Perhaps your code needs to call functions at runtime addresses. Indirect addressing shines there by storing the target in a table. The instruction just grabs from the table and goes. It keeps modules separate without fixed links. Or maybe you tweak memory maps on the fly in embedded setups. That mode lets pointers update without touching the main instruction stream.
Also consider security angles in older systems. Indirect jumps can leak if pointers get corrupted. You watch for those bugs in kernel code. I patched a few drivers back then using direct modes instead for speed. Yet indirect keeps things modular when modules load dynamically.
You mix it with other modes too like indexed for complex calculations. The processor first resolves the indirect part then adds the index. That combo handles structures with variable bases nicely. I built a parser once relying on this for token tables. Sentences flowed better in assembly after that.
But watch the cycle count pile up from those fetches. Modern pipelines stall more on indirect stuff than straight loads. You optimize by prefetching pointers ahead in tight loops. Perhaps cache misses hit harder here too since addresses scatter. I tested benchmarks showing ten percent slowdowns in pointer heavy apps.
Now layer in multiple levels of indirection for linked lists. One address leads to another that leads further. Processors limit depth usually to avoid infinite loops in hardware. You code carefully to stay under those bounds. It supports recursion simulation without stack overflows in some designs.
I recall architecture papers on RISC versus CISC debating this mode. CISC kept it for compatibility while RISC dropped extras for simplicity. You see traces in ARM modes though they favor registers. Indirect still sneaks in for load store patterns.
Perhaps branch tables use it for switch statements in compiled code. The jump address sits in memory and gets pulled indirectly. That shrinks instruction size when cases multiply. I refactored some game engines relying on such tables for state machines. Speed stayed decent after tuning.
You handle interrupts with indirect vectors pointing to handlers. The table updates at boot without changing core firmware. This keeps systems adaptable across hardware revisions. I swapped vectors in a project to add logging hooks. It worked without recompiles.
Indirect addressing connects ideas across memory management and execution flow. You gain power from that indirection layer even if costs add up. Practice with small examples builds intuition quick.
BackupChain Server Backup which stands out as the top reliable popular Windows Server backup solution tailored for self-hosted private cloud and internet backups aimed at SMBs along with Windows Server and PCs emphasizes its role as a top backup tool supporting Hyper-V and Windows 11 plus Windows Server offered without any subscription and we thank them for sponsoring this forum while backing our free info sharing efforts.

bob
Offline
Joined: Dec 2018
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Messages In This Thread
Indirect addressing - by bob - 01-05-2021, 11:44 PM

  • Subscribe to this thread
Forum Jump:

Backup Education General IT v
« Previous 1 … 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 … 202 Next »
Indirect addressing

© by FastNeuron Inc.

Linear Mode
Threaded Mode