Answer the question
In order to leave comments, you need to log in
Linear address? Multiplication by 16, how does it work in general and why in a memory model, 32 bits, with 32 bit registers?
For example, 20 bit address space, and 16 bit registers, to get a 20 bit linear address from 16 bit registers, you need A*16+B. Who came up with this perversion? There is an infinite number of solutions 16x+c=y. You can choose an infinite number of X and C to get Y. That is, different values of the segment register and offset can give the same linear address. What's the point. This is the same confusion. Why, on the contrary, they multiply by 16, and not 4096 (shift by 12 bits) to just get the address of the 4 most significant bits of the segment, and 16 bits of the offset (and let it be further converted into a physical one), and no intersections.
Or here's another example CS:IP defines the address of the next instruction. That is, the linear address will be CS * 16 + IP, now we substitute in CS 0x0500 and in IP 0xFFFF then the sum will be = 14fff, and now we execute the following command, and we get 5000, (ffff + 1 = 0) it is obvious that the program will make an unexpected transition don't know where.
Or that CS can only have 4 high bits that are not zero?
Answer the question
In order to leave comments, you need to log in
Have you come to hang out?
Yes, that's how it was arranged, now, when all this has already lost all relevance, it's strange to complain. You still can’t imagine what perversions, for example, the developers of 8-bit game consoles went to.
now we execute the following command, and we get 5000, (ffff + 1 = 0) it is obvious that the program will make an unexpected transition, do not understand where
Some mess in your reasoning;
There is an address space, say 1000 bytes, and our addressing register cannot store such a large number = 1000;
Then, in order to get a linear address, we need TWO registers; R1 and R2
So that R1*(maximum_number_that_can_be_stored_in_register + 1) + R2 >= 1000
{maximum_number_that_can_be_stored_in_register = 15} from 0 to 15 can store a byte, so multiplication is done by 16
Address 1000 can only be accessed in ONE way: R1 = Integer(1000 / sixteen) ; R2 = RemainderofDivision(1000 / 16)
We have small registers and a lot of memory. That is, the complete address is given by a register pair, not by a single register. It is possible to make linear addressing, and it is possible segment. I will explain the logic behind the segments.
1. We have linear addressing, and for some reason we need to add one to the address. If the lower address overflows, you need to transfer this unit to the upper one - that is, make a long adder, increase the register file, constantly work with pairs of registers and this pair cannot be replaced by one - the machine essentially turns into a 32-bit crutch.
2. Linear addressing greatly complicates the loaders - they have to process the so-called relocations. The base address is set, and if the download happened differently. to certain points in memory it is necessary to add the difference. In segment addressing, these relocations are much smaller: they are specified by segments, not by points. (And in x64, VERY MANY commands use “from IP” addressing to get rid of relocations.)
3. Compatibility with Intel 8080. It was then widely used, and IBM went for a trick: after a slight alteration, programs under 8080 also worked on their PC. Now COM is a strange Windows technology, but before COM was an extension of small executable files that were one segment long.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question