The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: lly99 on April 05, 2008, 06:22:55 AM

Title: nasm/ Entry 386 question
Post by: lly99 on April 05, 2008, 06:22:55 AM
 :dazzled:

Entry 386:

Hello       EveryBody

xor   eax, eax
   mov   ax, cs
   shl   eax, 4
   add   eax, LABEL_SEG_CODE32
   mov   word [LABEL_DESC_CODE32 + 2], ax
   shr   eax, 16
   mov   byte [LABEL_DESC_CODE32 + 4], al
   mov   byte [LABEL_DESC_CODE32 + 7], ah


shl   eax, 4 ;(???????????  why?)
thanks
Title: Re: nasm/ Entry 386 question
Post by: jj2007 on April 05, 2008, 07:33:39 AM
xor   eax, eax       ; eax=0
mov   ax, cs         ; eax=cs
shl   eax, 4          ; eax=cs*16
Title: Re: nasm/ Entry 386 question
Post by: lly99 on April 05, 2008, 07:46:57 AM
Thank you very much!!!!  :bg

:U
Title: Re: nasm/ Entry 386 question
Post by: Ian_B on April 05, 2008, 11:22:39 AM
Quote from: lly99 on April 05, 2008, 06:22:55 AM
xor   eax, eax
mov   ax, cs

If you are using this code yourself, this might be a simpler replacement:

movzx eax, cs


Regards.
Title: Re: nasm/ Entry 386 question
Post by: lly99 on April 06, 2008, 06:42:29 AM
Quote from: Ian_B on April 05, 2008, 11:22:39 AM
Quote from: lly99 on April 05, 2008, 06:22:55 AM
xor   eax, eax
mov   ax, cs

If you are using this code yourself, this might be a simpler replacement:

movzx eax, cs


Regards.

Yes        movzx eax, cs   ; zero fill :clap: