flat assembler
Message board for the users of flat assembler.

Index > DOS > Alink problem with OBJ & COFF

Author
Thread Post new topic Reply to topic
fonolite



Joined: 14 Dec 2005
Posts: 32
fonolite 14 Dec 2005, 07:03
My program is DOS EXE(only 16bit).

3 step for building
1) main.asm assembled by "ml /c main.asm" (omf/obj)
2) subcode.asm assembled by "fasm subcode.asm" (coff format)
3) alink -m main.obj subcode.obj -o main.exe (dos exe)


1. main.asm
PUBLIC maindata
EXTRN subdata:WORD

maindata db 34h


2. subcode.asm
format COFF

PUBLIC subdata
EXTRN maindata :BYTE

USE16

subdata dw 89h




3. alink problem
subcode.asm
mov al, BYTE [maindata]
=> assemble OK, but link error
It says,
Error: target address out of frame
Base=00000AF0,target=00000670

Alink outputs only map file and fails to make EXE.


4. Strangely
main.asm
mov ax, subdata
=> assemble OK & alink OK
Alink produces EXE well.




Alink is only what I found to support both OMF/OBJ(MASM) and COFF(FASM).
I have to use FASM to assmble 64bit code.

Any Idea?
Post 14 Dec 2005, 07:03
View user's profile Send private message Reply with quote
fonolite



Joined: 14 Dec 2005
Posts: 32
fonolite 15 Dec 2005, 02:04
Hello! I resolved it by myself. Very Happy

Here is a orginal map file created by alink.

SEGMENT MAINCODE PUBLIC USE16 PARA 'CODE'
at 00000200, length 000003D4

SEGMENT MAINDATA PUBLIC USE16 PARA 'DATA'
at 00000690, length 000004B7


SEGMENT SUBCODE PUBLIC USE32 PARA
at 00000B00, length 00000047


SEGMENT SUBDATA PUBLIC USE32 PARA
at 00000B50, length 00000008


I think SUBCODE couldn't pointer the data of the lower address(MAINDATA).

I made a simple 32bit segment in main.asm having the same name of 'SUBCODE'.

Alink combines MAINCODE32(32bit) and SUBCODE(32bit).

So SUBCODE locates in lower address than MAINDATA.


Here is a final map file.

SEGMENT MAINCODE PUBLIC USE16 PARA 'CODE'
at 00000200, length 000003D4

SEGMENT SUBCODE PUBLIC USE32 PARA 'CODE'
at 000005E0, length 000000A7


SEGMENT MAINDATA PUBLIC USE16 PARA 'DATA'
at 00000690, length 000004B7


SEGMENT SUBDATA PUBLIC USE32 PARA
at 00000B50, length 00000008



link OK. Alink generates EXE well.

You know this is not a complete solution. Crying or Very sad

But Alink did a job anyway. Cool
Post 15 Dec 2005, 02:04
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.