Question

This is the program I am trying to assemble & link. But I get a linker error:

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

I am using the following commands to assemble and link:

  • command for assemble: ml /c a04asm1.asm
  • command for linking: 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  
Was it helpful?

Solution

You need to use the 16-bit linker for this to work, try:

assemble: ml /c a04asm1.asm
link16 a04asm1.obj 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top