     1                                  
     2                                  ; Public Domain
     3                                  
     4                                  ; test install command: install; hintoth; hintoth uninstall
     5                                  ; test run command: ; .; .
     6                                  
     7                                  %include "lmacros3.mac"
     1                              <1> [list -]
    14                              <2> [list -]
    14                              <1> [list -]
     8                                  
     9                                  %assign _OTHER 1
    10                                  
    11                                  %include "hint.asm"
     1                              <1> 
     2                              <1> ; Public Domain
     3                              <1> 
     4                              <1> ; test install command: install; hint skipself; hint uninstall
     5                              <1> ; test run command: skipself; .; .
     6                              <1> 
     7                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
     8                              <1> 
     9                              <1> 	numdef OTHER, 0
    10                              <1> %if _OTHER
    11                              <1>  %define ELDOTHER 1
    12                              <1>  %define OTH_STRING "OTH"
    13                              <1>  %imacro getotherds 0
    14                              <1> reloc	mov ds, word [ss:otherds]
    15                              <1> internaldatarelocation
    16                              <1>  %endmacro
    17                              <1>  %imacro resetds 0
    18                              <1> 	push ss
    19                              <1> 	pop ds
    20                              <1>  %endmacro
    21                              <1>  %imacro getotheres 0
    22                              <1> reloc	mov es, word [ss:otherds]
    23                              <1> internaldatarelocation
    24                              <1>  %endmacro
    25                              <1>  %imacro resetes 0
    26                              <1> 	push ss
    27                              <1> 	pop es
    28                              <1>  %endmacro
    29                              <1> %else
    30                              <1>  %define OTH_STRING ""
    31                              <1>  %idefine getotherds
    32                              <1>  %idefine resetds
    33                              <1>  %idefine getotheres
    34                              <1>  %idefine resetes
    35                              <1> %endif
    36                              <1> 
    37                              <1> %include "eld.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2025 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELD_MAC
    16                              <2> %define ELD_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
     1                              <3> [list -]
    19                              <2> 
    20                              <2> 		; ELD executable header
    21                              <2> 	struc ELD_HEADER
    22 00000000 ????????            <2> eldhSignature:		resb 4	; "ELD1"
    23 00000004 ??????              <2> 			resb 3	; reserved
    24 00000007 ??                  <2> 			resb 1	; 26 (Ctrl-Z)
    25 00000008 ????????            <2> eldhCodeOffset:		resd 1	; position displacement from eldhSignature
    26 0000000C ????                <2> eldhCodeImageLength:	resw 1	; amount bytes, at least 32
    27 0000000E ????                <2> eldhCodeAllocLength:	resw 1	; amount bytes, added to prior. sum < 64 KiB
    28 00000010 ????????            <2> eldhDataOffset:		resd 1
    29 00000014 ????                <2> eldhDataImageLength:	resw 1	; (zero allowed)
    30 00000016 ????                <2> eldhDataAllocLength:	resw 1	; (zero allowed)
    31 00000018 ????                <2> eldhCodeEntrypoint:	resw 1	; within code section, used as displacement
    32 0000001A ????????            <2> eldhReserved:		resb 4	; reserved
    33 0000001E ????                <2> eldhExtensionSize:	resw 1	; from eldhSignature, -> past eldhx fields in use
    34                              <2> 	endstruc
    35                              <2> 	endarea ELD_HEADER, 1
    36                              <2> 
    37                              <2> 	struc ELD_HEADERX
    38 00000000 <res 20h>           <2> eldhxHeader:		resb ELD_HEADER_size
    39 00000020 ????????            <2> eldhxDescriptionOffset:	resd 1	; zero if none, from eldhxHeader. <= 128 Bytes
    40 00000024 ????????            <2> eldhxHelpOffset:	resd 1	; zero if none, from eldhxHeader
    41 00000028 ????????            <2> eldhxLibTable:		resd 1	; zero if none, from eldhxHeader
    42 0000002C ????????            <2> eldhxDateTimeOffset:	resd 1	; zero if none, from eldhxHeader
    43                              <2> 	alignb 16
    44                              <2> 	endstruc
    45                              <2> 
    46                              <2> 	struc ELD_TRAILER_HEADER
    47 00000000 ????????????????    <2> eldthSignature:		resb 8	; "ELD1TAIL"
    48 00000008 ????????            <2> eldthHeaderOffset:	resd 1	; negative displacement from eldthSignature,
    49                              <2> 				;  add this dword to the seek offset
    50 0000000C ????                <2> eldthReserved:		resw 1	; reserved, must be initialised to zero
    51 0000000E ????                <2> eldthChecksum:		resw 1	; sum of all words in trailer header = 0
    52                              <2> 	endstruc
    53                              <2> 	endarea ELD_TRAILER_HEADER, 1
    54                              <2> 
    55                              <2> 	struc ELD_LIBTABLE
    56 00000000 ????                <2> eldltFormat:		resw 1
    57                              <2> 	; 0 = uncompressed
    58                              <2> 	; 2 = heatshrink compressed
    59                              <2> 	; 3 = lzexedat -4 compressed
    60                              <2> 	; 4 = lzexedat -4 -l compressed
    61 00000002 ????                <2> eldltAmount:		resw 1
    62 00000004 ????????            <2> eldltOffset:		resd 1	; from eldhxHeader
    63                              <2> eldltCompressedLength:		; (dword, only present if format 2, 3, or 4)
    64                              <2> 	endstruc
    65                              <2> 	endarea ELD_LIBTABLE, 1
    66                              <2> 
    67                              <2> 		; ELD instance header
    68                              <2> 	struc ELD_INSTANCE
    69 00000000 ????                <2> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    70 00000002 ????                <2> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    71 00000004 ????                <2> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    72 00000006 ????                <2> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    73 00000008 ????????????????    <2> eldiIdentifier:		resb 8	; blank-filled text
    74 00000010 ????                <2> eldiFlags:		resw 1	; flags
    75                              <2> eldiListing_size equ 14
    76 00000012 <res Eh>            <2> eldiListing:		resb eldiListing_size
    77                              <2> 				; ASCIZ listing file name
    78                              <2> 	endstruc
    79                              <2> 		; flags for eldiFlags:
    80                              <2> eldifResident:		equ 1
    81                              <2> 
    82                              <2> 		; ELD link info header
    83                              <2> 	struc ELD_LINKINFO
    84 00000000 ????                <2> eldlSignature:		resw 1	; 0E1D1h
    85 00000002 ????????            <2> eldlReserved:		resw 2
    86 00000006 ????                <2> eldlUseLinkHash:	resw 1
    87 00000008 ????                <2> eldlDataAmount:		resw 1
    88 0000000A ????                <2> eldlDataPrefixes:	resw 1
    89 0000000C ????                <2> eldlDataEntries:	resw 1
    90 0000000E ????                <2> eldlDataAddresses:	resw 1
    91 00000010 ????                <2> eldlCodeAmount:		resw 1
    92 00000012 ????                <2> eldlCodePrefixes:	resw 1
    93 00000014 ????                <2> eldlCodeEntries:	resw 1
    94 00000016 ????                <2> eldlCodeAddresses:	resw 1
    95                              <2> 	endstruc
    96                              <2> 
    97                              <2> 	numdef ELD_CODE_VSTART, 9001h
    98                              <2> 	numdef ELD_DATA_VSTART, 8000h
    99                              <2> 	numdef ELD_RELOC_VSTART, 8000h
   100                              <2> 
   101                              <2> 	numdef ELD_RECLAIM_HINT, 0
   102                              <2> 	strdef ELD_LISTING, ""
   103                              <2> 	numdef ELD_DATETIME, 0
   104                              <2> 
   105                              <2> %if _ELD_DATETIME
   106                              <2>  %define PUT_ELDHX_DATETIME_OFFSET at eldhxDateTimeOffset, dd DATAOFFSET + datetime - datastart
   107                              <2>  %macro PUT_ELD_DATETIME 0.nolist
   108                              <2> datetime:	asciz __UTC_DATE__,'T',__UTC_TIME__,'Z'
   109                              <2> 		asciz		; for future extension
   110                              <2>  %endmacro
   111                              <2> %else
   112                              <2>  %define PUT_ELDHX_DATETIME_OFFSET
   113                              <2>  %define PUT_ELD_DATETIME
   114                              <2> %endif
   115                              <2> 
   116                              <2> %endif
    38                              <1> %include "eldcall.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug call macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2024 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELDCALL_MAC
    16                              <2> %define ELDCALL_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
     1                              <3> [list -]
    19                              <2> %include "nasmhash.mac"
     1                              <3> 
     2                              <3> %if 0
     3                              <3> 
     4                              <3> Hashing macros
     5                              <3>  by E. C. Masloch, 2019
     6                              <3> 
     7                              <3> Usage of the works is permitted provided that this
     8                              <3> instrument is retained with the works, so that any entity
     9                              <3> that uses the works is notified of this instrument.
    10                              <3> 
    11                              <3> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <3> 
    13                              <3> %endif
    14                              <3> 
    15                              <3> %ifndef __NASMHASH_MAC__
    16                              <3> %assign __NASMHASH_MAC__ 1
    17                              <3> 
    18                              <3> 
    19                              <3> 	%macro hashdef 2+.nolist
    20                              <3> %ifempty %2
    21                              <3>  %assign _%1 1
    22                              <3> %else
    23                              <3> %ifstr %2
    24                              <3>  %define %%string %2
    25                              <3> %elifid %2
    26                              <3>  %defstr %%string %2
    27                              <3> %elifnum %2
    28                              <3>  %defstr %%string %2
    29                              <3> %eliftok %2
    30                              <3>  %defstr %%string %2
    31                              <3> %else
    32                              <3>  %error Unknown input
    33                              <3> %endif
    34                              <3> %strlen %%length %%string
    35                              <3> %assign %%hash 1
    36                              <3> %assign %%index 1
    37                              <3> %rep %%length
    38                              <3>  %substr %%char %%string %%index
    39                              <3>  %assign %%hash (%%hash * 31 + %%char) & 0FFFFh
    40                              <3>  %assign %%index %%index + 1
    41                              <3> %endrep
    42                              <3> %assign _%1 %%hash
    43                              <3> %endif
    44                              <3> 	%endmacro
    45                              <3> 
    46                              <3> 
    47                              <3> %endif
    20                              <2> %include "elddata.mac"
     1                              <3> %if 0
     2                              <3> 
     3                              <3> Extensions for lDebug data relocation macros
     4                              <3> 
     5                              <3> Copyright (C) 2008-2024 E. C. Masloch
     6                              <3> 
     7                              <3> Usage of the works is permitted provided that this
     8                              <3> instrument is retained with the works, so that any entity
     9                              <3> that uses the works is notified of this instrument.
    10                              <3> 
    11                              <3> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <3> 
    13                              <3> %endif
    14                              <3> 
    15                              <3> %ifndef ELDDATA_MAC
    16                              <3> %define ELDDATA_MAC 1
    17                              <3> 
    18                              <3> %include "lmacros3.mac"
     1                              <4> [list -]
    19                              <3> %include "nasmhash.mac"
     1                              <4> 
     2                              <4> %if 0
     3                              <4> 
     4                              <4> Hashing macros
     5                              <4>  by E. C. Masloch, 2019
     6                              <4> 
     7                              <4> Usage of the works is permitted provided that this
     8                              <4> instrument is retained with the works, so that any entity
     9                              <4> that uses the works is notified of this instrument.
    10                              <4> 
    11                              <4> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <4> 
    13                              <4> %endif
    14                              <4> 
    15                              <4> %ifndef __NASMHASH_MAC__
    16                              <4> %assign __NASMHASH_MAC__ 1
    17                              <4> 
    18                              <4> 
    19                              <4> 	%macro hashdef 2+.nolist
    20                              <4> %ifempty %2
    21                              <4>  %assign _%1 1
    22                              <4> %else
    23                              <4> %ifstr %2
    24                              <4>  %define %%string %2
    25                              <4> %elifid %2
    26                              <4>  %defstr %%string %2
    27                              <4> %elifnum %2
    28                              <4>  %defstr %%string %2
    29                              <4> %eliftok %2
    30                              <4>  %defstr %%string %2
    31                              <4> %else
    32                              <4>  %error Unknown input
    33                              <4> %endif
    34                              <4> %strlen %%length %%string
    35                              <4> %assign %%hash 1
    36                              <4> %assign %%index 1
    37                              <4> %rep %%length
    38                              <4>  %substr %%char %%string %%index
    39                              <4>  %assign %%hash (%%hash * 31 + %%char) & 0FFFFh
    40                              <4>  %assign %%index %%index + 1
    41                              <4> %endrep
    42                              <4> %assign _%1 %%hash
    43                              <4> %endif
    44                              <4> 	%endmacro
    45                              <4> 
    46                              <4> 
    47                              <4> %endif
    20                              <3> %include "eldcheck.mac"
     1                              <4> %if 0
     2                              <4> 
     3                              <4> Extensions for lDebug relocation check macros
     4                              <4> 
     5                              <4> Copyright (C) 2008-2023 E. C. Masloch
     6                              <4> 
     7                              <4> Usage of the works is permitted provided that this
     8                              <4> instrument is retained with the works, so that any entity
     9                              <4> that uses the works is notified of this instrument.
    10                              <4> 
    11                              <4> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <4> 
    13                              <4> %endif
    14                              <4> 
    15                              <4> %ifndef ELDCHECK_MAC
    16                              <4> %define ELDCHECK_MAC 1
    17                              <4> 
    18                              <4> %assign ELDSTRICT 0
    19                              <4> %assign ELDSTRICTCOUNTER 0
    20                              <4> 
    21                              <4> 	%imacro eldstrict 1.nolist
    22                              <4> %ifidni %1, on
    23                              <4>  %assign ELDSTRICT 1
    24                              <4>  [warning +error=reloc-abs]
    25                              <4>  [warning +reloc-abs]
    26                              <4> %elifidni %1, off
    27                              <4>  %assign ELDSTRICT 0
    28                              <4>  [warning -reloc-abs]
    29                              <4> %else
    30                              <4>  %error Unknown keyword
    31                              <4> %endif
    32                              <4> 	%endmacro
    33                              <4> 
    34                              <4> 	%imacro reloc 1+.nolist
    35                              <4> %if ELDSTRICT
    36                              <4>  %if ELDSTRICTCOUNTER
    37                              <4>   %error Missing relocation
    38                              <4>  %endif
    39                              <4>  [warning -reloc-abs]
    40                              <4>  %assign ELDSTRICTCOUNTER 1
    41                              <4> %endif
    42                              <4> %1
    43                              <4> 	%endmacro
    44                              <4> 
    45                              <4> 	%imacro reloc2 1+.nolist
    46                              <4> %if ELDSTRICT
    47                              <4>  %if ELDSTRICTCOUNTER
    48                              <4>   %error Missing relocation
    49                              <4>  %endif
    50                              <4>  [warning -reloc-abs]
    51                              <4>  %assign ELDSTRICTCOUNTER 2
    52                              <4> %endif
    53                              <4> %1
    54                              <4> 	%endmacro
    55                              <4> 
    56                              <4> 	%imacro eldstrictcheck 0.nolist
    57                              <4> %if ELDSTRICT
    58                              <4>  %ifn ELDSTRICTCOUNTER
    59                              <4>   %error Unexpected relocation
    60                              <4>  %else
    61                              <4>   %assign ELDSTRICTCOUNTER ELDSTRICTCOUNTER - 1
    62                              <4>   %ifn ELDSTRICTCOUNTER
    63                              <4>    [warning +reloc-abs]
    64                              <4>   %endif
    65                              <4>  %endif
    66                              <4> %endif
    67                              <4> 	%endmacro
    68                              <4> 
    69                              <4> %endif
    70                              <4> 
    21                              <3> 
    22                              <3> 
    23                              <3> %assign ELDLINKER 0
    24                              <3> 
    25                              <3> %define INTERNAL_CODE_TO_CODE_RELOCATIONS ""
    26                              <3> %define INTERNAL_CODE_TO_DATA_RELOCATIONS ""
    27                              <3> %define INTERNAL_DATA_TO_CODE_RELOCATIONS ""
    28                              <3> %define INTERNAL_DATA_TO_DATA_RELOCATIONS ""
    29                              <3> %define INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS ""
    30                              <3> %define INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS ""
    31                              <3> %define INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS ""
    32                              <3> %define INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS ""
    33                              <3> %assign ELDDATA_OPTIONAL_STATUS 0		; not any seen yet
    34                              <3> %assign ELDDATA_PMREQUIRED_STATUS 0		; not any seen yet
    35                              <3> %assign ELDDATA_NEXT_STATUS 0			; not any seen yet
    36                              <3> %assign ELDDATA_NEXT_ENTRY -1
    37                              <3> %assign ELDDATA_NEXT_SECTION -1
    38                              <3> %assign ELDDATA_NEXT_OTHER -1
    39                              <3> 
    40                              <3> 	%imacro internalcoderelocation 0-1.nolist -2
    41                              <3> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    42                              <3> %if ELDLINKER
    43                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    44                              <3>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    45                              <3>  %else
    46                              <3>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    47                              <3>  %endif
    48                              <3> %else
    49                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    50                              <3>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    51                              <3>  %else
    52                              <3>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    53                              <3>  %endif
    54                              <3> %endif
    55                              <3> 	eldstrictcheck
    56                              <3> 	%endmacro
    57                              <3> 
    58                              <3> 	%imacro internaldatarelocation 0-1.nolist -2
    59                              <3> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    60                              <3> %if ELDLINKER
    61                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    62                              <3>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    63                              <3>  %else
    64                              <3>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    65                              <3>  %endif
    66                              <3> %else
    67                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    68                              <3>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    69                              <3>  %else
    70                              <3>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    71                              <3>  %endif
    72                              <3> %endif
    73                              <3> 	eldstrictcheck
    74                              <3> 	%endmacro
    75                              <3> 
    76                              <3> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    77                              <3> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    78                              <3> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    79                              <3> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    80                              <3> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    81                              <3> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    82                              <3> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    83                              <3> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    84                              <3> 
    85                              <3> 
    86                              <3> %define LINK_DATA_RELOCATIONS ""
    87                              <3> %define LINK_LINKER_DATA_RELOCATIONS ""
    88                              <3> %define LINK_DATA_NAMES db ""
    89                              <3> %define LINK_DATA_DETECTION none, none
    90                              <3> 
    91                              <3> %define LINK_OTHER_DATA_RELOCATIONS ""
    92                              <3> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    93                              <3> %define LINK_OTHER_DATA_NAMES db ""
    94                              <3> %define LINK_OTHER_DATA_DETECTION none, none
    95                              <3> 
    96                              <3> %ifndef ELDOTHER
    97                              <3>  %assign ELDOTHER 0
    98                              <3> %endif
    99                              <3> %assign ELDOTHERLINK 0
   100                              <3> 
   101                              <3> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
   102                              <3> %if ELDOTHER
   103                              <3>  %assign ELDOTHERLINK 1
   104                              <3> %endif
   105                              <3> 	linkdatarelocation %1, %2, %3
   106                              <3> %assign ELDOTHERLINK 0
   107                              <3> 	%endmacro
   108                              <3> 
   109                              <3> 	%imacro linkdatarelocation 1-4.nolist -2, required, single
   110                              <3> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   111                              <3> %ifidni %3, required
   112                              <3>  %assign %%optional 0
   113                              <3> %elifidni %3, optional
   114                              <3>  %assign %%optional 100h
   115                              <3>  %if ELDDATA_OPTIONAL_STATUS == 0
   116                              <3>   %assign ELDDATA_OPTIONAL_STATUS 1
   117                              <3>  %elif ELDDATA_OPTIONAL_STATUS == 1
   118                              <3>  %else
   119                              <3>   %error Optional data link not allowed here
   120                              <3>  %endif
   121                              <3> %elifidni %3, PM required
   122                              <3>  %assign %%optional 300h
   123                              <3>  %assign ELDDATA_PMREQUIRED_STATUS 1
   124                              <3>  %if ELDDATA_OPTIONAL_STATUS == 0
   125                              <3>   %assign ELDDATA_OPTIONAL_STATUS 1
   126                              <3>  %elif ELDDATA_OPTIONAL_STATUS == 1
   127                              <3>  %else
   128                              <3>   %error Optional data link not allowed here
   129                              <3>  %endif
   130                              <3> %else
   131                              <3>  %fatal Unknown optional keyword
   132                              <3> %endif
   133                              <3> %ifidni _CURRENT_SECTION_TYPE, DATA
   134                              <3>  %assign %%DATASECTION 1
   135                              <3> %else
   136                              <3>  %assign %%DATASECTION 0
   137                              <3> %endif
   138                              <3> %ifidni %4, single
   139                              <3>  %if ELDDATA_NEXT_STATUS == 1		; after next ?
   140                              <3>   %error Unexpected single data link after next data link
   141                              <3>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   142                              <3>   %assign ELDDATA_NEXT_STATUS 3		; note single with next/last present
   143                              <3>  %endif
   144                              <3>  %assign %%next 0
   145                              <3> %elifidni %4, next
   146                              <3>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   147                              <3>   %assign ELDDATA_NEXT_STATUS 1		; in next
   148                              <3>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   149                              <3>   %assign ELDDATA_NEXT_STATUS 1		; in next
   150                              <3>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   151                              <3>   %assign ELDDATA_NEXT_STATUS 1		; in next
   152                              <3>  %elif ELDDATA_NEXT_STATUS == 1		; repeated next ?
   153                              <3>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   156                              <3>    %error Unexpected next data link
   157                              <3>   %endif
   158                              <3>  %else
   159                              <3>   %error Next data link not allowed here
   160                              <3>  %endif
   161                              <3>  %ifn %%optional
   162                              <3>   %error Next data link only valid as optional or PM required
   163                              <3>  %endif
   164                              <3>  %assign %%next 400h
   165                              <3>  %assign ELDDATA_NEXT_ENTRY %%entry
   166                              <3>  %assign ELDDATA_NEXT_SECTION %%DATASECTION
   167                              <3>  %assign ELDDATA_NEXT_OTHER ELDOTHERLINK
   168                              <3> %elifidni %4, last
   169                              <3>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   170                              <3>   %error Next last data link not allowed here
   171                              <3>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   172                              <3>   %error Next last data link not allowed here
   173                              <3>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   174                              <3>   %error Next last data link not allowed here
   175                              <3>  %elif ELDDATA_NEXT_STATUS == 1		; after next ?
   176                              <3>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   179                              <3>    %error Unexpected next data link
   180                              <3>   %endif
   181                              <3>   %assign ELDDATA_NEXT_STATUS 2		; note now after last
   182                              <3>  %else
   183                              <3>   %error Next data link not allowed here
   184                              <3>  %endif
   185                              <3>  %assign %%next 800h
   186                              <3>  %assign ELDDATA_NEXT_ENTRY -1
   187                              <3>  %assign ELDDATA_NEXT_SECTION -1
   188                              <3> %else
   189                              <3>  %fatal Unknown next keyword
   190                              <3> %endif
   191                              <3> 	%if ELDOTHERLINK
   192                              <3> %if ELDLINKER
   193                              <3>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   194                              <3> %else
   195                              <3>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   196                              <3> %endif
   197                              <3> 	%else
   198                              <3> %if ELDLINKER
   199                              <3>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   200                              <3> %else
   201                              <3>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   202                              <3> %endif
   203                              <3> 	%endif
   204                              <3> %defstr %%string %1
   205                              <3> %strlen %%length %%string
   206                              <3> %if %%length > 64
   207                              <3> 	; Could be increased, but mustn't exceed 127 bytes
   208                              <3> 	;  because flag 80h is used to mark optional links
   209                              <3> 	;  that failed to be matched.
   210                              <3>  %error Too long link name: %1
   211                              <3> %endif
   212                              <3> %define LINK_DATA_CHECK %1
   213                              <3> 	%if ELDOTHERLINK
   214                              <3> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   215                              <3> %if LINK_DATA_NEW
   216                              <3>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   217                              <3> 	hashdef HASH, %%string
   218                              <3>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   220                              <3> %else
   221                              <3>  %%name equ LINK_DATA_DUPLICATE
   222                              <3> %endif
   223                              <3> 	%else
   224                              <3> 	linkdata_detect LINK_DATA_DETECTION
   225                              <3> %if LINK_DATA_NEW
   226                              <3>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   227                              <3> 	hashdef HASH, %%string
   228                              <3>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   230                              <3> %else
   231                              <3>  %%name equ LINK_DATA_DUPLICATE
   232                              <3> %endif
   233                              <3> 	%endif
   234                              <3> 	eldstrictcheck
   235                              <3> 	%endmacro
   236                              <3> 
   237                              <3> 	%imacro linkdata_detect 2-*.nolist
   238                              <3> %assign LINK_DATA_NEW 1
   239                              <3> %rep (%0 - 2) / 2
   240                              <3>  %rotate 2
   241                              <3>  %ifidni %1, LINK_DATA_CHECK
   242                              <3>   %assign LINK_DATA_NEW 0
   243                              <3>   %xdefine LINK_DATA_DUPLICATE %2
   244                              <3>   %exitrep
   245                              <3>  %endif
   246                              <3> %endrep
   247                              <3> 	%endmacro
   248                              <3> 
   249                              <3> 	%imacro link_data_dump_names 1-*.nolist
   250                              <3> %rep %0
   251                              <3> 	%1
   252                              <3>  %rotate 1
   253                              <3> %endrep
   254                              <3> 	%endmacro
   255                              <3> 
   256                              <3> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   257                              <3> ; dw LINK_DATA_RELOCATIONS, 0, 0
   258                              <3> ; link_data_dump_names ELDCALL_CODE_NAMES
   259                              <3> 
   260                              <3> %endif
    21                              <2> 
    22                              <2> %assign ELDLINKER 0
    23                              <2> 
    24                              <2> [section relocatedzero nobits vstart=0]
    25                              <2> relocatedzero:
    26                              <2> __SECT__
    27                              <2> 
    28                              <2> 	numdef HOUDINI, 1
    29                              <2> 	numdef HOUDINI_CONDITIONAL, 1
    30                              <2> 
    31                              <2> %imacro houdini 0.nolist
    32                              <2> %if _HOUDINI
    33                              <2>  %if _HOUDINI_CONDITIONAL
    34                              <2> reloc	testopt [ss:relocateddata], 100h
    35                              <2> linkdatarelocation options7, -3
    36                              <2> 	jz %%skip
    37                              <2>  %endif
    38                              <2> reloc	testopt [ss:relocateddata], 100h
    39                              <2> linkdatarelocation internalflags6, -3
    40                              <2> 	jz %%skip
    41                              <2> 	int3
    42                              <2> %%skip:
    43                              <2> %endif
    44                              <2> %endmacro
    45                              <2> 
    46                              <2> %define ELDCALL_CODE_RELOCATIONS ""
    47                              <2> %define ELDCALL_LINKER_CODE_RELOCATIONS ""
    48                              <2> %define ELDCALL_CODE_RELOCATIONS_OPTIONAL ""
    49                              <2> %define ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ""
    50                              <2> %define ELDCALL_CODE_NAMES db ""
    51                              <2> %define ELDCALL_CODE_DETECTION none, none
    52                              <2> %assign ELDCALL_OPTIONAL_STATUS 0		; not any seen yet
    53                              <2> %assign ELDCALL_PMREQUIRED_STATUS 0		; not any seen yet
    54                              <2> %assign ELDCALL_NEXT_STATUS 0			; not any seen yet
    55                              <2> %assign ELDCALL_NEXT_ENTRY -1
    56                              <2> 
    57                              <2> 	%imacro extcall 1-3.nolist required, single
    58                              <2> %ifidni _CURRENT_SECTION_TYPE, DATA
    59                              <2>  %error "ELD call cannot be used in ELD data block"
    60                              <2> %endif
    61                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP
    62                              <2> %ifidni %2, required
    63                              <2>  %assign %%optional 0
    64                              <2> %elifidni %2, optional
    65                              <2>  %assign %%optional 100h
    66                              <2>  %if ELDCALL_OPTIONAL_STATUS == 0
    67                              <2>   %assign ELDCALL_OPTIONAL_STATUS 1
    68                              <2>  %elif ELDCALL_OPTIONAL_STATUS == 1
    69                              <2>  %else
    70                              <2>   %error Optional code link not allowed here
    71                              <2>  %endif
    72                              <2> %elifidni %2, PM required
    73                              <2>  %assign %%optional 300h
    74                              <2>  %assign ELDCALL_PMREQUIRED_STATUS 1
    75                              <2>  %if ELDCALL_OPTIONAL_STATUS == 0
    76                              <2>   %assign ELDCALL_OPTIONAL_STATUS 1
    77                              <2>  %elif ELDCALL_OPTIONAL_STATUS == 1
    78                              <2>  %else
    79                              <2>   %error Optional code link not allowed here
    80                              <2>  %endif
    81                              <2> %else
    82                              <2>  %fatal Unknown optional keyword
    83                              <2> %endif
    84                              <2> %ifidni %3, single
    85                              <2>  %if ELDCALL_NEXT_STATUS == 1		; after next ?
    86                              <2>   %error Unexpected single code link after next code link
    87                              <2>  %elif ELDCALL_NEXT_STATUS == 2		; after last ?
    88                              <2>   %assign ELDCALL_NEXT_STATUS 3		; note single with next/last present
    89                              <2>  %endif
    90                              <2>  %assign %%next 0
    91                              <2> %elifidni %3, next
    92                              <2>  %if ELDCALL_NEXT_STATUS == 0		; no next/last yet ?
    93                              <2>   %assign ELDCALL_NEXT_STATUS 1		; in next
    94                              <2>  %elif ELDCALL_NEXT_STATUS == 2		; after last ?
    95                              <2>   %assign ELDCALL_NEXT_STATUS 1		; in next
    96                              <2>  %elif ELDCALL_NEXT_STATUS == 3		; after single ?
    97                              <2>   %assign ELDCALL_NEXT_STATUS 1		; in next
    98                              <2>  %elif ELDCALL_NEXT_STATUS == 1		; repeated next ?
    99                              <2>   %if ELDCALL_NEXT_ENTRY != %%entry
   100                              <2>    %error Unexpected next code link
   101                              <2>   %endif
   102                              <2>  %else
   103                              <2>   %error Next code link not allowed here
   104                              <2>  %endif
   105                              <2>  %ifn %%optional
   106                              <2>   %error Next code link only valid as optional or PM required
   107                              <2>  %endif
   108                              <2>  %assign %%next 400h
   109                              <2>  %assign ELDCALL_NEXT_ENTRY %%entry
   110                              <2> %elifidni %3, last
   111                              <2>  %if ELDCALL_NEXT_STATUS == 0		; no next/last yet ?
   112                              <2>   %error Next last code link not allowed here
   113                              <2>  %elif ELDCALL_NEXT_STATUS == 2		; after last ?
   114                              <2>   %error Next last code link not allowed here
   115                              <2>  %elif ELDCALL_NEXT_STATUS == 3		; after single ?
   116                              <2>   %error Next last code link not allowed here
   117                              <2>  %elif ELDCALL_NEXT_STATUS == 1		; after next ?
   118                              <2>   %if ELDCALL_NEXT_ENTRY != %%entry
   119                              <2>    %error Unexpected next code link
   120                              <2>   %endif
   121                              <2>   %assign ELDCALL_NEXT_STATUS 2		; note now after last
   122                              <2>  %else
   123                              <2>   %error Next code link not allowed here
   124                              <2>  %endif
   125                              <2>  %assign %%next 800h
   126                              <2>  %assign ELDCALL_NEXT_ENTRY -1
   127                              <2>  %assign ELDCALL_NEXT_SECTION -1
   128                              <2> %else
   129                              <2>  %fatal Unknown next keyword
   130                              <2> %endif
   131                              <2> %if %%next != 400h
   132                              <2> %if 0
   133                              <2> [warning -reloc-rel-word]
   134                              <2> 	call near relocatedzero
   135                              <2> [warning +reloc-rel-word]
   136                              <2> %else
   137                              <2> 	db 0E8h
   138                              <2> reloc	dw relocatedzero
   139                              <2> 	eldstrictcheck
   140                              <2> %endif
   141                              <2> 	jmp strict short %%skipparameter
   142                              <2> 	dw 0
   143                              <2> %%skipparameter:
   144                              <2> %endif
   145                              <2> %if ELDLINKER
   146                              <2>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS ELDCALL_LINKER_CODE_RELOCATIONS, %%entry, %%name
   147                              <2>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional + %%next, %%entry, %%name
   148                              <2> %else
   149                              <2>  %xdefine ELDCALL_CODE_RELOCATIONS ELDCALL_CODE_RELOCATIONS, %%entry, %%name
   150                              <2>  %xdefine ELDCALL_CODE_RELOCATIONS_OPTIONAL ELDCALL_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional + %%next, %%entry, %%name
   151                              <2> %endif
   152                              <2> %defstr %%string %1
   153                              <2> %strlen %%length %%string
   154                              <2> %if %%length > 64
   155                              <2> 	; Could be increased, but mustn't exceed 127 bytes
   156                              <2> 	;  because flag 80h is used to mark optional links
   157                              <2> 	;  that failed to be matched.
   158                              <2>  %error Too long link name: %1
   159                              <2> %endif
   160                              <2> %define ELDCALL_CODE_CHECK %1
   161                              <2> 	linkcode_detect ELDCALL_CODE_DETECTION
   162                              <2> %if ELDCALL_CODE_NEW
   163                              <2>  %xdefine ELDCALL_CODE_DETECTION ELDCALL_CODE_DETECTION, %1, %%name
   164                              <2> 	hashdef HASH, %%string
   165                              <2> %xdefine ELDCALL_CODE_NAMES 	ELDCALL_CODE_NAMES, %%name:, dw _HASH, {counted %%string}
   167                              <2> %else
   168                              <2>  %%name equ ELDCALL_CODE_DUPLICATE
   169                              <2> %endif
   170                              <2> 	%endmacro
   171                              <2> 
   172                              <2> 	%imacro linkcode_detect 2-*.nolist
   173                              <2> %assign ELDCALL_CODE_NEW 1
   174                              <2> %rep (%0 - 2) / 2
   175                              <2>  %rotate 2
   176                              <2>  %ifidni %1, ELDCALL_CODE_CHECK
   177                              <2>   %assign ELDCALL_CODE_NEW 0
   178                              <2>   %xdefine ELDCALL_CODE_DUPLICATE %2
   179                              <2>   %exitrep
   180                              <2>  %endif
   181                              <2> %endrep
   182                              <2> 	%endmacro
   183                              <2> 
   184                              <2> 
   185                              <2> %define ELDCALL_CALLCALL_LIST none
   186                              <2> %define ELDCALL_CALLCALL_PROCESSED_PRIOR ""
   187                              <2> 
   188                              <2> 	%imacro extcallcall 1.nolist
   189                              <2> 	call %1
   190                              <2> %xdefine ELDCALL_CALLCALL_LIST ELDCALL_CALLCALL_LIST, %1
   191                              <2> 	%endmacro
   192                              <2> 
   193                              <2> %assign ELDCALLCALL_DUMPED 0
   194                              <2> 
   195                              <2> 	%imacro eldcall_dump_callcall 1-*.nolist
   196                              <2> %xdefine ELDCALL_CALLCALL_PROCESSED ELDCALL_CALLCALL_PROCESSED_PRIOR
   197                              <2>  %rep %0 - 1
   198                              <2>   %rotate 1
   199                              <2>   %define ELDCALL_CHECK %1
   200                              <2> 	eldcall_callcall_detect ELDCALL_CALLCALL_PROCESSED
   201                              <2>   %if ELDCALL_NEW
   202                              <2>    %xdefine ELDCALL_CALLCALL_PROCESSED ELDCALL_CALLCALL_PROCESSED, %1
   203                              <2> 	align 8, nop
   204                              <2> %1:
   205                              <2> 	extcall %1
   206                              <2> 	retn
   207                              <2>   %endif
   208                              <2>  %endrep
   209                              <2> %assign ELDCALLCALL_DUMPED 1
   210                              <2> %define ELDCALL_CALLCALL_LIST none
   211                              <2> 	%endmacro
   212                              <2> 
   213                              <2> 	%imacro eldcall_new_callcall 0.nolist
   214                              <2> %if ELDCALLCALL_DUMPED
   215                              <2>  %xdefine ELDCALL_CALLCALL_PROCESSED_PRIOR   ELDCALL_CALLCALL_PROCESSED_PRIOR, ELDCALL_CALLCALL_PROCESSED
   217                              <2>  %assign ELDCALLCALL_DUMPED 0
   218                              <2>  %define ELDCALL_CALLCALL_LIST none
   219                              <2> %endif
   220                              <2> 	%endmacro
   221                              <2> 
   222                              <2> 	%imacro eldcall_callcall_detect 1-*.nolist
   223                              <2> %assign ELDCALL_NEW 1
   224                              <2> %rep %0
   225                              <2>  %ifidni %1, ELDCALL_CHECK
   226                              <2>   %assign ELDCALL_NEW 0
   227                              <2>   %exitrep
   228                              <2>  %endif
   229                              <2>  %rotate 1
   230                              <2> %endrep
   231                              <2> 	%endmacro
   232                              <2> 
   233                              <2> 	%imacro eldcall_dump_names 1-*.nolist
   234                              <2> %rep %0
   235                              <2> 	%1
   236                              <2>  %rotate 1
   237                              <2> %endrep
   238                              <2> 	%endmacro
   239                              <2> 
   240                              <2> ; eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   241                              <2> ; if using optional code links:
   242                              <2> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
   243                              <2> ;  dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
   244                              <2> ; if not using optional code links:
   245                              <2> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
   246                              <2> ;  dw ELDCALL_CODE_RELOCATIONS, 0, 0
   247                              <2> ; eldcall_dump_names ELDCALL_CODE_NAMES
   248                              <2> 
   249                              <2> %endif
    39                              <1> %include "elddata.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug data relocation macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2024 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELDDATA_MAC
    16                              <2> %define ELDDATA_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
    19                              <2> %include "nasmhash.mac"
    20                              <2> %include "eldcheck.mac"
    21                              <2> 
    22                              <2> 
    23                              <2> %assign ELDLINKER 0
    24                              <2> 
    25                              <2> %define INTERNAL_CODE_TO_CODE_RELOCATIONS ""
    26                              <2> %define INTERNAL_CODE_TO_DATA_RELOCATIONS ""
    27                              <2> %define INTERNAL_DATA_TO_CODE_RELOCATIONS ""
    28                              <2> %define INTERNAL_DATA_TO_DATA_RELOCATIONS ""
    29                              <2> %define INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS ""
    30                              <2> %define INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS ""
    31                              <2> %define INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS ""
    32                              <2> %define INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS ""
    33                              <2> %assign ELDDATA_OPTIONAL_STATUS 0		; not any seen yet
    34                              <2> %assign ELDDATA_PMREQUIRED_STATUS 0		; not any seen yet
    35                              <2> %assign ELDDATA_NEXT_STATUS 0			; not any seen yet
    36                              <2> %assign ELDDATA_NEXT_ENTRY -1
    37                              <2> %assign ELDDATA_NEXT_SECTION -1
    38                              <2> %assign ELDDATA_NEXT_OTHER -1
    39                              <2> 
    40                              <2> 	%imacro internalcoderelocation 0-1.nolist -2
    41                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    42                              <2> %if ELDLINKER
    43                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    44                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    45                              <2>  %else
    46                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    47                              <2>  %endif
    48                              <2> %else
    49                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    50                              <2>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    51                              <2>  %else
    52                              <2>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    53                              <2>  %endif
    54                              <2> %endif
    55                              <2> 	eldstrictcheck
    56                              <2> 	%endmacro
    57                              <2> 
    58                              <2> 	%imacro internaldatarelocation 0-1.nolist -2
    59                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    60                              <2> %if ELDLINKER
    61                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    62                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    63                              <2>  %else
    64                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    65                              <2>  %endif
    66                              <2> %else
    67                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    68                              <2>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    69                              <2>  %else
    70                              <2>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    71                              <2>  %endif
    72                              <2> %endif
    73                              <2> 	eldstrictcheck
    74                              <2> 	%endmacro
    75                              <2> 
    76                              <2> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    77                              <2> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    78                              <2> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    79                              <2> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    80                              <2> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    81                              <2> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    82                              <2> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    83                              <2> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    84                              <2> 
    85                              <2> 
    86                              <2> %define LINK_DATA_RELOCATIONS ""
    87                              <2> %define LINK_LINKER_DATA_RELOCATIONS ""
    88                              <2> %define LINK_DATA_NAMES db ""
    89                              <2> %define LINK_DATA_DETECTION none, none
    90                              <2> 
    91                              <2> %define LINK_OTHER_DATA_RELOCATIONS ""
    92                              <2> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    93                              <2> %define LINK_OTHER_DATA_NAMES db ""
    94                              <2> %define LINK_OTHER_DATA_DETECTION none, none
    95                              <2> 
    96                              <2> %ifndef ELDOTHER
    97                              <2>  %assign ELDOTHER 0
    98                              <2> %endif
    99                              <2> %assign ELDOTHERLINK 0
   100                              <2> 
   101                              <2> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
   102                              <2> %if ELDOTHER
   103                              <2>  %assign ELDOTHERLINK 1
   104                              <2> %endif
   105                              <2> 	linkdatarelocation %1, %2, %3
   106                              <2> %assign ELDOTHERLINK 0
   107                              <2> 	%endmacro
   108                              <2> 
   109                              <2> 	%imacro linkdatarelocation 1-4.nolist -2, required, single
   110                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   111                              <2> %ifidni %3, required
   112                              <2>  %assign %%optional 0
   113                              <2> %elifidni %3, optional
   114                              <2>  %assign %%optional 100h
   115                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   116                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   117                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   118                              <2>  %else
   119                              <2>   %error Optional data link not allowed here
   120                              <2>  %endif
   121                              <2> %elifidni %3, PM required
   122                              <2>  %assign %%optional 300h
   123                              <2>  %assign ELDDATA_PMREQUIRED_STATUS 1
   124                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   125                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   126                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   127                              <2>  %else
   128                              <2>   %error Optional data link not allowed here
   129                              <2>  %endif
   130                              <2> %else
   131                              <2>  %fatal Unknown optional keyword
   132                              <2> %endif
   133                              <2> %ifidni _CURRENT_SECTION_TYPE, DATA
   134                              <2>  %assign %%DATASECTION 1
   135                              <2> %else
   136                              <2>  %assign %%DATASECTION 0
   137                              <2> %endif
   138                              <2> %ifidni %4, single
   139                              <2>  %if ELDDATA_NEXT_STATUS == 1		; after next ?
   140                              <2>   %error Unexpected single data link after next data link
   141                              <2>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   142                              <2>   %assign ELDDATA_NEXT_STATUS 3		; note single with next/last present
   143                              <2>  %endif
   144                              <2>  %assign %%next 0
   145                              <2> %elifidni %4, next
   146                              <2>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   147                              <2>   %assign ELDDATA_NEXT_STATUS 1		; in next
   148                              <2>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   149                              <2>   %assign ELDDATA_NEXT_STATUS 1		; in next
   150                              <2>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   151                              <2>   %assign ELDDATA_NEXT_STATUS 1		; in next
   152                              <2>  %elif ELDDATA_NEXT_STATUS == 1		; repeated next ?
   153                              <2>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   156                              <2>    %error Unexpected next data link
   157                              <2>   %endif
   158                              <2>  %else
   159                              <2>   %error Next data link not allowed here
   160                              <2>  %endif
   161                              <2>  %ifn %%optional
   162                              <2>   %error Next data link only valid as optional or PM required
   163                              <2>  %endif
   164                              <2>  %assign %%next 400h
   165                              <2>  %assign ELDDATA_NEXT_ENTRY %%entry
   166                              <2>  %assign ELDDATA_NEXT_SECTION %%DATASECTION
   167                              <2>  %assign ELDDATA_NEXT_OTHER ELDOTHERLINK
   168                              <2> %elifidni %4, last
   169                              <2>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   170                              <2>   %error Next last data link not allowed here
   171                              <2>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   172                              <2>   %error Next last data link not allowed here
   173                              <2>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   174                              <2>   %error Next last data link not allowed here
   175                              <2>  %elif ELDDATA_NEXT_STATUS == 1		; after next ?
   176                              <2>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   179                              <2>    %error Unexpected next data link
   180                              <2>   %endif
   181                              <2>   %assign ELDDATA_NEXT_STATUS 2		; note now after last
   182                              <2>  %else
   183                              <2>   %error Next data link not allowed here
   184                              <2>  %endif
   185                              <2>  %assign %%next 800h
   186                              <2>  %assign ELDDATA_NEXT_ENTRY -1
   187                              <2>  %assign ELDDATA_NEXT_SECTION -1
   188                              <2> %else
   189                              <2>  %fatal Unknown next keyword
   190                              <2> %endif
   191                              <2> 	%if ELDOTHERLINK
   192                              <2> %if ELDLINKER
   193                              <2>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   194                              <2> %else
   195                              <2>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   196                              <2> %endif
   197                              <2> 	%else
   198                              <2> %if ELDLINKER
   199                              <2>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   200                              <2> %else
   201                              <2>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   202                              <2> %endif
   203                              <2> 	%endif
   204                              <2> %defstr %%string %1
   205                              <2> %strlen %%length %%string
   206                              <2> %if %%length > 64
   207                              <2> 	; Could be increased, but mustn't exceed 127 bytes
   208                              <2> 	;  because flag 80h is used to mark optional links
   209                              <2> 	;  that failed to be matched.
   210                              <2>  %error Too long link name: %1
   211                              <2> %endif
   212                              <2> %define LINK_DATA_CHECK %1
   213                              <2> 	%if ELDOTHERLINK
   214                              <2> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   215                              <2> %if LINK_DATA_NEW
   216                              <2>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   217                              <2> 	hashdef HASH, %%string
   218                              <2>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   220                              <2> %else
   221                              <2>  %%name equ LINK_DATA_DUPLICATE
   222                              <2> %endif
   223                              <2> 	%else
   224                              <2> 	linkdata_detect LINK_DATA_DETECTION
   225                              <2> %if LINK_DATA_NEW
   226                              <2>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   227                              <2> 	hashdef HASH, %%string
   228                              <2>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   230                              <2> %else
   231                              <2>  %%name equ LINK_DATA_DUPLICATE
   232                              <2> %endif
   233                              <2> 	%endif
   234                              <2> 	eldstrictcheck
   235                              <2> 	%endmacro
   236                              <2> 
   237                              <2> 	%imacro linkdata_detect 2-*.nolist
   238                              <2> %assign LINK_DATA_NEW 1
   239                              <2> %rep (%0 - 2) / 2
   240                              <2>  %rotate 2
   241                              <2>  %ifidni %1, LINK_DATA_CHECK
   242                              <2>   %assign LINK_DATA_NEW 0
   243                              <2>   %xdefine LINK_DATA_DUPLICATE %2
   244                              <2>   %exitrep
   245                              <2>  %endif
   246                              <2> %endrep
   247                              <2> 	%endmacro
   248                              <2> 
   249                              <2> 	%imacro link_data_dump_names 1-*.nolist
   250                              <2> %rep %0
   251                              <2> 	%1
   252                              <2>  %rotate 1
   253                              <2> %endrep
   254                              <2> 	%endmacro
   255                              <2> 
   256                              <2> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   257                              <2> ; dw LINK_DATA_RELOCATIONS, 0, 0
   258                              <2> ; link_data_dump_names ELDCALL_CODE_NAMES
   259                              <2> 
   260                              <2> %endif
    40                              <1> %include "isvariab.mac"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> lDebug isvariable? function strutures and macros
     5                              <2> 
     6                              <2> Copyright (C) 2008-2025 E. C. Masloch
     7                              <2> 
     8                              <2> Usage of the works is permitted provided that this
     9                              <2> instrument is retained with the works, so that any entity
    10                              <2> that uses the works is notified of this instrument.
    11                              <2> 
    12                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                              <2> 
    14                              <2> %endif
    15                              <2> 
    16                              <2> 
    17                              <2> 	struc ISVARIABLESTRUC
    18 00000000 ????                <2> ivName:		resw 1		; -> name (up to 13 bytes, but actually only 11)
    19                              <2> 				;  (search for ivfNameLengthLimit for limit)
    20                              <2> 				;  (length given by ivFlags & ivfNameLengthMask)
    21                              <2> 	; The ivName pointer is only used for more-byte names. It actually
    22                              <2> 	;  contains the trailer of the name, excluding the prefix formed by
    23                              <2> 	;  the first two bytes. This suffix can be the empty string if the
    24                              <2> 	;  variable in question has a two-byte name.
    25                              <2> 	; (For one-byte names this field is unused and contains zero.)
    26 00000002 ????                <2> ivFlags:	resw 1
    27 00000004 ????                <2> ivAddress:	resw 1		; default -> variable
    28                              <2> 	; The ivAddress field is used by default_variable_setup as the base
    29                              <2> 	;  address for the variable(s). It is also used by var_ext_setup as
    30                              <2> 	;  the ELD code section offset to transfer control to. Otherwise, it
    31                              <2> 	;  is usually set to zero and unused.
    32 00000006 ????                <2> ivSetup:	resw 1		; -> set up code (in expr code section)
    33                              <2> 	; INP:	ax = array index (0-based)
    34                              <2> 	;	di = 0
    35                              <2> 	;	cl = default size of variable (1..4)
    36                              <2> 	;	ch = length of variable name
    37                              <2> 	;	bx -> ISVARIABLESTRUC structure
    38                              <2> 	; CHG:	ax, bx, cx, dx, si, di
    39                              <2> 	; OUT:	NC if valid,
    40                              <2> 	;	 bx -> var, di = 0 or di -> mask
    41                              <2> 	;	 cl = size of variable (1..4)
    42                              <2> 	;	 ch = length of variable name
    43 00000008 ??                  <2> ivArrayLast:	resb 1		; 0 if no array, FFh = 256 entries
    44                              <2> 	; The ivArrayLast field is used by the dispatcher to determine
    45                              <2> 	;  whether to support array index expressions. It is checked
    46                              <2> 	;  before decrementing the index if ivfArrayOneBased is set.
    47 00000009 ??                  <2> ivArrayBetween: resb 1		; how many bytes to skip for each index
    48                              <2> 	; The ivArrayBetween field is only used by default_variable_setup.
    49                              <2> 	endstruc
    50                              <2> 
    51                              <2> ivfNameLengthMask:	equ 15	; gives name trailer length, 0 to 11
    52                              <2> ivfNameLengthLimit:	equ 13
    53                              <2> ivfVarLengthShift:	equ 4
    54                              <2> ivfVarLengthMask:	equ 3 << ivfVarLengthShift
    55                              <2> 				; gives default variable size minus 1
    56                              <2> ivfReadOnly:		equ 80h	; variable cannot be written at all
    57                              <2> ivfArrayOneBased:	equ 100h; first array entry is 1 not 0 (ivArrayLast > 0)
    58                              <2> ivfArrayOptional:	equ 200h; array index expression is optional
    59                              <2> ivfSeparatorSpecial:	equ 400h; used for RIxxP/L/S/O
    60                              <2> 
    61                              <2> %define ISVARIABLESTRINGS db "",db ""
    62                              <2> %define IVS_ONEBYTE_NAMES ""
    63                              <2> %define IVS_MOREBYTE_NAMEHEADERS ""
    64                              <2> %assign IVS_HAVE_ONEBYTE 0
    65                              <2> %assign IVS_SINGLE_ONEBYTE 1
    66                              <2> 
    67                              <2> 		; %1 = name string
    68                              <2> 		; %2 = default variable length, 1 to 4
    69                              <2> 		; %3 = flags to set (except name length and var length)
    70                              <2> 		; %4 = ivAddress value
    71                              <2> 		; %5 = ivArrayLast, defaults to 0 (no array)
    72                              <2> 		; %6 = ivArrayBetween, defaults to 0 (immediately consecutive)
    73                              <2> 		; %7 = ivSetup, defaults to default_variable_setup
    74                              <2> 	%macro isvariablestruc 4-7.nolist 0, 0, default_variable_setup
    75                              <2> %push
    76                              <2> %strlen %$namelength %1
    77                              <2> %if %$namelength > ivfNameLengthLimit
    78                              <2>  %error Expected at most 13-byte name (or adjust isvariable? code)
    79                              <2> %endif
    80                              <2> %if IVS_ONEBYTE && %$namelength != 1
    81                              <2>  %error Expected a one-byte name
    82                              <2> %elif ! IVS_ONEBYTE && %$namelength < 2
    83                              <2>  %error Expected at least a two-byte name
    84                              <2> %endif
    85                              <2> %if IVS_ONEBYTE
    86                              <2>  %define IVS_SINGLE_ONEBYTE_NAME %1
    87                              <2>  %if IVS_HAVE_ONEBYTE
    88                              <2>   %assign IVS_SINGLE_ONEBYTE 0
    89                              <2>  %endif
    90                              <2>  %assign IVS_HAVE_ONEBYTE 1
    91                              <2>  %assign %$namelength 0
    92                              <2>  %xdefine IVS_ONEBYTE_NAMES IVS_ONEBYTE_NAMES, %1
    93                              <2>  %%name equ 0
    94                              <2> %else
    95                              <2>  %assign %$namelength %$namelength - 2
    96                              <2>  %substr %$nametrailer %1 3,-1
    97                              <2>  %substr %$nameheader %1 1,2
    98                              <2>  %xdefine IVS_MOREBYTE_NAMEHEADERS IVS_MOREBYTE_NAMEHEADERS, %$nameheader
    99                              <2>  %xdefine ISVARIABLESTRINGS ISVARIABLESTRINGS, %%name:, {db %$nametrailer}
   100                              <2> %endif
   101                              <2> 
   102                              <2> %assign %$varlength %2 - 1	; 0 means one byte, 1 means two bytes,
   103                              <2> 				;  2 means three bytes, 3 means four bytes
   104                              <2> 	istruc ISVARIABLESTRUC
   105                              <2> at ivName,		dw %%name
   106                              <2>  IV_NAME_RELOCATION
   107                              <2> at ivFlags,		dw %$$namelength | (%$$varlength << ivfVarLengthShift) | %3
   108                              <2> at ivAddress,		dw %4
   109                              <2>  IV_ADDRESS_RELOCATION
   110                              <2> at ivSetup,		dw %7
   111                              <2>  IV_SETUP_RELOCATION
   112                              <2> at ivArrayLast,		db %5
   113                              <2> at ivArrayBetween,	db %6
   114                              <2> 	iend
   115                              <2> %pop
   116                              <2> %ifndef SECTION_OF_%7
   117                              <2>  %error Unknown target section for symbol %7
   118                              <2> %elifnidni %[SECTION_OF_%7], _EXPR_SECTION
   119                              <2>  %error Wrong section for symbol %7: section_of=SECTION_OF_%7, expr=_EXPR_SECTION
   120                              <2> %endif
   121                              <2> 	%endmacro
   122                              <2> 
   123                              <2> %define IV_NAME_RELOCATION
   124                              <2> %define IV_ADDRESS_RELOCATION
   125                              <2> %define IV_SETUP_RELOCATION
   126                              <2> 
   127                              <2> 	%macro isvariablestrings 2-*.nolist
   128                              <2> %rep %0
   129                              <2>  %1
   130                              <2>  %rotate 1
   131                              <2> %endrep
   132                              <2> 	%endmacro
    41                              <1> 
    42                              <1> 
    43                              <1> 	cpu 8086
    44                              <1> 
    45                              <1> 	addsection RELOCATEDDATA, nobits vstart=_ELD_RELOC_VSTART
    46                              <1> relocateddata:
    47                              <1> 
    48                              <1> 	addsection HEADER, start=0
    49                              <1> 
    50                              <1> 	istruc ELD_HEADERX
    51                              <1> at eldhxHeader
    52                              <1> 		; ELD executable header
    53                              <1> 	istruc ELD_HEADER
    54 00000000 454C4431            <1> at eldhSignature,	db "ELD1"
    55 00000004 000000              <1> 			db 0,0,0
    56 00000007 1A                  <1> 			db 26
    57 00000008 60000000            <1> at eldhCodeOffset,	dd CODEOFFSET
    58 0000000C 800B                <1> at eldhCodeImageLength,	dw code_size
    59 0000000E 0000                <1> at eldhCodeAllocLength,	dw 0
    60 00000010 E00B0000            <1> at eldhDataOffset,	dd DATAOFFSET
    61 00000014 4001                <1> at eldhDataImageLength,	dw data_size
    62 00000016 0000                <1> at eldhDataAllocLength,	dw total_data_size - data_size
    63 00000018 AB02                <1> at eldhCodeEntrypoint,	dw linker - code
    64                              <1> at eldhReserved
    65 0000001A 00<rep 4h>2800      <1> at eldhExtensionSize,	dw header_extension_end - $$
    66                              <1> 	iend
    67 00000020 [30000000]          <1> at eldhxDescriptionOffset,	dd description
    68 00000024 710C0000            <1> at eldhxHelpOffset,		dd DATAOFFSET + msg.help - datastart
    69                              <1> PUT_ELDHX_DATETIME_OFFSET
    70                              <1> header_extension_end:
    71 00000028 00<rep 8h>          <1> 	iend
    72                              <1> 
    73 00000030 44756D702054726163- <1> description:		asciz "Dump TracList hints for all ELDs."
    73 00000039 4C6973742068696E74- <1>
    73 00000042 7320666F7220616C6C- <1>
    73 0000004B 20454C44732E00      <1>
    74                              <1> 
    75                              <1> 
    76 00000052 00<rep Eh>          <1> 	align 16, db 0
    77                              <1> 
    78                              <1> 	eldstrict on
    79                              <1> 
    80                              <1> CODEOFFSET equ $ - $$
    81                              <1> 	addsection CODE, follows=HEADER vstart=_ELD_CODE_VSTART
    82                              <1> %define CODEFIXUP - code + 0
    83                              <1> code:
    84                              <1> 		; ELD instance header
    85                              <1> 	istruc ELD_INSTANCE
    86                              <1> at eldiStartCode
    87 00000000 00<rep 2h>          <1> at eldiEndCode
    88 00000002 00<rep 2h>          <1> at eldiStartData
    89 00000004 00<rep 2h>          <1> at eldiEndData
    90 00000006 00<rep 2h>48494E54- <1> at eldiIdentifier,	fill 8, 32, db "HINT",OTH_STRING
    90 0000000C 4F544820            <1>
    91 00000010 00<rep 2h>68696E74- <1> at eldiListing,		asciz _ELD_LISTING
    91 00000016 6F74682E6C737400    <1>
    92 0000001E 00<rep 2h>          <1> 	iend
    93                              <1> 
    94                              <1> 
    95                              <1> command:
    96 00000020 EB08                <1> 	jmp strict short .entry
    97                              <1> .chain:
    98 00000022 E8[0000]EB020000    <1> 	extcall cmd3_not_ext, required	; must NOT be extcallcall
    99 00000029 90                  <1> 	times 10 - ($ - command) nop
   100                              <1> .entry:
   101 0000002A 56                  <1> 	push si
   102 0000002B 3C2D                <1> 	cmp al, '-'
   103 0000002D 7503                <1> 	jne @F
   104 0000002F E87E01              <1> 	extcallcall skipcomma
   105                              <1> @@:
   106 00000032 4E                  <1> 	dec si
   107                              <1> 
   108 00000033 BA[0400]            <1> reloc	mov dx, msg.hint_keyword
   109                              <1> internaldatarelocation
   110 00000036 E87F01              <1> 	extcallcall isstring?
   111 00000039 7405                <1> 	je .ours
   112 0000003B 5E                  <1> 	pop si
   113 0000003C 4E                  <1> 	dec si
   114 0000003D AC                  <1> 	lodsb
   115 0000003E EBE2                <1> 	jmp .chain
   116                              <1> 
   117                              <1> .ours:
   118 00000040 58                  <1> 	pop ax
   119 00000041 E86C01              <1> 	extcallcall skipcomma
   120 00000044 4E                  <1> 	dec si
   121 00000045 C706[0000][0000]    <1> reloc2	mov word [relocateddata], relocateddata
   122                              <1> linkdatarelocation lastcmd, -4
   123                              <1> linkdatarelocation dmycmd
   124 0000004B BA[0000]            <1> reloc	mov dx, relocateddata
   125                              <1> linkdatarelocation msg.uninstall
   126 0000004E E86701              <1> 	extcallcall isstring?
   127 00000051 7419                <1> 	je uninstall
   128                              <1> 
   129                              <1> %if _OTHER
   130 00000053 A1[0200]            <1> reloc	mov ax, word [otherseg]
   131                              <1> internaldatarelocation
   132 00000056 E86701              <1> 	extcallcall ispm
   133 00000059 7508                <1> 	jnz @F
   134 0000005B 92                  <1> 	xchg dx, ax
   135 0000005C E86901              <1> 	extcallcall setes2dx
   136 0000005F 26A1[0000]          <1> reloc	mov ax, word [es:relocateddata]
   137                              <1> otherlinkdatarelocation dssel
   138                              <1> @@:
   139 00000063 A3[0000]            <1> reloc	mov word [otherds], ax
   140                              <1> internaldatarelocation
   141                              <1> %endif
   142                              <1> 
   143 00000066 E89800              <1> 	call run
   144 00000069 E86401              <1> 	extcallcall cmd3
   145                              <1> 
   146                              <1> uninstall:
   147 0000006C AC                  <1> 	lodsb
   148 0000006D E86801              <1> 	extcallcall chkeol
   149                              <1> 
   150 00000070 E86B00              <1> 	call get_es_ext
   151                              <1> 
   152 00000073 06                  <1> 	push es
   153 00000074 1F                  <1> 	pop ds
   154 00000075 31DB                <1> 	xor bx, bx		; = 0 (no prior, modify ext_command_handler)
   155 00000077 BF[2000]            <1> reloc	mov di, command		; di -> us
   156                              <1> internalcoderelocation
   157 0000007A 368B36[0000]        <1> reloc	mov si, word [ss:relocateddata]
   158                              <1> linkdatarelocation ext_command_handler
   159                              <1> 				; si -> first
   160 0000007F 85F6                <1> 	test si, si		; none installed ?
   161 00000081 7450                <1> 	jz .error		; error -->
   162                              <1> 
   163                              <1> .loop:
   164 00000083 39F7                <1> 	cmp di, si		; found ?
   165 00000085 740D                <1> 	je .bx			; yes, use bx -->
   166 00000087 89F3                <1> 	mov bx, si		; bx -> prior handler
   167 00000089 AD                  <1> 	lodsw			; skip entrypoint jmp strict short
   168 0000008A AC                  <1> 	lodsb			; get first byte of chainer
   169 0000008B 3CE9                <1> 	cmp al, 0E9h		; expecting jmp near ?
   170 0000008D 7544                <1> 	jne .error		; no, error -->
   171 0000008F AD                  <1> 	lodsw			; get rel16 displacement
   172 00000090 01C6                <1> 	add si, ax		; -> next handler
   173 00000092 EBEF                <1> 	jmp .loop
   174                              <1> 
   175                              <1> .bx:
   176 00000094 85DB                <1> 	test bx, bx		; any prior ?
   177 00000096 751A                <1> 	jnz .bxnz		; yes -->
   178 00000098 AF                  <1> 	scasw			; skip entrypoint jmp strict short
   179 00000099 803DE8              <1> 	cmp byte [di], 0E8h	; is it a call to cmd3_not_ext ?
   180 0000009C 7507                <1> 	jne @F			; no -->
   181                              <1> 				; yes, reset ext_command_handler to zero
   182                              <1> .setbx:
   183 0000009E 36891E[0000]        <1> reloc	mov word [ss:relocateddata], bx
   184                              <1> linkdatarelocation ext_command_handler
   185 000000A3 EB1E                <1> 	jmp .done
   186                              <1> 
   187                              <1> @@:
   188 000000A5 803DE9              <1> 	cmp byte [di], 0E9h	; validate
   189 000000A8 7529                <1> 	jne .error		; failure -->
   190 000000AA 47                  <1> 	inc di			; -> rel16 displacement
   191 000000AB 8B1D                <1> 	mov bx, word [di]	; get displacement
   192 000000AD AF                  <1> 	scasw			; -> after jmp near
   193 000000AE 01FB                <1> 	add bx, di		; -> next handler
   194 000000B0 EBEC                <1> 	jmp .setbx		; set ext_command_handler to next
   195                              <1> 
   196                              <1> .bxnz:
   197 000000B2 89DE                <1> 	mov si, bx		; -> prior handler with us as downlink
   198 000000B4 87FE                <1> 	xchg di, si		; si -> ours, di -> prior
   199 000000B6 A7                  <1> 	cmpsw			; skip entrypoint jmp strict short
   200 000000B7 A4                  <1> 	movsb			; copy 0E8h/0E9h
   201 000000B8 AD                  <1> 	lodsw			; ax = near rel16 displacement
   202 000000B9 01F0                <1> 	add ax, si		; add in our base (= absolute offset)
   203 000000BB 29F8                <1> 	sub ax, di
   204 000000BD 48                  <1> 	dec ax
   205 000000BE 48                  <1> 	dec ax			; subtract new base (= relative displacement)
   206 000000BF AB                  <1> 	stosw			; store new rel16 displacement
   207 000000C0 A5                  <1> 	movsw			; jmp strict short
   208 000000C1 A5                  <1> 	movsw			; linkcall target
   209 000000C2 A4                  <1> 	movsb			; trailer
   210                              <1> .done:
   211 000000C3 8026[1000]FE        <1> reloc	clropt [code + eldiFlags], eldifResident
   212                              <1> internalcoderelocation -3	; mark block as free
   213 000000C8 BA[0C00]            <1> reloc	mov dx, msg.uninstall_done
   214                              <1> internaldatarelocation
   215                              <1> @@:
   216 000000CB 16                  <1> 	push ss
   217 000000CC 1F                  <1> 	pop ds
   218 000000CD E81001              <1> 	extcallcall putsz
   219 000000D0 E8FD00              <1> 	extcallcall cmd3	; return
   220                              <1> 
   221                              <1> .error:
   222 000000D3 B8010E              <1> 	mov ax, 0E01h
   223 000000D6 E80F01              <1> 	extcallcall setrc
   224 000000D9 BA[2300]            <1> reloc	mov dx, msg.uninstall_error
   225                              <1> internaldatarelocation
   226 000000DC EBED                <1> 	jmp @B
   227                              <1> 
   228                              <1> 
   229                              <1> get_es_ext:
   230 000000DE 8E06[0000]          <1> reloc	mov es, word [relocateddata]
   231                              <1> linkdatarelocation extdssel
   232 000000E2 E8DB00              <1> 	extcallcall ispm
   233 000000E5 7404                <1> 	jz @F
   234 000000E7 8E06[0000]          <1> reloc	mov es, word [relocateddata]
   235                              <1> linkdatarelocation extseg
   236                              <1> @@:
   237 000000EB C3                  <1> 	retn
   238                              <1> 
   239                              <1> 
   240                              <1> %if _OTHER
   241                              <1> get_es_ext_other:
   242                              <1> 	getotherds
    14 000000EC 368E1E[0000]        <2> reloc mov ds, word [ss:otherds]
    15                              <2> internaldatarelocation
   243 000000F1 8E06[0000]          <1> reloc	mov es, word [relocateddata]
   244                              <1> otherlinkdatarelocation extdssel
   245 000000F5 E8C800              <1> 	extcallcall ispm
   246 000000F8 7404                <1> 	jz @F
   247 000000FA 8E06[0000]          <1> reloc	mov es, word [relocateddata]
   248                              <1> otherlinkdatarelocation extseg
   249                              <1> @@:
   250                              <1> 	resetds
    18 000000FE 16                  <2>  push ss
    19 000000FF 1F                  <2>  pop ds
   251 00000100 C3                  <1> 	retn
   252                              <1> %else
   253                              <1>  get_es_ext_other equ get_es_ext
   254                              <1> %endif
   255                              <1> 
   256                              <1> 
   257                              <1> run:
   258 00000101 16                  <1> 	push ss
   259 00000102 07                  <1> 	pop es
   260                              <1> %ifn _OTHER
   261                              <1> 	xor bx, bx
   262                              <1> reloc	mov dx, msg.skipself
   263                              <1> internaldatarelocation
   264                              <1> 	extcallcall isstring?
   265                              <1> 	jne @F
   266                              <1> 	dec bx
   267                              <1> @@:
   268                              <1> reloc	mov byte [skipself], bl
   269                              <1> internaldatarelocation
   270                              <1> %endif
   271 00000103 AC                  <1> 	lodsb
   272 00000104 E8D100              <1> 	extcallcall chkeol
   273                              <1> 
   274                              <1> %ifn _OTHER
   275                              <1> reloc2	mov word [buffer.next], buffer
   276                              <1> internaldatarelocation -4
   277                              <1> internaldatarelocation
   278                              <1> reloc	mov byte [buffer], 0
   279                              <1> internaldatarelocation -3
   280                              <1> 
   281                              <1> 	mov al, 2Dh
   282                              <1> 	extcallcall intchk		; ZR if offset = -1 or segment = 0
   283                              <1> 					; CHG: ax, dx, bx
   284                              <1> 	jz .no_hint
   285                              <1> 
   286                              <1> reloc	mov ah, byte [relocateddata]
   287                              <1> linkdatarelocation try_debugger_amis_multiplex_number
   288                              <1> 	call later_plex_check
   289                              <1> 	jnc @F
   290                              <1> 
   291                              <1> 	mov ah, 0FFh		; start with multiplex number 0FFh
   292                              <1> .loop_hint:
   293                              <1> 	call later_plex_check
   294                              <1> @@:
   295                              <1> 	jnc .end_hint		; if found --> (NC)
   296                              <1> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   297                              <1> 	jnc .loop_hint		; try next if we didn't check all yet -->
   298                              <1> .no_hint:
   299                              <1> 	push ss
   300                              <1> 	pop es
   301                              <1> reloc	mov dx, msg.no_outer
   302                              <1> internaldatarelocation
   303                              <1> 	extcallcall putsz
   304                              <1> 	mov ax, 0E61h
   305                              <1> 	extcallcall setrc
   306                              <1> 	retn
   307                              <1> 
   308                              <1> .end_hint:
   309                              <1> 	push ss
   310                              <1> 	pop es
   311                              <1> 	mov al, 40h		; AMIS message display service
   312                              <1> reloc	mov word [later_hint_service], ax
   313                              <1> internaldatarelocation
   314                              <1> %endif
   315                              <1> 
   316                              <1> display_eld_memory:
   317 00000107 31C0                <1> 	xor ax, ax
   318                              <1> .loop:
   319 00000109 BF[0000]            <1> reloc	mov di, relocateddata
   320                              <1> linkdatarelocation line_out
   321                              <1> 	getotherds
    14 0000010C 368E1E[0000]        <2> reloc mov ds, word [ss:otherds]
    15                              <2> internaldatarelocation
   322 00000111 3906[0000]          <1> reloc	cmp word [relocateddata], ax
   323                              <1> otherlinkdatarelocation extseg_used
   324 00000115 7705                <1> 	ja @F
   325                              <1> .end:
   326                              <1> 	resetds
    18 00000117 16                  <2>  push ss
    19 00000118 1F                  <2>  pop ds
   327 00000119 16                  <1> 	push ss
   328 0000011A 07                  <1> 	pop es
   329                              <1> %ifn _OTHER
   330                              <1> reloc	mov ax, word [later_hint_service]
   331                              <1> internaldatarelocation
   332                              <1> reloc	mov bx, buffer
   333                              <1> internaldatarelocation
   334                              <1> reloc	mov dx, [relocateddata]
   335                              <1> linkdatarelocation pspdbg	; must be 86 Mode segment even in PM
   336                              <1> 	extcallcall call_int2D
   337                              <1> 	cmp al, 0FFh
   338                              <1> 	je .retn
   339                              <1> reloc	mov dx, msg.error_amismsg
   340                              <1> internaldatarelocation
   341                              <1> 	extcallcall putsz
   342                              <1> reloc	mov dx, msg.error_no
   343                              <1> internaldatarelocation
   344                              <1> 	cmp al, 0
   345                              <1> 	je .goterror
   346                              <1> reloc	mov dx, msg.error_truncated
   347                              <1> internaldatarelocation
   348                              <1> 	cmp al, 0FEh
   349                              <1> 	je .goterror
   350                              <1> reloc	mov dx, msg.error_unknown
   351                              <1> internaldatarelocation
   352                              <1> .goterror:
   353                              <1> 	extcallcall putsz
   354                              <1> 	mov ax, 0E64h
   355                              <1> 	extcallcall setrc
   356                              <1> .retn:
   357                              <1> %endif
   358 0000011B C3                  <1> 	retn
   359                              <1> 
   360                              <1> @@:
   361 0000011C BB[0000]            <1> reloc	mov bx, relocateddata
   362                              <1> otherlinkdatarelocation extdssel, -2, optional
   363 0000011F E89E00              <1> 	extcallcall ispm
   364 00000122 7403                <1> 	jz @F
   365 00000124 BB[0000]            <1> reloc	mov bx, relocateddata
   366                              <1> otherlinkdatarelocation extseg, -2, optional
   367                              <1> @@:
   368 00000127 85DB                <1> 	test bx, bx
   369 00000129 7512                <1> 	jnz @F
   370                              <1> .error:
   371                              <1> 	resetds
    18 0000012B 16                  <2>  push ss
    19 0000012C 1F                  <2>  pop ds
   372 0000012D 16                  <1> 	push ss
   373 0000012E 07                  <1> 	pop es
   374 0000012F BA[4200]            <1> reloc	mov dx, msg.eld.error
   375                              <1> internaldatarelocation
   376 00000132 E8AB00              <1> 	extcallcall putsz
   377 00000135 B8620E              <1> 	mov ax, 0E62h
   378 00000138 E8AD00              <1> 	extcallcall setrc
   379 0000013B EBDA                <1> 	jmp .end
   380                              <1> 
   381                              <1> @@:
   382 0000013D 8E07                <1> 	mov es, word [bx]
   383 0000013F 89C3                <1> 	mov bx, ax
   384 00000141 263907              <1> 	cmp word [es:bx + eldiStartCode], ax
   385 00000144 75E5                <1> 	jne .error
   386 00000146 89C2                <1> 	mov dx, ax
   387 00000148 83C220              <1> 	add dx, ELD_INSTANCE_size
   388 0000014B 72DE                <1> 	jc .error
   389 0000014D 26395702            <1> 	cmp word [es:bx + eldiEndCode], dx
   390 00000151 72D8                <1> 	jb .error
   391 00000153 8B16[0000]          <1> reloc	mov dx, word [relocateddata]
   392                              <1> otherlinkdatarelocation extseg_used
   393 00000157 26395702            <1> 	cmp word [es:bx + eldiEndCode], dx
   394 0000015B 77CE                <1> 	ja .error
   395 0000015D 740B                <1> 	je @F
   396 0000015F 83EA20              <1> 	sub dx, ELD_INSTANCE_size
   397 00000162 72C7                <1> 	jc .error
   398 00000164 26395702            <1> 	cmp word [es:bx + eldiEndCode], dx
   399 00000168 77C1                <1> 	ja .error
   400                              <1> @@:
   401 0000016A 268B5702            <1> 	mov dx, word [es:bx + eldiEndCode]
   402 0000016E 89D5                <1> 	mov bp, dx
   403 00000170 29C2                <1> 	sub dx, ax
   404 00000172 72B7                <1> 	jc .error
   405                              <1> %ifn _OTHER
   406                              <1> reloc	rol byte [ss:skipself], 1
   407                              <1> internaldatarelocation
   408                              <1> 	jnc @F
   409                              <1> reloc	cmp bx, strict word code
   410                              <1> internalcoderelocation
   411                              <1> 	je .next
   412                              <1> @@:
   413                              <1> %endif
   414 00000174 8D7712              <1> 	lea si, [bx + eldiListing]
   415 00000177 26803C00            <1> 	cmp byte [es:si], 0
   416 0000017B 7428                <1> 	je .next
   417 0000017D 06                  <1> 	push es
   418 0000017E 16                  <1> 	 push ss
   419 0000017F 07                  <1> 	 pop es
   420 00000180 56                  <1> 	push si
   421                              <1> 	resetds
    18 00000181 16                  <2>  push ss
    19 00000182 1F                  <2>  pop ds
   422 00000183 BE[6200]            <1> reloc	mov si, msg.hint
   423                              <1> internaldatarelocation
   424 00000186 E86700              <1> 	extcallcall copy_single_counted_string
   425 00000189 5E                  <1> 	pop si
   426 0000018A 1F                  <1> 	pop ds
   427                              <1> 
   428 0000018B B90E00              <1> 	mov cx, eldiListing_size
   429 0000018E A8                  <1> 	db __TEST_IMM8			; skip stosb
   430                              <1> @@:
   431 0000018F AA                  <1> 	stosb				; store
   432 00000190 AC                  <1> 	lodsb				; load
   433 00000191 84C0                <1> 	test al, al			; is it NUL ?
   434 00000193 E0FA                <1> 	loopne @B			; store if non-NUL -->
   435                              <1> 
   436 00000195 16                  <1> 	push ss
   437 00000196 1F                  <1> 	pop ds
   438 00000197 B83A3A              <1> 	mov ax, "::"
   439 0000019A AB                  <1> 	stosw
   440 0000019B 93                  <1> 	xchg ax, bx
   441 0000019C E85900              <1> 	extcallcall hexword
   442 0000019F B068                <1> 	mov al, 'h'
   443 000001A1 AA                  <1> 	stosb
   444                              <1> 
   445                              <1> %if _OTHER
   446 000001A2 E85B00              <1> 	extcallcall putsline_crlf
   447                              <1> %else
   448                              <1> 	mov ax, 13 | (10 << 8)
   449                              <1> 	stosw
   450                              <1> 	mov cx, di
   451                              <1> reloc	mov si, relocateddata
   452                              <1> linkdatarelocation line_out
   453                              <1> 	sub cx, si
   454                              <1> reloc	mov di, word [buffer.next]
   455                              <1> internaldatarelocation
   456                              <1> 	mov ax, di
   457                              <1> 	add ax, cx
   458                              <1> reloc	cmp ax, strict word buffer.end - 1
   459                              <1> internaldatarelocation
   460                              <1> 	ja .full
   461                              <1> 	rep movsb
   462                              <1> reloc	mov word [buffer.next], di
   463                              <1> internaldatarelocation
   464                              <1> 	mov al, 0
   465                              <1> 	stosb
   466                              <1> %endif
   467                              <1> 
   468                              <1> .next:
   469 000001A5 89E8                <1> 	mov ax, bp
   470 000001A7 E95FFF              <1> 	jmp .loop
   471                              <1> 
   472                              <1> 
   473                              <1> %ifn _OTHER
   474                              <1> .full:
   475                              <1> reloc	mov dx, msg.buffer_full
   476                              <1> internaldatarelocation
   477                              <1> 	extcallcall putsz
   478                              <1> 	mov ax, 0E63h
   479                              <1> 	extcallcall setrc
   480                              <1> 	jmp .end
   481                              <1> 
   482                              <1> 
   483                              <1> 		; INP:	ah = multiplex number to check
   484                              <1> 		; OUT:	CY if multiplex number unused or no signature match,
   485                              <1> 		;	 bp, ah, ds unmodified
   486                              <1> 		;	NC if match found,
   487                              <1> 		;	 ah = multiplex number (unmodified)
   488                              <1> 		; CHG:	si, di, es, cx, dx
   489                              <1> later_plex_check:
   490                              <1> 	push ss
   491                              <1> 	pop ds
   492                              <1> reloc	testopt [relocateddata], 8
   493                              <1> linkdatarelocation internalflags4, -3
   494                              <1> 	jz @F
   495                              <1> reloc	mov si, relocateddata
   496                              <1> linkdatarelocation amis_multiplex_number, -2, optional
   497                              <1> 	test si, si
   498                              <1> 	jz @F
   499                              <1> 	cmp ah, byte [si]
   500                              <1> 	je .notfound		; do not use our own multiplexer -->
   501                              <1> @@:
   502                              <1> 	mov al, 00h		; AMIS installation check
   503                              <1> 	extcallcall call_int2D	; AMIS (or "DOS reserved" = iret if no AMIS present)
   504                              <1> 	cmp al, 0FFh
   505                              <1> 	jne .notfound
   506                              <1> 	push ss
   507                              <1> 	pop ds
   508                              <1> reloc	mov si, msg.debuggeramissig
   509                              <1> internaldatarelocation		; ds:si -> our AMIS name strings
   510                              <1> 	extcallcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
   511                              <1> 	mov cx, 8		; Ignore description, only compare vendor and program name
   512                              <1> 	repe cmpsw
   513                              <1> 	je .checkret		; ZR, NC = match -->
   514                              <1> .notfound:
   515                              <1> 	stc			; CY no match
   516                              <1> .checkret:
   517                              <1> 	retn
   518                              <1> %endif
   519                              <1> 
   520                              <1> 
   521 000001AA 90<rep 6h>E8[0000]- <1> 	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   521 000001B3 EB020000C3E8[0000]- <1>
   521 000001BB EB020000C3E8[0000]- <1>
   521 000001C3 EB020000C3E8[0000]- <1>
   521 000001CB EB020000C3E8[0000]- <1>
   521 000001D3 EB020000C3E8[0000]- <1>
   521 000001DB EB020000C3E8[0000]- <1>
   521 000001E3 EB020000C3E8[0000]- <1>
   521 000001EB EB020000C3E8[0000]- <1>
   521 000001F3 EB020000C3E8[0000]- <1>
   521 000001FB EB020000C3E8[0000]- <1>
   521 00000203 EB020000C3          <1>
   522                              <1> 
   523                              <1> endinstalled equ ($ + CODEFIXUP + 15) & ~15
   524                              <1> 
   525                              <1> 
   526                              <1> start:
   527 00000208 8CC3                <1> 	mov bx, es
   528 0000020A 16                  <1> 	 push ss
   529 0000020B 07                  <1> 	 pop es
   530 0000020C E8A1FF              <1> 	call skipcomma
   531 0000020F 4E                  <1> 	dec si
   532 00000210 BA[0000]            <1> reloc	mov dx, relocateddata
   533                              <1> linkdatarelocation msg.install
   534 00000213 E8A2FF              <1> 	call isstring?
   535 00000216 7440                <1> 	je install
   536 00000218 BA[8C00]            <1> reloc	mov dx, msg.keyword_help
   537                              <1> internaldatarelocation
   538 0000021B E89AFF              <1> 	call isstring?
   539 0000021E 7409                <1> 	je help
   540 00000220 E8DEFE              <1> 	call run
   541                              <1> @@:
   542 00000223 E80F00              <1> 	call uninstall_oneshot
   543 00000226 31C0                <1> 	xor ax, ax
   544 00000228 CB                  <1> 	retf
   545                              <1> 
   546                              <1> help:
   547 00000229 AC                  <1> 	lodsb
   548 0000022A E8ABFF              <1> 	call chkeol
   549 0000022D BA[9100]            <1> reloc	mov dx, msg.help
   550                              <1> internaldatarelocation
   551 00000230 E8ADFF              <1> 	call putsz
   552 00000233 EBEE                <1> 	jmp @B
   553                              <1> 
   554                              <1> 
   555                              <1> uninstall_oneshot:
   556 00000235 36F606[0000]01      <1> reloc	testopt [ss:relocateddata], 1
   557                              <1> linkdatarelocation options7, -3
   558 0000023B 751A                <1> 	jnz @F
   559                              <1> 
   560 0000023D 2EA1[0200]          <1> reloc	mov ax, word [cs:code + eldiEndCode]
   561                              <1> internalcoderelocation
   562 00000241 2E2B06[0000]        <1> reloc	sub ax, word [cs:code + eldiStartCode]
   563                              <1> internalcoderelocation
   564 00000246 2906[0000]          <1> reloc	sub word [relocateddata], ax
   565                              <1> linkdatarelocation extseg_used
   566                              <1> 
   567 0000024A 2EA1[0600]          <1> reloc	mov ax, word [cs:code + eldiEndData]
   568                              <1> internalcoderelocation
   569 0000024E 2E2B06[0400]        <1> reloc	sub ax, word [cs:code + eldiStartData]
   570                              <1> internalcoderelocation
   571 00000253 2906[0000]          <1> reloc	sub word [relocateddata], ax
   572                              <1> linkdatarelocation extdata_used
   573                              <1> @@:
   574 00000257 C3                  <1> 	retn
   575                              <1> 
   576                              <1> 
   577                              <1> DATAOFFSET equ CODEOFFSET + code_size
   578                              <1> 	addsection DATA, follows=CODE vstart=_ELD_DATA_VSTART
   579                              <1> %define DATAFIXUP - datastart + 0
   580                              <1> datastart:
   581                              <1> PUT_ELD_DATETIME
   582                              <1> 
   583                              <1> %if _OTHER
   584                              <1> 	align 2, db 0
   585 00000000 0000                <1> otherds:	dw 0
   586 00000002 0000                <1> otherseg:	dw 0
   587                              <1> %endif
   588                              <1> 
   589                              <1> msg:
   590                              <1> %ifn _OTHER
   591                              <1> 	align 2, db 0
   592                              <1> .debuggeramissig:
   593                              <1> 		fill 8, 32, db "ecm"
   594                              <1> 		fill 8, 32, db "lDebug"
   595                              <1> %endif
   596 00000004 48494E544F544800    <1> .hint_keyword:		asciz "HINT",OTH_STRING
   597 0000000C 48494E544F54482075- <1> .uninstall_done:	db "HINT",OTH_STRING," uninstalled."
   597 00000015 6E696E7374616C6C65- <1>
   597 0000001E 642E                <1>
   598                              <1> %if _ELD_RECLAIM_HINT
   599                              <1> 			db " (Don't forget to use reclaim.eld)"
   600                              <1> %endif
   601 00000020 0D0A00              <1> 			asciz 13,10
   602 00000023 48494E544F54482075- <1> .uninstall_error:	asciz "HINT",OTH_STRING," unable to uninstall!",13,10
   602 0000002C 6E61626C6520746F20- <1>
   602 00000035 756E696E7374616C6C- <1>
   602 0000003E 210D0A00            <1>
   603 00000042 4572726F7220647572- <1> .eld.error:		asciz "Error during ELD enumeration.",13,10
   603 0000004B 696E6720454C442065- <1>
   603 00000054 6E756D65726174696F- <1>
   603 0000005D 6E2E0D0A00          <1>
   604 00000062 14547261634C697374- <1> .hint:			counted "TracList-add-offset="
   604 0000006B 2D6164642D6F666673- <1>
   604 00000074 65743D              <1>
   605                              <1> %ifn _OTHER
   606                              <1> .skipself:		asciz "SKIPSELF"
   607                              <1> .no_outer:		asciz "Error: No outer debugger found.",13,10
   608                              <1> .error_amismsg:		asciz "Error: Outer debugger AMIS message service "
   609                              <1> .error_no:		asciz "not installed.",13,10
   610                              <1> .error_truncated:	asciz "truncated.",13,10
   611                              <1> .error_unknown:		asciz "unknown error.",13,10
   612                              <1> .buffer_full:		asciz "Error: Buffer full.",13,10
   613                              <1> %endif
   614                              <1> 
   615                              <1> uinit_data: equ $
   616 00000077 48494E544F54482069- <1> .installed:		asciz "HINT",OTH_STRING," installed.",13,10
   616 00000080 6E7374616C6C65642E- <1>
   616 00000089 0D0A00              <1>
   617 0000008C 48454C5000          <1> .keyword_help:		asciz "HELP"
   618 00000091 5468697320454C4420- <1> .help:		db "This ELD can be installed residently or used transiently.",13,10
   618 0000009A 63616E20626520696E- <1>
   618 000000A3 7374616C6C65642072- <1>
   618 000000AC 65736964656E746C79- <1>
   618 000000B5 206F72207573656420- <1>
   618 000000BE 7472616E7369656E74- <1>
   618 000000C7 6C792E0D0A          <1>
   619 000000CC 0D0A                <1> 		db 13,10
   620 000000CE 52756E6E696E672048- <1> 		db "Running HINT",OTH_STRING," displays TracList hints for all currently",13,10
   620 000000D7 494E544F5448206469- <1>
   620 000000E0 73706C617973205472- <1>
   620 000000E9 61634C697374206869- <1>
   620 000000F2 6E747320666F722061- <1>
   620 000000FB 6C6C2063757272656E- <1>
   620 00000104 746C790D0A          <1>
   621 00000109 696E7374616C6C6564- <1> 		db "installed ELD instances"
   621 00000112 20454C4420696E7374- <1>
   621 0000011B 616E636573          <1>
   622                              <1> %if _OTHER
   623 00000120 206F6620746865206F- <1> 		db " of the other link debugger"
   623 00000129 74686572206C696E6B- <1>
   623 00000132 206465627567676572  <1>
   624                              <1> %else
   625                              <1> 		db " to the outer debugger"
   626                              <1> %endif
   627 0000013B 2E0D0A              <1> 		db ".",13,10
   628 0000013E 00                  <1> 		asciz
   629                              <1> 
   630 0000013F 00                  <1> 	align 16, db 0
   631                              <1> init_data_end:
   632                              <1> data_size equ $ - datastart
   633                              <1> transient_data_size equ data_size
   634                              <1> 
   635                              <1> 	absolute uinit_data
   636 00000077 ??                  <1> 	alignb 2
   637                              <1> %ifn _OTHER
   638                              <1> later_hint_service:	resw 1
   639                              <1> buffer:			resb 384
   640                              <1> .end:
   641                              <1> .next:			resw 1
   642                              <1> skipself:		resb 1
   643                              <1> %endif
   644                              <1> 
   645 00000078 ????????????????    <1> 	alignb 16
   646                              <1> uinit_data_end:
   647                              <1> resident_data_end:
   648                              <1> resident_data_size equ resident_data_end - datastart
   649                              <1> 
   650                              <1> %if uinit_data_end >= init_data_end
   651                              <1>  total_data_size equ $ - datastart
   652                              <1> %else
   653                              <1>  total_data_size equ init_data_end - datastart
   654                              <1> %endif
   655                              <1> %assign _DATA_SIZE total_data_size
   656                              <1> 
   657                              <1> 
   658                              <1> 	usesection CODE
   659                              <1> 
   660                              <1> install:
   661 00000258 AC                  <1> 	lodsb
   662 00000259 E8[0000]EB020000    <1> 	extcall chkeol
   663                              <1> 
   664                              <1> 	houdini
   665 00000260 8EC3                <1> 	mov es, bx		; => ext seg (writable)
   666                              <1> 
   667 00000262 B8A000              <1> 	mov ax, endresident - endinstalled
   668 00000265 262906[0200]        <1> reloc	sub word [es:code + eldiEndCode], ax
   669                              <1> internalcoderelocation		; adjust size
   670 0000026A 2906[0000]          <1> reloc	sub word [relocateddata], ax
   671                              <1> linkdatarelocation extseg_used	; adjust size
   672                              <1> 
   673                              <1> %if (transient_data_size - resident_data_size) > 0
   674 0000026E B8C000              <1> 	mov ax, transient_data_size - resident_data_size
   675 00000271 262906[0600]        <1> reloc	sub word [es:code + eldiEndData], ax
   676                              <1> internalcoderelocation		; adjust size
   677 00000276 2906[0000]          <1> reloc	sub word [relocateddata], ax
   678                              <1> linkdatarelocation extdata_used	; adjust size
   679                              <1> %endif
   680                              <1> 
   681 0000027A 8B1E[0000]          <1> reloc	mov bx, word [relocateddata]
   682                              <1> linkdatarelocation ext_command_handler
   683                              <1> 				; -> prior
   684 0000027E BF[2000]            <1> reloc	mov di, command		; -> our handler
   685                              <1> internalcoderelocation
   686 00000281 85DB                <1> 	test bx, bx		; installing as first ?
   687 00000283 740A                <1> 	jz .only_first		; yes, simple --> (leave as extcall cmd3_not_ext)
   688 00000285 AF                  <1> 	scasw			; skip entrypoint jmp strict short
   689 00000286 B0E9                <1> 	mov al, 0E9h		; = jmp near opcode
   690 00000288 AA                  <1> 	stosb			; store
   691 00000289 93                  <1> 	xchg ax, bx		; ax -> next handler
   692 0000028A 29F8                <1> 	sub ax, di
   693 0000028C 48                  <1> 	dec ax
   694 0000028D 48                  <1> 	dec ax			; ax = ax - (di + 2)
   695 0000028E AB                  <1> 	stosw			; store our downlink as rel16 displacement
   696                              <1> 
   697                              <1> .only_first:
   698 0000028F 26800E[1000]01      <1> reloc	setopt [es:code + eldiFlags], eldifResident
   699                              <1> internalcoderelocation -3	; mark block as resident
   700 00000295 C706[0000][2000]    <1> reloc2	mov word [relocateddata], command
   701                              <1> linkdatarelocation ext_command_handler, -4
   702                              <1> internalcoderelocation		; -> our entrypoint
   703                              <1> 
   704 0000029B F606[0000]04        <1> reloc	testopt [relocateddata], 4
   705                              <1> linkdatarelocation options7, -3
   706 000002A0 7506                <1> 	jnz @F
   707 000002A2 BA[7700]            <1> reloc	mov dx, msg.installed
   708                              <1> internaldatarelocation
   709 000002A5 E838FF              <1> 	call putsz
   710                              <1> @@:
   711 000002A8 31C0                <1> 	xor ax, ax
   712 000002AA CB                  <1> 	retf
   713                              <1> 
   714                              <1> 
   715                              <1> %include "eldlink.asm"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug linker
     4                              <2> 
     5                              <2> Copyright (C) 2008-2025 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %include "lmacros3.mac"
     1                              <3> [list -]
    16                              <2> %include "eld.mac"
     1                              <3> %if 0
     2                              <3> 
     3                              <3> Extensions for lDebug macros
     4                              <3> 
     5                              <3> Copyright (C) 2008-2025 E. C. Masloch
     6                              <3> 
     7                              <3> Usage of the works is permitted provided that this
     8                              <3> instrument is retained with the works, so that any entity
     9                              <3> that uses the works is notified of this instrument.
    10                              <3> 
    11                              <3> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <3> 
    13                              <3> %endif
    14                              <3> 
    15                              <3> %ifndef ELD_MAC
    16                              <3> %define ELD_MAC 1
    17                              <3> 
    18                              <3> %include "lmacros3.mac"
    19                              <3> 
    20                              <3> 		; ELD executable header
    21                              <3> 	struc ELD_HEADER
    22                              <3> eldhSignature:		resb 4	; "ELD1"
    23                              <3> 			resb 3	; reserved
    24                              <3> 			resb 1	; 26 (Ctrl-Z)
    25                              <3> eldhCodeOffset:		resd 1	; position displacement from eldhSignature
    26                              <3> eldhCodeImageLength:	resw 1	; amount bytes, at least 32
    27                              <3> eldhCodeAllocLength:	resw 1	; amount bytes, added to prior. sum < 64 KiB
    28                              <3> eldhDataOffset:		resd 1
    29                              <3> eldhDataImageLength:	resw 1	; (zero allowed)
    30                              <3> eldhDataAllocLength:	resw 1	; (zero allowed)
    31                              <3> eldhCodeEntrypoint:	resw 1	; within code section, used as displacement
    32                              <3> eldhReserved:		resb 4	; reserved
    33                              <3> eldhExtensionSize:	resw 1	; from eldhSignature, -> past eldhx fields in use
    34                              <3> 	endstruc
    35                              <3> 	endarea ELD_HEADER, 1
    36                              <3> 
    37                              <3> 	struc ELD_HEADERX
    38                              <3> eldhxHeader:		resb ELD_HEADER_size
    39                              <3> eldhxDescriptionOffset:	resd 1	; zero if none, from eldhxHeader. <= 128 Bytes
    40                              <3> eldhxHelpOffset:	resd 1	; zero if none, from eldhxHeader
    41                              <3> eldhxLibTable:		resd 1	; zero if none, from eldhxHeader
    42                              <3> eldhxDateTimeOffset:	resd 1	; zero if none, from eldhxHeader
    43                              <3> 	alignb 16
    44                              <3> 	endstruc
    45                              <3> 
    46                              <3> 	struc ELD_TRAILER_HEADER
    47                              <3> eldthSignature:		resb 8	; "ELD1TAIL"
    48                              <3> eldthHeaderOffset:	resd 1	; negative displacement from eldthSignature,
    49                              <3> 				;  add this dword to the seek offset
    50                              <3> eldthReserved:		resw 1	; reserved, must be initialised to zero
    51                              <3> eldthChecksum:		resw 1	; sum of all words in trailer header = 0
    52                              <3> 	endstruc
    53                              <3> 	endarea ELD_TRAILER_HEADER, 1
    54                              <3> 
    55                              <3> 	struc ELD_LIBTABLE
    56                              <3> eldltFormat:		resw 1
    57                              <3> 	; 0 = uncompressed
    58                              <3> 	; 2 = heatshrink compressed
    59                              <3> 	; 3 = lzexedat -4 compressed
    60                              <3> 	; 4 = lzexedat -4 -l compressed
    61                              <3> eldltAmount:		resw 1
    62                              <3> eldltOffset:		resd 1	; from eldhxHeader
    63                              <3> eldltCompressedLength:		; (dword, only present if format 2, 3, or 4)
    64                              <3> 	endstruc
    65                              <3> 	endarea ELD_LIBTABLE, 1
    66                              <3> 
    67                              <3> 		; ELD instance header
    68                              <3> 	struc ELD_INSTANCE
    69                              <3> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    70                              <3> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    71                              <3> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    72                              <3> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    73                              <3> eldiIdentifier:		resb 8	; blank-filled text
    74                              <3> eldiFlags:		resw 1	; flags
    75                              <3> eldiListing_size equ 14
    76                              <3> eldiListing:		resb eldiListing_size
    77                              <3> 				; ASCIZ listing file name
    78                              <3> 	endstruc
    79                              <3> 		; flags for eldiFlags:
    80                              <3> eldifResident:		equ 1
    81                              <3> 
    82                              <3> 		; ELD link info header
    83                              <3> 	struc ELD_LINKINFO
    84                              <3> eldlSignature:		resw 1	; 0E1D1h
    85                              <3> eldlReserved:		resw 2
    86                              <3> eldlUseLinkHash:	resw 1
    87                              <3> eldlDataAmount:		resw 1
    88                              <3> eldlDataPrefixes:	resw 1
    89                              <3> eldlDataEntries:	resw 1
    90                              <3> eldlDataAddresses:	resw 1
    91                              <3> eldlCodeAmount:		resw 1
    92                              <3> eldlCodePrefixes:	resw 1
    93                              <3> eldlCodeEntries:	resw 1
    94                              <3> eldlCodeAddresses:	resw 1
    95                              <3> 	endstruc
    96                              <3> 
    97                              <3> 	numdef ELD_CODE_VSTART, 9001h
    98                              <3> 	numdef ELD_DATA_VSTART, 8000h
    99                              <3> 	numdef ELD_RELOC_VSTART, 8000h
   100                              <3> 
   101                              <3> 	numdef ELD_RECLAIM_HINT, 0
   102                              <3> 	strdef ELD_LISTING, ""
   103                              <3> 	numdef ELD_DATETIME, 0
   104                              <3> 
   105                              <3> %if _ELD_DATETIME
   106                              <3>  %define PUT_ELDHX_DATETIME_OFFSET at eldhxDateTimeOffset, dd DATAOFFSET + datetime - datastart
   107                              <3>  %macro PUT_ELD_DATETIME 0.nolist
   108                              <3> datetime:	asciz __UTC_DATE__,'T',__UTC_TIME__,'Z'
   109                              <3> 		asciz		; for future extension
   110                              <3>  %endmacro
   111                              <3> %else
   112                              <3>  %define PUT_ELDHX_DATETIME_OFFSET
   113                              <3>  %define PUT_ELD_DATETIME
   114                              <3> %endif
   115                              <3> 
   116                              <3> %endif
    17                              <2> 
    18                              <2> 	cpu 8086
    19                              <2> 
    20                              <2> %if ELDSTRICT
    21                              <2>  %if ELDSTRICTCOUNTER
    22                              <2>   %error Missing relocation
    23                              <2>  %endif
    24                              <2> %endif
    25                              <2> 	eldstrict off		; linker does some relocations
    26                              <2> 
    27                              <2> %ifn ELDCALLCALL_DUMPED
    28                              <2> 	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
    29                              <2> %endif
    30                              <2> 
    31                              <2> 	numdef ELD_IDENTICALISE, 0
    32                              <2> 	numdef ELD_DEBUG, 0
    33                              <2> 	numdef ELD_LINKER_PASSES, 1
    34                              <2> 	strdef LISTING, _ELD_LISTING
    35                              <2> 	numdef ELDCALL_OPTIONAL, ELDCALL_OPTIONAL_STATUS
    36                              <2> 	numdef ELDDATA_OPTIONAL, ELDDATA_OPTIONAL_STATUS
    37                              <2> 	numdef ELDDATA_NEXT, ELDDATA_NEXT_STATUS
    38                              <2> 	numdef ELDCALL_NEXT, ELDCALL_NEXT_STATUS
    39                              <2> %if _ELD_IDENTICALISE
    40                              <2>  ;%assign _ELDCALL_OPTIONAL 1
    41                              <2> %endif
    42                              <2> %ifn _ELDCALL_OPTIONAL
    43                              <2> %assign ELDCALL_OPTIONAL_STATUS 2		; not allowed
    44                              <2> %endif
    45                              <2> ;%ifn _ELDDATA_OPTIONAL
    46                              <2> ;%assign ELDDATA_OPTIONAL_STATUS 2		; not allowed
    47                              <2> ;%endif
    48                              <2> 	gendef MAP, ""
    49                              <2> 
    50                              <2> %ifnidni _MAP, ""
    51                              <2>  [map all _MAP]
    52                              <2> %endif
    53                              <2> 
    54                              <2> 
    55                              <2> endresident: equ ($ + _CURRENT_SECTION %+ FIXUP + 15) & ~15
    56                              <2> 
    57                              <2> %if _ELD_LINKER_PASSES
    58                              <2> %assign ELDLINKER 1
    59                              <2> 
    60                              <2> 	struc LINKTABLE
    61 00000000 ????????            <2> ltCodeToCode:	resw 2
    62 00000004 ????????            <2> ltCodeToData:	resw 2
    63 00000008 ????????            <2> ltDataToCode:	resw 2
    64 0000000C ????????            <2> ltDataToData:	resw 2
    65 00000010 ????????            <2> ltLinkData:	resw 2
    66 00000014 ????????            <2> ltLinkCode:	resw 2
    67                              <2> 	endstruc
    68                              <2> %endif
    69                              <2> 
    70                              <2> 
    71                              <2> 		; INP:	es:dx -> loaded initial ELD image
    72                              <2> 		;	 ELD instance structure filled
    73                              <2> 		;	es => ELD code area
    74                              <2> 		;	ds:di -> link info
    75                              <2> 		;	ss:bx -> loaded initial data
    76                              <2> 		;	ss:si -> command line tail
    77                              <2> 		;	cs:ip -> entrypoint
    78                              <2> 		;	ss:sp -> far return address for current mode
    79                              <2> 		; STT:	UP, EI
    80                              <2> linker:
    81                              <2> 		; The first 15 Bytes of the linker should be
    82                              <2> 		;  the same regardless of the linker options
    83                              <2> 		;  used (debug, passes, vstart). This allows
    84                              <2> 		;  the eldcomp ELD to match even if up to 15
    85                              <2> 		;  Bytes of the linker are trailing in the
    86                              <2> 		;  resident part of the ELD.
    87                              <2> 	lframe
    88                              <2>  %if ELDOTHER
    89                              <2> 	lvar dword, linkinfo_other
    90                              <2> 	lvar word, use_hash_other
    91                              <2>  %endif
    92 000002AB 5589E58D66FA        <2> 	lenter
    93                              <2> 	lvar dword, instance
    94 000002B1 06                  <2> 	 push es
    95 000002B2 52                  <2> 	 push dx		; -> start of where we're loaded in ELD cs
    96                              <2> 	lvar word, targetsection_low_optional_high
    97 000002B3 50                  <2> 	 push ax		; placeholder
    98                              <2> 	lequ ?targetsection_low_optional_high, targetsection
    99                              <2> 	lequ ?targetsection_low_optional_high + 1, optional
   100                              <2> 	lvar dword, linkinfo
   101 000002B4 1E                  <2> 	 push ds
   102 000002B5 57                  <2> 	 push di		; -> link info (in debugger ss or message seg)
   103                              <2> 	lvar dword, nextreloc
   104 000002B6 06                  <2> 	 push es		; => ELD cs
   105 000002B7 52                  <2> 	 push dx		; placeholder
   106                              <2> 	lvar dword, entry
   107 000002B8 06                  <2> 	 push es		; => ELD cs
   108 000002B9 50                  <2> 	 push ax		; placeholder
   109 000002BA 31C0                <2> 	xor ax, ax
   110 000002BC 813DD1E1            <2> 	cmp word [di + eldlSignature], 0E1D1h
   111                              <2> %if ($ - linker) < 16
   112                              <2>  %error Expected invariant first paragraph of linker
   113                              <2> %endif
   114 000002C0 7403                <2> 	je @F
   115                              <2> .error_j1:
   116 000002C2 E9FD03              <2> 	jmp .error		; signature mismatch -->
   117                              <2> @@:
   118 000002C5 837D0601            <2> 	cmp word [di + eldlUseLinkHash], 1
   119 000002C9 77F7                <2> 	ja .error_j1		; unknown use link hash number -->
   120 000002CB 7201                <2> 	jb @F
   121                              <2> %if _ELDDATA_NEXT || _ELDCALL_NEXT
   122                              <2> 	dec al			; = -1 if hash used
   123                              <2> %else
   124 000002CD 48                  <2> 	dec ax
   125                              <2> %endif
   126                              <2> @@:
   127                              <2> 	lvar word, use_hash_low_skip_last_high
   128 000002CE 50                  <2> 	 push ax		; = -1 if hash used, else 0
   129                              <2> 	lequ ?use_hash_low_skip_last_high, use_hash
   130                              <2> 	lequ ?use_hash_low_skip_last_high + 1, skip_last
   131                              <2> %if _ELD_IDENTICALISE && _ELD_LINKER_PASSES
   132                              <2> 	mov ax, linktable - code
   133                              <2> 	lvar word, lt
   134                              <2> 	 push ax		; -> link tables (a single reference)
   135                              <2> %endif
   136                              <2> %if _ELD_LINKER_PASSES || ELDOTHER || _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   137 000002CF 31C0                <2> 	xor ax, ax
   138                              <2>  %if _ELD_LINKER_PASSES
   139                              <2> 	lvar word, pass
   140 000002D1 50                  <2> 	 push ax		; = 0 for linker itself, = 2 for application
   141                              <2> 	lvar word, amounterrors
   142 000002D2 50                  <2> 	 push ax		; how many distinct errors encountered in pass 2
   143                              <2>  %endif
   144                              <2>  %if _ELD_LINKER_PASSES || _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   145                              <2> 	lvar word, name
   146 000002D3 50                  <2> 	 push ax		; -> name currently being sought (in our table)
   147                              <2>  %endif
   148                              <2>  %if ELDOTHER
   149                              <2> 	lvar word, other
   150 000002D4 50                  <2> 	 push ax		; byte: 0 = own data links, -1 = other data links
   151                              <2>  %endif
   152                              <2>  %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   153                              <2> 	lvar word, optionalmissing
   154 000002D5 50                  <2> 	 push ax
   155                              <2>  %endif
   156                              <2> %endif
   157 000002D6 56                  <2> 	push si			; -> command line tail
   158 000002D7 53                  <2> 	push bx			; -> data block in ELD data area (segment ss)
   159                              <2> 
   160                              <2> 			; simple: add instance base (dx) to code
   161 000002D8 06                  <2> 	push es
   162 000002D9 1F                  <2> 	pop ds			; ds = es => ELD cs
   163                              <2> %if _ELD_LINKER_PASSES
   164                              <2> .pass:
   165 000002DA 8B5EE4              <2> 	mov bx, word [bp + ?pass]	; 0 or 2
   166 000002DD 01D3                <2> 	add bx, dx		; -> start of the ELD instance in cs, +0 or +2
   167                              <2>  %if _ELD_IDENTICALISE
   168                              <2> 	add bx, word [bp + ?lt]	; add in single reference to linktable
   169                              <2> 	mov si, word [ltCodeToCode + bx]
   170                              <2>  %else
   171 000002DF 8BB77C07            <2> 	mov si, word [linktable - code + ltCodeToCode + bx]
   172                              <2>  %endif
   173                              <2> %else
   174                              <2> 	mov si, internalcodetocoderelocations - code
   175                              <2> %endif		 		; si -> table for code to code (linker or app)
   176 000002E3 01D6                <2> 	add si, dx		; relocate the table pointer itself
   177                              <2> @@:
   178 000002E5 AD                  <2> 	lodsw
   179 000002E6 85C0                <2> 	test ax, ax		; was last ?
   180 000002E8 740B                <2> 	jz @F			; yes -->
   181 000002EA 93                  <2> 	xchg bx, ax		; bx = entry
   182 000002EB 01D3                <2> 	add bx, dx		; relocate the entry itself
   183                              <2> %if _ELD_CODE_VSTART
   184 000002ED 812F[0000]          <2> 	sub word [bx], code	; undo adjustment
   185                              <2> %endif
   186 000002F1 0117                <2> 	add word [bx], dx	; relocate word referenced by entry
   187 000002F3 EBF0                <2> 	jmp @B
   188                              <2> 
   189                              <2> @@:
   190                              <2> 			; next, add heap data base (on stack) to code
   191                              <2> %if _ELD_LINKER_PASSES
   192 000002F5 8B5EE4              <2> 	mov bx, word [bp + ?pass]	; 0 or 2
   193 000002F8 01D3                <2> 	add bx, dx		; -> start of the ELD instance in cs, +0 or +2
   194                              <2>  %if _ELD_IDENTICALISE
   195                              <2> 	add bx, word [bp + ?lt]	; add in single reference to linktable
   196                              <2> 	mov si, word [ltCodeToData + bx]
   197                              <2>  %else
   198 000002FA 8BB78007            <2> 	mov si, word [linktable - code + ltCodeToData + bx]
   199                              <2>  %endif
   200                              <2> %else
   201                              <2> 	mov si, internalcodetodatarelocations - code
   202                              <2> %endif				; si -> table for code to data (linker or app)
   203 000002FE 01D6                <2> 	add si, dx		; relocate the table pointer itself
   204                              <2> @@:
   205 00000300 AD                  <2> 	lodsw
   206 00000301 85C0                <2> 	test ax, ax		; was last ?
   207 00000303 740C                <2> 	jz @F			; yes -->
   208 00000305 93                  <2> 	xchg bx, ax		; bx = entry
   209 00000306 01D3                <2> 	add bx, dx		; relocate the entry itself
   210                              <2> 		; ! access the offset of the data area block, topmost on stack
   211 00000308 58                  <2> 	pop ax			; ax -> heap data
   212 00000309 50                  <2> 	push ax
   213                              <2> %if _ELD_DATA_VSTART
   214 0000030A 2D[0000]            <2> 	sub ax, datastart	; undo adjustment
   215                              <2> %endif
   216 0000030D 0107                <2> 	add word [bx], ax	; relocate word referenced by entry
   217 0000030F EBEF                <2> 	jmp @B
   218                              <2> 
   219                              <2> @@:
   220                              <2> 
   221                              <2> 			; add instance base (dx) to data
   222                              <2> %if _ELD_LINKER_PASSES
   223 00000311 8B5EE4              <2> 	mov bx, word [bp + ?pass]
   224 00000314 01D3                <2> 	add bx, dx
   225                              <2>  %if _ELD_IDENTICALISE
   226                              <2> 	add bx, word [bp + ?lt]
   227                              <2> 	mov si, word [ltDataToCode + bx]
   228                              <2>  %else
   229 00000316 8BB78407            <2> 	mov si, word [linktable - code + ltDataToCode + bx]
   230                              <2>  %endif
   231                              <2> %else
   232                              <2> 	mov si, internaldatatocoderelocations - code
   233                              <2> %endif
   234 0000031A 01D6                <2> 	add si, dx
   235                              <2> @@:
   236 0000031C AD                  <2> 	lodsw
   237 0000031D 83F8FF              <2> 	cmp ax, -1		; was last ?
   238 00000320 740F                <2> 	je @F			; yes -->
   239 00000322 93                  <2> 	xchg bx, ax		; bx = entry
   240                              <2> 		; ! access the offset of the data area block, topmost on stack
   241 00000323 58                  <2> 	pop ax
   242 00000324 50                  <2> 	push ax
   243 00000325 01C3                <2> 	add bx, ax		; relocate the entry itself
   244                              <2> %if _ELD_CODE_VSTART
   245 00000327 36812F[0000]        <2> 	sub word [ss:bx], code	; undo adjustment
   246                              <2> %endif
   247 0000032C 360117              <2> 	add word [ss:bx], dx	; relocate word referenced by entry
   248 0000032F EBEB                <2> 	jmp @B
   249                              <2> 
   250                              <2> @@:
   251                              <2> 			; next, add heap data base (on stack) to data
   252                              <2> %if _ELD_LINKER_PASSES
   253 00000331 8B5EE4              <2> 	mov bx, word [bp + ?pass]
   254 00000334 01D3                <2> 	add bx, dx
   255                              <2>  %if _ELD_IDENTICALISE
   256                              <2> 	add bx, word [bp + ?lt]
   257                              <2> 	mov si, word [ltDataToData + bx]
   258                              <2>  %else
   259 00000336 8BB78807            <2> 	mov si, word [linktable - code + ltDataToData + bx]
   260                              <2>  %endif
   261                              <2> %else
   262                              <2> 	mov si, internaldatatodatarelocations - code
   263                              <2> %endif
   264 0000033A 01D6                <2> 	add si, dx
   265                              <2> @@:
   266 0000033C AD                  <2> 	lodsw
   267 0000033D 83F8FF              <2> 	cmp ax, -1		; was last ?
   268 00000340 740D                <2> 	je @F			; yes -->
   269 00000342 93                  <2> 	xchg bx, ax		; bx = entry
   270                              <2> 		; ! access the offset of the data area block, topmost on stack
   271 00000343 58                  <2> 	pop ax			; ax -> heap data
   272 00000344 50                  <2> 	push ax
   273 00000345 01C3                <2> 	add bx, ax		; relocate the entry itself
   274                              <2> %if _ELD_DATA_VSTART
   275 00000347 2D[0000]            <2> 	sub ax, datastart	; undo adjustment
   276                              <2> %endif
   277 0000034A 360107              <2> 	add word [ss:bx], ax	; relocate word referenced by entry
   278 0000034D EBED                <2> 	jmp @B
   279                              <2> 
   280                              <2> @@:
   281 0000034F 8B56F6              <2> 	mov dx, word [bp + ?instance]
   282                              <2> 				; reset (why??) -> ELD instance in ELD cs
   283                              <2> %if _ELD_LINKER_PASSES
   284 00000352 8B5EE4              <2> 	mov bx, word [bp + ?pass]
   285 00000355 01D3                <2> 	add bx, dx
   286                              <2>  %if _ELD_IDENTICALISE
   287                              <2> 	add bx, word [bp + ?lt]
   288                              <2> 	add dx, word [ltLinkData + bx]
   289                              <2>  %else
   290 00000357 03978C07            <2> 	add dx, word [linktable - code + ltLinkData + bx]
   291                              <2>  %endif
   292                              <2> %else
   293                              <2> 	add dx, linkerdatarelocations - code
   294                              <2> %endif
   295                              <2> .otherloop:
   296 0000035B 8956EC              <2> 	mov word [bp + ?nextreloc], dx
   297                              <2> 				; -> data link relocation table
   298                              <2> 
   299                              <2> .datarelocloop:		; must be done before further relocs
   300 0000035E C576EC              <2> 	lds si, [bp + ?nextreloc]
   301 00000361 AD                  <2> 	lodsw			; ax = section indicator
   302 00000362 85C0                <2> 	test ax, ax		; end of table ?
   303 00000364 7503E96301          <2> 	jz .donedatareloc
   304 00000369 48                  <2> 	dec ax			; al = 1 if data, 0 if code (NB ah may != 0)
   305                              <2> 		; ! access the offset of the data area block, topmost on stack
   306 0000036A 5B                  <2> 	pop bx
   307 0000036B 53                  <2> 	push bx			; bx -> ELD data block
   308 0000036C 8946F4              <2> 	mov word [bp + ?targetsection_low_optional_high], ax
   309 0000036F 84C0                <2> 	test al, al		; data ?
   310 00000371 AD                  <2> 	lodsw
   311 00000372 7504                <2> 	jnz @F			; yes -->
   312 00000374 0346F6              <2> 	add ax, word [bp + ?instance]
   313                              <2> 				; relocate entry into code
   314 00000377 A9                  <2> 	db __TEST_IMM16		; (skip add)
   315                              <2> @@:
   316 00000378 01D8                <2> 	add ax, bx		; relocate entry into data
   317 0000037A 8946E8              <2> 	mov word [bp + ?entry], ax
   318                              <2> 				; save away -> where to patch
   319 0000037D AD                  <2> 	lodsw			; get unrelocated -> name
   320 0000037E 8976EC              <2> 	mov word [bp + ?nextreloc], si
   321                              <2> 				; update -> behind relocation table entry
   322                              <2> %if _ELDDATA_NEXT
   323                              <2> 	rol byte [bp + ?skip_last], 1	; skipping ?
   324                              <2> 	jnc @F				; no -->
   325                              <2> 	test byte [bp + ?optional], 8	; is it a last relocation ?
   326                              <2> 	jz .datarelocloop		; no, leave skip_last set -->
   327                              <2> 	not byte [bp + ?skip_last]	; disable skip_last
   328                              <2> 	jmp .datarelocloop
   329                              <2> @@:
   330                              <2> %endif
   331 00000381 E80301              <2> 	call .build_match	; get ax = scan value, si -> counted string,
   332                              <2> 				;  dl = original value at byte [si]
   333                              <2> 				; NC if symbol already not found before
   334                              <2> 				; CY if to search for the symbol
   335                              <2> %if _ELD_LINKER_PASSES
   336 00000384 73D8                <2> 	jnc .datarelocloop	; if duplicate of a not found symbol -->
   337                              <2> %endif
   338 00000386 C45EF0              <2> 	les bx, [bp + ?linkinfo]
   339                              <2> %if ELDOTHER
   340 00000389 D046DE              <2> 	rol byte [bp + ?other], 1
   341 0000038C 7303                <2> 	jnc @F
   342 0000038E C45EFC              <2> 	les bx, [bp + ?linkinfo_other]
   343                              <2> @@:
   344                              <2> %endif				; es:bx -> link info table of the ELD host
   345 00000391 268B4F08            <2> 	mov cx, word [es:bx + eldlDataAmount]	; amount data link info
   346 00000395 268B7F0A            <2> 	mov di, word [es:bx + eldlDataPrefixes]	; -> prefixes or hashes
   347                              <2> .datarelocfind:
   348 00000399 83F901              <2> 	cmp cx, 1			; NZ if cx == 0
   349 0000039C F2AF                <2> 	repne scasw			; scan initial
   350                              <2> %if _ELDDATA_OPTIONAL
   351 0000039E 7541                <2> 	jne .datanotfound_may_be_optional
   352                              <2> %else
   353                              <2> 	jne .datanotfound
   354                              <2> %endif
   355 000003A0 57                  <2> 	push di
   356 000003A1 51                  <2> 	push cx
   357 000003A2 56                  <2> 	push si
   358 000003A3 262B7F0A            <2> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   359 000003A7 4F                  <2> 	dec di
   360 000003A8 4F                  <2> 	dec di				; 0-based
   361 000003A9 26037F0C            <2> 	add di, word [es:bx + eldlDataEntries]	; -> entry
   362 000003AD 268B3D              <2> 	mov di, [es:di]			; -> counted suffix/string
   363 000003B0 B500                <2> 	mov ch, 0
   364 000003B2 8A0C                <2> 	mov cl, byte [si]		; cx = length
   365 000003B4 41                  <2> 	inc cx
   366                              <2> 	; cmp al, al			; ZR if length is zero
   367 000003B5 F3A6                <2> 	repe cmpsb			; match ?
   368 000003B7 5E                  <2> 	pop si
   369 000003B8 59                  <2> 	pop cx
   370 000003B9 5F                  <2> 	pop di
   371 000003BA 75DD                <2> 	jne .datarelocfind		; if not found this time,
   372                              <2> 					;  scan for next initial -->
   373 000003BC 8814                <2> 	mov byte [si], dl		; restore the original byte at counter
   374 000003BE 262B7F0A            <2> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   375 000003C2 4F                  <2> 	dec di
   376 000003C3 4F                  <2> 	dec di				; 0-based
   377 000003C4 26037F0E            <2> 	add di, word [es:bx + eldlDataAddresses]	; -> address (offset)
   378 000003C8 268B05              <2> 	mov ax, word [es:di]		; get link data from the table
   379 000003CB E80700              <2> 	call .address_data_reloc
   380                              <2> %if _ELD_RELOC_VSTART
   381 000003CE 2D[0000]            <2> 	sub ax, relocateddata		; *not* a relocation
   382                              <2> %endif
   383 000003D1 0104                <2> 	add word [si], ax		; relocate
   384                              <2> %if _ELDDATA_NEXT
   385                              <2> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   386                              <2> 	jz .datarelocloop
   387                              <2> 	mov byte [bp + ?skip_last], -1	; skip subsequent next/last relocs
   388                              <2> %endif
   389 000003D3 EB89                <2> 	jmp .datarelocloop
   390                              <2> 
   391                              <2> .address_data_reloc:
   392 000003D5 C576E8              <2> 	lds si, [bp + ?entry]		; -> entry if in ELD code instance
   393 000003D8 807EF400            <2> 	cmp byte [bp + ?targetsection], 0
   394                              <2> 					; relocation in code ?
   395 000003DC 7402                <2> 	je @F				; yes -->
   396 000003DE 16                  <2> 	push ss
   397 000003DF 1F                  <2> 	pop ds				; => our ELD data block
   398                              <2> @@:
   399 000003E0 C3                  <2> 	retn
   400                              <2> 
   401                              <2> %if _ELDDATA_OPTIONAL
   402                              <2> .datanotfound_may_be_optional:
   403 000003E1 8814                <2> 	mov byte [si], dl		; restore the original byte at counter
   404                              <2> %if _ELDDATA_NEXT
   405                              <2> 	test byte [bp + ?optional], 3	; is it an optional relocation ?
   406                              <2> %else
   407 000003E3 807EF500            <2> 	cmp byte [bp + ?optional], 0	; is it an optional relocation ?
   408                              <2> %endif
   409                              <2> %if _ELD_DEBUG
   410                              <2> 	jnz @F
   411                              <2>  %ifn _ELD_LINKER_PASSES
   412                              <2> 	mov si, 0			; (invalid link)
   413                              <2> linkdatarelocation internalflags6
   414                              <2> 	test si, si
   415                              <2> 	jz .datanotfound
   416                              <2> 	mov si, 0			; (invalid link)
   417                              <2> linkdatarelocation options7
   418                              <2> 	test si, si
   419                              <2> 	jz .datanotfound
   420                              <2>  %else
   421                              <2> 	cmp byte [bp + ?pass], 0
   422                              <2> 	je .datanotfound
   423                              <2>  %endif
   424                              <2> 	houdini				; (the above conditions are for this)
   425                              <2> 	jmp .datanotfound
   426                              <2> @@:
   427                              <2> %else
   428 000003E7 742E                <2> 	jz .datanotfound		; no, handle as an error -->
   429                              <2> %endif
   430                              <2> 
   431                              <2> %if ELDDATA_PMREQUIRED_STATUS
   432                              <2> 	mov si, relocateddata
   433                              <2> linkdatarelocation build_option_PM
   434                              <2> 	test si, si			; is it a PM build ?
   435                              <2> 	jz @F				; no --> (treat PM required as optional)
   436                              <2> 	test byte [bp + ?optional], 2	; optional status is PM required ?
   437                              <2> 	jnz .datanotfound		; yes, handle as an error -->
   438                              <2> @@:
   439                              <2> %endif
   440                              <2> 
   441                              <2> %if _ELD_LINKER_PASSES
   442                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   443 000003E9 D046DC              <2> 	rol byte [bp + ?optionalmissing], 1
   444 000003EC 730B                <2> 	jnc .optionaldatamissingmsg
   445 000003EE 8B76E0              <2> 	mov si, [bp + ?name]
   446 000003F1 800C80              <2> 	or byte [si], 80h
   447 000003F4 F656DC              <2> 	not byte [bp + ?optionalmissing]
   448 000003F7 EB15                <2> 	jmp @F
   449                              <2> .optionaldatamissingmsg:
   450                              <2> %endif
   451 000003F9 36F606[0000]02      <2> 	testopt [ss:relocateddata], 2	; debug optional link ?
   452                              <2> linkdatarelocation options7, -3
   453 000003FF 740D                <2> 	jz @F				; no -->
   454                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   455 00000401 C646DDFF            <2> 	mov byte [bp + ?optionalmissing + 1], -1
   456                              <2> %endif
   457 00000405 BE[C80A]            <2> 	mov si, lmsg.warning_data_optional
   458                              <2> internalcoderelocation
   459 00000408 E82B00              <2> 	call .notfound			; display a warning
   460                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   461 0000040B F656DD              <2> 	not byte [bp + ?optionalmissing + 1]
   462                              <2> %endif
   463                              <2> @@:
   464                              <2> %endif
   465                              <2> %if _ELDDATA_NEXT
   466                              <2> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   467                              <2> 	jnz .datarelocloop
   468                              <2> %endif
   469 0000040E E8C4FF              <2> 	call .address_data_reloc
   470 00000411 832400              <2> 	and word [si], 0		; indicate optional data link failed
   471 00000414 E947FF              <2> 	jmp .datarelocloop
   472                              <2> %endif
   473                              <2> 
   474                              <2> 
   475                              <2> %if _ELDCALL_OPTIONAL
   476                              <2> .codenotfound_may_be_optional:
   477                              <2> 	mov byte [si], dl		; restore the original byte at counter
   478                              <2> %if _ELDCALL_NEXT
   479                              <2> 	test byte [bp + ?optional], 3	; is it an optional relocation ?
   480                              <2> %else
   481                              <2> 	cmp byte [bp + ?optional], 0	; is it an optional relocation ?
   482                              <2> %endif
   483                              <2> %if _ELD_DEBUG
   484                              <2> 	jnz @F
   485                              <2>  %ifn _ELD_LINKER_PASSES
   486                              <2> 	mov si, 0			; (invalid link)
   487                              <2> linkdatarelocation internalflags6
   488                              <2> 	test si, si
   489                              <2> 	jz .codenotfound
   490                              <2> 	mov si, 0			; (invalid link)
   491                              <2> linkdatarelocation options7
   492                              <2> 	test si, si
   493                              <2> 	jz .codenotfound
   494                              <2>  %else
   495                              <2> 	cmp byte [bp + ?pass], 0
   496                              <2> 	je .codenotfound
   497                              <2>  %endif
   498                              <2> 	houdini				; (the above conditions are for this)
   499                              <2> 	jmp .codenotfound
   500                              <2> @@:
   501                              <2> %else
   502                              <2> 	jz .codenotfound		; no, handle as an error -->
   503                              <2> %endif
   504                              <2> 
   505                              <2> %if ELDCALL_PMREQUIRED_STATUS
   506                              <2>  %if _ELD_LINKER_PASSES
   507                              <2>   %assign ELDLINKER 0
   508                              <2>  %endif
   509                              <2> 	mov si, relocateddata
   510                              <2> linkdatarelocation build_option_PM
   511                              <2>  %if _ELD_LINKER_PASSES
   512                              <2>   %assign ELDLINKER 1
   513                              <2>  %endif
   514                              <2> 	test si, si			; is it a PM build ?
   515                              <2> 	jz @F				; no --> (treat PM required as optional)
   516                              <2> 	test byte [bp + ?optional], 2	; optional status is PM required ?
   517                              <2> 	jnz .codenotfound		; yes, handle as an error -->
   518                              <2> @@:
   519                              <2> %endif
   520                              <2> 
   521                              <2> %if _ELD_LINKER_PASSES
   522                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   523                              <2> 	rol byte [bp + ?optionalmissing], 1
   524                              <2> 	jnc .optionalcodemissingmsg
   525                              <2> 	mov si, [bp + ?name]
   526                              <2> 	or byte [si], 80h
   527                              <2> 	not byte [bp + ?optionalmissing]
   528                              <2> 	jmp @F
   529                              <2> .optionalcodemissingmsg:
   530                              <2> %endif
   531                              <2> 	testopt [ss:relocateddata], 2	; debug optional link ?
   532                              <2> linkdatarelocation options7, -3
   533                              <2> 	jz @F				; no -->
   534                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   535                              <2> 	mov byte [bp + ?optionalmissing + 1], -1
   536                              <2> %endif
   537                              <2> 	mov si, lmsg.warning_code_optional
   538                              <2> internalcoderelocation
   539                              <2> 	call .notfound			; display a warning
   540                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   541                              <2> 	not byte [bp + ?optionalmissing + 1]
   542                              <2> %endif
   543                              <2> @@:
   544                              <2> %endif
   545                              <2> %if _ELDCALL_NEXT
   546                              <2> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   547                              <2> 	jnz .coderelocloop
   548                              <2> %endif
   549                              <2> 	lds si, [bp + ?entry]		; -> code site (must be in ELD cs)
   550                              <2> 	mov word [si], 9090h
   551                              <2> 	mov byte [si + 2], 90h		; indicate optional code link failed
   552                              <2> 					;  (NOP out the 3-byte call near imm)
   553                              <2> 	jmp .coderelocloop
   554                              <2> %endif
   555                              <2> 
   556                              <2> 
   557                              <2> %if _ELD_LINKER_PASSES
   558                              <2> .datanotfound:
   559 00000417 BE[EA0A]            <2> 	mov si, lmsg.error_data
   560                              <2> internalcoderelocation
   561 0000041A E81900              <2> 	call .notfound			; display error
   562 0000041D 7306                <2> 	jnc .error_j3			; NC if in pass 0, error out now -->
   563 0000041F FF46E2              <2> 	inc word [bp + ?amounterrors]	; count the amount of errors
   564 00000422 E939FF              <2> 	jmp .datarelocloop		; go to next relocation entry -->
   565                              <2> 
   566                              <2> .error_j3:
   567 00000425 E99A02              <2> 	jmp .error
   568                              <2> 
   569                              <2> .codenotfound:
   570 00000428 BE[030B]            <2> 	mov si, lmsg.error_code
   571                              <2> internalcoderelocation
   572 0000042B E80800              <2> 	call .notfound			; display error
   573 0000042E 73F5                <2> 	jnc .error_j3			; NC if in pass 0 -->
   574 00000430 FF46E2              <2> 	inc word [bp + ?amounterrors]	; count the amount of errors
   575 00000433 E9AD00              <2> 	jmp .coderelocloop		; go to next -->
   576                              <2> 
   577                              <2> .notfound:
   578 00000436 807EE400            <2> 	cmp byte [bp + ?pass], 0	; pass 0 ?
   579 0000043A 7442                <2> 	je .notfound.retn		; yes, do not try displaying --> (NC)
   580 0000043C 16                  <2> 	 push ss
   581 0000043D 07                  <2> 	 pop es
   582 0000043E BF[0000]            <2> 	mov di, relocateddata
   583                              <2> linkdatarelocation line_out		; es:di -> line_out buffer
   584 00000441 E83B00              <2> 	call .copy			; copy prefix message
   585 00000444 8B76E0              <2> 	mov si, word [bp + ?name]
   586 00000447 AD                  <2> 	lodsw				; = hash
   587 00000448 E8[0000]EB020000    <2> 	extcall hexword			; display the hash in hex
   588 0000044F 56                  <2> 	push si
   589 00000450 BE[1C0B]            <2> 	mov si, lmsg.error.2
   590                              <2> internalcoderelocation
   591 00000453 E82900              <2> 	call .copy			; display message fragment
   592 00000456 5E                  <2> 	pop si
   593                              <2> %if _ELD_LINKER_PASSES
   594 00000457 56                  <2> 	push si
   595 00000458 E82400              <2> 	call .copy			; copy over the full name
   596 0000045B 5E                  <2> 	pop si
   597                              <2>  %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   598 0000045C 800C80              <2> 	or byte [si], 80h		; mark as failed optional link
   599 0000045F D046DD              <2> 	rol byte [bp + ?optionalmissing + 1], 1
   600                              <2> 					; was it optional ?
   601 00000462 7203                <2> 	jc @F				; yes -->
   602                              <2>  %endif
   603 00000464 C60400              <2> 	mov byte [si], 0		; mark as failed (counter byte = 0)
   604                              <2> @@:
   605                              <2> %else
   606                              <2> 	call .copy
   607                              <2> %endif
   608 00000467 B022                <2> 	mov al, '"'
   609 00000469 AA                  <2> 	stosb				; end message with a closing quote mark
   610 0000046A 16                  <2> 	 push ss
   611 0000046B 1F                  <2> 	 pop ds
   612 0000046C E8[0000]EB020000    <2> 	extcall putsline_crlf		; display diagnostic line
   613 00000473 B8350E              <2> 	mov ax, 0E35h
   614 00000476 E8[0000]EB020000    <2> 	extcall setrc
   615 0000047D F9                  <2> 	stc				; CY, diagnostic displayed
   616                              <2> .notfound.retn:
   617 0000047E C3                  <2> 	retn
   618                              <2> 
   619                              <2> .copy:		; (cannot use extcallcall here)
   620 0000047F E8[0000]EB020000    <2> 	extcall copy_single_counted_string
   621 00000486 C3                  <2> 	retn
   622                              <2> %else
   623                              <2> .datanotfound: equ .error
   624                              <2> .codenotfound: equ .error
   625                              <2> %endif
   626                              <2> 
   627                              <2> .build_match:
   628                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   629 00000487 C646DC00            <2> 	mov byte [bp + ?optionalmissing], 0
   630                              <2> 		; This is needed for eldtestj.asm with debugoptlink.
   631                              <2> 		;  The optional data link sets flag 80h, then the
   632                              <2> 		;  required data link to the same symbol sets this
   633                              <2> 		;  flag but doesn't reset it. So the first optional
   634                              <2> 		;  code link still had this set. Reset here to fix.
   635                              <2> %endif
   636                              <2> %if _ELD_CODE_VSTART
   637 0000048B 2D[0000]            <2> 	sub ax, code			; revert adjustment (= displacement)
   638                              <2> %endif
   639 0000048E 0346F6              <2> 	add ax, word [bp + ?instance]	; make displacement into -> name string
   640 00000491 96                  <2> 	xchg si, ax			; si -> hash word, counted name string
   641                              <2> %if _ELD_LINKER_PASSES || _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   642 00000492 8976E0              <2> 	mov word [bp + ?name], si	; save away for diagnostics
   643                              <2> %endif
   644 00000495 AD                  <2> 	lodsw			; = hash, si -> counted string
   645 00000496 8A14                <2> 	mov dl, byte [si]	; dl = original start byte of match
   646                              <2> %if _ELD_LINKER_PASSES
   647 00000498 84D2                <2> 	test dl, dl		; marked as already failed ?
   648                              <2> 				;  (80h = optional, 0 = required)
   649 0000049A 750A                <2> 	jnz @F			; no -->
   650 0000049C 837EE200            <2> 	cmp word [bp + ?amounterrors], 0
   651                              <2> 				; validate error status
   652 000004A0 7503E9C200          <2> 	je .error_j		; no error known ?! cancel quickly -->
   653 000004A5 C3                  <2> 	retn			; (NC)
   654                              <2> 
   655                              <2> @@:
   656                              <2> %else
   657                              <2> 	test dl, dl
   658                              <2> %endif
   659                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   660 000004A6 7909                <2> 	jns @F
   661 000004A8 80E27F              <2> 	and dl, 7Fh
   662 000004AB 8814                <2> 	mov byte [si], dl
   663 000004AD C646DCFF            <2> 	mov byte [bp + ?optionalmissing], -1
   664                              <2> @@:
   665                              <2> %endif
   666                              <2> %if ELDOTHER
   667 000004B1 D046DE              <2> 	rol byte [bp + ?other], 1
   668 000004B4 7305                <2> 	jnc @F
   669 000004B6 D046FA              <2> 	rol byte [bp + ?use_hash_other], 1
   670 000004B9 EB03                <2> 	jmp @FF
   671                              <2> 
   672                              <2> @@:
   673                              <2> %endif
   674 000004BB D046E6              <2> 	rol byte [bp + ?use_hash], 1
   675                              <2> @@:
   676                              <2> 		; If to use the hash, then ax = hash and si ->
   677                              <2> 		;  the entire symbol name as a counted string.
   678 000004BE 720A                <2> 	jc @F			; if to use hash, return now -->
   679 000004C0 AC                  <2> 	lodsb			; al = length
   680 000004C1 91                  <2> 	xchg cx, ax		; cl = length
   681 000004C2 AD                  <2> 	lodsw			; ax = prefix
   682 000004C3 49                  <2> 	dec cx
   683 000004C4 49                  <2> 	dec cx			; cl = adjusted length
   684 000004C5 4E                  <2> 	dec si			; -> second byte of prefix
   685 000004C6 8A14                <2> 	mov dl, byte [si]	; dl = original start byte of match
   686 000004C8 880C                <2> 	mov byte [si], cl	; si -> counted string suffix
   687                              <2> 		; (this name entry has been edited to provide the
   688                              <2> 		;  name suffix as a counted string, as required by
   689                              <2> 		;  the old-style non-hash link info tables.
   690                              <2> 		; it will be reset later by writing dl to si -> the
   691                              <2> 		;  first byte of the match string.)
   692                              <2> @@:
   693                              <2> %if _ELD_LINKER_PASSES
   694 000004CA F9                  <2> 	stc			; CY
   695                              <2> %endif
   696 000004CB C3                  <2> 	retn
   697                              <2> 
   698                              <2> 
   699                              <2> .donedatareloc:
   700                              <2> %if ELDOTHER
   701 000004CC D046DE              <2> 	rol byte [bp + ?other], 1
   702 000004CF 7303E9C901          <2> 	jc .otherdone		; other link only has data links,
   703                              <2> 				;  so at this point we're done -->
   704                              <2> %endif
   705                              <2> 
   706 000004D4 8B56F6              <2> 	mov dx, word [bp + ?instance]
   707                              <2> %if _ELD_LINKER_PASSES
   708 000004D7 8B5EE4              <2> 	mov bx, word [bp + ?pass]
   709 000004DA 01D3                <2> 	add bx, dx
   710                              <2>  %if _ELD_IDENTICALISE
   711                              <2> 	add bx, word [bp + ?lt]
   712                              <2> 	add dx, word [ltLinkCode + bx]
   713                              <2>  %else
   714 000004DC 03979007            <2> 	add dx, word [linktable - code + ltLinkCode + bx]
   715                              <2>  %endif
   716                              <2> %else
   717                              <2> 	add dx, linkercoderelocations - code
   718                              <2> %endif
   719 000004E0 8956EC              <2> 	mov word [bp + ?nextreloc], dx
   720                              <2> 
   721                              <2> .coderelocloop:
   722 000004E3 C576EC              <2> 	lds si, [bp + ?nextreloc]
   723 000004E6 AD                  <2> 	lodsw
   724                              <2> %if _ELDCALL_OPTIONAL || _ELDCALL_NEXT
   725                              <2> 	dec ax				; optional word is 1-based, get 0-based
   726                              <2> 	js .donecodereloc
   727                              <2> 	mov word [bp + ?targetsection_low_optional_high], ax
   728                              <2> 	lodsw
   729                              <2> %endif
   730 000004E7 0346F6              <2> 	add ax, word [bp + ?instance]
   731 000004EA 8946E8              <2> 	mov word [bp + ?entry], ax
   732 000004ED AD                  <2> 	lodsw
   733 000004EE 8976EC              <2> 	mov word [bp + ?nextreloc], si
   734                              <2> %ifn _ELDCALL_OPTIONAL || _ELDCALL_NEXT
   735 000004F1 85C0                <2> 	test ax, ax			; if no optional word, check -> match
   736 000004F3 7503E98100          <2> 	jz .donecodereloc
   737                              <2> %endif
   738                              <2> %if _ELDCALL_NEXT
   739                              <2> 	rol byte [bp + ?skip_last], 1	; skipping ?
   740                              <2> 	jnc @F				; no -->
   741                              <2> 	test byte [bp + ?optional], 8	; is it a last relocation ?
   742                              <2> 	jz .coderelocloop		; no, leave skip_last set -->
   743                              <2> 	not byte [bp + ?skip_last]	; disable skip_last
   744                              <2> 	jmp .coderelocloop
   745                              <2> @@:
   746                              <2> %endif
   747 000004F8 E88CFF              <2> 	call .build_match
   748                              <2> %if _ELD_LINKER_PASSES
   749 000004FB 73E6                <2> 	jnc .coderelocloop
   750                              <2> %endif
   751 000004FD C45EF0              <2> 	les bx, [bp + ?linkinfo]
   752 00000500 268B4F10            <2> 	mov cx, word [es:bx + eldlCodeAmount]	; amount code link info
   753 00000504 268B7F12            <2> 	mov di, word [es:bx + eldlCodePrefixes]	; -> prefixes or hashes
   754                              <2> .coderelocfind:
   755 00000508 83F901              <2> 	cmp cx, 1			; NZ if cx == 0
   756 0000050B F2AF                <2> 	repne scasw			; scan initial
   757                              <2> %if _ELDCALL_OPTIONAL
   758                              <2> 	jne .codenotfound_may_be_optional
   759                              <2> %else
   760                              <2>  %if _ELD_DEBUG
   761                              <2> 	je @F
   762                              <2> 	houdini
   763                              <2> 	jmp .codenotfound
   764                              <2> @@:
   765                              <2>  %else
   766 0000050D 7403E916FF          <2> 	jne .codenotfound
   767                              <2>  %endif
   768                              <2> %endif
   769 00000512 57                  <2> 	push di
   770 00000513 51                  <2> 	push cx
   771 00000514 56                  <2> 	push si
   772 00000515 262B7F12            <2> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   773 00000519 4F                  <2> 	dec di
   774 0000051A 4F                  <2> 	dec di				; 0-based
   775 0000051B 26037F14            <2> 	add di, word [es:bx + eldlCodeEntries]	; -> entry
   776 0000051F 268B3D              <2> 	mov di, [es:di]			; -> counted suffix/string
   777 00000522 B500                <2> 	mov ch, 0
   778 00000524 8A0C                <2> 	mov cl, byte [si]		; cx = length
   779 00000526 41                  <2> 	inc cx
   780                              <2> 	; cmp al, al			; ZR if length is zero
   781 00000527 F3A6                <2> 	repe cmpsb			; match ?
   782 00000529 5E                  <2> 	pop si
   783 0000052A 59                  <2> 	pop cx
   784 0000052B 5F                  <2> 	pop di
   785 0000052C 75DA                <2> 	jne .coderelocfind
   786 0000052E 8814                <2> 	mov byte [si], dl
   787 00000530 262B7F12            <2> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   788 00000534 4F                  <2> 	dec di
   789 00000535 4F                  <2> 	dec di				; 0-based
   790 00000536 01FF                <2> 	add di, di			; quadruple index
   791 00000538 26037F16            <2> 	add di, word [es:bx + eldlCodeAddresses]	; -> address (offset, segment)
   792 0000053C 26FF35              <2> 	push word [es:di]
   793 0000053F C576E8              <2> 	lds si, [bp + ?entry]
   794 00000542 8F4405              <2> 	pop word [si + 3 + 2]		; call near imm (3), jmp short (2)
   795                              <2> 					;  patch the destination address
   796 00000545 803CE8              <2> 	cmp byte [si], 0E8h		; is it as expected ?
   797 00000548 751D                <2> 	jne .error_j
   798 0000054A 268B7D02            <2> 	mov di, word [es:di + 2]
   799 0000054E BB[0000]            <2> 	mov bx, relocateddata
   800                              <2> linkdatarelocation linkcall_table	; ss:bx -> link call table
   801 00000551 36833F01            <2> 	cmp word [ss:bx], 1		; is it initialised to format 1 ?
   802 00000555 7510                <2> 	jne .error_j			; no -->
   803 00000557 368B4F02            <2> 	mov cx, word [ss:bx + 2]	; get amount of segments
   804 0000055B E30A                <2> 	jcxz .error_j			; none -->
   805                              <2> @@:
   806 0000055D 83C304              <2> 	add bx, 4			; -> next segment
   807 00000560 36393F              <2> 	cmp word [ss:bx], di		; value matches ?
   808 00000563 7405                <2> 	je @F				; yes, found -->
   809 00000565 E2F6                <2> 	loop @B				; try remaining segments
   810                              <2> .error_j:
   811 00000567 E95801              <2> 	jmp .error
   812                              <2> 
   813                              <2> @@:
   814 0000056A 368B5F02            <2> 	mov bx, word [ss:bx + 2]	; -> call destination offset
   815                              <2> 		; si + 3 + delta = bx
   816                              <2> 		; delta = bx - si - 3
   817 0000056E 29F3                <2> 	sub bx, si
   818 00000570 83EB03              <2> 	sub bx, 3
   819 00000573 895C01              <2> 	mov word [si + 1], bx		; patch the call instruction
   820                              <2> %if _ELDCALL_NEXT
   821                              <2> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   822                              <2> 	jz .coderelocloop
   823                              <2> 	mov byte [bp + ?skip_last], -1	; skip subsequent next/last relocs
   824                              <2> %endif
   825 00000576 E96AFF              <2> 	jmp .coderelocloop
   826                              <2> 
   827                              <2> .donecodereloc:
   828                              <2> %if _ELD_LINKER_PASSES
   829 00000579 8B46E2              <2> 	mov ax, word [bp + ?amounterrors]
   830 0000057C 85C0                <2> 	test ax, ax
   831 0000057E 75E7                <2> 	jnz .error_j
   832 00000580 8B5EE4              <2> 	mov bx, word [bp + ?pass]
   833 00000583 85DB                <2> 	test bx, bx
   834 00000585 750B                <2> 	jnz @F
   835 00000587 43                  <2> 	inc bx
   836 00000588 43                  <2> 	inc bx
   837 00000589 895EE4              <2> 	mov word [bp + ?pass], bx
   838 0000058C 8B56F6              <2> 	mov dx, word [bp + ?instance]
   839 0000058F E948FD              <2> 	jmp .pass
   840                              <2> 
   841                              <2> @@:
   842                              <2> %endif
   843                              <2> 
   844                              <2> %ifnidni _LISTING, ""
   845                              <2> %assign ELDLINKER 0
   846                              <2> .hint:
   847 00000592 16                  <2> 	push ss
   848 00000593 1F                  <2> 	pop ds
   849 00000594 B02D                <2> 	mov al, 2Dh
   850 00000596 E8[0000]EB020000    <2> 	extcall intchk			; ZR if offset = -1 or segment = 0
   851                              <2> 					; CHG: ax, dx, bx
   852 0000059D 743A                <2> 	jz .no_hint
   853                              <2> 
   854                              <2> %if ELDOTHER
   855 0000059F BE[C208]            <2> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
   856                              <2> internalcoderelocation
   857                              <2> %endif
   858                              <2> 
   859 000005A2 8A26[0000]          <2> 	mov ah, byte [relocateddata]
   860                              <2> linkdatarelocation try_debugger_amis_multiplex_number
   861 000005A6 E82001              <2> 	call plex_check
   862 000005A9 7305                <2> 	jnc @F
   863                              <2> 
   864 000005AB B4FF                <2> 	mov ah, 0FFh		; start with multiplex number 0FFh
   865                              <2> .loop_hint:
   866 000005AD E81901              <2> 	call plex_check
   867                              <2> @@:
   868 000005B0 7307                <2> 	jnc .end_hint		; if found --> (NC)
   869 000005B2 80EC01              <2> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   870 000005B5 73F6                <2> 	jnc .loop_hint		; try next if we didn't check all yet -->
   871 000005B7 EB20                <2> 	jmp .no_hint
   872                              <2> 
   873                              <2> .end_hint:
   874 000005B9 50                  <2> 	push ax
   875 000005BA C446F6              <2> 	les ax, [bp + ?instance]
   876 000005BD BF[0309]            <2> 	mov di, listmsg.hint.offset
   877                              <2> internalcoderelocation
   878 000005C0 E8[0000]EB020000    <2> 	extcall hexword
   879 000005C7 BB[E208]            <2> 	mov bx, listmsg.hint
   880                              <2> internalcoderelocation
   881 000005CA 368B16[0000]        <2> 	mov dx, [ss:relocateddata]
   882                              <2> linkdatarelocation extseg	; must be 86 Mode segment even in PM
   883 000005CF 58                  <2> 	pop ax
   884 000005D0 B040                <2> 	mov al, 40h		; AMIS message display service
   885 000005D2 E8[0000]EB020000    <2> 	extcall call_int2D
   886                              <2> .no_hint:
   887                              <2> %endif
   888                              <2> 
   889                              <2> %if ELDOTHER
   890                              <2> %assign ELDLINKER 0
   891 000005D9 F656DE              <2> 	not byte [bp + ?other]
   892                              <2> 
   893 000005DC 16                  <2> 	push ss
   894 000005DD 1F                  <2> 	pop ds
   895 000005DE B02D                <2> 	mov al, 2Dh
   896 000005E0 E8[0000]EB020000    <2> 	extcall intchk			; ZR if offset = -1 or segment = 0
   897                              <2> 					; CHG: ax, dx, bx
   898 000005E7 7503E99900          <2> 	jz .no_other
   899                              <2> 
   900 000005EC BE[C208]            <2> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
   901                              <2> internalcoderelocation
   902                              <2> 
   903 000005EF 8A26[0000]          <2> 	mov ah, byte [relocateddata]
   904                              <2> linkdatarelocation try_debugger_amis_multiplex_number
   905 000005F3 E8D300              <2> 	call plex_check
   906 000005F6 7305                <2> 	jnc @F
   907                              <2> 
   908 000005F8 B4FF                <2> 	mov ah, 0FFh		; start with multiplex number 0FFh
   909                              <2> .loop_other_debug:
   910 000005FA E8CC00              <2> 	call plex_check
   911                              <2> @@:
   912 000005FD 731F                <2> 	jnc .end_other		; if found --> (NC)
   913 000005FF 80EC01              <2> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   914 00000602 73F6                <2> 	jnc .loop_other_debug	; try next if we didn't check all yet -->
   915                              <2> 
   916 00000604 BE[D208]            <2> 	mov si, loaderamissig	; ds:si -> our AMIS name strings
   917                              <2> internalcoderelocation
   918                              <2> 
   919 00000607 8A26[0000]          <2> 	mov ah, byte [relocateddata]
   920                              <2> linkdatarelocation try_debugger_amis_multiplex_number
   921 0000060B E8BB00              <2> 	call plex_check
   922 0000060E 7305                <2> 	jnc @F
   923                              <2> 
   924 00000610 B4FF                <2> 	mov ah, 0FFh		; start with multiplex number 0FFh
   925                              <2> .loop_other_loader:
   926 00000612 E8B400              <2> 	call plex_check
   927                              <2> @@:
   928 00000615 7307                <2> 	jnc .end_other		; if found --> (NC)
   929 00000617 80EC01              <2> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   930 0000061A 73F6                <2> 	jnc .loop_other_loader	; try next if we didn't check all yet -->
   931                              <2> 
   932 0000061C EB67                <2> 	jmp .no_other
   933                              <2> 
   934                              <2> .end_other:
   935 0000061E B042                <2> 	mov al, 42h		; AMIS get other link info service
   936 00000620 E8[0000]EB020000    <2> 	extcall call_int2D
   937 00000627 3CFF                <2> 	cmp al, 0FFh
   938 00000629 755A                <2> 	jne .no_other
   939                              <2> 
   940 0000062B 89F0                <2> 	mov ax, si		; selector => PSP
   941 0000062D E8[0000]EB020000    <2> 	extcall ispm
   942 00000634 7402                <2> 	jz @F
   943 00000636 89D0                <2> 	mov ax, dx		; segment => PSP
   944                              <2> @@:
   945 00000638 16                  <2> 	 push ss
   946 00000639 1F                  <2> 	 pop ds
   947 0000063A A3[0000]            <2> 	mov word [otherds], ax
   948                              <2> internaldatarelocation		; current mode sel/seg
   949 0000063D 8916[0200]          <2> 	mov word [otherseg], dx
   950                              <2> internaldatarelocation		; remember segment
   951                              <2> 
   952 00000641 89C8                <2> 	mov ax, cx		; selector => link info
   953 00000643 E8[0000]EB020000    <2> 	extcall ispm
   954 0000064A 7402                <2> 	jz @F
   955 0000064C 89D8                <2> 	mov ax, bx		; segment => link info
   956                              <2> @@:
   957 0000064E 897EFC              <2> 	mov word [bp + ?linkinfo_other], di
   958 00000651 8946FE              <2> 	mov word [bp + ?linkinfo_other + 2], ax
   959                              <2> 
   960 00000654 8ED8                <2> 	mov ds, ax		; => link info
   961 00000656 31C0                <2> 	xor ax, ax
   962 00000658 813DD1E1            <2> 	cmp word [di + eldlSignature], 0E1D1h
   963 0000065C 7516                <2> 	jne .error_other
   964 0000065E 837D0601            <2> 	cmp word [di + eldlUseLinkHash], 1
   965 00000662 7710                <2> 	ja .error_other
   966 00000664 7201                <2> 	jb @F
   967 00000666 48                  <2> 	dec ax
   968                              <2> @@:
   969 00000667 8946FA              <2> 	mov word [bp + ?use_hash_other], ax
   970                              <2> 
   971 0000066A 8B56F6              <2> 	mov dx, word [bp + ?instance]
   972 0000066D 81C29608            <2> 	add dx, linkerotherdatarelocations - code
   973 00000671 E9E7FC              <2> 	jmp .otherloop
   974                              <2> 
   975                              <2> .error_other:
   976 00000674 0E                  <2> 	push cs
   977 00000675 1F                  <2> 	pop ds
   978 00000676 B8330E              <2> 	mov ax, 0E33h
   979 00000679 E8[0000]EB020000    <2> 	extcall setrc
   980 00000680 BA[4F0B]            <2> 	mov dx, lmsg.error_other
   981                              <2> internalcoderelocation
   982 00000683 EB0F                <2> 	jmp @F
   983                              <2> 
   984                              <2> .no_other:
   985 00000685 0E                  <2> 	push cs
   986 00000686 1F                  <2> 	pop ds
   987 00000687 B8340E              <2> 	mov ax, 0E34h
   988 0000068A E8[0000]EB020000    <2> 	extcall setrc
   989 00000691 BA[270B]            <2> 	mov dx, lmsg.no_other
   990                              <2> internalcoderelocation
   991                              <2> @@:
   992 00000694 E8[0000]EB020000    <2> 	extcall putsz
   993                              <2> .error_j2:
   994 0000069B EB25                <2> 	jmp .error
   995                              <2> 
   996                              <2> .otherdone:
   997                              <2>  %if _ELD_LINKER_PASSES
   998 0000069D 8B46E2              <2> 	mov ax, word [bp + ?amounterrors]
   999 000006A0 85C0                <2> 	test ax, ax
  1000 000006A2 75F7                <2> 	jnz .error_j2
  1001                              <2>  %endif
  1002                              <2> %endif
  1003                              <2> 
  1004 000006A4 5B                  <2> 	pop bx				; -> our heap data
  1005 000006A5 5E                  <2> 	pop si				; -> our command line tail
  1006 000006A6 16                  <2> 	 push ss
  1007 000006A7 1F                  <2> 	 pop ds
  1008 000006A8 C47EF6              <2> 	les di, [bp + ?instance]
  1009 000006AB 268B4502            <2> 	mov ax, word [es:di + eldiEndCode]
  1010                              <2> houdini
  1011 000006AF 2D[B002]            <2> 	sub ax, strict word endresident + code
  1012                              <2> internalcoderelocation
  1013 000006B2 26C74502[B002]      <2> 	mov word [es:di + eldiEndCode], endresident + code
  1014                              <2> internalcoderelocation
  1015 000006B8 2906[0000]          <2> 	sub word [relocateddata], ax
  1016                              <2> linkdatarelocation extseg_used
  1017                              <2> %if _DATA_SIZE == 0
  1018                              <2> 	xor ax, ax
  1019                              <2> 	mov word [es:di + eldiStartData], ax
  1020                              <2> 	mov word [es:di + eldiEndData], ax
  1021                              <2> %endif
  1022 000006BC 89EC5D              <2> 	lleave code
  1023                              <2> 		; INP:	es => ELD code segment
  1024                              <2> 		;	ds:si -> command line tail
  1025                              <2> 		;	ds:bx -> ELD data block
  1026                              <2> 		;	ss:sp -> far return address for current mode
  1027                              <2> 		; STT:	ds = ss, UP, EI
  1028 000006BF E946FB              <2> 	jmp start
  1029                              <2> 
  1030                              <2> .error:
  1031 000006C2 89EC5D              <2> 	lleave
  1032 000006C5 B8FFFF              <2> 	mov ax, -1
  1033 000006C8 CB                  <2> 	retf
  1034                              <2> 
  1035                              <2> 
  1036                              <2> %ifnidni _LISTING, ""
  1037                              <2>  %assign ELDHINT 1
  1038                              <2> %else
  1039                              <2>  %assign ELDHINT 0
  1040                              <2> %endif
  1041                              <2> 
  1042                              <2> %if ELDOTHER || ELDHINT
  1043                              <2> 		; INP:	ah = multiplex number to check
  1044                              <2> 		;	(if ELDOTHER:)
  1045                              <2> 		;	 cs:si -> 16-byte AMIS signature to check
  1046                              <2> 		; OUT:	CY if multiplex number unused or no signature match,
  1047                              <2> 		;	 bp, ah, ds unmodified
  1048                              <2> 		;	NC if match found,
  1049                              <2> 		;	 ah = multiplex number (unmodified)
  1050                              <2> 		; CHG:	di, es, cx, dx
  1051                              <2> 		;	(if ELDOTHER:) bx
  1052                              <2> 		;	(if not ELDOTHER:) si
  1053                              <2> plex_check:
  1054 000006C9 16                  <2> 	push ss
  1055 000006CA 1F                  <2> 	pop ds
  1056 000006CB F606[0000]08        <2> 	testopt [relocateddata], 8
  1057                              <2> linkdatarelocation internalflags4, -3
  1058 000006D0 740B                <2> 	jz @F
  1059                              <2> %if ELDOTHER
  1060 000006D2 BB[0000]            <2> 	mov bx, relocateddata
  1061                              <2> linkdatarelocation amis_multiplex_number, -2, optional
  1062 000006D5 85DB                <2> 	test bx, bx
  1063 000006D7 7404                <2> 	jz @F
  1064 000006D9 3A27                <2> 	cmp ah, byte [bx]
  1065 000006DB 741F                <2> 	je .notfound		; do not use our own multiplexer -->
  1066                              <2> %else
  1067                              <2> 	mov si, relocateddata
  1068                              <2> linkdatarelocation amis_multiplex_number, -2, optional
  1069                              <2> 	test si, si
  1070                              <2> 	jz @F
  1071                              <2> 	cmp ah, byte [si]
  1072                              <2> 	je .notfound		; do not use our own multiplexer -->
  1073                              <2> %endif
  1074                              <2> @@:
  1075 000006DD B000                <2> 	mov al, 00h		; AMIS installation check
  1076 000006DF E8[0000]EB020000    <2> 	extcall call_int2D	; AMIS (or "DOS reserved" = iret if no AMIS present)
  1077 000006E6 3CFF                <2> 	cmp al, 0FFh
  1078 000006E8 7512                <2> 	jne .notfound
  1079 000006EA 0E                  <2> 	push cs
  1080 000006EB 1F                  <2> 	pop ds
  1081                              <2> %if ELDOTHER
  1082 000006EC 56                  <2> 	push si
  1083 000006ED E8[0000]EB020000    <2> 	extcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
  1084 000006F4 B90800              <2> 	mov cx, 8		; Ignore description, only compare vendor and program name
  1085 000006F7 F3A7                <2> 	repe cmpsw
  1086 000006F9 5E                  <2> 	pop si
  1087                              <2> %else
  1088                              <2> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
  1089                              <2> internalcoderelocation
  1090                              <2> 	extcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
  1091                              <2> 	mov cx, 8		; Ignore description, only compare vendor and program name
  1092                              <2> 	repe cmpsw
  1093                              <2> %endif
  1094 000006FA 7401                <2> 	je .checkret		; ZR, NC = match -->
  1095                              <2> .notfound:
  1096 000006FC F9                  <2> 	stc			; CY no match
  1097                              <2> .checkret:
  1098 000006FD C3                  <2> 	retn
  1099                              <2> %endif
  1100                              <2> 
  1101                              <2> 
  1102 000006FE 00<rep 2h>          <2> 	align 4, db 0
  1103                              <2> linkercoderelocations:
  1104                              <2> %if _ELDCALL_OPTIONAL || _ELDCALL_NEXT
  1105                              <2> 	dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
  1106                              <2> %else
  1107 00000700 2200[0B09]B001-     <2> 	dw ELDCALL_CODE_RELOCATIONS, 0, 0
  1107 00000706 [1A09]B801[2609]C0- <2>
  1107 0000070D 01[3209]C801[3909]- <2>
  1107 00000714 D001[4409]D801-     <2>
  1107 0000071A [4B09]E001[5409]E8- <2>
  1107 00000721 01[5C09]F001[6409]- <2>
  1107 00000728 F801[8109]0002-     <2>
  1107 0000072E [8B09]5902[4B09]96- <2>
  1107 00000735 05[9B09]C005[8109]- <2>
  1107 0000073C D205[A409]E005-     <2>
  1107 00000742 [9B09]2006[A409]2D- <2>
  1107 00000749 06[3209]4306[3209]- <2>
  1107 00000750 7906[5C09]8A06-     <2>
  1107 00000756 [5C09]9406[5409]DF- <2>
  1107 0000075D 06[A409]ED06[3909]- <2>
  1107 00000764 00000000            <2>
  1108                              <2> %endif
  1109                              <2> 
  1110                              <2> %if _ELD_LINKER_PASSES
  1111                              <2> linkerlinkercoderelocations:
  1112                              <2> %if _ELDCALL_OPTIONAL || _ELDCALL_NEXT
  1113                              <2> 	dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
  1114                              <2> %else
  1115 00000768 4804[8109]6C04-     <2> 	dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
  1115 0000076E [8B09]7604[5C09]7F- <2>
  1115 00000775 04[6409]00000000    <2>
  1116                              <2> %endif
  1117                              <2> 
  1118                              <2> 	align 2, db 0
  1119                              <2> linktable:
  1120                              <2> 	istruc LINKTABLE
  1121                              <2> at ltCodeToCode
  1122 0000077C 8608                <2> 	dw internallinkercodetocoderelocations - code
  1123 0000077E 2608                <2> 	dw internalcodetocoderelocations - code
  1124                              <2> at ltCodeToData
  1125 00000780 9008                <2> 	dw internallinkercodetodatarelocations - code
  1126 00000782 5008                <2> 	dw internalcodetodatarelocations - code
  1127                              <2> at ltDataToCode
  1128 00000784 9208                <2> 	dw internallinkerdatatocoderelocations - code
  1129 00000786 6E08                <2> 	dw internaldatatocoderelocations - code
  1130                              <2> at ltDataToData
  1131 00000788 9408                <2> 	dw internallinkerdatatodatarelocations - code
  1132 0000078A 7008                <2> 	dw internaldatatodatarelocations - code
  1133                              <2> at ltLinkData
  1134 0000078C 7208                <2> 	dw linkerlinkerdatarelocations - code
  1135 0000078E 9407                <2> 	dw linkerdatarelocations - code
  1136                              <2> at ltLinkCode
  1137 00000790 6807                <2> 	dw linkerlinkercoderelocations - code
  1138 00000792 0007                <2> 	dw linkercoderelocations - code
  1139                              <2> 	iend
  1140                              <2> %endif
  1141                              <2> 
  1142                              <2> 	align 2, db 0
  1143                              <2> linkerdatarelocations:
  1144 00000794 01004700[B109]0100- <2> 	dw LINK_DATA_RELOCATIONS, 0
  1144 0000079C 4900[BB09]01004C00- <2>
  1144 000007A4 [C409]01007D00-     <2>
  1144 000007AA [D409]0100A100-     <2>
  1144 000007B0 [D409]0100E000-     <2>
  1144 000007B6 [EA09]0100E900-     <2>
  1144 000007BC [F509]01000A01-     <2>
  1144 000007C2 [FE09]01001102-     <2>
  1144 000007C8 [090A]01003802-     <2>
  1144 000007CE [170A]01004802-     <2>
  1144 000007D4 [220A]01005502-     <2>
  1144 000007DA [300A]01006C02-     <2>
  1144 000007E0 [220A]01007802-     <2>
  1144 000007E6 [300A]01007C02-     <2>
  1144 000007EC [D409]01009702-     <2>
  1144 000007F2 [D409]01009D02-     <2>
  1144 000007F8 [170A]0100A405-     <2>
  1144 000007FE [500A]0100CD05-     <2>
  1144 00000804 [F509]0100F105-     <2>
  1144 0000080A [500A]01000906-     <2>
  1144 00000810 [500A]0100BA06-     <2>
  1144 00000816 [220A]0100CD06-     <2>
  1144 0000081C [750A]0101D306-     <2>
  1144 00000822 [860A]0000          <2>
  1145                              <2> 
  1146                              <2> 	align 2, db 0
  1147                              <2> internalcodetocoderelocations:
  1148 00000826 7800C5003F0244024C- <2> 	dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
  1148 0000082F 025102680274027F02- <2>
  1148 00000838 92029902A005BE05C8- <2>
  1148 00000841 05ED05050681069206- <2>
  1148 0000084A B006B6060000        <2>
  1149                              <2> 
  1150                              <2> 	align 2, db 0
  1151                              <2> internalcodetodatarelocations:
  1152 00000850 340054006400C900DA- <2> 	dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
  1152 00000859 00EF000F0130018401- <2>
  1152 00000862 19022E02A3023B063F- <2>
  1152 0000086B 060000              <2>
  1153                              <2> 
  1154                              <2> 	align 2, db 0
  1155                              <2> internaldatatocoderelocations:
  1156 0000086E FFFF                <2> 	dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
  1157                              <2> 
  1158                              <2> 	align 2, db 0
  1159                              <2> internaldatatodatarelocations:
  1160 00000870 FFFF                <2> 	dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
  1161                              <2> 
  1162                              <2> %if _ELD_LINKER_PASSES
  1163                              <2> 	align 2, db 0
  1164                              <2> linkerlinkerdatarelocations:
  1165 00000872 0100FC03[170A]0100- <2> 	dw LINK_LINKER_DATA_RELOCATIONS, 0
  1165 0000087A 3F04[FE09]01004F05- <2>
  1165 00000882 [3F0A]0000          <2>
  1166                              <2> 
  1167                              <2> 	align 2, db 0
  1168                              <2> internallinkercodetocoderelocations:
  1169 00000886 060418042904510400- <2> 	dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
  1169 0000088F 00                  <2>
  1170                              <2> 
  1171                              <2> 	align 2, db 0
  1172                              <2> internallinkercodetodatarelocations:
  1173 00000890 0000                <2> 	dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
  1174                              <2> 
  1175                              <2> 	align 2, db 0
  1176                              <2> internallinkerdatatocoderelocations:
  1177 00000892 FFFF                <2> 	dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
  1178                              <2> 
  1179                              <2> 	align 2, db 0
  1180                              <2> internallinkerdatatodatarelocations:
  1181 00000894 FFFF                <2> 	dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
  1182                              <2> %endif
  1183                              <2> 
  1184                              <2> %if ELDOTHER
  1185                              <2> 	align 2, db 0
  1186                              <2> linkerotherdatarelocations:
  1187 00000896 01006100[9E0A]0100- <2> 	dw LINK_OTHER_DATA_RELOCATIONS, 0
  1187 0000089E F300[A60A]0100FC00- <2>
  1187 000008A6 [B10A]01001301-     <2>
  1187 000008AC [BA0A]01011D01-     <2>
  1187 000008B2 [A60A]01012501-     <2>
  1187 000008B8 [B10A]01005501-     <2>
  1187 000008BE [BA0A]0000          <2>
  1188                              <2> 
  1189                              <2>  %ifnidn LINK_OTHER_LINKER_DATA_RELOCATIONS, ""
  1190                              <2>   %error Other linker data links not supported
  1191                              <2>  %endif
  1192                              <2> %endif
  1193                              <2> 
  1194                              <2> %if ELDOTHER || ELDHINT
  1195                              <2> 	align 2, db 0
  1196                              <2> debuggeramissig:
  1197 000008C2 65636D20<rep 5h>    <2> 		fill 8, 32, db "ecm"
  1198 000008CA 6C446562756720-     <2> 		fill 8, 32, db "lDebug"
  1198 000008CA <rep 2h>            <2>
  1199                              <2> %endif
  1200                              <2> 
  1201                              <2> %if ELDOTHER
  1202                              <2> 	align 2, db 0
  1203                              <2> loaderamissig:
  1204 000008D2 65636D20<rep 5h>    <2> 		fill 8, 32, db "ecm"
  1205 000008DA 4C6F6164657220-     <2> 		fill 8, 32, db "Loader"
  1205 000008DA <rep 2h>            <2>
  1206                              <2> %endif
  1207                              <2> 
  1208                              <2> %ifnidni _LISTING, ""
  1209                              <2> listmsg:
  1210 000008E2 547261634C6973742D- <2> .hint:		db "TracList-add-offset=",_LISTING,"::"
  1210 000008EB 6164642D6F66667365- <2>
  1210 000008F4 743D68696E746F7468- <2>
  1210 000008FD 2E6C73743A3A        <2>
  1211 00000903 2D2D2D2D680D0A00    <2> .hint.offset:	asciz "----h",13,10
  1212                              <2> %endif
  1213                              <2> 
  1214 0000090B 30CD0C636D64335F6E- <2> 	eldcall_dump_names ELDCALL_CODE_NAMES
  1214 00000914 6F745F657874D55509- <2>
  1214 0000091D 736B6970636F6D6D61- <2>
  1214 00000926 03C309697373747269- <2>
  1214 0000092F 6E673F289004697370- <2>
  1214 00000938 6DB774087365746573- <2>
  1214 00000941 326478BABD04636D64- <2>
  1214 0000094A 33DDB90663686B656F- <2>
  1214 00000953 6C551205707574737A- <2>
  1214 0000095C B212057365747263D0- <2>
  1214 00000965 BB1A636F70795F7369- <2>
  1214 0000096E 6E676C655F636F756E- <2>
  1214 00000977 7465645F737472696E- <2>
  1214 00000980 67848107686578776F- <2>
  1214 00000989 72646FA20D70757473- <2>
  1214 00000992 6C696E655F63726C66- <2>
  1214 0000099B 986906696E7463686B- <2>
  1214 000009A4 21300A63616C6C5F69- <2>
  1214 000009AD 6E743244            <2>
  1215 000009B1 C30B076C617374636D- <2> 	link_data_dump_names LINK_DATA_NAMES
  1215 000009BA 646B5D06646D79636D- <2>
  1215 000009C3 6454400D6D73672E75- <2>
  1215 000009CC 6E696E7374616C6C97- <2>
  1215 000009D5 B6136578745F636F6D- <2>
  1215 000009DE 6D616E645F68616E64- <2>
  1215 000009E7 6C6572EB4208657874- <2>
  1215 000009F0 647373656CD52D0665- <2>
  1215 000009F9 787473656784E3086C- <2>
  1215 00000A02 696E655F6F75748D71- <2>
  1215 00000A0B 0B6D73672E696E7374- <2>
  1215 00000A14 616C6C5ABC086F7074- <2>
  1215 00000A1D 696F6E7337E7D30B65- <2>
  1215 00000A26 78747365675F757365- <2>
  1215 00000A2F 64B2400C6578746461- <2>
  1215 00000A38 74615F757365646844- <2>
  1215 00000A41 0E6C696E6B63616C6C- <2>
  1215 00000A4A 5F7461626C65F09E22- <2>
  1215 00000A53 7472795F6465627567- <2>
  1215 00000A5C 6765725F616D69735F- <2>
  1215 00000A65 6D756C7469706C6578- <2>
  1215 00000A6E 5F6E756D626572CB51- <2>
  1215 00000A77 0E696E7465726E616C- <2>
  1215 00000A80 666C61677334688C15- <2>
  1215 00000A89 616D69735F6D756C74- <2>
  1215 00000A92 69706C65785F6E756D- <2>
  1215 00000A9B 626572              <2>
  1216                              <2> %if ELDOTHER
  1217 00000A9E 0A0A05647373656CEB- <2> 	link_data_dump_names LINK_OTHER_DATA_NAMES
  1217 00000AA7 420865787464737365- <2>
  1217 00000AB0 6CD52D066578747365- <2>
  1217 00000AB9 67E7D30B6578747365- <2>
  1217 00000AC2 675F75736564        <2>
  1218                              <2> %endif
  1219                              <2> 
  1220                              <2> lmsg:
  1221                              <2> %if _ELD_LINKER_PASSES
  1222                              <2> %if _ELDCALL_OPTIONAL
  1223                              <2> .warning_code_optional:		counted "Optional code link missing, hash="
  1224                              <2> %endif
  1225                              <2> %if _ELDDATA_OPTIONAL
  1226 00000AC8 214F7074696F6E616C- <2> .warning_data_optional:		counted "Optional data link missing, hash="
  1226 00000AD1 2064617461206C696E- <2>
  1226 00000ADA 6B206D697373696E67- <2>
  1226 00000AE3 2C20686173683D      <2>
  1227                              <2> %endif
  1228 00000AEA 1844617461206C696E- <2> .error_data:			counted "Data link missing, hash="
  1228 00000AF3 6B206D697373696E67- <2>
  1228 00000AFC 2C20686173683D      <2>
  1229 00000B03 18436F6465206C696E- <2> .error_code:			counted "Code link missing, hash="
  1229 00000B0C 6B206D697373696E67- <2>
  1229 00000B15 2C20686173683D      <2>
  1230 00000B1C 0A682C206C6162656C- <2> .error.2:			counted "h, label ",'"'
  1230 00000B25 2022                <2>
  1231                              <2> %endif
  1232                              <2> %if ELDOTHER
  1233 00000B27 454C44206C696E6B65- <2> .no_other:		asciz "ELD linker: No other link info found!",13,10
  1233 00000B30 723A204E6F206F7468- <2>
  1233 00000B39 6572206C696E6B2069- <2>
  1233 00000B42 6E666F20666F756E64- <2>
  1233 00000B4B 210D0A00            <2>
  1234 00000B4F 454C44206C696E6B65- <2> .error_other:		asciz "ELD linker: Other link info unknown format!",13,10
  1234 00000B58 723A204F7468657220- <2>
  1234 00000B61 6C696E6B20696E666F- <2>
  1234 00000B6A 20756E6B6E6F776E20- <2>
  1234 00000B73 666F726D6174210D0A- <2>
  1234 00000B7C 00                  <2>
  1235                              <2> %endif
  1236                              <2> 
  1237 00000B7D 00<rep 3h>          <2> 	align 16, db 0
   716                              <1> 
   717                              <1> 	align 16
   718                              <1> code_size equ $ - code
