0

Fixed; here's the fixed code (doesn't do anything and crashes, but it assembles, which is the point):

.686P
.MODEL FLAT
.CODE
_START:
    MOV al, 255
END _START

I also discovered I had to use the /c switch with ml and then link separately with /SUBSYSTEM:CONSOLE.


Just rediscovered x86 assembly and MASM32 and am getting myself reacquainted with the basics. I wrote a short, pointless program thus, to see if I could assemble anything:

.686P
.MODEL FLAT
.CODE
START:
    MOV al, 255
END

I ran ml /coff test.asm and got this output:

Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

 Assembling: test.asm
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

"test.obj"
"/OUT:test.exe"
LINK : fatal error LNK1561: entry point must be defined

I read online that START was the name of the entry point. Have I done this wrong or this is a different problem?

Thanks in advance!

Archimaredes
  • 1,397
  • 12
  • 26

2 Answers2

1

That END directive is used to set the entry point: http://msdn.microsoft.com/en-us/library/wxy1fb5k(v=vs.80).aspx

So END should be END START. The entry point label can be any valid label name.

Mike Kwan
  • 24,123
  • 12
  • 63
  • 96
0

I don't have MASM, but usually the entry point is _start:, not START:.

See this MASM example program.

nrz
  • 10,435
  • 4
  • 39
  • 71
  • Thanks! I did some more research and as well as that being correct (_START also works), I forgot to end the program with `END _START`. It now assembles. – Archimaredes Oct 03 '12 at 21:48