The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: andaihiep on April 02, 2007, 04:51:36 PM

Title: Redirected 16 bit question
Post by: andaihiep on April 02, 2007, 04:51:36 PM
hi this is my first program assembly : hello.asm

.model small
.stack 100
.data
    CLRF    db  13,10,'$'
    MSG     db  'Hello!$'
.code
MAIN   Proc
    ;khoi dau thanh ghi DS
        mov     AX,@Data
        mov     DS,AX
    ;ve dau dong moi dung ham 9 cua INT 21H
        mov     AH,9
        lea     DX,CLRF
        INT     21H
    ;hien thi loi chao dung ham 9 cua INT 21H
        mov     AH,9
        lea     DX,MSG
        INT     21H
    ;ve dau dong moi dung ham 9 cua INT 21H
        mov     AH,9
        lea     DX,CLRF
        INT     21H
    ;tro ve DOS dung ham 4CH cua INT 21H
        mov     AH,4CH
        INT     21H
MAIN    Endp
End     MAIN

i wrote by masm32v9.0 but have some errors when i write : ml hello.asm
link : error segment reference in fix up record
hello.obj: fatal error link1123 : failure during conversion to cof : file invalid or corrupt
when i click project->assembler asm file it has a error
C:\masm32\bin\hello.asm(9) : error A2006: undefined symbol : DGROUP
so i don't to solve these problem
can you helpme

Title: Re: MASM32 Version 9 Release
Post by: mnemonic on April 02, 2007, 05:35:44 PM
Hi andaihiep,

your question just does not belong here.
You are trying to build a 16bit program for DOS and so you should ask your question in the "16 bit DOS Programming (http://www.masm32.com/board/index.php?board=24.0)"-subforum.

Regards  :wink
Title: Re: Redirected 16 bit question
Post by: MichaelW on April 04, 2007, 02:03:28 AM
andaihiep,

You need a 16-bit linker to link this. The 32-bit linker included in the MASM32 package will not work. And if your next question is "where can I get one", I don't currently know. The one that used to be available is no longer.
Title: Re: Redirected 16 bit question
Post by: andaihiep on April 04, 2007, 03:19:17 PM
Thank you very much . I have found the linker for 16bit at the link on the top right : forum links and website, now I can write some small program
Title: Re: Redirected 16 bit question
Post by: Ian on July 01, 2011, 05:48:20 PM
 I'm not used to seeing ..
lea DX, ...
the 16-bit 8086 can't  lea into DX ..
so this assembles much more bytes than the "legacy" instruction ..
mov DX, OFFSET yourlabel
..
Title: Re: Redirected 16 bit question
Post by: dedndave on July 01, 2011, 05:52:34 PM
LEA DX,SomeLabel works
however, if it is a hard label, MOV DX,offset SomeLabel is faster
LEA should be used when some calculation is required:
        lea     dx,[bx+8]