| ||
The move instruction has a system level functionality where segment/ selector registers can be loaded or set.
No 64-bit | If you are developing 64-bit applications you should skip over this section, as the CS, DS, ES, and SS selectors are nullified and thus ignored. The FS and GS are left in reserve for use. |
If you are developing 32-bit applications the system registers are known as selectors. In Win32 the CS, DS, and ES selectors are typically set to the same block of memory and need not be modified.
If you are developing in Real Mode, aka 16-bit applications, then these system registers are known as segment registers. In the Real Mode environment sreg represents the segment register supporting a 16-bit offset addressing up to a maximum of 65,536 x 16 bytes. In a Protected Mode environment the selector register indexes a 32-bit address using virtual memory. Application programmers do not need to worry about this. In the DOS and Extended DOS Protected Mode environments the ES is typically set to the same value as the DS, and the FS and GS are used to address extraneous memory blocks such as a video graphics adapter (VGA).
Real Mode An example of an old monochrome write access:
monosel dw 0b000h xor edi,edi mov es,monosel mov es:[di],ax add di,4
Protected Mode An example of an old monochrome write access:
monoadr dd 0b0000h monosel dw 013fh mov edi,monoadr mov fs,monosel mov fs:[edi],eax add edi,4