News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

MASM - compilation

Started by ofiras, March 23, 2007, 12:32:08 PM

Previous topic - Next topic

ofiras

Hello everyone,
Im new here, and I have jest started learning ASM...
I didn't get it - how do I compile my ASM file? (Make it an EXE file)
I heard I need to use 'ml' and 'link' in the cmd of windows, but it says he doesn't know the command "ml"...
What do I do?
All I need is to make an ASM file to EXE, I don't care how...
Please help...
Thanks,
Ofir.

ragdog

hi

download m32v9r.zip and install !

save as compile.cmd in your project folder

and try this @echo off
set path=\masm32\
set resname=rsrc
set name=source

if exist %name%.exe del %name%.exe
if exist %resname%.res del %resname%.res

%path%bin\rc /v %resname%.rc
%path%bin\cvtres.exe /machine:ix86 %resname%.res
%path%bin\ml.exe /c /coff /nologo /I"%path%include" %name%.asm
%path%bin\link.exe /SUBSYSTEM:WINDOWS /OUT:%name%.exe /LIBPATH:"%path%Lib" %name%.obj %resname%.obj

if exist *.obj del *.obj

pause


ragdog

ofiras

Thenks, but i didn't really get it...
What do I save as compile.cmd? Where do I try this :

"@echo off
set path=\masm32\
set resname=rsrc
set name=source

if exist %name%.exe del %name%.exe
if exist %resname%.res del %resname%.res

%path%bin\rc /v %resname%.rc
%path%bin\cvtres.exe /machine:ix86 %resname%.res
%path%bin\ml.exe /c /coff /nologo /I"%path%include" %name%.asm
%path%bin\link.exe /SUBSYSTEM:WINDOWS /OUT:%name%.exe /LIBPATH:"%path%Lib" %name%.obj %resname%.obj

if exist *.obj del *.obj

pause
"?

Thenks,
Ofir.

ragdog

in your project folder

here is a example

[attachment deleted by admin]

ofiras

Tnx very very much...
one (I think) last thing...
It says "filename.obj : fatal error LNK1190: invalid fixup found, type 0x0001".
Why?
Thenks,
Ofir

hutch--

Without seeing your source code, it is probably invalid startup code. Try this, BEFORE any of the runtime code place the label "start:", at the end of the runtime code put "end start" and see if you get the same error.

Its logic is something like this.

.486 etc ....
.data
  ; any data here
.data?
  ; any uninitialised data here
.code

start:

  ; all of the runtime code here

end start






Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

ofiras

Still not working...
I just want to print something on the screen...
I'll be glad if you can chack my code to see what's wrong with it:
.586
.model flat, stdcall  ;32 bit memory model
option casemap :none  ;case sensitive

include windows.inc
include user32.inc
include kernel32.inc

includelib user32.lib
includelib kernel32.lib
.data

Message db "Hello!!! I'm Ofir$"

.code

start:

mov dx,OFFSET Message
mov ax,SEG Message
mov ds,ax

mov ah,9
int 21h
mov ax,4c00h
int 21h

end start


It says:
"
Assembling: myf.asm
myf.asm<19> : error A2022: instruction operands must be the same size
myf.asm<20> : error A2004: symbol type conflict
Microsoft <R> bla bla bla...
Copyright <C> bla bla bla...

LINK : fatal error LNK1181: cannot open input file "myf.obj"
"

I have never compiled even 1 program in ASM... I'll be very happy to do it, so thenks very very much for your help.


Thenks a lot,
Ofir

PBrennick

ofiras,
There are several things wrong here. Primarily you are putting 16bit code into a win32 source. This will never work as interrupts are not allowed in win32 (basically).

The first thing we need to know is are you trying to write a windows program or a DOS program. Once we know that, we can better help you. Based on your answer, this topic will be moved to either the Campus or to the 16bit programming area.

Let us know what you want.
Paul
The GeneSys Project is available from:
The Repository or My crappy website

Sameer

also there are so many examples around just have a look

also look at The GeneSys Project

ofiras

First of all, thenks a lot for all of you for trying to help me.
For start, I want to know how to use DOS.
How do I do it?

My original code was diffrent, but i changed it... it was:

; This is a simple program which displays "Hello World!"
; on the screen.

.model small
.stack
.data

Message db "Hello World!$" ; message to be display

.code

mov dx,OFFSET Message ; offset of Message is in DX
mov ax,SEG Message ; segment of Message is in AX
mov ds,ax ; DS:DX points to string

mov ah,9 ; function 9 - display string
int 21h ; call dos service
mov ax,4c00h ; return to dos DOS
int 21h

END start               ;end here


Thenks,
Ofir


ofiras


MichaelW

With the addition of a start: label at the start of the code segment, your code will assemble, link, and run OK. What version of MASM are you using, and do you have a 16-bit linker?
eschew obfuscation