News:

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

Looking for an Assembler to fit my style

Started by Rogare, September 30, 2009, 07:13:35 PM

Previous topic - Next topic

Rogare

Hello,

I've been working with assembly for few days, at first in theory and then when I tried doing something with what I wrote I found out that Assembly in books isn't a standard. I worked for a while with TASM from BC++ 2005 and TLINK from a really old BC, but it is 16-bit and I am using old versions and I just can't continue like that.
I tried working with several Assemblers but always I lacked documentation and their syntax was different.

I am looking for an assembler (that comes with a linker as well! In it, or near it) that will require the least adjustments to my code and will work with 32-bit on Win XP Home. And I'd like to know that there is some documentation of how to use it (especially if it is command-line application).

Here is a most basic ASM program that uses the syntax I like:

.MODEL SMALL
.STACK 100h
.DATA
x DB 2Ah
.CODE

start:
mov ax,@data
mov ds,ax

mov ah,02h
mov dl,x
int 21h

mov ah,08h
int 21h
mov x,al

mov ax,4C00h
int 21h
END start

BlackVortex

Well, if you like the masm syntax, then you're better off with the masm32 package (which is the main focus of this forum !)
Documentation is more than sufficient  :-D Also compatible with most assembly code you'll stumble upon.

So I suggest you use the masm32 package with the jwasm assembler instead of the ml.exe v6 provided. It is a clone/replacement with extra features, like 64-bit assembly, faster etc :
http://www.japheth.de/JWasm.html

Or since you're making the switch anyway, you could go all out and invest some time on the GoAsm package (it also includes a linker and a resource assembler) Its syntax is a bit different but I got used to it quickly. There's less red tape than with Masm. Although it doesn't have runtime conditionals, it may in the future I hope !
http://www.jorgon.freeserve.co.uk/

Both are good choices.

Rogare

I'll look into Masm32 in a second.
GoAsm always downloads an invalid .zip (tried 4 times).
JWasm looks weird at the moment, maybe later when I get more comfortable with the environment.

Edit: Masm32 seems nice.
Could you post a simple program that works like what I posted just that it'll work with masm32?

BlackVortex

Check out the examples in the masm32 installation  :bg

The code you posted needs I believe a couple of changes to assemble under masm.

Rogare

I tried something, help me out.

I tried to assemble this program:

.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib

Main PROTO

.DATA
x DB 2Ah
.CODE

start:
invoke Main
invoke ExitProcess,0

Main proc

mov ah,02h
mov dl,x
int 21h

mov ah,08h
int 21h
mov x,al

ret

Main endp

end start


This is the command-line output:

D:\masm32\bin>ml D:\GOTO.ASM
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: D:\GOTO.ASM
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/z2
"GOTO.obj"
"GOTO.exe"
NUL
LINK : warning LNK4044: unrecognized option "z2"; ignored
GOTO.obj : warning LNK4033: converting object format from OMF to COFF
LINK : fatal error LNK1181: cannot open input file "GOTO.exe"


Thanks for everything.

dedndave

Quoteoption casemap :none
i think casemap: none is ok, but not casemap :none

that is not the big problem, though
you are writing 16-bit code into a 32-bit template
flat means no INT 21h allowed
i suggest you learn 32-bit if you have the time and fortitude

BlackVortex

Yep, forget about old DOS coding, learn about 32-bit coding for windows here :
http://win32assembly.online.fr/

Rogare

If 32-bit is that different (I thought the difference is larger registers and few minor things) - how can I work with 16-bit ASM?

dedndave

well - you need a 16-bit linker
i think Link16.exe is in the masm32 package
if not - get lnk563.exe from the fourm links (upper right corner)
if you look at the list of forums, down near the bottom is a special one for 16-bit
i posted a batch file in there the other day to assemble 16-bit files
you can also find many examples

Rogare

Thanks both of you, I am moving down to the 16-bit section.