title: Big Endian to Little Endian
body: <p>My original assignment question is this:</p>
  
  <blockquote>
    <p>Write a program that uses the variables below and MOV instructions to copy the value from bigEndian to littleEndian, reversing the order of the bytes. The number's 32 - bit value is understood to be 12345678 hexadecimal. </p>
  
  <pre><code>.data
  bigEndian   BYTE 12h, 34h, 56h, 78h
  littleEndian DWORD?
  </code></pre>
  </blockquote>
  
  <p>I think my code is right but I can't figure out why I am getting this error. Here's my code and error:</p>
  
  <pre><code>.386
  .model flat, stdcall
  .stack 4096
  ExitProcess PROTO, dwExitCode:DWORD
  
  .data
   bigEndian   BYTE 12h, 34h, 56h, 78h
   littleEndian DWORD ?
   .code
   main PROC
   mov eax, DWORD PTR bigEndian; eax = 87654321h
   mov littleEndian, eax
  
   invoke ExitProcess, 0
   main ENDP
   END main
  </code></pre>
  
  <blockquote>
    <p>1>------ Build started: Project: BigEndianLittleEndian, Configuration: Debug Win32 ------</p>
    
    <p>1>  Assembling BigEndiantoLittleEndian.asm...</p>
    
    <p>1>BigEndiantoLittleEndian.asm(20): error A2008: syntax error</p>
    
    <p>1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\BuildCustomizations\masm.targets(50,5): error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"Debug\BigEndiantoLittleEndian.obj" /W3 /errorReport:prompt  /TaBigEndiantoLittleEndian.asm" exited with code 1.</p>
    
    <p>========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========</p>
  </blockquote>
  
  <p>How can I fix this error?</p>
  
  <blockquote>
    <p>Here is updated code:</p>
  </blockquote>
  
  <pre><code>.386
  .model flat, stdcall
  .stack 4096
  ExitProcess PROTO, dwExitCode:DWORD
  
  .data
  bigEndian   BYTE 12h, 34h, 56h, 78h
  littleEndian DWORD ?
  
  
  .code
  main PROC
  
  mov ah, byte ptr bigEndian+0
  mov al, byte ptr bigEndian+1
  mov word ptr littleEndian+2,ax;here I want to move my now full register into      the 32bit register eax. 
  mov ah, byte ptr bigEndian+2
  mov al, byte ptr bigEndian+3
  mov word ptr littleEndian+2,ax here I want to move my now full register into    the 32bit register eax which results in the order being reversed.
  
  
  invoke ExitProcess, 0
  main ENDP
  END main
  </code></pre>
  
  <p>The error I get</p>
  
  <blockquote>
    <p>1>------ Build started: Project: BigEndianLittleEndian, Configuration: Debug 
    Win32 ------</p>
    
    <p>1>  Assembling BigEndiantoLittleEndian.asm...</p>
    
    <p>1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(708,9): error MSB4030: "main" is an invalid value for the "NoEntryPoint" parameter of the "Link" task. The "NoEntryPoint" parameter is of type "System.Boolean".</p>
    
    <p>========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========</p>
  </blockquote>