     1                                  
     2                                  ; Public Domain
     3                                  
     4                                  ; test install command: install; instnoth; instnoth uninstall
     5                                  ; test run command: run; .; .
     6                                  
     7                                  %include "lmacros3.mac"
     1                              <1> [list -]
    14                              <2> [list -]
    14                              <1> [list -]
     8                                  
     9                                  %assign _OTHER 1
    10                                  
    11                                  %include "instnoun.asm"
     1                              <1> 
     2                              <1> ; Public Domain
     3                              <1> 
     4                              <1> ; test install command: install; instnoun; instnoun uninstall
     5                              <1> ; test run command: run; .; .
     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>  %define NAME_STRING "INSTNOTH"
    14                              <1>  %idefine ownss ss:
    15                              <1>  %imacro getotherds 0
    16                              <1> 	mov ds, word [ss:otherds]
    17                              <1> internaldatarelocation
    18                              <1>  %endmacro
    19                              <1>  %imacro resetds 0
    20                              <1> 	push ss
    21                              <1> 	pop ds
    22                              <1>  %endmacro
    23                              <1>  %imacro getotheres 0
    24                              <1> 	mov es, word [ss:otherds]
    25                              <1> internaldatarelocation
    26                              <1>  %endmacro
    27                              <1>  %imacro resetes 0
    28                              <1> 	push ss
    29                              <1> 	pop es
    30                              <1>  %endmacro
    31                              <1> %else
    32                              <1>  %define OTH_STRING ""
    33                              <1>  %define NAME_STRING "INSTNOUN"
    34                              <1>  %idefine ownss
    35                              <1>  %idefine getotherds
    36                              <1>  %idefine resetds
    37                              <1>  %idefine getotheres
    38                              <1>  %idefine resetes
    39                              <1> %endif
    40                              <1> 
    41                              <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
    42                              <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> 
    36                              <3> 	%imacro internalcoderelocation 0-1.nolist -2
    37                              <3> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    38                              <3> %if ELDLINKER
    39                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    40                              <3>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    41                              <3>  %else
    42                              <3>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    43                              <3>  %endif
    44                              <3> %else
    45                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    46                              <3>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    47                              <3>  %else
    48                              <3>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    49                              <3>  %endif
    50                              <3> %endif
    51                              <3> 	eldstrictcheck
    52                              <3> 	%endmacro
    53                              <3> 
    54                              <3> 	%imacro internaldatarelocation 0-1.nolist -2
    55                              <3> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    56                              <3> %if ELDLINKER
    57                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    58                              <3>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    59                              <3>  %else
    60                              <3>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    61                              <3>  %endif
    62                              <3> %else
    63                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    64                              <3>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    65                              <3>  %else
    66                              <3>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    67                              <3>  %endif
    68                              <3> %endif
    69                              <3> 	eldstrictcheck
    70                              <3> 	%endmacro
    71                              <3> 
    72                              <3> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    73                              <3> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    74                              <3> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    75                              <3> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    76                              <3> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    77                              <3> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    78                              <3> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    79                              <3> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    80                              <3> 
    81                              <3> 
    82                              <3> %define LINK_DATA_RELOCATIONS ""
    83                              <3> %define LINK_LINKER_DATA_RELOCATIONS ""
    84                              <3> %define LINK_DATA_NAMES db ""
    85                              <3> %define LINK_DATA_DETECTION none, none
    86                              <3> 
    87                              <3> %define LINK_OTHER_DATA_RELOCATIONS ""
    88                              <3> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    89                              <3> %define LINK_OTHER_DATA_NAMES db ""
    90                              <3> %define LINK_OTHER_DATA_DETECTION none, none
    91                              <3> 
    92                              <3> %ifndef ELDOTHER
    93                              <3>  %assign ELDOTHER 0
    94                              <3> %endif
    95                              <3> %assign ELDOTHERLINK 0
    96                              <3> 
    97                              <3> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
    98                              <3> %if ELDOTHER
    99                              <3>  %assign ELDOTHERLINK 1
   100                              <3> %endif
   101                              <3> 	linkdatarelocation %1, %2, %3
   102                              <3> %assign ELDOTHERLINK 0
   103                              <3> 	%endmacro
   104                              <3> 
   105                              <3> 	%imacro linkdatarelocation 1-3.nolist -2, required
   106                              <3> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   107                              <3> %ifidni %3, required
   108                              <3>  %assign %%optional 0
   109                              <3> %elifidni %3, optional
   110                              <3>  %assign %%optional 100h
   111                              <3>  %if ELDDATA_OPTIONAL_STATUS == 0
   112                              <3>   %assign ELDDATA_OPTIONAL_STATUS 1
   113                              <3>  %elif ELDDATA_OPTIONAL_STATUS == 1
   114                              <3>  %else
   115                              <3>   %error Optional data link not allowed here
   116                              <3>  %endif
   117                              <3> %elifidni %3, PM required
   118                              <3>  %assign %%optional 300h
   119                              <3>  %assign ELDDATA_PMREQUIRED_STATUS 1
   120                              <3>  %if ELDDATA_OPTIONAL_STATUS == 0
   121                              <3>   %assign ELDDATA_OPTIONAL_STATUS 1
   122                              <3>  %elif ELDDATA_OPTIONAL_STATUS == 1
   123                              <3>  %else
   124                              <3>   %error Optional data link not allowed here
   125                              <3>  %endif
   126                              <3> %else
   127                              <3>  %fatal Unknown optional keyword
   128                              <3> %endif
   129                              <3> %ifidni _CURRENT_SECTION_TYPE, DATA
   130                              <3>  %assign %%DATASECTION 1
   131                              <3> %else
   132                              <3>  %assign %%DATASECTION 0
   133                              <3> %endif
   134                              <3> 	%if ELDOTHERLINK
   135                              <3> %if ELDLINKER
   136                              <3>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   137                              <3> %else
   138                              <3>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   139                              <3> %endif
   140                              <3> 	%else
   141                              <3> %if ELDLINKER
   142                              <3>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   143                              <3> %else
   144                              <3>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   145                              <3> %endif
   146                              <3> 	%endif
   147                              <3> %defstr %%string %1
   148                              <3> %strlen %%length %%string
   149                              <3> %if %%length > 64
   150                              <3>  %error Too long link name: %1
   151                              <3> %endif
   152                              <3> %define LINK_DATA_CHECK %1
   153                              <3> 	%if ELDOTHERLINK
   154                              <3> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   155                              <3> %if LINK_DATA_NEW
   156                              <3>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   157                              <3> 	hashdef HASH, %%string
   158                              <3>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   160                              <3> %else
   161                              <3>  %%name equ LINK_DATA_DUPLICATE
   162                              <3> %endif
   163                              <3> 	%else
   164                              <3> 	linkdata_detect LINK_DATA_DETECTION
   165                              <3> %if LINK_DATA_NEW
   166                              <3>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   167                              <3> 	hashdef HASH, %%string
   168                              <3>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   170                              <3> %else
   171                              <3>  %%name equ LINK_DATA_DUPLICATE
   172                              <3> %endif
   173                              <3> 	%endif
   174                              <3> 	eldstrictcheck
   175                              <3> 	%endmacro
   176                              <3> 
   177                              <3> 	%imacro linkdata_detect 2-*.nolist
   178                              <3> %assign LINK_DATA_NEW 1
   179                              <3> %rep (%0 - 2) / 2
   180                              <3>  %rotate 2
   181                              <3>  %ifidni %1, LINK_DATA_CHECK
   182                              <3>   %assign LINK_DATA_NEW 0
   183                              <3>   %xdefine LINK_DATA_DUPLICATE %2
   184                              <3>   %exitrep
   185                              <3>  %endif
   186                              <3> %endrep
   187                              <3> 	%endmacro
   188                              <3> 
   189                              <3> 	%imacro link_data_dump_names 1-*.nolist
   190                              <3> %rep %0
   191                              <3> 	%1
   192                              <3>  %rotate 1
   193                              <3> %endrep
   194                              <3> 	%endmacro
   195                              <3> 
   196                              <3> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   197                              <3> ; dw LINK_DATA_RELOCATIONS, 0, 0
   198                              <3> ; link_data_dump_names ELDCALL_CODE_NAMES
   199                              <3> 
   200                              <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> 
    55                              <2> 	%imacro extcall 1-2.nolist required
    56                              <2> %ifidni _CURRENT_SECTION_TYPE, DATA
    57                              <2>  %error "ELD call cannot be used in ELD data block"
    58                              <2> %endif
    59                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP
    60                              <2> %ifidni %2, required
    61                              <2>  %assign %%optional 0
    62                              <2> %elifidni %2, optional
    63                              <2>  %assign %%optional 100h
    64                              <2>  %if ELDCALL_OPTIONAL_STATUS == 0
    65                              <2>   %assign ELDCALL_OPTIONAL_STATUS 1
    66                              <2>  %elif ELDCALL_OPTIONAL_STATUS == 1
    67                              <2>  %else
    68                              <2>   %error Optional code link not allowed here
    69                              <2>  %endif
    70                              <2> %elifidni %2, PM required
    71                              <2>  %assign %%optional 300h
    72                              <2>  %assign ELDCALL_PMREQUIRED_STATUS 1
    73                              <2>  %if ELDCALL_OPTIONAL_STATUS == 0
    74                              <2>   %assign ELDCALL_OPTIONAL_STATUS 1
    75                              <2>  %elif ELDCALL_OPTIONAL_STATUS == 1
    76                              <2>  %else
    77                              <2>   %error Optional code link not allowed here
    78                              <2>  %endif
    79                              <2> %else
    80                              <2>  %fatal Unknown optional keyword
    81                              <2> %endif
    82                              <2> %if 0
    83                              <2> [warning -reloc-rel-word]
    84                              <2> 	call near relocatedzero
    85                              <2> [warning +reloc-rel-word]
    86                              <2> %else
    87                              <2> 	db 0E8h
    88                              <2> reloc	dw relocatedzero
    89                              <2> 	eldstrictcheck
    90                              <2> %endif
    91                              <2> 	jmp strict short %%skipparameter
    92                              <2> 	dw 0
    93                              <2> %%skipparameter:
    94                              <2> %if ELDLINKER
    95                              <2>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS ELDCALL_LINKER_CODE_RELOCATIONS, %%entry, %%name
    96                              <2>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional, %%entry, %%name
    97                              <2> %else
    98                              <2>  %xdefine ELDCALL_CODE_RELOCATIONS ELDCALL_CODE_RELOCATIONS, %%entry, %%name
    99                              <2>  %xdefine ELDCALL_CODE_RELOCATIONS_OPTIONAL ELDCALL_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional, %%entry, %%name
   100                              <2> %endif
   101                              <2> %defstr %%string %1
   102                              <2> %strlen %%length %%string
   103                              <2> %if %%length > 64
   104                              <2>  %error Too long link name: %1
   105                              <2> %endif
   106                              <2> %define ELDCALL_CODE_CHECK %1
   107                              <2> 	linkcode_detect ELDCALL_CODE_DETECTION
   108                              <2> %if ELDCALL_CODE_NEW
   109                              <2>  %xdefine ELDCALL_CODE_DETECTION ELDCALL_CODE_DETECTION, %1, %%name
   110                              <2> 	hashdef HASH, %%string
   111                              <2> %xdefine ELDCALL_CODE_NAMES 	ELDCALL_CODE_NAMES, %%name:, dw _HASH, {counted %%string}
   113                              <2> %else
   114                              <2>  %%name equ ELDCALL_CODE_DUPLICATE
   115                              <2> %endif
   116                              <2> 	%endmacro
   117                              <2> 
   118                              <2> 	%imacro linkcode_detect 2-*.nolist
   119                              <2> %assign ELDCALL_CODE_NEW 1
   120                              <2> %rep (%0 - 2) / 2
   121                              <2>  %rotate 2
   122                              <2>  %ifidni %1, ELDCALL_CODE_CHECK
   123                              <2>   %assign ELDCALL_CODE_NEW 0
   124                              <2>   %xdefine ELDCALL_CODE_DUPLICATE %2
   125                              <2>   %exitrep
   126                              <2>  %endif
   127                              <2> %endrep
   128                              <2> 	%endmacro
   129                              <2> 
   130                              <2> 
   131                              <2> %define ELDCALL_CALLCALL_LIST none
   132                              <2> 
   133                              <2> 	%imacro extcallcall 1.nolist
   134                              <2> 	call %1
   135                              <2> %xdefine ELDCALL_CALLCALL_LIST ELDCALL_CALLCALL_LIST, %1
   136                              <2> 	%endmacro
   137                              <2> 
   138                              <2> %assign ELDCALLCALL_DUMPED 0
   139                              <2> 
   140                              <2> 	%imacro eldcall_dump_callcall 1-*.nolist
   141                              <2> %define ELDCALL_CALLCALL_PROCESSED none
   142                              <2>  %rep %0 - 1
   143                              <2>   %rotate 1
   144                              <2>   %define ELDCALL_CHECK %1
   145                              <2> 	eldcall_callcall_detect ELDCALL_CALLCALL_PROCESSED
   146                              <2>   %if ELDCALL_NEW
   147                              <2>    %xdefine ELDCALL_CALLCALL_PROCESSED ELDCALL_CALLCALL_PROCESSED, %1
   148                              <2> 	align 8, nop
   149                              <2> %1:
   150                              <2> 	extcall %1
   151                              <2> 	retn
   152                              <2>   %endif
   153                              <2>  %endrep
   154                              <2> %unimacro extcallcall 1.nolist
   155                              <2> %assign ELDCALLCALL_DUMPED 1
   156                              <2> %define ELDCALL_CALLCALL_LIST none
   157                              <2> 	%endmacro
   158                              <2> 
   159                              <2> 	%imacro eldcall_callcall_detect 1-*.nolist
   160                              <2> %assign ELDCALL_NEW 1
   161                              <2> %rep %0 - 1
   162                              <2>  %rotate 1
   163                              <2>  %ifidni %1, ELDCALL_CHECK
   164                              <2>   %assign ELDCALL_NEW 0
   165                              <2>   %exitrep
   166                              <2>  %endif
   167                              <2> %endrep
   168                              <2> 	%endmacro
   169                              <2> 
   170                              <2> 	%imacro eldcall_dump_names 1-*.nolist
   171                              <2> %rep %0
   172                              <2> 	%1
   173                              <2>  %rotate 1
   174                              <2> %endrep
   175                              <2> 	%endmacro
   176                              <2> 
   177                              <2> ; eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   178                              <2> ; if using optional code links:
   179                              <2> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
   180                              <2> ;  dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
   181                              <2> ; if not using optional code links:
   182                              <2> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
   183                              <2> ;  dw ELDCALL_CODE_RELOCATIONS, 0, 0
   184                              <2> ; eldcall_dump_names ELDCALL_CODE_NAMES
   185                              <2> 
   186                              <2> %endif
    43                              <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> 
    36                              <2> 	%imacro internalcoderelocation 0-1.nolist -2
    37                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    38                              <2> %if ELDLINKER
    39                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    40                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    41                              <2>  %else
    42                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    43                              <2>  %endif
    44                              <2> %else
    45                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    46                              <2>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    47                              <2>  %else
    48                              <2>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    49                              <2>  %endif
    50                              <2> %endif
    51                              <2> 	eldstrictcheck
    52                              <2> 	%endmacro
    53                              <2> 
    54                              <2> 	%imacro internaldatarelocation 0-1.nolist -2
    55                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    56                              <2> %if ELDLINKER
    57                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    58                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    59                              <2>  %else
    60                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    61                              <2>  %endif
    62                              <2> %else
    63                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    64                              <2>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    65                              <2>  %else
    66                              <2>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    67                              <2>  %endif
    68                              <2> %endif
    69                              <2> 	eldstrictcheck
    70                              <2> 	%endmacro
    71                              <2> 
    72                              <2> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    73                              <2> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    74                              <2> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    75                              <2> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    76                              <2> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    77                              <2> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    78                              <2> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    79                              <2> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    80                              <2> 
    81                              <2> 
    82                              <2> %define LINK_DATA_RELOCATIONS ""
    83                              <2> %define LINK_LINKER_DATA_RELOCATIONS ""
    84                              <2> %define LINK_DATA_NAMES db ""
    85                              <2> %define LINK_DATA_DETECTION none, none
    86                              <2> 
    87                              <2> %define LINK_OTHER_DATA_RELOCATIONS ""
    88                              <2> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    89                              <2> %define LINK_OTHER_DATA_NAMES db ""
    90                              <2> %define LINK_OTHER_DATA_DETECTION none, none
    91                              <2> 
    92                              <2> %ifndef ELDOTHER
    93                              <2>  %assign ELDOTHER 0
    94                              <2> %endif
    95                              <2> %assign ELDOTHERLINK 0
    96                              <2> 
    97                              <2> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
    98                              <2> %if ELDOTHER
    99                              <2>  %assign ELDOTHERLINK 1
   100                              <2> %endif
   101                              <2> 	linkdatarelocation %1, %2, %3
   102                              <2> %assign ELDOTHERLINK 0
   103                              <2> 	%endmacro
   104                              <2> 
   105                              <2> 	%imacro linkdatarelocation 1-3.nolist -2, required
   106                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   107                              <2> %ifidni %3, required
   108                              <2>  %assign %%optional 0
   109                              <2> %elifidni %3, optional
   110                              <2>  %assign %%optional 100h
   111                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   112                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   113                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   114                              <2>  %else
   115                              <2>   %error Optional data link not allowed here
   116                              <2>  %endif
   117                              <2> %elifidni %3, PM required
   118                              <2>  %assign %%optional 300h
   119                              <2>  %assign ELDDATA_PMREQUIRED_STATUS 1
   120                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   121                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   122                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   123                              <2>  %else
   124                              <2>   %error Optional data link not allowed here
   125                              <2>  %endif
   126                              <2> %else
   127                              <2>  %fatal Unknown optional keyword
   128                              <2> %endif
   129                              <2> %ifidni _CURRENT_SECTION_TYPE, DATA
   130                              <2>  %assign %%DATASECTION 1
   131                              <2> %else
   132                              <2>  %assign %%DATASECTION 0
   133                              <2> %endif
   134                              <2> 	%if ELDOTHERLINK
   135                              <2> %if ELDLINKER
   136                              <2>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   137                              <2> %else
   138                              <2>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   139                              <2> %endif
   140                              <2> 	%else
   141                              <2> %if ELDLINKER
   142                              <2>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   143                              <2> %else
   144                              <2>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   145                              <2> %endif
   146                              <2> 	%endif
   147                              <2> %defstr %%string %1
   148                              <2> %strlen %%length %%string
   149                              <2> %if %%length > 64
   150                              <2>  %error Too long link name: %1
   151                              <2> %endif
   152                              <2> %define LINK_DATA_CHECK %1
   153                              <2> 	%if ELDOTHERLINK
   154                              <2> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   155                              <2> %if LINK_DATA_NEW
   156                              <2>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   157                              <2> 	hashdef HASH, %%string
   158                              <2>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   160                              <2> %else
   161                              <2>  %%name equ LINK_DATA_DUPLICATE
   162                              <2> %endif
   163                              <2> 	%else
   164                              <2> 	linkdata_detect LINK_DATA_DETECTION
   165                              <2> %if LINK_DATA_NEW
   166                              <2>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   167                              <2> 	hashdef HASH, %%string
   168                              <2>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   170                              <2> %else
   171                              <2>  %%name equ LINK_DATA_DUPLICATE
   172                              <2> %endif
   173                              <2> 	%endif
   174                              <2> 	eldstrictcheck
   175                              <2> 	%endmacro
   176                              <2> 
   177                              <2> 	%imacro linkdata_detect 2-*.nolist
   178                              <2> %assign LINK_DATA_NEW 1
   179                              <2> %rep (%0 - 2) / 2
   180                              <2>  %rotate 2
   181                              <2>  %ifidni %1, LINK_DATA_CHECK
   182                              <2>   %assign LINK_DATA_NEW 0
   183                              <2>   %xdefine LINK_DATA_DUPLICATE %2
   184                              <2>   %exitrep
   185                              <2>  %endif
   186                              <2> %endrep
   187                              <2> 	%endmacro
   188                              <2> 
   189                              <2> 	%imacro link_data_dump_names 1-*.nolist
   190                              <2> %rep %0
   191                              <2> 	%1
   192                              <2>  %rotate 1
   193                              <2> %endrep
   194                              <2> 	%endmacro
   195                              <2> 
   196                              <2> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   197                              <2> ; dw LINK_DATA_RELOCATIONS, 0, 0
   198                              <2> ; link_data_dump_names ELDCALL_CODE_NAMES
   199                              <2> 
   200                              <2> %endif
    44                              <1> %include "install.mac"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> lDebug INSTALL command macros
     5                              <2> 
     6                              <2> Copyright (C) 2008-2023 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> 	struc INSTALLFLAG
    17 00000000 ????                <2> ifKeyword:	resw 1
    18 00000002 ????                <2> ifDescription:	resw 1
    19 00000004 ????                <2> ifOptions:	resw 1
    20 00000006 ????                <2> ifValue:	resw 1
    21 00000008 ????                <2> ifTrying:	resw 1
    22 0000000A ????                <2> ifReserved:	resw 1
    23                              <2> 	endstruc
    24                              <2> 
    45                              <1> 
    46                              <1> 	cpu 8086
    47                              <1> 
    48                              <1> 	addsection RELOCATEDDATA, nobits vstart=_ELD_RELOC_VSTART
    49                              <1> relocateddata:
    50                              <1> 
    51                              <1> 	addsection HEADER, start=0
    52                              <1> 
    53                              <1> 	istruc ELD_HEADERX
    54                              <1> at eldhxHeader
    55                              <1> 		; ELD executable header
    56                              <1> 	istruc ELD_HEADER
    57 00000000 454C4431            <1> at eldhSignature,	db "ELD1"
    58 00000004 000000              <1> 			db 0,0,0
    59 00000007 1A                  <1> 			db 26
    60 00000008 50000000            <1> at eldhCodeOffset,	dd CODEOFFSET
    61 0000000C 800C                <1> at eldhCodeImageLength,	dw code_size
    62 0000000E 0000                <1> at eldhCodeAllocLength,	dw 0
    63 00000010 D00C0000            <1> at eldhDataOffset,	dd DATAOFFSET
    64 00000014 4001                <1> at eldhDataImageLength,	dw data_size
    65 00000016 0000                <1> at eldhDataAllocLength,	dw total_data_size - data_size
    66 00000018 D903                <1> at eldhCodeEntrypoint,	dw linker - code
    67                              <1> at eldhReserved
    68 0000001A 00<rep 4h>2400      <1> at eldhExtensionSize,	dw header_extension_end - $$
    69                              <1> 	iend
    70 00000020 [30000000]          <1> at eldhxDescriptionOffset,	dd description
    71                              <1> PUT_ELDHX_DATETIME_OFFSET
    72                              <1> header_extension_end:
    73 00000024 00<rep Ch>          <1> 	iend
    74                              <1> 
    75 00000030 4C69737420494E5354- <1> description:		asciz "List INSTALL command nouns."
    75 00000039 414C4C20636F6D6D61- <1>
    75 00000042 6E64206E6F756E732E- <1>
    75 0000004B 00                  <1>
    76                              <1> 
    77                              <1> 
    78 0000004C 00<rep 4h>          <1> 	align 16, db 0
    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>494E5354- <1> at eldiIdentifier,	fill 8, 32, db "INSTNOUN"
    90 0000000C 4E4F554E            <1>
    91 00000010 00<rep 2h>696E7374- <1> at eldiListing,		asciz _ELD_LISTING
    91 00000016 6E6F74682E6C737400  <1>
    92 0000001F 00                  <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 E8BE02              <1> 	extcallcall skipcomma
   105                              <1> @@:
   106 00000032 4E                  <1> 	dec si
   107                              <1> 
   108 00000033 BA[0400]            <1> 	mov dx, msg.instnoun
   109                              <1> internaldatarelocation
   110 00000036 E8BF02              <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 E8AC02              <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> 	mov dx, relocateddata
   125                              <1> linkdatarelocation msg.uninstall
   126 0000004E E8A702              <1> 	extcallcall isstring?
   127 00000051 7419                <1> 	je uninstall
   128                              <1> 
   129                              <1> %if _OTHER
   130 00000053 A1[0200]            <1> 	mov ax, word [otherseg]
   131                              <1> internaldatarelocation
   132 00000056 E8A702              <1> 	extcallcall ispm
   133 00000059 7508                <1> 	jnz @F
   134 0000005B 92                  <1> 	xchg dx, ax
   135 0000005C E8A902              <1> 	extcallcall setes2dx
   136 0000005F 26A1[0000]          <1> 	mov ax, word [es:relocateddata]
   137                              <1> otherlinkdatarelocation dssel
   138                              <1> @@:
   139 00000063 A3[0000]            <1> 	mov word [otherds], ax
   140                              <1> internaldatarelocation
   141                              <1> %endif
   142                              <1> 
   143 00000066 E87F00              <1> 	call run
   144 00000069 E8A402              <1> 	extcallcall cmd3
   145                              <1> 
   146                              <1> uninstall:
   147 0000006C AC                  <1> 	lodsb
   148 0000006D E8A802              <1> 	extcallcall chkeol
   149                              <1> 
   150 00000070 8E06[0000]          <1> 	mov es, word [relocateddata]
   151                              <1> linkdatarelocation extdssel
   152 00000074 E88902              <1> 	extcallcall ispm
   153 00000077 7404                <1> 	jz @F
   154 00000079 8E06[0000]          <1> 	mov es, word [relocateddata]
   155                              <1> linkdatarelocation extseg
   156                              <1> @@:
   157 0000007D 06                  <1> 	push es
   158 0000007E 1F                  <1> 	pop ds
   159 0000007F 31DB                <1> 	xor bx, bx		; = 0 (no prior, modify ext_command_handler)
   160 00000081 BF[2000]            <1> 	mov di, command		; di -> us
   161                              <1> internalcoderelocation
   162 00000084 368B36[0000]        <1> 	mov si, word [ss:relocateddata]
   163                              <1> linkdatarelocation ext_command_handler
   164                              <1> 				; si -> first
   165 00000089 85F6                <1> 	test si, si		; none installed ?
   166 0000008B 7450                <1> 	jz .error		; error -->
   167                              <1> 
   168                              <1> .loop:
   169 0000008D 39F7                <1> 	cmp di, si		; found ?
   170 0000008F 740D                <1> 	je .bx			; yes, use bx -->
   171 00000091 89F3                <1> 	mov bx, si		; bx -> prior handler
   172 00000093 AD                  <1> 	lodsw			; skip entrypoint jmp strict short
   173 00000094 AC                  <1> 	lodsb			; get first byte of chainer
   174 00000095 3CE9                <1> 	cmp al, 0E9h		; expecting jmp near ?
   175 00000097 7544                <1> 	jne .error		; no, error -->
   176 00000099 AD                  <1> 	lodsw			; get rel16 displacement
   177 0000009A 01C6                <1> 	add si, ax		; -> next handler
   178 0000009C EBEF                <1> 	jmp .loop
   179                              <1> 
   180                              <1> .bx:
   181 0000009E 85DB                <1> 	test bx, bx		; any prior ?
   182 000000A0 751A                <1> 	jnz .bxnz		; yes -->
   183 000000A2 AF                  <1> 	scasw			; skip entrypoint jmp strict short
   184 000000A3 803DE8              <1> 	cmp byte [di], 0E8h	; is it a call to cmd3_not_ext ?
   185 000000A6 7507                <1> 	jne @F			; no -->
   186                              <1> 				; yes, reset ext_command_handler to zero
   187                              <1> .setbx:
   188 000000A8 36891E[0000]        <1> 	mov word [ss:relocateddata], bx
   189                              <1> linkdatarelocation ext_command_handler
   190 000000AD EB1E                <1> 	jmp .done
   191                              <1> 
   192                              <1> @@:
   193 000000AF 803DE9              <1> 	cmp byte [di], 0E9h	; validate
   194 000000B2 7529                <1> 	jne .error		; failure -->
   195 000000B4 47                  <1> 	inc di			; -> rel16 displacement
   196 000000B5 8B1D                <1> 	mov bx, word [di]	; get displacement
   197 000000B7 AF                  <1> 	scasw			; -> after jmp near
   198 000000B8 01FB                <1> 	add bx, di		; -> next handler
   199 000000BA EBEC                <1> 	jmp .setbx		; set ext_command_handler to next
   200                              <1> 
   201                              <1> .bxnz:
   202 000000BC 89DE                <1> 	mov si, bx		; -> prior handler with us as downlink
   203 000000BE 87FE                <1> 	xchg di, si		; si -> ours, di -> prior
   204 000000C0 A7                  <1> 	cmpsw			; skip entrypoint jmp strict short
   205 000000C1 A4                  <1> 	movsb			; copy 0E8h/0E9h
   206 000000C2 AD                  <1> 	lodsw			; ax = near rel16 displacement
   207 000000C3 01F0                <1> 	add ax, si		; add in our base (= absolute offset)
   208 000000C5 29F8                <1> 	sub ax, di
   209 000000C7 48                  <1> 	dec ax
   210 000000C8 48                  <1> 	dec ax			; subtract new base (= relative displacement)
   211 000000C9 AB                  <1> 	stosw			; store new rel16 displacement
   212 000000CA A5                  <1> 	movsw			; jmp strict short
   213 000000CB A5                  <1> 	movsw			; linkcall target
   214 000000CC A4                  <1> 	movsb			; trailer
   215                              <1> .done:
   216 000000CD 8026[1000]FE        <1> 	clropt [code + eldiFlags], eldifResident
   217                              <1> internalcoderelocation -3	; mark block as free
   218 000000D2 BA[8A00]            <1> 	mov dx, msg.uninstall_done
   219                              <1> internaldatarelocation
   220                              <1> @@:
   221 000000D5 16                  <1> 	push ss
   222 000000D6 1F                  <1> 	pop ds
   223 000000D7 E84602              <1> 	extcallcall putsz
   224 000000DA E83302              <1> 	extcallcall cmd3	; return
   225                              <1> 
   226                              <1> .error:
   227 000000DD B8010E              <1> 	mov ax, 0E01h
   228 000000E0 E84502              <1> 	extcallcall setrc
   229 000000E3 BA[AA00]            <1> 	mov dx, msg.uninstall_error
   230                              <1> internaldatarelocation
   231 000000E6 EBED                <1> 	jmp @B
   232                              <1> 
   233                              <1> 
   234                              <1> run:
   235 000000E8 16                  <1> 	push ss
   236 000000E9 07                  <1> 	pop es
   237                              <1> 
   238 000000EA B8[0000]            <1> 	mov ax, relocateddata
   239                              <1> otherlinkdatarelocation installformat, -2, optional
   240 000000ED 85C0                <1> 	test ax, ax
   241 000000EF 750D                <1> 	jnz @F
   242 000000F1 B8410E              <1> 	mov ax, 0E41h
   243 000000F4 E83102              <1> 	extcallcall setrc
   244 000000F7 BA[F000]            <1> 	mov dx, msg.none
   245                              <1> internaldatarelocation
   246                              <1> .putsz_end:
   247 000000FA E82302              <1> 	extcallcall putsz
   248 000000FD C3                  <1> 	retn
   249                              <1> 
   250                              <1> @@:
   251 000000FE 83F801              <1> 	cmp ax, 1
   252 00000101 740B                <1> 	je @F
   253 00000103 B8420E              <1> 	mov ax, 0E42h
   254 00000106 E81F02              <1> 	extcallcall setrc
   255 00000109 BA[1501]            <1> 	mov dx, msg.unknown
   256                              <1> internaldatarelocation
   257 0000010C EBEC                <1> 	jmp .putsz_end
   258                              <1> 
   259                              <1> @@:
   260 0000010E E8DF01              <1> 	extcallcall skipcomma
   261 00000111 E81C02              <1> 	extcallcall iseol?
   262 00000114 7503E94B01          <1> 	je list
   263                              <1> 
   264 00000119 4E                  <1> 	dec si
   265 0000011A 31DB                <1> 	xor bx, bx
   266 0000011C BA[2800]            <1> 	mov dx, msg.quiet
   267                              <1> internaldatarelocation
   268 0000011F E8D601              <1> 	extcallcall isstring?
   269 00000122 7505                <1> 	jne @F
   270 00000124 E8C901              <1> 	extcallcall skipcomma
   271 00000127 4E                  <1> 	dec si
   272 00000128 4B                  <1> 	dec bx
   273                              <1> @@:
   274                              <1> 
   275 00000129 B9[D701]            <1> 	mov cx, set
   276                              <1> internalcoderelocation
   277 0000012C BA[0F00]            <1> 	mov dx, msg.install
   278                              <1> internaldatarelocation
   279 0000012F E8C601              <1> 	extcallcall isstring?
   280 00000132 7429                <1> 	je change_or_toggle
   281 00000134 BA[1E00]            <1> 	mov dx, msg.set
   282                              <1> internaldatarelocation
   283 00000137 E8BE01              <1> 	extcallcall isstring?
   284 0000013A 7430                <1> 	je change
   285                              <1> 
   286 0000013C B9[0F02]            <1> 	mov cx, clear
   287                              <1> internalcoderelocation
   288 0000013F BA[0D00]            <1> 	mov dx, msg.uninstall
   289                              <1> internaldatarelocation
   290 00000142 E8B301              <1> 	extcallcall isstring?
   291 00000145 7425                <1> 	je change
   292 00000147 BA[2200]            <1> 	mov dx, msg.clear
   293                              <1> internaldatarelocation
   294 0000014A E8AB01              <1> 	extcallcall isstring?
   295 0000014D 741D                <1> 	je change
   296                              <1> 
   297 0000014F B9[C001]            <1> 	mov cx, toggle
   298                              <1> internalcoderelocation
   299 00000152 BA[1700]            <1> 	mov dx, msg.toggle
   300                              <1> internaldatarelocation
   301 00000155 E8A001              <1> 	extcallcall isstring?
   302 00000158 7412                <1> 	je change
   303                              <1> 
   304 0000015A E8DB01              <1> 	extcallcall error
   305                              <1> 
   306                              <1> change_or_toggle:
   307 0000015D E89001              <1> 	extcallcall skipcomma
   308 00000160 4E                  <1> 	dec si
   309 00000161 BA[1700]            <1> 	mov dx, msg.toggle
   310                              <1> internaldatarelocation
   311 00000164 E89101              <1> 	extcallcall isstring?
   312 00000167 7503                <1> 	jne @F
   313 00000169 B9[C001]            <1> 	mov cx, toggle
   314                              <1> internalcoderelocation
   315                              <1> @@:
   316                              <1> change:
   317 0000016C 881E[3401]          <1> 	mov byte [quiet], bl
   318                              <1> internaldatarelocation
   319 00000170 E87D01              <1> 	extcallcall skipcomma
   320 00000173 56                  <1> 	push si
   321                              <1> .loopcheck:
   322 00000174 4E                  <1> 	dec si
   323 00000175 E8CF00              <1> 	call checkinstallflag	; valid command ? (errors out if no)
   324                              <1> 	getotherds
    16 00000178 368E1E[0000]        <2>  mov ds, word [ss:otherds]
    17                              <2> internaldatarelocation
   325 0000017D 8B7F04              <1> 	mov di, word [bx + ifOptions]
   326 00000180 85FF                <1> 	test di, di		; normal with options pointer ?
   327 00000182 7503E9B101          <1> 	jz error		; no -->
   328                              <1> 	resetds
    20 00000187 16                  <2>  push ss
    21 00000188 1F                  <2>  pop ds
   329 00000189 E86401              <1> 	extcallcall skipcomma
   330 0000018C E8A101              <1> 	extcallcall iseol?
   331 0000018F 75E3                <1> 	jne .loopcheck
   332                              <1> 
   333 00000191 5E                  <1> 	pop si
   334                              <1> .loopdo:
   335 00000192 4E                  <1> 	dec si
   336 00000193 E8B100              <1> 	call checkinstallflag	; re-detect which it is, cannot fail
   337                              <1> 	getotherds
    16 00000196 368E1E[0000]        <2>  mov ds, word [ss:otherds]
    17                              <2> internaldatarelocation
   338 0000019B 8B5702              <1> 	mov dx, word [bx + ifDescription]
   339 0000019E 8B7F04              <1> 	mov di, word [bx + ifOptions]
   340 000001A1 8B4706              <1> 	mov ax, word [bx + ifValue]
   341 000001A4 85FF                <1> 	test di, di		; normal with options pointer ?
   342 000001A6 7503E98D01          <1> 	jz error		; no -->
   343 000001AB FFD1                <1> 	call cx			; call install.set or install.clear
   344                              <1> 	resetds
    20 000001AD 16                  <2>  push ss
    21 000001AE 1F                  <2>  pop ds
   345 000001AF E83E01              <1> 	extcallcall skipcomma
   346 000001B2 E87B01              <1> 	extcallcall iseol?
   347 000001B5 75DB                <1> 	jne .loopdo
   348 000001B7 C3                  <1> 	retn
   349                              <1> 
   350                              <1> 
   351                              <1> 		; OUT:	ZR if not reverse
   352                              <1> isreverse:
   353                              <1> 		; (n & (n - 1)) != 0
   354 000001B8 53                  <1> 	push bx
   355 000001B9 89C3                <1> 	mov bx, ax
   356 000001BB 4B                  <1> 	dec bx
   357 000001BC 21C3                <1> 	and bx, ax
   358 000001BE 5B                  <1> 	pop bx
   359 000001BF C3                  <1> 	retn
   360                              <1> 
   361                              <1> 
   362                              <1> toggle:
   363 000001C0 E8F5FF              <1> 	call isreverse
   364 000001C3 740A                <1> 	jz .togglenormal
   365                              <1> 
   366                              <1> .togglereverse:
   367 000001C5 F7D0                <1> 	not ax
   368 000001C7 3105                <1> 	xor word [di], ax
   369 000001C9 8505                <1> 	test word [di], ax
   370 000001CB 7421                <1> 	jz settry
   371 000001CD EB06                <1> 	jmp @F
   372                              <1> 
   373                              <1> .togglenormal:
   374 000001CF 3105                <1> 	xor word [di], ax
   375 000001D1 8505                <1> 	test word [di], ax
   376 000001D3 7519                <1> 	jnz settry
   377                              <1> @@:
   378 000001D5 EB4F                <1> 	jmp cleartry
   379                              <1> 
   380                              <1> 
   381                              <1> set:
   382 000001D7 E8DEFF              <1> 	call isreverse
   383 000001DA 740C                <1> 	jz .setnormal
   384                              <1> 
   385                              <1> .setreverse:
   386 000001DC F7D0                <1> 	not ax
   387 000001DE 8505                <1> 	test word [di], ax	; already clear ?
   388 000001E0 741B                <1> 	jz @F			; yes -->
   389 000001E2 F7D0                <1> 	not ax
   390 000001E4 2105                <1> 	and word [di], ax	; clear flag
   391 000001E6 EB06                <1> 	jmp settry
   392                              <1> 
   393                              <1> 
   394                              <1> .setnormal:
   395 000001E8 8505                <1> 	test word [di], ax	; already set ?
   396 000001EA 7511                <1> 	jnz @F			; yes -->
   397 000001EC 0905                <1> 	or word [di], ax	; set flag
   398                              <1> settry:
   399 000001EE 36D006[3401]        <1> 	rol byte [ownss quiet], 1
   400                              <1> internaldatarelocation
   401 000001F3 724F                <1> 	jc reset
   402 000001F5 E82801              <1> 	call putsz
   403 000001F8 BA[5D00]            <1> 	mov dx, msg.tryenable
   404                              <1> internaldatarelocation
   405 000001FB EB0D                <1> 	jmp .putsz
   406                              <1> 
   407                              <1> @@:
   408 000001FD 36D006[3401]        <1> 	rol byte [ownss quiet], 1
   409                              <1> internaldatarelocation
   410 00000202 7240                <1> 	jc reset
   411 00000204 E81901              <1> 	call putsz
   412 00000207 BA[2E00]            <1> 	mov dx, msg.alreadyenabled
   413                              <1> internaldatarelocation
   414                              <1> .putsz:
   415                              <1> 	resetds
    20 0000020A 16                  <2>  push ss
    21 0000020B 1F                  <2>  pop ds
   416 0000020C E91101              <1> 	jmp putsz
   417                              <1> 
   418                              <1> 
   419                              <1> clear:
   420 0000020F E8A6FF              <1> 	call isreverse
   421 00000212 740A                <1> 	jz .clearnormal
   422                              <1> 
   423                              <1> .clearreverse:
   424 00000214 F7D0                <1> 	not ax
   425 00000216 8505                <1> 	test word [di], ax	; already set ?
   426 00000218 751B                <1> 	jnz @F
   427 0000021A 0905                <1> 	or word [di], ax	; set flag
   428 0000021C EB08                <1> 	jmp cleartry
   429                              <1> 
   430                              <1> .clearnormal:
   431 0000021E 8505                <1> 	test word [di], ax	; already clear ?
   432 00000220 7413                <1> 	jz @F			; yes -->
   433 00000222 F7D0                <1> 	not ax			; get mask value
   434 00000224 2105                <1> 	and word [di], ax	; clear flag
   435                              <1> cleartry:
   436 00000226 36D006[3401]        <1> 	rol byte [ownss quiet], 1
   437                              <1> internaldatarelocation
   438 0000022B 7217                <1> 	jc reset
   439 0000022D E8F000              <1> 	call putsz
   440 00000230 BA[7300]            <1> 	mov dx, msg.trydisable
   441                              <1> internaldatarelocation
   442                              <1> .putsz:
   443 00000233 EBD5                <1> 	jmp settry.putsz
   444                              <1> 
   445                              <1> @@:
   446 00000235 36D006[3401]        <1> 	rol byte [ownss quiet], 1
   447                              <1> internaldatarelocation
   448 0000023A 7208                <1> 	jc reset
   449 0000023C E8E100              <1> 	call putsz
   450 0000023F BA[4500]            <1> 	mov dx, msg.alreadydisabled
   451                              <1> internaldatarelocation
   452 00000242 EBEF                <1> 	jmp .putsz
   453                              <1> 
   454                              <1> 
   455                              <1> reset:
   456                              <1> 	resetds
    20 00000244 16                  <2>  push ss
    21 00000245 1F                  <2>  pop ds
   457 00000246 C3                  <1> 	retn
   458                              <1> 
   459                              <1> 
   460                              <1> checkinstallflag:
   461                              <1> 	getotheres
    24 00000247 368E06[0000]        <2>  mov es, word [ss:otherds]
    25                              <2> internaldatarelocation
   462 0000024C BB[F4FF]            <1> 	mov bx, relocateddata - INSTALLFLAG_size
   463                              <1> otherlinkdatarelocation installflags
   464                              <1> @@:
   465 0000024F 83C30C              <1> 	add bx, INSTALLFLAG_size
   466                              <1> %if _OTHER
   467 00000252 26                  <1> 	es
   468                              <1> %endif
   469 00000253 8B17                <1> 	mov dx, word [bx + ifKeyword]
   470 00000255 85D2                <1> 	test dx, dx
   471 00000257 7408                <1> 	jz .error
   472 00000259 E89C00              <1> 	call isstring?
   473 0000025C 75F1                <1> 	jne @B
   474                              <1> 	resetes
    28 0000025E 16                  <2>  push ss
    29 0000025F 07                  <2>  pop es
   475 00000260 C3                  <1> 	retn
   476                              <1> 
   477                              <1> .error:
   478 00000261 E9D400              <1> 	jmp error
   479                              <1> 
   480                              <1> 
   481                              <1> list:
   482 00000264 31C0                <1> 	xor ax, ax
   483                              <1> 	lframe none
   484 00000266 5589E5              <1> 	lenter
   485                              <1> 	lvar word, last
   486 00000269 50                  <1> 	 push ax
   487                              <1> 
   488 0000026A BE[0000]            <1> 	mov si, relocateddata
   489                              <1> otherlinkdatarelocation installflags
   490                              <1> loop:
   491                              <1> 	houdini
   492 0000026D BF[0000]            <1> 	mov di, relocateddata
   493                              <1> linkdatarelocation line_out
   494                              <1> 
   495                              <1> 	getotherds
    16 00000270 368E1E[0000]        <2>  mov ds, word [ss:otherds]
    17                              <2> internaldatarelocation
   496 00000275 AD                  <1> 	lodsw				; ifKeyword
   497 00000276 85C0                <1> 	test ax, ax
   498 00000278 7465                <1> 	jz end
   499                              <1> 
   500 0000027A 50                  <1> 	push ax
   501                              <1> 
   502 0000027B AD                  <1> 	lodsw				; ifDescription
   503 0000027C 3B46FE              <1> 	cmp ax, word [bp + ?last]
   504 0000027F 750D                <1> 	jne @F
   505                              <1> 
   506 00000281 B020                <1> 	mov al, 32
   507 00000283 B90C00              <1> 	mov cx, 12
   508 00000286 F3AA                <1> 	rep stosb
   509 00000288 58                  <1> 	pop ax
   510 00000289 E85900              <1> 	call copy_asciz
   511                              <1> 
   512 0000028C EB47                <1> 	jmp next
   513                              <1> 
   514                              <1> @@:
   515 0000028E AD                  <1> 	lodsw				; ifOptions
   516 0000028F E8AE00              <1> 	extcallcall hexword
   517 00000292 93                  <1> 	xchg bx, ax
   518                              <1> 
   519 00000293 B020                <1> 	mov al, 32
   520 00000295 AA                  <1> 	stosb
   521                              <1> 
   522 00000296 AD                  <1> 	lodsw				; ifValue
   523 00000297 E8A600              <1> 	extcallcall hexword
   524 0000029A 92                  <1> 	xchg dx, ax
   525                              <1> 
   526 0000029B B020                <1> 	mov al, 32
   527 0000029D AA                  <1> 	stosb
   528                              <1> 
   529 0000029E B83F20              <1> 	mov ax, "? "
   530 000002A1 85DB                <1> 	test bx, bx
   531 000002A3 7415                <1> 	jz @F
   532                              <1> 
   533 000002A5 B02B                <1> 	mov al, '+'
   534                              <1> 
   535                              <1> 		; (n & (n - 1)) != 0
   536 000002A7 53                  <1> 	push bx
   537 000002A8 89D3                <1> 	mov bx, dx
   538 000002AA 4B                  <1> 	dec bx
   539 000002AB 21D3                <1> 	and bx, dx
   540 000002AD 5B                  <1> 	pop bx
   541 000002AE 7404                <1> 	jz .notreverse
   542                              <1> 
   543 000002B0 F7D2                <1> 	not dx
   544 000002B2 B02D                <1> 	mov al, '-'
   545                              <1> 
   546                              <1> .notreverse:
   547 000002B4 8517                <1> 	test word [bx], dx
   548 000002B6 7502                <1> 	jnz @F
   549 000002B8 3406                <1> 	xor al, '+' ^ '-'
   550                              <1> @@:
   551 000002BA AB                  <1> 	stosw
   552                              <1> 
   553 000002BB 58                  <1> 	pop ax
   554                              <1> 
   555 000002BC E82600              <1> 	call copy_asciz
   556                              <1> 
   557 000002BF B020                <1> 	mov al, 32
   558 000002C1 B9[1B00]            <1> 	mov cx, relocateddata + 15 + 10 + 2
   559                              <1> linkdatarelocation line_out
   560 000002C4 29F9                <1> 	sub cx, di
   561 000002C6 7602                <1> 	jbe @F
   562 000002C8 F3AA                <1> 	rep stosb
   563                              <1> @@:
   564 000002CA AA                  <1> 	stosb
   565                              <1> 
   566 000002CB 83EE06              <1> 	sub si, 6			; ifTrying - ifDescription
   567 000002CE AD                  <1> 	lodsw				; ifDescription
   568 000002CF 8946FE              <1> 	mov word [bp + ?last], ax
   569 000002D2 E81000              <1> 	call copy_asciz
   570                              <1> 
   571                              <1> next:
   572 000002D5 83C608              <1> 	add si, 8			; INSTALLFLAG_size - (ifDescription + 2)
   573                              <1> 
   574                              <1> 	resetds
    20 000002D8 16                  <2>  push ss
    21 000002D9 1F                  <2>  pop ds
   575 000002DA E86B00              <1> 	extcallcall putsline_crlf
   576 000002DD EB8E                <1> 	jmp loop
   577                              <1> 
   578                              <1> end:
   579                              <1> 	resetds
    20 000002DF 16                  <2>  push ss
    21 000002E0 1F                  <2>  pop ds
   580 000002E1 89EC5D              <1> 	lleave , forcerestoresp
   581 000002E4 C3                  <1> 	retn
   582                              <1> 
   583                              <1> 
   584                              <1> copy_asciz:
   585 000002E5 56                  <1> 	push si
   586 000002E6 96                  <1> 	xchg si, ax
   587 000002E7 A8                  <1> 	db __TEST_IMM8
   588                              <1> @@:
   589 000002E8 AA                  <1> 	stosb
   590 000002E9 AC                  <1> 	lodsb
   591 000002EA 84C0                <1> 	test al, al
   592 000002EC 75FA                <1> 	jnz @B
   593 000002EE 5E                  <1> 	pop si
   594 000002EF C3                  <1> 	retn
   595                              <1> 
   596                              <1> 
   597 000002F0 E8[0000]EB020000C3- <1> 	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   597 000002F8 E8[0000]EB020000C3- <1>
   597 00000300 E8[0000]EB020000C3- <1>
   597 00000308 E8[0000]EB020000C3- <1>
   597 00000310 E8[0000]EB020000C3- <1>
   597 00000318 E8[0000]EB020000C3- <1>
   597 00000320 E8[0000]EB020000C3- <1>
   597 00000328 E8[0000]EB020000C3- <1>
   597 00000330 E8[0000]EB020000C3- <1>
   597 00000338 E8[0000]EB020000C3- <1>
   597 00000340 E8[0000]EB020000C3- <1>
   597 00000348 E8[0000]EB020000C3  <1>
   598                              <1> 
   599                              <1> endinstalled equ ($ + CODEFIXUP + 15) & ~15
   600                              <1> 
   601                              <1> 
   602                              <1> start:
   603 00000350 8CC3                <1> 	mov bx, es
   604 00000352 16                  <1> 	 push ss
   605 00000353 07                  <1> 	 pop es
   606 00000354 E899FF              <1> 	call skipcomma
   607 00000357 4E                  <1> 	dec si
   608 00000358 BA[0000]            <1> 	mov dx, relocateddata
   609                              <1> linkdatarelocation msg.install
   610 0000035B E89AFF              <1> 	call isstring?
   611 0000035E 7432                <1> 	je install
   612 00000360 BA[0000]            <1> 	mov dx, relocateddata
   613                              <1> linkdatarelocation msg.run
   614 00000363 E892FF              <1> 	call isstring?
   615 00000366 E87FFD              <1> 	call run
   616 00000369 E80300              <1> 	call uninstall_oneshot
   617 0000036C 31C0                <1> 	xor ax, ax
   618 0000036E CB                  <1> 	retf
   619                              <1> 
   620                              <1> 
   621                              <1> uninstall_oneshot:
   622 0000036F 36F606[0000]01      <1> 	testopt [ss:relocateddata], 1
   623                              <1> linkdatarelocation options7, -3
   624 00000375 751A                <1> 	jnz @F
   625                              <1> 
   626 00000377 2EA1[0200]          <1> 	mov ax, word [cs:code + eldiEndCode]
   627                              <1> internalcoderelocation
   628 0000037B 2E2B06[0000]        <1> 	sub ax, word [cs:code + eldiStartCode]
   629                              <1> internalcoderelocation
   630 00000380 2906[0000]          <1> 	sub word [relocateddata], ax
   631                              <1> linkdatarelocation extseg_used
   632                              <1> 
   633 00000384 2EA1[0600]          <1> 	mov ax, word [cs:code + eldiEndData]
   634                              <1> internalcoderelocation
   635 00000388 2E2B06[0400]        <1> 	sub ax, word [cs:code + eldiStartData]
   636                              <1> internalcoderelocation
   637 0000038D 2906[0000]          <1> 	sub word [relocateddata], ax
   638                              <1> linkdatarelocation extdata_used
   639                              <1> @@:
   640 00000391 C3                  <1> 	retn
   641                              <1> 
   642                              <1> 
   643                              <1> install:
   644 00000392 AC                  <1> 	lodsb
   645 00000393 E8[0000]EB020000    <1> 	extcall chkeol
   646                              <1> 
   647                              <1> 	houdini
   648 0000039A 8EC3                <1> 	mov es, bx		; => ext seg (writable)
   649 0000039C B89000              <1> 	mov ax, endresident - endinstalled
   650 0000039F 262906[0200]        <1> 	sub word [es:code + eldiEndCode], ax
   651                              <1> internalcoderelocation		; adjust size
   652 000003A4 2906[0000]          <1> 	sub word [relocateddata], ax
   653                              <1> linkdatarelocation extseg_used	; adjust size
   654 000003A8 8B1E[0000]          <1> 	mov bx, word [relocateddata]
   655                              <1> linkdatarelocation ext_command_handler
   656                              <1> 				; -> prior
   657 000003AC BF[2000]            <1> 	mov di, command		; -> our handler
   658                              <1> internalcoderelocation
   659 000003AF 85DB                <1> 	test bx, bx		; installing as first ?
   660 000003B1 740A                <1> 	jz .only_first		; yes, simple --> (leave as extcall cmd3_not_ext)
   661 000003B3 AF                  <1> 	scasw			; skip entrypoint jmp strict short
   662 000003B4 B0E9                <1> 	mov al, 0E9h		; = jmp near opcode
   663 000003B6 AA                  <1> 	stosb			; store
   664 000003B7 93                  <1> 	xchg ax, bx		; ax -> next handler
   665 000003B8 29F8                <1> 	sub ax, di
   666 000003BA 48                  <1> 	dec ax
   667 000003BB 48                  <1> 	dec ax			; ax = ax - (di + 2)
   668 000003BC AB                  <1> 	stosw			; store our downlink as rel16 displacement
   669                              <1> 
   670                              <1> .only_first:
   671 000003BD 26800E[1000]01      <1> 	setopt [es:code + eldiFlags], eldifResident
   672                              <1> internalcoderelocation -3	; mark block as resident
   673 000003C3 C706[0000][2000]    <1> 	mov word [relocateddata], command
   674                              <1> linkdatarelocation ext_command_handler, -4
   675                              <1> internalcoderelocation		; -> our entrypoint
   676                              <1> 
   677 000003C9 F606[0000]04        <1> 	testopt [relocateddata], 4
   678                              <1> linkdatarelocation options7, -3
   679 000003CE 7506                <1> 	jnz @F
   680 000003D0 BA[D200]            <1> 	mov dx, msg.installed
   681                              <1> internaldatarelocation
   682 000003D3 E84AFF              <1> 	call putsz
   683                              <1> @@:
   684 000003D6 31C0                <1> 	xor ax, ax
   685 000003D8 CB                  <1> 	retf
   686                              <1> 
   687                              <1> 
   688                              <1> DATAOFFSET equ CODEOFFSET + code_size
   689                              <1> 	addsection DATA, follows=CODE vstart=_ELD_DATA_VSTART
   690                              <1> %define DATAFIXUP - datastart + 0
   691                              <1> datastart:
   692                              <1> PUT_ELD_DATETIME
   693                              <1> 
   694                              <1> %if _OTHER
   695                              <1> 	align 2, db 0
   696 00000000 0000                <1> otherds:	dw 0
   697 00000002 0000                <1> otherseg:	dw 0
   698                              <1> %endif
   699                              <1> 
   700                              <1> msg:
   701 00000004 494E53544E4F544800  <1> .instnoun:		asciz NAME_STRING
   702 0000000D 554E                <1> .uninstall:		db "UN"
   703 0000000F 494E5354414C4C00    <1> .install:		asciz "INSTALL"
   704 00000017 544F47474C4500      <1> .toggle:		asciz "TOGGLE"
   705 0000001E 53455400            <1> .set:			asciz "SET"
   706 00000022 434C45415200        <1> .clear:			asciz "CLEAR"
   707 00000028 515549455400        <1> .quiet:			asciz "QUIET"
   708 0000002E 20697320616C726561- <1> .alreadyenabled:	asciz " is already enabled.",13,10
   708 00000037 647920656E61626C65- <1>
   708 00000040 642E0D0A00          <1>
   709 00000045 20697320616C726561- <1> .alreadydisabled:	asciz " is already disabled.",13,10
   709 0000004E 64792064697361626C- <1>
   709 00000057 65642E0D0A00        <1>
   710 0000005D 3A20547279696E6720- <1> .tryenable:		asciz ": Trying to enable.",13,10
   710 00000066 746F20656E61626C65- <1>
   710 0000006F 2E0D0A00            <1>
   711 00000073 3A20547279696E6720- <1> .trydisable:		asciz ": Trying to disable.",13,10
   711 0000007C 746F2064697361626C- <1>
   711 00000085 652E0D0A00          <1>
   712 0000008A 494E53544E4F544820- <1> .uninstall_done:	db NAME_STRING," command uninstalled."
   712 00000093 636F6D6D616E642075- <1>
   712 0000009C 6E696E7374616C6C65- <1>
   712 000000A5 642E                <1>
   713                              <1> %if _ELD_RECLAIM_HINT
   714                              <1> 			db " (Don't forget to use reclaim.eld)"
   715                              <1> %endif
   716 000000A7 0D0A00              <1> 			asciz 13,10
   717 000000AA 494E53544E4F544820- <1> .uninstall_error:	asciz NAME_STRING," command unable to uninstall!",13,10
   717 000000B3 636F6D6D616E642075- <1>
   717 000000BC 6E61626C6520746F20- <1>
   717 000000C5 756E696E7374616C6C- <1>
   717 000000CE 210D0A00            <1>
   718 000000D2 494E53544E4F544820- <1> .installed:		asciz NAME_STRING," command installed.",13,10
   718 000000DB 636F6D6D616E642069- <1>
   718 000000E4 6E7374616C6C65642E- <1>
   718 000000ED 0D0A00              <1>
   719                              <1> 
   720 000000F0 4E6F20696E7374616C- <1> .none:			asciz "No install flag format link found.",13,10
   720 000000F9 6C20666C616720666F- <1>
   720 00000102 726D6174206C696E6B- <1>
   720 0000010B 20666F756E642E0D0A- <1>
   720 00000114 00                  <1>
   721 00000115 556E6B6E6F776E2069- <1> .unknown:		asciz "Unknown install flag format.",13,10
   721 0000011E 6E7374616C6C20666C- <1>
   721 00000127 616720666F726D6174- <1>
   721 00000130 2E0D0A00            <1>
   722                              <1> 
   723                              <1> 
   724                              <1> uinit_data:
   725                              <1> 
   726 00000134 00<rep Ch>          <1> 	align 16, db 0
   727                              <1> data_size equ $ - datastart
   728                              <1> 
   729                              <1> 	absolute uinit_data
   730                              <1> 
   731 00000134 ??                  <1> quiet:			resb 1
   732                              <1> 
   733 00000135 <res Bh>            <1> 	alignb 16
   734                              <1> uinit_data_end:
   735                              <1> 
   736                              <1> total_data_size equ $ - datastart
   737                              <1> %assign _DATA_SIZE total_data_size
   738                              <1> 
   739                              <1> 	usesection CODE
   740                              <1> 
   741                              <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> %if _ELD_IDENTICALISE
    38                              <2>  ;%assign _ELDCALL_OPTIONAL 1
    39                              <2> %endif
    40                              <2> %ifn _ELDCALL_OPTIONAL
    41                              <2> %assign ELDCALL_OPTIONAL_STATUS 2		; not allowed
    42                              <2> %endif
    43                              <2> ;%ifn _ELDDATA_OPTIONAL
    44                              <2> ;%assign ELDDATA_OPTIONAL_STATUS 2		; not allowed
    45                              <2> ;%endif
    46                              <2> 	gendef MAP, ""
    47                              <2> 
    48                              <2> %ifnidni _MAP, ""
    49                              <2>  [map all _MAP]
    50                              <2> %endif
    51                              <2> 
    52                              <2> 
    53                              <2> endresident: equ ($ + _CURRENT_SECTION %+ FIXUP + 15) & ~15
    54                              <2> 
    55                              <2> %if _ELD_LINKER_PASSES
    56                              <2> %assign ELDLINKER 1
    57                              <2> 
    58                              <2> 	struc LINKTABLE
    59 00000000 ????????            <2> ltCodeToCode:	resw 2
    60 00000004 ????????            <2> ltCodeToData:	resw 2
    61 00000008 ????????            <2> ltDataToCode:	resw 2
    62 0000000C ????????            <2> ltDataToData:	resw 2
    63 00000010 ????????            <2> ltLinkData:	resw 2
    64 00000014 ????????            <2> ltLinkCode:	resw 2
    65                              <2> 	endstruc
    66                              <2> %endif
    67                              <2> 
    68                              <2> 
    69                              <2> 		; INP:	es:dx -> loaded initial ELD image
    70                              <2> 		;	 ELD instance structure filled
    71                              <2> 		;	es => ELD code area
    72                              <2> 		;	ds:di -> link info
    73                              <2> 		;	ss:bx -> loaded initial data
    74                              <2> 		;	ss:si -> command line tail
    75                              <2> 		;	cs:ip -> entrypoint
    76                              <2> 		;	ss:sp -> far return address for current mode
    77                              <2> 		; STT:	UP, EI
    78                              <2> linker:
    79                              <2> 		; The first 15 Bytes of the linker should be
    80                              <2> 		;  the same regardless of the linker options
    81                              <2> 		;  used (debug, passes, vstart). This allows
    82                              <2> 		;  the eldcomp ELD to match even if up to 15
    83                              <2> 		;  Bytes of the linker are trailing in the
    84                              <2> 		;  resident part of the ELD.
    85                              <2> 	lframe
    86                              <2>  %if ELDOTHER
    87                              <2> 	lvar dword, linkinfo_other
    88                              <2> 	lvar word, use_hash_other
    89                              <2>  %endif
    90 000003D9 5589E58D66FA        <2> 	lenter
    91                              <2> 	lvar dword, instance
    92 000003DF 06                  <2> 	 push es
    93 000003E0 52                  <2> 	 push dx		; -> start of where we're loaded in ELD cs
    94                              <2> 	lvar word, targetsection_low_optional_high
    95 000003E1 50                  <2> 	 push ax		; placeholder
    96                              <2> 	lequ ?targetsection_low_optional_high, targetsection
    97                              <2> 	lequ ?targetsection_low_optional_high + 1, optional
    98                              <2> 	lvar dword, linkinfo
    99 000003E2 1E                  <2> 	 push ds
   100 000003E3 57                  <2> 	 push di		; -> link info (in debugger ss or message seg)
   101                              <2> 	lvar dword, nextreloc
   102 000003E4 06                  <2> 	 push es		; => ELD cs
   103 000003E5 52                  <2> 	 push dx		; placeholder
   104                              <2> 	lvar dword, entry
   105 000003E6 06                  <2> 	 push es		; => ELD cs
   106 000003E7 50                  <2> 	 push ax		; placeholder
   107 000003E8 31C0                <2> 	xor ax, ax
   108 000003EA 813DD1E1            <2> 	cmp word [di + eldlSignature], 0E1D1h
   109                              <2> %if ($ - linker) < 16
   110                              <2>  %error Expected invariant first paragraph of linker
   111                              <2> %endif
   112 000003EE 7403E97902          <2> 	jne .error_j		; signature mismatch -->
   113 000003F3 837D0601            <2> 	cmp word [di + eldlUseLinkHash], 1
   114 000003F7 7603E97002          <2> 	ja .error_j		; unknown use link hash number -->
   115 000003FC 7201                <2> 	jb @F
   116 000003FE 48                  <2> 	dec ax			; = -1 if hash used
   117                              <2> @@:
   118                              <2> 	lvar word, use_hash
   119 000003FF 50                  <2> 	 push ax		; = -1 if hash used, else 0
   120                              <2> %if _ELD_IDENTICALISE && _ELD_LINKER_PASSES
   121                              <2> 	mov ax, linktable - code
   122                              <2> 	lvar word, lt
   123                              <2> 	 push ax		; -> link tables (a single reference)
   124                              <2> %endif
   125                              <2> %if _ELD_LINKER_PASSES || ELDOTHER
   126 00000400 31C0                <2> 	xor ax, ax
   127                              <2>  %if _ELD_LINKER_PASSES
   128                              <2> 	lvar word, pass
   129 00000402 50                  <2> 	 push ax		; = 0 for linker itself, = 2 for application
   130                              <2> 	lvar word, amounterrors
   131 00000403 50                  <2> 	 push ax		; how many distinct errors encountered in pass 2
   132                              <2> 	lvar word, name
   133 00000404 50                  <2> 	 push ax		; -> name currently being sought (in our table)
   134                              <2>  %endif
   135                              <2>  %if ELDOTHER
   136                              <2> 	lvar word, other
   137 00000405 50                  <2> 	 push ax		; byte: 0 = own data links, -1 = other data links
   138                              <2>  %endif
   139                              <2> %endif
   140 00000406 56                  <2> 	push si			; -> command line tail
   141 00000407 53                  <2> 	push bx			; -> data block in ELD data area (segment ss)
   142                              <2> 
   143                              <2> 			; simple: add instance base (dx) to code
   144 00000408 06                  <2> 	push es
   145 00000409 1F                  <2> 	pop ds			; ds = es => ELD cs
   146                              <2> %if _ELD_LINKER_PASSES
   147                              <2> .pass:
   148 0000040A 8B5EE4              <2> 	mov bx, word [bp + ?pass]	; 0 or 2
   149 0000040D 01D3                <2> 	add bx, dx		; -> start of the ELD instance in cs, +0 or +2
   150                              <2>  %if _ELD_IDENTICALISE
   151                              <2> 	add bx, word [bp + ?lt]	; add in single reference to linktable
   152                              <2> 	mov si, word [ltCodeToCode + bx]
   153                              <2>  %else
   154 0000040F 8BB76408            <2> 	mov si, word [linktable - code + ltCodeToCode + bx]
   155                              <2>  %endif
   156                              <2> %else
   157                              <2> 	mov si, internalcodetocoderelocations - code
   158                              <2> %endif		 		; si -> table for code to code (linker or app)
   159 00000413 01D6                <2> 	add si, dx		; relocate the table pointer itself
   160                              <2> @@:
   161 00000415 AD                  <2> 	lodsw
   162 00000416 85C0                <2> 	test ax, ax		; was last ?
   163 00000418 740B                <2> 	jz @F			; yes -->
   164 0000041A 93                  <2> 	xchg bx, ax		; bx = entry
   165 0000041B 01D3                <2> 	add bx, dx		; relocate the entry itself
   166                              <2> %if _ELD_CODE_VSTART
   167 0000041D 812F[0000]          <2> 	sub word [bx], code	; undo adjustment
   168                              <2> %endif
   169 00000421 0117                <2> 	add word [bx], dx	; relocate word referenced by entry
   170 00000423 EBF0                <2> 	jmp @B
   171                              <2> 
   172                              <2> @@:
   173                              <2> 			; next, add heap data base (on stack) to code
   174                              <2> %if _ELD_LINKER_PASSES
   175 00000425 8B5EE4              <2> 	mov bx, word [bp + ?pass]	; 0 or 2
   176 00000428 01D3                <2> 	add bx, dx		; -> start of the ELD instance in cs, +0 or +2
   177                              <2>  %if _ELD_IDENTICALISE
   178                              <2> 	add bx, word [bp + ?lt]	; add in single reference to linktable
   179                              <2> 	mov si, word [ltCodeToData + bx]
   180                              <2>  %else
   181 0000042A 8BB76808            <2> 	mov si, word [linktable - code + ltCodeToData + bx]
   182                              <2>  %endif
   183                              <2> %else
   184                              <2> 	mov si, internalcodetodatarelocations - code
   185                              <2> %endif				; si -> table for code to data (linker or app)
   186 0000042E 01D6                <2> 	add si, dx		; relocate the table pointer itself
   187                              <2> @@:
   188 00000430 AD                  <2> 	lodsw
   189 00000431 85C0                <2> 	test ax, ax		; was last ?
   190 00000433 740C                <2> 	jz @F			; yes -->
   191 00000435 93                  <2> 	xchg bx, ax		; bx = entry
   192 00000436 01D3                <2> 	add bx, dx		; relocate the entry itself
   193                              <2> 		; ! access the offset of the data area block, topmost on stack
   194 00000438 58                  <2> 	pop ax			; ax -> heap data
   195 00000439 50                  <2> 	push ax
   196                              <2> %if _ELD_DATA_VSTART
   197 0000043A 2D[0000]            <2> 	sub ax, datastart	; undo adjustment
   198                              <2> %endif
   199 0000043D 0107                <2> 	add word [bx], ax	; relocate word referenced by entry
   200 0000043F EBEF                <2> 	jmp @B
   201                              <2> 
   202                              <2> @@:
   203                              <2> 
   204                              <2> 			; add instance base (dx) to data
   205                              <2> %if _ELD_LINKER_PASSES
   206 00000441 8B5EE4              <2> 	mov bx, word [bp + ?pass]
   207 00000444 01D3                <2> 	add bx, dx
   208                              <2>  %if _ELD_IDENTICALISE
   209                              <2> 	add bx, word [bp + ?lt]
   210                              <2> 	mov si, word [ltDataToCode + bx]
   211                              <2>  %else
   212 00000446 8BB76C08            <2> 	mov si, word [linktable - code + ltDataToCode + bx]
   213                              <2>  %endif
   214                              <2> %else
   215                              <2> 	mov si, internaldatatocoderelocations - code
   216                              <2> %endif
   217 0000044A 01D6                <2> 	add si, dx
   218                              <2> @@:
   219 0000044C AD                  <2> 	lodsw
   220 0000044D 83F8FF              <2> 	cmp ax, -1		; was last ?
   221 00000450 740F                <2> 	je @F			; yes -->
   222 00000452 93                  <2> 	xchg bx, ax		; bx = entry
   223                              <2> 		; ! access the offset of the data area block, topmost on stack
   224 00000453 58                  <2> 	pop ax
   225 00000454 50                  <2> 	push ax
   226 00000455 01C3                <2> 	add bx, ax		; relocate the entry itself
   227                              <2> %if _ELD_CODE_VSTART
   228 00000457 36812F[0000]        <2> 	sub word [ss:bx], code	; undo adjustment
   229                              <2> %endif
   230 0000045C 360117              <2> 	add word [ss:bx], dx	; relocate word referenced by entry
   231 0000045F EBEB                <2> 	jmp @B
   232                              <2> 
   233                              <2> @@:
   234                              <2> 			; next, add heap data base (on stack) to data
   235                              <2> %if _ELD_LINKER_PASSES
   236 00000461 8B5EE4              <2> 	mov bx, word [bp + ?pass]
   237 00000464 01D3                <2> 	add bx, dx
   238                              <2>  %if _ELD_IDENTICALISE
   239                              <2> 	add bx, word [bp + ?lt]
   240                              <2> 	mov si, word [ltDataToData + bx]
   241                              <2>  %else
   242 00000466 8BB77008            <2> 	mov si, word [linktable - code + ltDataToData + bx]
   243                              <2>  %endif
   244                              <2> %else
   245                              <2> 	mov si, internaldatatodatarelocations - code
   246                              <2> %endif
   247 0000046A 01D6                <2> 	add si, dx
   248                              <2> @@:
   249 0000046C AD                  <2> 	lodsw
   250 0000046D 83F8FF              <2> 	cmp ax, -1		; was last ?
   251 00000470 740D                <2> 	je @F			; yes -->
   252 00000472 93                  <2> 	xchg bx, ax		; bx = entry
   253                              <2> 		; ! access the offset of the data area block, topmost on stack
   254 00000473 58                  <2> 	pop ax			; ax -> heap data
   255 00000474 50                  <2> 	push ax
   256 00000475 01C3                <2> 	add bx, ax		; relocate the entry itself
   257                              <2> %if _ELD_DATA_VSTART
   258 00000477 2D[0000]            <2> 	sub ax, datastart	; undo adjustment
   259                              <2> %endif
   260 0000047A 360107              <2> 	add word [ss:bx], ax	; relocate word referenced by entry
   261 0000047D EBED                <2> 	jmp @B
   262                              <2> 
   263                              <2> @@:
   264 0000047F 8B56F6              <2> 	mov dx, word [bp + ?instance]
   265                              <2> 				; reset (why??) -> ELD instance in ELD cs
   266                              <2> %if _ELD_LINKER_PASSES
   267 00000482 8B5EE4              <2> 	mov bx, word [bp + ?pass]
   268 00000485 01D3                <2> 	add bx, dx
   269                              <2>  %if _ELD_IDENTICALISE
   270                              <2> 	add bx, word [bp + ?lt]
   271                              <2> 	add dx, word [ltLinkData + bx]
   272                              <2>  %else
   273 00000487 03977408            <2> 	add dx, word [linktable - code + ltLinkData + bx]
   274                              <2>  %endif
   275                              <2> %else
   276                              <2> 	add dx, linkerdatarelocations - code
   277                              <2> %endif
   278                              <2> .otherloop:
   279 0000048B 8956EC              <2> 	mov word [bp + ?nextreloc], dx
   280                              <2> 				; -> data link relocation table
   281                              <2> 
   282                              <2> .datarelocloop:		; must be done before further relocs
   283 0000048E C576EC              <2> 	lds si, [bp + ?nextreloc]
   284 00000491 AD                  <2> 	lodsw			; ax = section indicator
   285 00000492 85C0                <2> 	test ax, ax		; end of table ?
   286 00000494 7503E93801          <2> 	jz .donedatareloc
   287 00000499 48                  <2> 	dec ax			; al = 1 if data, 0 if code (NB ah may != 0)
   288                              <2> 		; ! access the offset of the data area block, topmost on stack
   289 0000049A 5B                  <2> 	pop bx
   290 0000049B 53                  <2> 	push bx			; bx -> ELD data block
   291 0000049C 8946F4              <2> 	mov word [bp + ?targetsection_low_optional_high], ax
   292 0000049F 84C0                <2> 	test al, al		; data ?
   293 000004A1 AD                  <2> 	lodsw
   294 000004A2 7504                <2> 	jnz @F			; yes -->
   295 000004A4 0346F6              <2> 	add ax, word [bp + ?instance]
   296                              <2> 				; relocate entry into code
   297 000004A7 A9                  <2> 	db __TEST_IMM16		; (skip add)
   298                              <2> @@:
   299 000004A8 01D8                <2> 	add ax, bx		; relocate entry into data
   300 000004AA 8946E8              <2> 	mov word [bp + ?entry], ax
   301                              <2> 				; save away -> where to patch
   302 000004AD AD                  <2> 	lodsw			; get unrelocated -> name
   303 000004AE 8976EC              <2> 	mov word [bp + ?nextreloc], si
   304                              <2> 				; update -> behind relocation table entry
   305 000004B1 E8E700              <2> 	call .build_match	; get ax = scan value, si -> counted string,
   306                              <2> 				;  dl = original value at byte [si]
   307                              <2> 				; NC if symbol already not found before
   308                              <2> 				; CY if to search for the symbol
   309                              <2> %if _ELD_LINKER_PASSES
   310 000004B4 73D8                <2> 	jnc .datarelocloop	; if duplicate of a not found symbol -->
   311                              <2> %endif
   312 000004B6 C45EF0              <2> 	les bx, [bp + ?linkinfo]
   313                              <2> %if ELDOTHER
   314 000004B9 D046DE              <2> 	rol byte [bp + ?other], 1
   315 000004BC 7303                <2> 	jnc @F
   316 000004BE C45EFC              <2> 	les bx, [bp + ?linkinfo_other]
   317                              <2> @@:
   318                              <2> %endif				; es:bx -> link info table of the ELD host
   319 000004C1 268B4F08            <2> 	mov cx, word [es:bx + eldlDataAmount]	; amount data link info
   320 000004C5 268B7F0A            <2> 	mov di, word [es:bx + eldlDataPrefixes]	; -> prefixes or hashes
   321                              <2> .datarelocfind:
   322 000004C9 83F901              <2> 	cmp cx, 1			; NZ if cx == 0
   323 000004CC F2AF                <2> 	repne scasw			; scan initial
   324 000004CE 7541                <2> 	jne .datarelocnotfound
   325 000004D0 57                  <2> 	push di
   326 000004D1 51                  <2> 	push cx
   327 000004D2 56                  <2> 	push si
   328 000004D3 262B7F0A            <2> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   329 000004D7 4F                  <2> 	dec di
   330 000004D8 4F                  <2> 	dec di				; 0-based
   331 000004D9 26037F0C            <2> 	add di, word [es:bx + eldlDataEntries]	; -> entry
   332 000004DD 268B3D              <2> 	mov di, [es:di]			; -> counted suffix/string
   333 000004E0 B500                <2> 	mov ch, 0
   334 000004E2 8A0C                <2> 	mov cl, byte [si]		; cx = length
   335 000004E4 41                  <2> 	inc cx
   336                              <2> 	; cmp al, al			; ZR if length is zero
   337 000004E5 F3A6                <2> 	repe cmpsb			; match ?
   338 000004E7 5E                  <2> 	pop si
   339 000004E8 59                  <2> 	pop cx
   340 000004E9 5F                  <2> 	pop di
   341 000004EA 75DD                <2> 	jne .datarelocfind		; if not found this time,
   342                              <2> 					;  scan for next initial -->
   343 000004EC 8814                <2> 	mov byte [si], dl		; restore the original byte at counter
   344 000004EE 262B7F0A            <2> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   345 000004F2 4F                  <2> 	dec di
   346 000004F3 4F                  <2> 	dec di				; 0-based
   347 000004F4 26037F0E            <2> 	add di, word [es:bx + eldlDataAddresses]	; -> address (offset)
   348 000004F8 268B05              <2> 	mov ax, word [es:di]		; get link data from the table
   349 000004FB E80700              <2> 	call .address_data_reloc
   350                              <2> %if _ELD_RELOC_VSTART
   351 000004FE 2D[0000]            <2> 	sub ax, relocateddata		; *not* a relocation
   352                              <2> %endif
   353 00000501 0104                <2> 	add word [si], ax		; relocate
   354 00000503 EB89                <2> 	jmp .datarelocloop
   355                              <2> 
   356                              <2> .address_data_reloc:
   357 00000505 C576E8              <2> 	lds si, [bp + ?entry]		; -> entry if in ELD code instance
   358 00000508 807EF400            <2> 	cmp byte [bp + ?targetsection], 0
   359                              <2> 					; relocation in code ?
   360 0000050C 7402                <2> 	je @F				; yes -->
   361 0000050E 16                  <2> 	push ss
   362 0000050F 1F                  <2> 	pop ds				; => our ELD data block
   363                              <2> @@:
   364 00000510 C3                  <2> 	retn
   365                              <2> 
   366                              <2> .datarelocnotfound:
   367 00000511 8814                <2> 	mov byte [si], dl		; restore the original byte at counter
   368 00000513 807EF500            <2> 	cmp byte [bp + ?optional], 0	; is it an optional relocation ?
   369                              <2> %if _ELD_DEBUG
   370                              <2> 	jne @F
   371                              <2>  %ifn _ELD_LINKER_PASSES
   372                              <2> 	mov si, 0			; (invalid link)
   373                              <2> linkdatarelocation internalflags6
   374                              <2> 	test si, si
   375                              <2> 	jz .datanotfound
   376                              <2> 	mov si, 0			; (invalid link)
   377                              <2> linkdatarelocation options7
   378                              <2> 	test si, si
   379                              <2> 	jz .datanotfound
   380                              <2>  %else
   381                              <2> 	cmp byte [bp + ?pass], 0
   382                              <2> 	je .datanotfound
   383                              <2>  %endif
   384                              <2> 	houdini				; (the above conditions are for this)
   385                              <2> 	jmp .datanotfound
   386                              <2> @@:
   387                              <2> %else
   388 00000517 7417                <2> 	je .datanotfound		; no, handle as an error -->
   389                              <2> %endif
   390                              <2> 
   391                              <2> %if ELDDATA_PMREQUIRED_STATUS
   392                              <2> 	mov si, relocateddata
   393                              <2> linkdatarelocation build_option_PM
   394                              <2> 	test si, si			; is it a PM build ?
   395                              <2> 	jz @F				; no --> (treat PM required as optional)
   396                              <2> 	test byte [bp + ?optional], 2	; optional status is PM required ?
   397                              <2> 	jnz .datanotfound		; yes, handle as an error -->
   398                              <2> @@:
   399                              <2> %endif
   400                              <2> 
   401                              <2> %if _ELD_LINKER_PASSES
   402 00000519 36F606[0000]02      <2> 	testopt [ss:relocateddata], 2	; debug optional link ?
   403                              <2> linkdatarelocation options7, -3
   404 0000051F 7406                <2> 	jz @F				; no -->
   405 00000521 BE[C90B]            <2> 	mov si, lmsg.warning_data_optional
   406                              <2> internalcoderelocation
   407 00000524 E82B00              <2> 	call .notfound			; display a warning
   408                              <2> @@:
   409                              <2> %endif
   410 00000527 E8DBFF              <2> 	call .address_data_reloc
   411 0000052A 832400              <2> 	and word [si], 0		; indicate optional data link failed
   412 0000052D E95EFF              <2> 	jmp .datarelocloop
   413                              <2> 
   414                              <2> 
   415                              <2> %if _ELDCALL_OPTIONAL
   416                              <2> .coderelocnotfound:
   417                              <2> 	mov byte [si], dl		; restore the original byte at counter
   418                              <2> 	cmp byte [bp + ?optional], 0	; is it an optional relocation ?
   419                              <2> %if _ELD_DEBUG
   420                              <2> 	jne @F
   421                              <2>  %ifn _ELD_LINKER_PASSES
   422                              <2> 	mov si, 0			; (invalid link)
   423                              <2> linkdatarelocation internalflags6
   424                              <2> 	test si, si
   425                              <2> 	jz .codenotfound
   426                              <2> 	mov si, 0			; (invalid link)
   427                              <2> linkdatarelocation options7
   428                              <2> 	test si, si
   429                              <2> 	jz .codenotfound
   430                              <2>  %else
   431                              <2> 	cmp byte [bp + ?pass], 0
   432                              <2> 	je .codenotfound
   433                              <2>  %endif
   434                              <2> 	houdini				; (the above conditions are for this)
   435                              <2> 	jmp .codenotfound
   436                              <2> @@:
   437                              <2> %else
   438                              <2> 	je .codenotfound		; no, handle as an error -->
   439                              <2> %endif
   440                              <2> 
   441                              <2> %if ELDCALL_PMREQUIRED_STATUS
   442                              <2>  %if _ELD_LINKER_PASSES
   443                              <2>   %assign ELDLINKER 0
   444                              <2>  %endif
   445                              <2> 	mov si, relocateddata
   446                              <2> linkdatarelocation build_option_PM
   447                              <2>  %if _ELD_LINKER_PASSES
   448                              <2>   %assign ELDLINKER 1
   449                              <2>  %endif
   450                              <2> 	test si, si			; is it a PM build ?
   451                              <2> 	jz @F				; no --> (treat PM required as optional)
   452                              <2> 	test byte [bp + ?optional], 2	; optional status is PM required ?
   453                              <2> 	jnz .codenotfound		; yes, handle as an error -->
   454                              <2> @@:
   455                              <2> %endif
   456                              <2> 
   457                              <2> %if _ELD_LINKER_PASSES
   458                              <2> 	testopt [ss:relocateddata], 2	; debug optional link ?
   459                              <2> linkdatarelocation options7, -3
   460                              <2> 	jz @F				; no -->
   461                              <2> 	mov si, lmsg.warning_code_optional
   462                              <2> internalcoderelocation
   463                              <2> 	call .notfound			; display a warning
   464                              <2> @@:
   465                              <2> %endif
   466                              <2> 	lds si, [bp + ?entry]		; -> code site (must be in ELD cs)
   467                              <2> 	mov word [si], 9090h
   468                              <2> 	mov byte [si + 2], 90h		; indicate optional code link failed
   469                              <2> 					;  (NOP out the 3-byte call near imm)
   470                              <2> 	jmp .coderelocloop
   471                              <2> %endif
   472                              <2> 
   473                              <2> 
   474                              <2> %if _ELD_LINKER_PASSES
   475                              <2> .datanotfound:
   476 00000530 BE[EB0B]            <2> 	mov si, lmsg.error_data
   477                              <2> internalcoderelocation
   478 00000533 E81C00              <2> 	call .notfound			; display error
   479 00000536 7203E93101          <2> 	jnc .error_j			; NC if in pass 0, error out now -->
   480 0000053B FF46E2              <2> 	inc word [bp + ?amounterrors]	; count the amount of errors
   481 0000053E E94DFF              <2> 	jmp .datarelocloop		; go to next relocation entry -->
   482                              <2> 
   483                              <2> .codenotfound:
   484 00000541 BE[040C]            <2> 	mov si, lmsg.error_code
   485                              <2> internalcoderelocation
   486 00000544 E80B00              <2> 	call .notfound			; display error
   487 00000547 7203E92001          <2> 	jnc .error_j			; NC if in pass 0 -->
   488 0000054C FF46E2              <2> 	inc word [bp + ?amounterrors]	; count the amount of errors
   489 0000054F E99600              <2> 	jmp .coderelocloop		; go to next -->
   490                              <2> 
   491                              <2> .notfound:
   492 00000552 807EE400            <2> 	cmp byte [bp + ?pass], 0q	; pass 0 ?
   493 00000556 743A                <2> 	je @F				; yes, do not try displaying --> (NC)
   494 00000558 16                  <2> 	 push ss
   495 00000559 07                  <2> 	 pop es
   496 0000055A BF[0000]            <2> 	mov di, relocateddata
   497                              <2> linkdatarelocation line_out		; es:di -> line_out buffer
   498 0000055D E83300              <2> 	call .copy			; copy prefix message
   499 00000560 8B76E0              <2> 	mov si, word [bp + ?name]
   500 00000563 AD                  <2> 	lodsw				; = hash
   501 00000564 E8[0000]EB020000    <2> 	extcall hexword			; display the hash in hex
   502 0000056B 56                  <2> 	push si
   503 0000056C BE[1D0C]            <2> 	mov si, lmsg.error.2
   504                              <2> internalcoderelocation
   505 0000056F E82100              <2> 	call .copy			; display message fragment
   506 00000572 5E                  <2> 	pop si
   507                              <2> %if _ELD_LINKER_PASSES
   508 00000573 56                  <2> 	push si
   509 00000574 E81C00              <2> 	call .copy			; copy over the full name
   510 00000577 5E                  <2> 	pop si
   511 00000578 C60400              <2> 	mov byte [si], 0		; mark as failed (counter byte = 0)
   512                              <2> %else
   513                              <2> 	call .copy
   514                              <2> %endif
   515 0000057B B022                <2> 	mov al, '"'
   516 0000057D AA                  <2> 	stosb				; end message with a closing quote mark
   517 0000057E 16                  <2> 	 push ss
   518 0000057F 1F                  <2> 	 pop ds
   519 00000580 E8[0000]EB020000    <2> 	extcall putsline_crlf		; display diagnostic line
   520 00000587 B8350E              <2> 	mov ax, 0E35h
   521 0000058A E8[0000]EB020000    <2> 	extcall setrc
   522 00000591 F9                  <2> 	stc				; CY, diagnostic displayed
   523                              <2> @@:
   524 00000592 C3                  <2> 	retn
   525                              <2> 
   526                              <2> .copy:		; (cannot use extcallcall here)
   527 00000593 E8[0000]EB020000    <2> 	extcall copy_single_counted_string
   528 0000059A C3                  <2> 	retn
   529                              <2> %else
   530                              <2> .datanotfound: equ .error_j
   531                              <2> .codenotfound: equ .error_j
   532                              <2> %endif
   533                              <2> 
   534                              <2> .build_match:
   535                              <2> %if _ELD_CODE_VSTART
   536 0000059B 2D[0000]            <2> 	sub ax, code			; revert adjustment (= displacement)
   537                              <2> %endif
   538 0000059E 0346F6              <2> 	add ax, word [bp + ?instance]	; make displacement into -> name string
   539 000005A1 96                  <2> 	xchg si, ax			; si -> hash word, counted name string
   540                              <2> %if _ELD_LINKER_PASSES
   541 000005A2 8976E0              <2> 	mov word [bp + ?name], si	; save away for diagnostics
   542                              <2> %endif
   543 000005A5 AD                  <2> 	lodsw			; = hash, si -> counted string
   544 000005A6 8A14                <2> 	mov dl, byte [si]	; dl = original start byte of match
   545                              <2> %if _ELD_LINKER_PASSES
   546 000005A8 84D2                <2> 	test dl, dl		; marked as already failed ?
   547 000005AA 750A                <2> 	jnz @F
   548 000005AC 837EE200            <2> 	cmp word [bp + ?amounterrors], 0
   549                              <2> 				; validate error status
   550 000005B0 7503E9B700          <2> 	je .error_j		; no error known ?! cancel quickly -->
   551 000005B5 C3                  <2> 	retn			; (NC)
   552                              <2> 
   553                              <2> @@:
   554                              <2> %endif
   555                              <2> %if ELDOTHER
   556 000005B6 D046DE              <2> 	rol byte [bp + ?other], 1
   557 000005B9 7305                <2> 	jnc @F
   558 000005BB D046FA              <2> 	rol byte [bp + ?use_hash_other], 1
   559 000005BE EB03                <2> 	jmp @FF
   560                              <2> 
   561                              <2> @@:
   562                              <2> %endif
   563 000005C0 D046E6              <2> 	rol byte [bp + ?use_hash], 1
   564                              <2> @@:
   565                              <2> 		; If to use the hash, then ax = hash and si ->
   566                              <2> 		;  the entire symbol name as a counted string.
   567 000005C3 720A                <2> 	jc @F			; if to use hash, return now -->
   568 000005C5 AC                  <2> 	lodsb			; al = length
   569 000005C6 91                  <2> 	xchg cx, ax		; cl = length
   570 000005C7 AD                  <2> 	lodsw			; ax = prefix
   571 000005C8 49                  <2> 	dec cx
   572 000005C9 49                  <2> 	dec cx			; cl = adjusted length
   573 000005CA 4E                  <2> 	dec si			; -> second byte of prefix
   574 000005CB 8A14                <2> 	mov dl, byte [si]	; dl = original start byte of match
   575 000005CD 880C                <2> 	mov byte [si], cl	; si -> counted string suffix
   576                              <2> 		; (this name entry has been edited to provide the
   577                              <2> 		;  name suffix as a counted string, as required by
   578                              <2> 		;  the old-style non-hash link info tables.
   579                              <2> 		; it will be reset later by writing dl to si -> the
   580                              <2> 		;  first byte of the match string.)
   581                              <2> @@:
   582                              <2> %if _ELD_LINKER_PASSES
   583 000005CF F9                  <2> 	stc			; CY
   584                              <2> %endif
   585 000005D0 C3                  <2> 	retn
   586                              <2> 
   587                              <2> 
   588                              <2> .donedatareloc:
   589                              <2> %if ELDOTHER
   590 000005D1 D046DE              <2> 	rol byte [bp + ?other], 1
   591 000005D4 7303E9A801          <2> 	jc .otherdone		; other link only has data links,
   592                              <2> 				;  so at this point we're done -->
   593                              <2> %endif
   594                              <2> 
   595 000005D9 8B56F6              <2> 	mov dx, word [bp + ?instance]
   596                              <2> %if _ELD_LINKER_PASSES
   597 000005DC 8B5EE4              <2> 	mov bx, word [bp + ?pass]
   598 000005DF 01D3                <2> 	add bx, dx
   599                              <2>  %if _ELD_IDENTICALISE
   600                              <2> 	add bx, word [bp + ?lt]
   601                              <2> 	add dx, word [ltLinkCode + bx]
   602                              <2>  %else
   603 000005E1 03977808            <2> 	add dx, word [linktable - code + ltLinkCode + bx]
   604                              <2>  %endif
   605                              <2> %else
   606                              <2> 	add dx, linkercoderelocations - code
   607                              <2> %endif
   608 000005E5 8956EC              <2> 	mov word [bp + ?nextreloc], dx
   609                              <2> 
   610                              <2> .coderelocloop:
   611 000005E8 C576EC              <2> 	lds si, [bp + ?nextreloc]
   612 000005EB AD                  <2> 	lodsw
   613                              <2> %if _ELDCALL_OPTIONAL
   614                              <2> 	dec ax				; optional word is 1-based, get 0-based
   615                              <2> 	js .donecodereloc
   616                              <2> 	mov word [bp + ?targetsection_low_optional_high], ax
   617                              <2> 	lodsw
   618                              <2> %endif
   619 000005EC 0346F6              <2> 	add ax, word [bp + ?instance]
   620 000005EF 8946E8              <2> 	mov word [bp + ?entry], ax
   621 000005F2 AD                  <2> 	lodsw
   622 000005F3 8976EC              <2> 	mov word [bp + ?nextreloc], si
   623                              <2> %ifn _ELDCALL_OPTIONAL
   624 000005F6 85C0                <2> 	test ax, ax			; if no optional word, check -> match
   625 000005F8 7503E98100          <2> 	jz .donecodereloc
   626                              <2> %endif
   627 000005FD E89BFF              <2> 	call .build_match
   628                              <2> %if _ELD_LINKER_PASSES
   629 00000600 73E6                <2> 	jnc .coderelocloop
   630                              <2> %endif
   631 00000602 C45EF0              <2> 	les bx, [bp + ?linkinfo]
   632 00000605 268B4F10            <2> 	mov cx, word [es:bx + eldlCodeAmount]	; amount code link info
   633 00000609 268B7F12            <2> 	mov di, word [es:bx + eldlCodePrefixes]	; -> prefixes or hashes
   634                              <2> .coderelocfind:
   635 0000060D 83F901              <2> 	cmp cx, 1			; NZ if cx == 0
   636 00000610 F2AF                <2> 	repne scasw			; scan initial
   637                              <2> %if _ELDCALL_OPTIONAL
   638                              <2> 	jne .coderelocnotfound
   639                              <2> %else
   640                              <2>  %if _ELD_DEBUG
   641                              <2> 	je @F
   642                              <2> 	houdini
   643                              <2> 	jmp .codenotfound
   644                              <2> @@:
   645                              <2>  %else
   646 00000612 7403E92AFF          <2> 	jne .codenotfound
   647                              <2>  %endif
   648                              <2> %endif
   649 00000617 57                  <2> 	push di
   650 00000618 51                  <2> 	push cx
   651 00000619 56                  <2> 	push si
   652 0000061A 262B7F12            <2> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   653 0000061E 4F                  <2> 	dec di
   654 0000061F 4F                  <2> 	dec di				; 0-based
   655 00000620 26037F14            <2> 	add di, word [es:bx + eldlCodeEntries]	; -> entry
   656 00000624 268B3D              <2> 	mov di, [es:di]			; -> counted suffix/string
   657 00000627 B500                <2> 	mov ch, 0
   658 00000629 8A0C                <2> 	mov cl, byte [si]		; cx = length
   659 0000062B 41                  <2> 	inc cx
   660                              <2> 	; cmp al, al			; ZR if length is zero
   661 0000062C F3A6                <2> 	repe cmpsb			; match ?
   662 0000062E 5E                  <2> 	pop si
   663 0000062F 59                  <2> 	pop cx
   664 00000630 5F                  <2> 	pop di
   665 00000631 75DA                <2> 	jne .coderelocfind
   666 00000633 8814                <2> 	mov byte [si], dl
   667 00000635 262B7F12            <2> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   668 00000639 4F                  <2> 	dec di
   669 0000063A 4F                  <2> 	dec di				; 0-based
   670 0000063B 01FF                <2> 	add di, di			; quadruple index
   671 0000063D 26037F16            <2> 	add di, word [es:bx + eldlCodeAddresses]	; -> address (offset, segment)
   672 00000641 26FF35              <2> 	push word [es:di]
   673 00000644 C576E8              <2> 	lds si, [bp + ?entry]
   674 00000647 8F4405              <2> 	pop word [si + 3 + 2]		; call near imm (3), jmp short (2)
   675                              <2> 					;  patch the destination address
   676 0000064A 803CE8              <2> 	cmp byte [si], 0E8h		; is it as expected ?
   677 0000064D 751D                <2> 	jne .error_j
   678 0000064F 268B7D02            <2> 	mov di, word [es:di + 2]
   679 00000653 BB[0000]            <2> 	mov bx, relocateddata
   680                              <2> linkdatarelocation linkcall_table	; ss:bx -> link call table
   681 00000656 36833F01            <2> 	cmp word [ss:bx], 1		; is it initialised to format 1 ?
   682 0000065A 7510                <2> 	jne .error_j			; no -->
   683 0000065C 368B4F02            <2> 	mov cx, word [ss:bx + 2]	; get amount of segments
   684 00000660 E30A                <2> 	jcxz .error_j			; none -->
   685                              <2> @@:
   686 00000662 83C304              <2> 	add bx, 4			; -> next segment
   687 00000665 36393F              <2> 	cmp word [ss:bx], di		; value matches ?
   688 00000668 7405                <2> 	je @F				; yes, found -->
   689 0000066A E2F6                <2> 	loop @B				; try remaining segments
   690                              <2> .error_j:
   691 0000066C E93701              <2> 	jmp .error
   692                              <2> 
   693                              <2> @@:
   694 0000066F 368B5F02            <2> 	mov bx, word [ss:bx + 2]	; -> call destination offset
   695                              <2> 		; si + 3 + delta = bx
   696                              <2> 		; delta = bx - si - 3
   697 00000673 29F3                <2> 	sub bx, si
   698 00000675 83EB03              <2> 	sub bx, 3
   699 00000678 895C01              <2> 	mov word [si + 1], bx		; patch the call instruction
   700 0000067B E96AFF              <2> 	jmp .coderelocloop
   701                              <2> 
   702                              <2> .donecodereloc:
   703                              <2> %if _ELD_LINKER_PASSES
   704 0000067E 8B46E2              <2> 	mov ax, word [bp + ?amounterrors]
   705 00000681 85C0                <2> 	test ax, ax
   706 00000683 75E7                <2> 	jnz .error_j
   707 00000685 8B5EE4              <2> 	mov bx, word [bp + ?pass]
   708 00000688 85DB                <2> 	test bx, bx
   709 0000068A 750B                <2> 	jnz @F
   710 0000068C 43                  <2> 	inc bx
   711 0000068D 43                  <2> 	inc bx
   712 0000068E 895EE4              <2> 	mov word [bp + ?pass], bx
   713 00000691 8B56F6              <2> 	mov dx, word [bp + ?instance]
   714 00000694 E973FD              <2> 	jmp .pass
   715                              <2> 
   716                              <2> @@:
   717                              <2> %endif
   718                              <2> 
   719                              <2> %ifnidni _LISTING, ""
   720                              <2> %assign ELDLINKER 0
   721                              <2> .hint:
   722 00000697 16                  <2> 	push ss
   723 00000698 1F                  <2> 	pop ds
   724 00000699 B02D                <2> 	mov al, 2Dh
   725 0000069B E8[0000]EB020000    <2> 	extcall intchk			; ZR if offset = -1 or segment = 0
   726                              <2> 					; CHG: ax, dx, bx
   727 000006A2 7437                <2> 	jz .no_hint
   728                              <2> 
   729 000006A4 8A26[0000]          <2> 	mov ah, byte [relocateddata]
   730                              <2> linkdatarelocation try_debugger_amis_multiplex_number
   731 000006A8 E80201              <2> 	call plex_check
   732 000006AB 7305                <2> 	jnc @F
   733                              <2> 
   734 000006AD B4FF                <2> 	mov ah, 0FFh		; start with multiplex number 0FFh
   735                              <2> .loop_hint:
   736 000006AF E8FB00              <2> 	call plex_check
   737                              <2> @@:
   738 000006B2 7307                <2> 	jnc .end_hint		; if found --> (NC)
   739 000006B4 80EC01              <2> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   740 000006B7 73F6                <2> 	jnc .loop_hint		; try next if we didn't check all yet -->
   741 000006B9 EB20                <2> 	jmp .no_hint
   742                              <2> 
   743                              <2> .end_hint:
   744 000006BB 50                  <2> 	push ax
   745 000006BC C446F6              <2> 	les ax, [bp + ?instance]
   746 000006BF BF[EC09]            <2> 	mov di, listmsg.hint.offset
   747                              <2> internalcoderelocation
   748 000006C2 E8[0000]EB020000    <2> 	extcall hexword
   749 000006C9 BB[CA09]            <2> 	mov bx, listmsg.hint
   750                              <2> internalcoderelocation
   751 000006CC 368B16[0000]        <2> 	mov dx, [ss:relocateddata]
   752                              <2> linkdatarelocation extseg	; must be 86 Mode segment even in PM
   753 000006D1 58                  <2> 	pop ax
   754 000006D2 B040                <2> 	mov al, 40h		; AMIS message display service
   755 000006D4 E8[0000]EB020000    <2> 	extcall call_int2D
   756                              <2> .no_hint:
   757                              <2> %endif
   758                              <2> 
   759                              <2> %if ELDOTHER
   760                              <2> %assign ELDLINKER 0
   761 000006DB F656DE              <2> 	not byte [bp + ?other]
   762                              <2> 
   763 000006DE 16                  <2> 	push ss
   764 000006DF 1F                  <2> 	pop ds
   765 000006E0 B02D                <2> 	mov al, 2Dh
   766 000006E2 E8[0000]EB020000    <2> 	extcall intchk			; ZR if offset = -1 or segment = 0
   767                              <2> 					; CHG: ax, dx, bx
   768 000006E9 747E                <2> 	jz .no_other
   769                              <2> 
   770 000006EB 8A26[0000]          <2> 	mov ah, byte [relocateddata]
   771                              <2> linkdatarelocation try_debugger_amis_multiplex_number
   772 000006EF E8BB00              <2> 	call plex_check
   773 000006F2 7305                <2> 	jnc @F
   774                              <2> 
   775 000006F4 B4FF                <2> 	mov ah, 0FFh		; start with multiplex number 0FFh
   776                              <2> .loop_other:
   777 000006F6 E8B400              <2> 	call plex_check
   778                              <2> @@:
   779 000006F9 7307                <2> 	jnc .end_other		; if found --> (NC)
   780 000006FB 80EC01              <2> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   781 000006FE 73F6                <2> 	jnc .loop_other		; try next if we didn't check all yet -->
   782 00000700 EB67                <2> 	jmp .no_other
   783                              <2> 
   784                              <2> .end_other:
   785 00000702 B042                <2> 	mov al, 42h		; AMIS get other link info service
   786 00000704 E8[0000]EB020000    <2> 	extcall call_int2D
   787 0000070B 3CFF                <2> 	cmp al, 0FFh
   788 0000070D 755A                <2> 	jne .no_other
   789                              <2> 
   790 0000070F 89F0                <2> 	mov ax, si		; selector => PSP
   791 00000711 E8[0000]EB020000    <2> 	extcall ispm
   792 00000718 7402                <2> 	jz @F
   793 0000071A 89D0                <2> 	mov ax, dx		; segment => PSP
   794                              <2> @@:
   795 0000071C 16                  <2> 	 push ss
   796 0000071D 1F                  <2> 	 pop ds
   797 0000071E A3[0000]            <2> 	mov word [otherds], ax
   798                              <2> internaldatarelocation		; current mode sel/seg
   799 00000721 8916[0200]          <2> 	mov word [otherseg], dx
   800                              <2> internaldatarelocation		; remember segment
   801                              <2> 
   802 00000725 89C8                <2> 	mov ax, cx		; selector => link info
   803 00000727 E8[0000]EB020000    <2> 	extcall ispm
   804 0000072E 7402                <2> 	jz @F
   805 00000730 89D8                <2> 	mov ax, bx		; segment => link info
   806                              <2> @@:
   807 00000732 897EFC              <2> 	mov word [bp + ?linkinfo_other], di
   808 00000735 8946FE              <2> 	mov word [bp + ?linkinfo_other + 2], ax
   809                              <2> 
   810 00000738 8ED8                <2> 	mov ds, ax		; => link info
   811 0000073A 31C0                <2> 	xor ax, ax
   812 0000073C 813DD1E1            <2> 	cmp word [di + eldlSignature], 0E1D1h
   813 00000740 7516                <2> 	jne .error_other
   814 00000742 837D0601            <2> 	cmp word [di + eldlUseLinkHash], 1
   815 00000746 7710                <2> 	ja .error_other
   816 00000748 7201                <2> 	jb @F
   817 0000074A 48                  <2> 	dec ax
   818                              <2> @@:
   819 0000074B 8946FA              <2> 	mov word [bp + ?use_hash_other], ax
   820                              <2> 
   821 0000074E 8B56F6              <2> 	mov dx, word [bp + ?instance]
   822 00000751 81C2A009            <2> 	add dx, linkerotherdatarelocations - code
   823 00000755 E933FD              <2> 	jmp .otherloop
   824                              <2> 
   825                              <2> .error_other:
   826 00000758 0E                  <2> 	push cs
   827 00000759 1F                  <2> 	pop ds
   828 0000075A B8330E              <2> 	mov ax, 0E33h
   829 0000075D E8[0000]EB020000    <2> 	extcall setrc
   830 00000764 BA[500C]            <2> 	mov dx, lmsg.error_other
   831                              <2> internalcoderelocation
   832 00000767 EB0F                <2> 	jmp @F
   833                              <2> 
   834                              <2> .no_other:
   835 00000769 0E                  <2> 	push cs
   836 0000076A 1F                  <2> 	pop ds
   837 0000076B B8340E              <2> 	mov ax, 0E34h
   838 0000076E E8[0000]EB020000    <2> 	extcall setrc
   839 00000775 BA[280C]            <2> 	mov dx, lmsg.no_other
   840                              <2> internalcoderelocation
   841                              <2> @@:
   842 00000778 E8[0000]EB020000    <2> 	extcall putsz
   843                              <2> .error_j2:
   844 0000077F EB25                <2> 	jmp .error
   845                              <2> 
   846                              <2> .otherdone:
   847                              <2>  %if _ELD_LINKER_PASSES
   848 00000781 8B46E2              <2> 	mov ax, word [bp + ?amounterrors]
   849 00000784 85C0                <2> 	test ax, ax
   850 00000786 75F7                <2> 	jnz .error_j2
   851                              <2>  %endif
   852                              <2> %endif
   853                              <2> 
   854 00000788 5B                  <2> 	pop bx				; -> our heap data
   855 00000789 5E                  <2> 	pop si				; -> our command line tail
   856 0000078A 16                  <2> 	 push ss
   857 0000078B 1F                  <2> 	 pop ds
   858 0000078C C47EF6              <2> 	les di, [bp + ?instance]
   859 0000078F 268B4502            <2> 	mov ax, word [es:di + eldiEndCode]
   860                              <2> houdini
   861 00000793 2D[E003]            <2> 	sub ax, strict word endresident + code
   862                              <2> internalcoderelocation
   863 00000796 26C74502[E003]      <2> 	mov word [es:di + eldiEndCode], endresident + code
   864                              <2> internalcoderelocation
   865 0000079C 2906[0000]          <2> 	sub word [relocateddata], ax
   866                              <2> linkdatarelocation extseg_used
   867                              <2> %if _DATA_SIZE == 0
   868                              <2> 	xor ax, ax
   869                              <2> 	mov word [es:di + eldiStartData], ax
   870                              <2> 	mov word [es:di + eldiEndData], ax
   871                              <2> %endif
   872 000007A0 89EC5D              <2> 	lleave code
   873                              <2> 		; INP:	es => ELD code segment
   874                              <2> 		;	ds:si -> command line tail
   875                              <2> 		;	ds:bx -> ELD data block
   876                              <2> 		;	ss:sp -> far return address for current mode
   877                              <2> 		; STT:	ds = ss, UP, EI
   878 000007A3 E9AAFB              <2> 	jmp start
   879                              <2> 
   880                              <2> .error:
   881 000007A6 89EC5D              <2> 	lleave
   882 000007A9 B8FFFF              <2> 	mov ax, -1
   883 000007AC CB                  <2> 	retf
   884                              <2> 
   885                              <2> 
   886                              <2> %ifnidni _LISTING, ""
   887                              <2>  %assign ELDHINT 1
   888                              <2> %else
   889                              <2>  %assign ELDHINT 0
   890                              <2> %endif
   891                              <2> 
   892                              <2> %if ELDOTHER || ELDHINT
   893                              <2> 		; INP:	ah = multiplex number to check
   894                              <2> 		; OUT:	CY if multiplex number unused or no signature match,
   895                              <2> 		;	 bp, ah, ds unmodified
   896                              <2> 		;	NC if match found,
   897                              <2> 		;	 ah = multiplex number (unmodified)
   898                              <2> 		; CHG:	si, di, es, cx, dx
   899                              <2> plex_check:
   900 000007AD 16                  <2> 	push ss
   901 000007AE 1F                  <2> 	pop ds
   902 000007AF F606[0000]08        <2> 	testopt [relocateddata], 8
   903                              <2> linkdatarelocation internalflags4, -3
   904 000007B4 740B                <2> 	jz @F
   905 000007B6 BE[0000]            <2> 	mov si, relocateddata
   906                              <2> linkdatarelocation amis_multiplex_number, -2, optional
   907 000007B9 85F6                <2> 	test si, si
   908 000007BB 7404                <2> 	jz @F
   909 000007BD 3A24                <2> 	cmp ah, byte [si]
   910 000007BF 7420                <2> 	je .notfound		; do not use our own multiplexer -->
   911                              <2> @@:
   912 000007C1 B000                <2> 	mov al, 00h		; AMIS installation check
   913 000007C3 E8[0000]EB020000    <2> 	extcall call_int2D	; AMIS (or "DOS reserved" = iret if no AMIS present)
   914 000007CA 3CFF                <2> 	cmp al, 0FFh
   915 000007CC 7513                <2> 	jne .notfound
   916 000007CE 0E                  <2> 	push cs
   917 000007CF 1F                  <2> 	pop ds
   918 000007D0 BE[BA09]            <2> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
   919                              <2> internalcoderelocation
   920 000007D3 E8[0000]EB020000    <2> 	extcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
   921 000007DA B90800              <2> 	mov cx, 8		; Ignore description, only compare vendor and program name
   922 000007DD F3A7                <2> 	repe cmpsw
   923 000007DF 7401                <2> 	je .checkret		; ZR, NC = match -->
   924                              <2> .notfound:
   925 000007E1 F9                  <2> 	stc			; CY no match
   926                              <2> .checkret:
   927 000007E2 C3                  <2> 	retn
   928                              <2> %endif
   929                              <2> 
   930                              <2> 
   931 000007E3 00                  <2> 	align 4, db 0
   932                              <2> linkercoderelocations:
   933                              <2> %if _ELDCALL_OPTIONAL
   934                              <2> 	dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
   935                              <2> %else
   936 000007E4 2200[F409]F002-     <2> 	dw ELDCALL_CODE_RELOCATIONS, 0, 0
   936 000007EA [030A]F802[0F0A]00- <2>
   936 000007F1 03[1B0A]0803[220A]- <2>
   936 000007F8 1003[2D0A]1803-     <2>
   936 000007FE [340A]2003[3D0A]28- <2>
   936 00000805 03[450A]3003[4D0A]- <2>
   936 0000080C 3803[560A]4003-     <2>
   936 00000812 [5E0A]4803[680A]93- <2>
   936 00000819 03[340A]9B06[950A]- <2>
   936 00000820 C206[5E0A]D406-     <2>
   936 00000826 [9E0A]E206[950A]04- <2>
   936 0000082D 07[9E0A]1107[1B0A]- <2>
   936 00000834 2707[1B0A]5D07-     <2>
   936 0000083A [450A]6E07[450A]78- <2>
   936 00000841 07[3D0A]C307[9E0A]- <2>
   936 00000848 D307[220A]00000000  <2>
   937                              <2> %endif
   938                              <2> 
   939                              <2> %if _ELD_LINKER_PASSES
   940                              <2> linkerlinkercoderelocations:
   941                              <2> %if _ELDCALL_OPTIONAL
   942                              <2> 	dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
   943                              <2> %else
   944 00000850 6405[5E0A]8005-     <2> 	dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
   944 00000856 [680A]8A05[450A]93- <2>
   944 0000085D 05[780A]00000000    <2>
   945                              <2> %endif
   946                              <2> 
   947                              <2> 	align 2, db 0
   948                              <2> linktable:
   949                              <2> 	istruc LINKTABLE
   950                              <2> at ltCodeToCode
   951 00000864 9009                <2> 	dw internallinkercodetocoderelocations - code
   952 00000866 0E09                <2> 	dw internalcodetocoderelocations - code
   953                              <2> at ltCodeToData
   954 00000868 9A09                <2> 	dw internallinkercodetodatarelocations - code
   955 0000086A 3A09                <2> 	dw internalcodetodatarelocations - code
   956                              <2> at ltDataToCode
   957 0000086C 9C09                <2> 	dw internallinkerdatatocoderelocations - code
   958 0000086E 7809                <2> 	dw internaldatatocoderelocations - code
   959                              <2> at ltDataToData
   960 00000870 9E09                <2> 	dw internallinkerdatatodatarelocations - code
   961 00000872 7A09                <2> 	dw internaldatatodatarelocations - code
   962                              <2> at ltLinkData
   963 00000874 7C09                <2> 	dw linkerlinkerdatarelocations - code
   964 00000876 7C08                <2> 	dw linkerdatarelocations - code
   965                              <2> at ltLinkCode
   966 00000878 5008                <2> 	dw linkerlinkercoderelocations - code
   967 0000087A E407                <2> 	dw linkercoderelocations - code
   968                              <2> 	iend
   969                              <2> %endif
   970                              <2> 
   971                              <2> 	align 2, db 0
   972                              <2> linkerdatarelocations:
   973 0000087C 01004700[AB0A]0100- <2> 	dw LINK_DATA_RELOCATIONS, 0
   973 00000884 4900[B50A]01004C00- <2>
   973 0000088C [BE0A]01007200-     <2>
   973 00000892 [CE0A]01007B00-     <2>
   973 00000898 [D90A]01008700-     <2>
   973 0000089E [E20A]0100AB00-     <2>
   973 000008A4 [E20A]01006E02-     <2>
   973 000008AA [F80A]0100C202-     <2>
   973 000008B0 [F80A]01005903-     <2>
   973 000008B6 [030B]01006103-     <2>
   973 000008BC [110B]01007203-     <2>
   973 000008C2 [1B0B]01008203-     <2>
   973 000008C8 [260B]01008F03-     <2>
   973 000008CE [340B]0100A603-     <2>
   973 000008D4 [260B]0100AA03-     <2>
   973 000008DA [E20A]0100C503-     <2>
   973 000008E0 [E20A]0100CB03-     <2>
   973 000008E6 [1B0B]0100A606-     <2>
   973 000008EC [540B]0100CF06-     <2>
   973 000008F2 [D90A]0100ED06-     <2>
   973 000008F8 [540B]01009E07-     <2>
   973 000008FE [260B]0100B107-     <2>
   973 00000904 [790B]0101B707-     <2>
   973 0000090A [8A0B]0000          <2>
   974                              <2> 
   975                              <2> 	align 2, db 0
   976                              <2> internalcodetocoderelocations:
   977 0000090E 8200CF002A013D0150- <2> 	dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
   977 00000917 016A0179037E038603- <2>
   977 00000920 8B03A203AD03C003C7- <2>
   977 00000929 03C006CA0665077607- <2>
   977 00000932 94079A07D1070000    <2>
   978                              <2> 
   979                              <2> 	align 2, db 0
   980                              <2> internalcodetodatarelocations:
   981 0000093A 340054006400D300E4- <2> 	dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
   981 00000943 00F8000A011D012D01- <2>
   981 0000094C 350140014801530162- <2>
   981 00000955 016E017B019901F101- <2>
   981 0000095E F90100020802290231- <2>
   981 00000967 02380240024A027302- <2>
   981 00000970 D1031F0723070000    <2>
   982                              <2> 
   983                              <2> 	align 2, db 0
   984                              <2> internaldatatocoderelocations:
   985 00000978 FFFF                <2> 	dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
   986                              <2> 
   987                              <2> 	align 2, db 0
   988                              <2> internaldatatodatarelocations:
   989 0000097A FFFF                <2> 	dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
   990                              <2> 
   991                              <2> %if _ELD_LINKER_PASSES
   992                              <2> 	align 2, db 0
   993                              <2> linkerlinkerdatarelocations:
   994 0000097C 01001C05[1B0B]0100- <2> 	dw LINK_LINKER_DATA_RELOCATIONS, 0
   994 00000984 5B05[F80A]01005406- <2>
   994 0000098C [430B]0000          <2>
   995                              <2> 
   996                              <2> 	align 2, db 0
   997                              <2> internallinkercodetocoderelocations:
   998 00000990 2205310542056D0500- <2> 	dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
   998 00000999 00                  <2>
   999                              <2> 
  1000                              <2> 	align 2, db 0
  1001                              <2> internallinkercodetodatarelocations:
  1002 0000099A 0000                <2> 	dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
  1003                              <2> 
  1004                              <2> 	align 2, db 0
  1005                              <2> internallinkerdatatocoderelocations:
  1006 0000099C FFFF                <2> 	dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
  1007                              <2> 
  1008                              <2> 	align 2, db 0
  1009                              <2> internallinkerdatatodatarelocations:
  1010 0000099E FFFF                <2> 	dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
  1011                              <2> %endif
  1012                              <2> 
  1013                              <2> %if ELDOTHER
  1014                              <2> 	align 2, db 0
  1015                              <2> linkerotherdatarelocations:
  1016 000009A0 01006100[A20B]0101- <2> 	dw LINK_OTHER_DATA_RELOCATIONS, 0
  1016 000009A8 EB00[AA0B]01004D02- <2>
  1016 000009B0 [BA0B]01006B02-     <2>
  1016 000009B6 [BA0B]0000          <2>
  1017                              <2> 
  1018                              <2>  %ifnidn LINK_OTHER_LINKER_DATA_RELOCATIONS, ""
  1019                              <2>   %error Other linker data links not supported
  1020                              <2>  %endif
  1021                              <2> %endif
  1022                              <2> 
  1023                              <2> %if ELDOTHER || ELDHINT
  1024                              <2> 	align 2, db 0
  1025                              <2> debuggeramissig:
  1026 000009BA 65636D20<rep 5h>    <2> 		fill 8, 32, db "ecm"
  1027 000009C2 6C446562756720-     <2> 		fill 8, 32, db "lDebug"
  1027 000009C2 <rep 2h>            <2>
  1028                              <2> %endif
  1029                              <2> 
  1030                              <2> %ifnidni _LISTING, ""
  1031                              <2> listmsg:
  1032 000009CA 547261634C6973742D- <2> .hint:		db "TracList-add-offset=",_LISTING,"::"
  1032 000009D3 6164642D6F66667365- <2>
  1032 000009DC 743D696E73746E6F74- <2>
  1032 000009E5 682E6C73743A3A      <2>
  1033 000009EC 2D2D2D2D680D0A00    <2> .hint.offset:	asciz "----h",13,10
  1034                              <2> %endif
  1035                              <2> 
  1036 000009F4 30CD0C636D64335F6E- <2> 	eldcall_dump_names ELDCALL_CODE_NAMES
  1036 000009FD 6F745F657874D55509- <2>
  1036 00000A06 736B6970636F6D6D61- <2>
  1036 00000A0F 03C309697373747269- <2>
  1036 00000A18 6E673F289004697370- <2>
  1036 00000A21 6DB774087365746573- <2>
  1036 00000A2A 326478BABD04636D64- <2>
  1036 00000A33 33DDB90663686B656F- <2>
  1036 00000A3C 6C551205707574737A- <2>
  1036 00000A45 B212057365747263E8- <2>
  1036 00000A4E 3A066973656F6C3FA7- <2>
  1036 00000A57 AA056572726F728481- <2>
  1036 00000A60 07686578776F72646F- <2>
  1036 00000A69 A20D707574736C696E- <2>
  1036 00000A72 655F63726C66D0BB1A- <2>
  1036 00000A7B 636F70795F73696E67- <2>
  1036 00000A84 6C655F636F756E7465- <2>
  1036 00000A8D 645F737472696E6798- <2>
  1036 00000A96 6906696E7463686B21- <2>
  1036 00000A9F 300A63616C6C5F696E- <2>
  1036 00000AA8 743244              <2>
  1037 00000AAB C30B076C617374636D- <2> 	link_data_dump_names LINK_DATA_NAMES
  1037 00000AB4 646B5D06646D79636D- <2>
  1037 00000ABD 6454400D6D73672E75- <2>
  1037 00000AC6 6E696E7374616C6CEB- <2>
  1037 00000ACF 420865787464737365- <2>
  1037 00000AD8 6CD52D066578747365- <2>
  1037 00000AE1 6797B6136578745F63- <2>
  1037 00000AEA 6F6D6D616E645F6861- <2>
  1037 00000AF3 6E646C657284E3086C- <2>
  1037 00000AFC 696E655F6F75748D71- <2>
  1037 00000B05 0B6D73672E696E7374- <2>
  1037 00000B0E 616C6C7DCF076D7367- <2>
  1037 00000B17 2E72756E5ABC086F70- <2>
  1037 00000B20 74696F6E7337E7D30B- <2>
  1037 00000B29 6578747365675F7573- <2>
  1037 00000B32 6564B2400C65787464- <2>
  1037 00000B3B 6174615F7573656468- <2>
  1037 00000B44 440E6C696E6B63616C- <2>
  1037 00000B4D 6C5F7461626C65F09E- <2>
  1037 00000B56 227472795F64656275- <2>
  1037 00000B5F 676765725F616D6973- <2>
  1037 00000B68 5F6D756C7469706C65- <2>
  1037 00000B71 785F6E756D626572CB- <2>
  1037 00000B7A 510E696E7465726E61- <2>
  1037 00000B83 6C666C61677334688C- <2>
  1037 00000B8C 15616D69735F6D756C- <2>
  1037 00000B95 7469706C65785F6E75- <2>
  1037 00000B9E 6D626572            <2>
  1038                              <2> %if ELDOTHER
  1039 00000BA2 0A0A05647373656CF1- <2> 	link_data_dump_names LINK_OTHER_DATA_NAMES
  1039 00000BAB 060D696E7374616C6C- <2>
  1039 00000BB4 666F726D61744D180C- <2>
  1039 00000BBD 696E7374616C6C666C- <2>
  1039 00000BC6 616773              <2>
  1040                              <2> %endif
  1041                              <2> 
  1042                              <2> lmsg:
  1043                              <2> %if _ELD_LINKER_PASSES
  1044                              <2> %if _ELDCALL_OPTIONAL
  1045                              <2> .warning_code_optional:		counted "Optional code link missing, hash="
  1046                              <2> %endif
  1047 00000BC9 214F7074696F6E616C- <2> .warning_data_optional:		counted "Optional data link missing, hash="
  1047 00000BD2 2064617461206C696E- <2>
  1047 00000BDB 6B206D697373696E67- <2>
  1047 00000BE4 2C20686173683D      <2>
  1048 00000BEB 1844617461206C696E- <2> .error_data:			counted "Data link missing, hash="
  1048 00000BF4 6B206D697373696E67- <2>
  1048 00000BFD 2C20686173683D      <2>
  1049 00000C04 18436F6465206C696E- <2> .error_code:			counted "Code link missing, hash="
  1049 00000C0D 6B206D697373696E67- <2>
  1049 00000C16 2C20686173683D      <2>
  1050 00000C1D 0A682C206C6162656C- <2> .error.2:			counted "h, label ",'"'
  1050 00000C26 2022                <2>
  1051                              <2> %endif
  1052                              <2> %if ELDOTHER
  1053 00000C28 454C44206C696E6B65- <2> .no_other:		asciz "ELD linker: No other link info found!",13,10
  1053 00000C31 723A204E6F206F7468- <2>
  1053 00000C3A 6572206C696E6B2069- <2>
  1053 00000C43 6E666F20666F756E64- <2>
  1053 00000C4C 210D0A00            <2>
  1054 00000C50 454C44206C696E6B65- <2> .error_other:		asciz "ELD linker: Other link info unknown format!",13,10
  1054 00000C59 723A204F7468657220- <2>
  1054 00000C62 6C696E6B20696E666F- <2>
  1054 00000C6B 20756E6B6E6F776E20- <2>
  1054 00000C74 666F726D6174210D0A- <2>
  1054 00000C7D 00                  <2>
  1055                              <2> %endif
  1056                              <2> 
  1057 00000C7E 00<rep 2h>          <2> 	align 16, db 0
   742                              <1> 
   743                              <1> 	align 16
   744                              <1> code_size equ $ - code
