链接16位asm代码时出错

时间:2013-07-20 07:22:18

标签: assembly segmentation-fault masm32

这是我正在尝试组装的程序&链接。但我收到链接器错误:

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

LINK : error : Segment reference in fixup record
A05ASM1.obj : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

我使用以下命令汇编和链接:

  • 汇编命令:ml /c a04asm1.asm
  • 用于链接的命令:link a04asm1.obj


page 60, 132  

TITLE         A04ASM1 (EXE) Move and add operations    
;-------------------------------------------------------------  
STACK             SEGMENT PARA STACK 'Stack'  
          DW      32 DUP(0)  
STACK         ENDS  
;-------------------------------------------------------------   
DATASEG       SEGMENT PARA 'Data'               
FLDD          DW      215  
FLDE          DW      125  
FLDF          DW      ?  
DATASEG       ENDS  
;-------------------------------------------------------------  
CODESEG       SEGMENT PARA 'Code'       
MAIN          PROC    FAR  
ASSUME  SS:STACK,DS:DATASEG,CS:CODESEG  

  MOV     AX,DATASEG  
  MOV     DS,AX  
  MOV     AX,FLDD  
  ADD     AX,FLDE  
  MOV     FLDF,AX  
  MOV     AX,4C00H  
  INT     21H  

MAIN              ENDP  
CODESEG           ENDS  
END     MAIN  

1 个答案:

答案 0 :(得分:0)

您需要使用16位链接器才能工作,请尝试:

assemble: ml /c a04asm1.asm
link16 a04asm1.obj