I'm a newbie in learning assembly language now. I'm using text The Art Of Assembly Language now.But I've met a big problem!!!
I can't assemble & link the source file correctly.For example ,in chapter 5
,the Pgm5_1.asm file.I can't assemble it any way.
Please help me!!! Tell me why,and what should I do,please!!! :(
Posted on 2002-07-28 00:44:09 by whitebird
what errors do you get when assembling?
Posted on 2002-07-28 01:19:02 by rkinasz
The wrong is this:
C:\WINDOWS>cd ..\masm32

C:\masm32>ml shell.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.

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

LINK : warning LNK4044: unrecognized option "z2"; ignored
LINK : error : Segment reference in fixup record
shell.obj : fatal error LNK1123: failure during conversion to COFF: file invalid
or corrupt


The file is below:

dseg segment para public 'data'

character byte ?
UnsignedIntVar word ?
DblUnsignedVar dword ?

integer typedef sword
char typedef byte
FarPtr typedef dword

J integer ?
c1 char ?
PtrVar FarPtr ?

K integer 4
c2 char 'A'
PtrVar2 FarPtr L

L integer 0,1,2,3
c3 char 'A',0dh,0ah,0
PtrTb1 FarPtr J,K,L

string byte "Hello world",0dh,0ah,0

dseg ends

cseg segment para public 'code'
assume cs:cseg, ds:dseg

Main proc
mov ax, dseg
mov ds, ax
mov es, ax

lea bx,L
mov ax,
add ax,2
add ax,4
add ax,6
mul K
mov J,ax

les bx,PtrVar2
mov di,k
mov ax,es:

mov c1,' '
mov al,c2
mov c3,al

Quit: mov ah,4ch
int 21h
Main endp

cseg ends

sseg segment para stack 'stack'
stk byte 1024 dup ("stack ")
sseg ends

zzzzzzseg segment para public 'zzzzzz'
LastBytes byte 16 dup (?)
zzzzzzseg ends
end Main
Posted on 2002-07-28 02:01:48 by whitebird
Art Of Assembly: 16bit dos code.
masm32 is geared for 32bit windows programs. You will have
to get a 16bit linker if you want to produce dos programs - and
you should ask yourself if you really want to do that.

And you should not crosspost.
Posted on 2002-07-28 02:33:58 by f0dder

f0dder is right, you need a 16 bit OMF linker to build 16 bit code, 32 bit MASM code is COFF.

It can be downloaded at Iczelion's site or if you can find it, in the Microsoft site.


Posted on 2002-07-28 03:20:32 by hutch--
if you fire up your newsreader and point it towards the news://microsoft.public.masm]news://microsoft.public.masm group, then you will be able to talk with the author of AoA directly, as he frequents that group on a daily basis.
Posted on 2002-07-28 07:45:10 by sluggy