From: fermineutron on
while back i had an old 16 bit TASM asembler and TLINK liner, which
worked fine, now i am trying to switch to 32 bit MASM in particular
MASM32 distributed as MASM version 9.0
Download is here http://www.masm32.com/masmdl.htm

Well anyways, it seems to not being able to successfully assemble even
a simple "Hellow World" program. Here is my code:
==========================Start Code=========================
..model small
..stack 100h
..data
string db "Hello world",0dh,0ah,'$'


..code
main proc
mov ax,seg string
mov ds,ax


mov ah,9
mov dx,offset string
int 21h


mov ax,4C00h
int 21h


main endp
end main


============================End Code=========================


MASM gives link error stating: "Segment reference in fixup record"


I am doing something wrong or is my version of MASM screwd up?


Is there a better assembler/linker to use?

From: Frank Kotler on
fermineutron wrote:
> while back i had an old 16 bit TASM asembler and TLINK liner, which
> worked fine, now i am trying to switch to 32 bit MASM in particular
> MASM32 distributed as MASM version 9.0
> Download is here http://www.masm32.com/masmdl.htm
>
> Well anyways, it seems to not being able to successfully assemble even
> a simple "Hellow World" program. Here is my code:
> ==========================Start Code=========================
> .model small
> .stack 100h
> .data
> string db "Hello world",0dh,0ah,'$'
>
>
> .code
> main proc
> mov ax,seg string
> mov ds,ax
>
>
> mov ah,9
> mov dx,offset string
> int 21h
>
>
> mov ax,4C00h
> int 21h
>
>
> main endp
> end main
>
>
> ============================End Code=========================
>
>
> MASM gives link error stating: "Segment reference in fixup record"
>
>
> I am doing something wrong or is my version of MASM screwd up?
>
>
> Is there a better assembler

Loaded question! :)

>/linker to use?

I think your version of Masm is okay for 16-bit code, but the linker is
32-bit only. Maybe this one?

http://www.jeremya.ironie.org/download/

Or Alink, or val(x)... or Tlink should work... Better yet, get yourself
some 32-bit code! :)

Best,
Frank
From: hutch-- on
fermineutron,

Frank is right here, the 32 bit Microsoft linker will not link 16 bit
DOS code. You need the old OMF linker from Microsoft if you actually
have a reason to build legacy 16 bit code.

If you need to write 32 bit code, MASM32 does this fine and it has
enough macros to get you started so you can learn the basic API
functions from Windows. In console mode the "hello world" is this
simple,

print "Hello World",13,10

It is powered by standard Windows API functions which are easy enough
to learn once you get the swing of basic windows code.

Regards,

hutch at movsd dot com

PS : You can also get the old linker from the masmforum web site.

From: fermineutron on
The main reasons why i want o use assembly language are
1) its flexibility
2) independence of OS

basically i am somewhat opposite of the assembly users who are looking
for easy way out, if i wanted to use printf i would use C, not asm.

Can you suggest a good assembler / linker for a 32 bit code which will
let me work with large memory models, modern CPUs and yet be lnker be
flexible enough to allow linking to object files compiled crom C
language.

I downloaded MASM 615 and tried to assemble / link the following code:
=======================================================
..model small
..stack 100h
..data
string db "Hello world",0dh,0ah,'$'


..code
main proc
mov ax,seg string
mov ds,ax

mov ah,9
mov dx,offset string
int 21h

mov ax,4C00h
int 21h

main endp
end main
====================================================
but i get this error
http://aycu18.webshots.com/image/6017/2004387942607200280_rs.jpg

why is that?

From: hutch-- on
fermineutron,

16 and 32 bit code use different object module formats and the 16 bit
code you are posting will not run in 32 bit mode because you are trying
to use real mode interrupts in a protected mode OS.

NOTHING will make your 16 bit code run as native 32 bit code as it is a
different operating system with different technical details behind it.
Write 16 bit code AS 16 bit code and 32 bit code AS 32 bit code, what
you are after does not exist.

When using modules written in C, you need to prototype them in masm
making sure you use the same calling convention in masm as you did in
C. Using C modules in masm is trivial to do and works fine.

Regards,

hutch at movsd dot com