News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

What are the difference between various assembling ways?

Started by amrak, April 08, 2015, 03:10:07 PM

Previous topic - Next topic

amrak

Some books and tutorials uses make32 file.asm to assemble the source files, while some uses ml file.asm, are there differences between those different styles. For instance when assembling this source file from Kip R. Irvines book


;TITLE Add and Subtract (AddSub.asm)
; This program adds and subtracts 32-bit integers
.386
.MODEL flat, stdcall
.STACK
INCLUDE Irvine32.inc
.code
main PROC
mov eax, 1000h ;EAX = 1000h
add eax, 4000h ;EAX = 5000h
sub eax, 2000h ;eax = 3000h
call Dumpregs ;display registers

exit
main ENDP
END main

;


When assembling using > masm> make32 AddSub.asm 
I do not get any errors or warnings and I can successfully execute the file. but,
When using masm>ml AddSub.asm
I get two errors
                        1) Error L2029 : '_DumpRegs@0': unresolved external
                         2) Error L2029: '_ExitProcess@4': Unresolved external.
Will be gratefull if someone could kindly make me understand the difference between the two options of assembling. I use masm615 and windows 7

dedndave

i haven't used Make for years, although some do use it
it's probably good for larger projects, where several different modules are used
Make will update just those modules that have been updated since the last build, and re-link the project
modern computers can re-build the entire project much faster than days of old   :P

as for the unresolved externals....
i don't recall the details for Make - other than it uses a make file
in this case, my guess is that the make file adds the libraries or otherwise sets the environment

it would appear that the assembler cannot find the Irvine32.lib and Kernel32.lib libraries
here is a template that i use for Irvine32 projects
notice the include's and includelib's at the beginning

;###############################################################################################

        INCLUDE     \Masm32\Irvine\Irvine32.inc  ;adds SmallWin.inc, VirtualKeys.inc

        OPTION      CaseMap:None

        INCLUDE     \Masm32\Irvine\floatio.inc
        INCLUDE     \Masm32\Irvine\GraphWin.inc
        INCLUDE     \Masm32\Irvine\macros.inc

        INCLUDELIB  \Masm32\Irvine\kernel32.lib
        INCLUDELIB  \Masm32\Irvine\user32.lib
        INCLUDELIB  \Masm32\Irvine\Irvine32.lib

;###############################################################################################

        .DATA

szMessage db 'Hello World',13,10,0

;***********************************************************************************************

        .DATA?

;###############################################################################################

        .CODE

;***********************************************************************************************

main    PROC

        mov     edx,offset szMessage
        call    WriteString

        call    WaitMsg
        INVOKE  ExitProcess,0

main    ENDP

;###############################################################################################

        END     main


the CaseMap option is used to make names case-sensitive - my preference
i think "dumpregs" would then have to be "DumpRegs", etc

Gunther

Hi amrak,

I think that Dave gave the right answer. Just a short point. Make is good for large programming projects with different tools (compiler, linker, assembler) with very different command line switches. You can do magic things with a well written make script. But for small and middle size projects would be a batch file or shell script good enough. Furthermore, make is a strange beast and has a strong learning curve.

Gunther
You have to know the facts before you can distort them.

amrak

Thank you for the clarifications @Dedndave and Gunther!

Gunther

Quote from: amrak on April 09, 2015, 03:54:56 AM
Thank you for the clarifications @Dedndave and Gunther!

You're welcome. But again: you should go Dave's direction and I would suggest to use a simple batch file. That's practicable and reasonable.

Gunther
You have to know the facts before you can distort them.