Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Label or instruction expected at start of line

1,476 views
Skip to first unread message

Andy K

unread,
Aug 3, 2016, 2:14:23 PM8/3/16
to
Getting this

Label or instruction expected at start of line

when trying to compile this.

; WinMain.asm
; 06/23/2014
;
; Assembler: NASM version 2.11.05 compiled on May 21 2014
; Linker: GoLink.Exe Version 1.0.0.0
;
; nasm -fwin32 -oWinMain.obj WinMain.asm
; golink /entry start /fo WinMain.exe WinMain.obj kernel32.dll
;
cpu 386
global start
extern GetCommandLineW
extern GetModuleHandleW
extern ExitProcess

[SECTION .code use64]

start:
push 3 ; nCmdShow SW_MAXIMIZE who needs this argument????????
call GetCommandLineW ; win32 API
push eax ; lpCmdLine
xor eax, eax
push eax ; hPrev nobody need this argument.
push eax
call GetModuleHandleW; win32 API
push eax ; hInst
call WinMain ; call WinMain with 4 arguments on the stack
exit:
push eax ; error code
call ExitProcess ; win32 API
; WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, int nCmdShow)
WinMain:
; do some useful things here
xor eax, eax ; return 0, everything went well
ret 16 ; restore the stack, pop 4 arguments

Frank Kotler

unread,
Aug 3, 2016, 2:59:28 PM8/3/16
to
Andy K wrote:
> Getting this
>
> Label or instruction expected at start of line
>
> when trying to compile this.

Hi Andy,

Possible that your editor (notepad?) is defaulting to utf-8 or
something? You may need to instruct your editor that you need ascii text.

I don't think it should cause an error, but ".code" is not one of the
"known" section names in "-f win32". Try "section .text". Also seems to
be some confusion whether you're doing 32 or 64 bit code...

Best,
Frank


Andy K

unread,
Aug 5, 2016, 4:22:32 PM8/5/16
to
Thanks,
Andy
0 new messages