3. Direct (or Absolute) Addressing

This is a very simple way of addressing memory - direct addressing means the code refers directly to a location in memory

For example

SUB (3001)

In this instance the value held at the absolute location 3001 in RAM is subtracted from the accumulator.

The good thing about direct addressing is that it is fast (but not as fast as immediate addressing) the bad thing about direct addressing is that the code depends on the correct data always being present at same location.

It is generally a good idea to avoid referring to absolute memory addresses in order to have 're-locatable code' i.e. code that does not depend on specific locations in memory.

You could use direct addressing on computers that are only running a single program. For example an engine management computer only ever runs the code the car engineers programmed into it, and so direct memory addressing is excellent for fast memory access.

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: writing fast code

 

 

Copyright © www.teach-ict.com