Category:8086 Assembly: Difference between revisions

Content added Content deleted
No edit summary
Line 49: Line 49:
As with all processors that use a stack, if you push one or more registers and want to restore the backed-up values correctly, you must pop them in the reverse order. You can pop them out of order on purpose to swap registers around. In fact, this is a quick way to move the segment from <code>DS</code> into <code>ES</code>, or vice-versa:
As with all processors that use a stack, if you push one or more registers and want to restore the backed-up values correctly, you must pop them in the reverse order. You can pop them out of order on purpose to swap registers around. In fact, this is a quick way to move the segment from <code>DS</code> into <code>ES</code>, or vice-versa:
<lang asm>push DS
<lang asm>push DS
pop ES ;you can't do "mov es, ds" but you can do this!
pop ES ;you can't do "mov es, ds" but you can do this!</lang>


===Arithmetic===
===Arithmetic===