i've got a 16bit/dos/medium model single.asm that builds to a working dos exe (checked with dosbox and IDA Pro)
using lastest available versions of
nasm.exe: 2.14.02
wlink: Open Watcom Linker Version 2.0 beta Sep 17 2019 01:44:30 (64-bit)
link.exe: Microsoft (R) Segmented Executable Linker Version 5.60.339 Dec 5 1994 (latest 16bit able version)
ulink.exe: UniLink v1.11 [beta] (build 11.27) from
ftp://ftp.styx.cabel.net/pub/UniLink/optlink.exe: OPTLINK (R) for Win32 Release 8.00.17 (from the dmd package: dmd.2.088.0.windows)
single.asmBITS 16
segment seg000 ; align=16
text: db 'Hello World!',0ah,0dh,'$'
segment seg001 ; align=16
..start:
mov ax,seg000
mov ds,ax
call far print
mov ax,0x4c00
int 0x21
segment seg002 ; align=16
print:
mov dx,text
mov ah,9
int 0x21
retf
segment seg003 stack
resb 256
buildnasm.exe -f obj -o single.obj ..\nasm.single.asm
ulink.exe single.obj, single.exe, single.map
then i try to split the program up into a file per segment but that fails to link
seg000BITS 16
segment seg000 public
global text
text: db 'Hello World!',0ah,0dh,'$'
seg001BITS 16
extern seg000
extern print
segment seg001 public
..start:
mov ax,seg000
mov ds,ax
call far print
mov ax,0x4c00
int 0x21
seg002BITS 16
segment seg002 public
extern text
global print
print:
mov dx,text
mov ah,9
int 0x21
retf
seg003BITS 16
segment seg003 stack
resb 256
buildnasm.exe -f obj -o seg000.obj seg000.asm
nasm.exe -f obj -o seg001.obj seg001.asm
nasm.exe -f obj -o seg002.obj seg002.asm
nasm.exe -f obj -o seg003.obj seg003.asm
ulink.exe seg000.obj seg001.obj seg002.obj seg003.obj, multi.exe, multi.map
this gives me a linker error that the seg000 reference in seg001.obj can't be resolved
ulink.exe:UniLink v1.11 [beta] (build 11.27)
Error: Unresolved external 'seg000' referenced from 'seg001.obj'
link.exe:Microsoft (R) Segmented Executable Linker Version 5.60.339 Dec 5 1994
Copyright (C) Microsoft Corp 1984-1993. All rights reserved.
seg001.obj(seg001.asm) : error L2029: 'seg000' : unresolved external
There was 1 error detected
wlink.exeOpen Watcom Linker Version 2.0 beta Sep 17 2019 01:44:30 (64-bit)
Copyright (c) 2002-2019 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
loading object files
Error! E2028: seg000 is an undefined reference
creating map file
creating a DOS executable
file seg001.obj(seg001.asm): undefined symbol seg000
optlink.exe:OPTLINK (R) for Win32 Release 8.00.17
Copyright (C) Digital Mars 1989-2013 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
seg001.obj(seg001)
Error 42: Symbol Undefined seg000
the single.asm works with all linkers
any ideas?
my goals: 100% identical single.exe and multi.exe (code and segment ordering)
but linking at all would be great