Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>By pushing the value of CS to the stack, and popping it into DS, you ensure that DS has the same value as CS.</p> <p>I haven't programmed in assembler for a while, but I thought there was no direct way to move from one segment register into another.</p> <p>You can see the stack as a pile of data. You push something on top and it stays there until you pop it of\ the pile. In that way you can use the stack to exchange data. But most of the time you use it to save data so you can use the registers for other purposes and restore the content later.</p> <p>This happens when you execute the code.</p> <p>1) initial situation</p> <pre><code>CS has value X DS has value Y Stack has .... </code></pre> <p>2) push CS</p> <pre><code>CS has value X DS has value Y Stack has ...., X </code></pre> <p>3) pop DS</p> <pre><code>CS has value X DS has value X Stack has .... </code></pre> <p>But what are segment registers. In the old days, 8086 had 16 bit address registers but a 20 bit addressspace. So they used the segment registers to combine both to a 20 bit space by multiplying the segment register by 16, and add the memory location. To save space, we had near pointers (without segment to jump within the segment) and far pointers (with segment).</p> <p>With the introduction to 80286 protected mode, the segment registers were reused as segment descriptors. They pointed to a memory location that gave enough information to get to the real space. But now we have linear address spaces (virtually mapped on the real memory).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload