Note that there are some explanatory texts on larger screens.

plurals
  1. POerror a2070 invalid instruction operands
    primarykey
    data
    text
    <p>I'm newbie in Win32 Assembly:</p> <p>I learn code this program, it's Window simple. But I get the error:</p> <blockquote> <p>error a2070 invalid instruction operands (MASM)</p> </blockquote> <p>I have searched on google about this error, but I still don't understand.</p> <pre><code>.386 .model flat, stdcall option casemap:none include \masm32\include\windows.inc include \masm32\include\kernel32.inc include \masm32\include\user32.inc includelib \masm32\lib\kernel32.lib includelib \masm32\lib\user32.lib WinMain PROTO :HINSTANCE, :HINSTANCE, :LPSTR, :DWORD .data AppName db "First Windows", 0 ClassName db "Window Class", 0 .data? hInstance dd ? CommandLine dd ? .code start: invoke GetModuleHandle, NULL MOV hInstance, EAX invoke GetCommandLine MOV CommandLine, EAX invoke WinMain, hInstance, NULL, CommandLine, SW_SHOWDEFAULT invoke ExitProcess, EAX WinMain PROC ahInstance:HINSTANCE, \ ahPrevInstance:HINSTANCE, \ aCommandLine:LPSTR, \ aCommandShow:DWORD LOCAL wc:WNDCLASSEX LOCAL hwnd:HANDLE LOCAL msg:MSG MOV wc.cbSize, SIZEOF WNDCLASSEX MOV wc.style, CS_HREDRAW or CS_VREDRAW MOV wc.lpfnWndProc, offset WndProc MOV wc.cbClsExtra, NULL MOV wc.cbWndExtra, NULL MOV wc.hInstance, hInstance ;;;;;;;;;;;;;;;; Error here invoke LoadIcon, NULL, IDI_APPLICATION MOV wc.hIcon, EAX MOV wc.hIconSm, EAX invoke LoadCursor, NULL, IDC_ARROW MOV wc.hCursor, EAX MOV wc.hbrBackground, COLOR_WINDOW+1 MOV wc.lpszMenuName, NULL MOV wc.lpszClassName, offset ClassName invoke RegisterClassEx, addr wc invoke CreateWindowEx, NULL, addr ClassName, addr AppName, \ WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, \ CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, ahInstance, NULL MOV hwnd, EAX invoke ShowWindow, hwnd, SW_SHOWNORMAL invoke UpdateWindow, hwnd .WHILE TRUE invoke GetMessage, addr msg, NULL, 0, 0 .BREAK .IF (!EAX) invoke TranslateMessage, addr msg invoke DispatchMessage, addr msg .ENDW MOV EAX, msg.wParam RET WinMain endp WndProc PROC ahWnd:HWND, aMsg:DWORD, awParam:WPARAM, alParam:LPARAM .IF aMsg == WM_DESTROY invoke PostQuitMessage, NULL .ELSE invoke DefWindowProc, ahWnd, aMsg, awParam, alParam ret .ENDIF XOR EAX, EAX ret WndProc endp end start </code></pre> <p>That line:</p> <pre><code>MOV wc.hInstance, hInstance </code></pre> <p>gets an error, I replace by:</p> <pre><code>PUSH hInstance POP wc.hInstance </code></pre> <p>--> this is OK.</p> <p>But I don't understand WHY ???</p> <p>Anyone can help me.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload