Assembly Language StepbyStep Programming with DOS and Linux 2nd Ed [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Assembly Language StepbyStep Programming with DOS and Linux 2nd Ed [Electronic resources] - نسخه متنی

Jeff Duntemann

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید









Appendix B: Segment Register Assumptions for Real Mode Segmented Model



One reason the segmented modes are so awful is that there is a whole layer of assumptions to be remembered about which segments are used in which ways with which instructions, and what may be overridden with override prefixes. Here's a quick summary you can refer to if it ever gets all turned around in your head. Keep in mind that this applies only to real mode segmented model. In 32-bit protected mode (as in Linux), all the segments point to the same memory space, and thus you don't need to "mess with" segments and overrides.

Where allowed, segment assumptions may be overridden with the segment override prefixes. These are DS:, SS:, CS:, and ES:. Under NASM, they must be placed inside the memory reference brackets. (MASM and TASM place them outside the brackets.) Here's an example of such an override in action:


mov [ES:BX],AX

The assumptions are these:



When the offset is specified in BX, SI, or DI, the assumed segment register is DS.



When the offset is specified in SP, the assumed segment register is SS. This may not be overridden!




When the offset is specified in BP, the assumed segment register is SS.



For string instruction LODS, the assumed segment is DS and the assumed offset is SI. This may not be overridden!



For string instructions STOS and SCAS, the assumed segment is ES and the assumed offset is DI. This may not be overridden!



For string instruction MOVS, the source must be pointed to by DS:SI and the destination must be pointed to by ES:DI. This may not be overridden!




/ 166