Мой первоначальный вопрос назначения заключается в следующем:Big Endian в Little Endian
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.
.data bigEndian BYTE 12h, 34h, 56h, 78h littleEndian DWORD?
Я думаю, что мой код правильный, но я не могу понять, почему я получаю эту ошибку. Вот мой код и ошибка:
.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
1>------ Build started: Project: BigEndianLittleEndian, Configuration: Debug Win32 ------
1> Assembling BigEndiantoLittleEndian.asm...
1>BigEndiantoLittleEndian.asm(20): error A2008: syntax error
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.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Как я могу исправить эту ошибку?
Here is updated 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
Я получаю ошибку
1>------ Build started: Project: BigEndianLittleEndian, Configuration: Debug Win32 ------
1> Assembling BigEndiantoLittleEndian.asm...
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".
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Я не вижу код для обратного байтов.Я предполагаю, что ваша ошибка ASM исходит из первого выражения mov. – user3344003
'mov eax, DWORD PTR bigEndian, eax = 87654321h' будет проблемой. 'mov' принимает 2 операнда. Не 3. Не знаете, что такое ', eax = 87654321h'. –
Вы посмотрели на строку, которая выдает ошибку? –