Question: I have started to learn assembly. I came across these lines.

```
;*************************************************;
; Second Stage Loader Entry Point
;************************************************;

main:
   cli  ; clear interrupts
   push cs ; Insure DS=CS
   pop ds

```

Here on second line of code, the code segment is push to the stack(I think this). I have seen it in many codes. Why we should do this and how it ensures DS =CS? On third line DS is pop out of stack(I think this). Why it is done? It is pop out of stack means it was push to stack before. There is no code for that. Can anybody explain all this to me? Thanks in advance.

Answer: 
`cs` and `ds` are just registers, pretty much like placeholders/variables, for more [information about registers read here](http://en.wikipedia.org/wiki/Processor_register). On the second line you are saying `push cs` this means that you put the content of `cs` onto the stack and on the following line you `pop` it back into `ds`.

So what just happened was that you copied `cs` to `ds`.

[`push`](http://www.penguin.cz/~literakl/intel/p.html#PUSH) is an instruction that says "put this on top of the stack"

[`pop`](http://www.penguin.cz/~literakl/intel/p.html#POP) is an instruction that says "take the top value from the stack" 

Once you do a `pop` the value is no longer stored on the stack.
Like in the comment written, `push cs` and then `pop ds` ensures that `ds=cs?`. `push cs` puts the value of cs on the top of the stack, and then `pop ds` removes the value from the stack and stores it in `ds`.