     1                                  
     2                                  ; Public Domain
     3                                  
     4                                  ; test install command: install; .; history uninstall
     5                                  ; test run command: ; .; .
     6                                  
     7                                  %include "lmacros3.mac"
     1                              <1> [list -]
    14                              <2> [list -]
    14                              <1> [list -]
     8                                  %include "eld.mac"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> Extensions for lDebug macros
     4                              <1> 
     5                              <1> Copyright (C) 2008-2023 E. C. Masloch
     6                              <1> 
     7                              <1> Usage of the works is permitted provided that this
     8                              <1> instrument is retained with the works, so that any entity
     9                              <1> that uses the works is notified of this instrument.
    10                              <1> 
    11                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <1> 
    13                              <1> %endif
    14                              <1> 
    15                              <1> %ifndef ELD_MAC
    16                              <1> %define ELD_MAC 1
    17                              <1> 
    18                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
    19                              <1> 
    20                              <1> 		; ELD executable header
    21                              <1> 	struc ELD_HEADER
    22 00000000 ????????            <1> eldhSignature:		resb 4	; "ELD1"
    23 00000004 ??????              <1> 			resb 3	; reserved
    24 00000007 ??                  <1> 			resb 1	; 26 (Ctrl-Z)
    25 00000008 ????????            <1> eldhCodeOffset:		resd 1	; position displacement from eldhSignature
    26 0000000C ????                <1> eldhCodeImageLength:	resw 1	; amount bytes, at least 32
    27 0000000E ????                <1> eldhCodeAllocLength:	resw 1	; amount bytes, added to prior. sum < 64 KiB
    28 00000010 ????????            <1> eldhDataOffset:		resd 1
    29 00000014 ????                <1> eldhDataImageLength:	resw 1	; (zero allowed)
    30 00000016 ????                <1> eldhDataAllocLength:	resw 1	; (zero allowed)
    31 00000018 ????                <1> eldhCodeEntrypoint:	resw 1	; within code section, used as displacement
    32 0000001A ????????            <1> eldhReserved:		resb 4	; reserved
    33 0000001E ????                <1> eldhExtensionSize:	resw 1	; from eldhSignature, -> past eldhx fields in use
    34                              <1> 	endstruc
    35                              <1> 	endarea ELD_HEADER, 1
    36                              <1> 
    37                              <1> 	struc ELD_HEADERX
    38 00000000 <res 20h>           <1> eldhxHeader:		resb ELD_HEADER_size
    39 00000020 ????????            <1> eldhxDescriptionOffset:	resd 1	; zero if none, from eldhxHeader. <= 128 Bytes
    40 00000024 ????????            <1> eldhxHelpOffset:	resd 1	; zero if none, from eldhxHeader
    41 00000028 ????????            <1> eldhxLibTable:		resd 1	; zero if none, from eldhxHeader
    42 0000002C ????????            <1> 	alignb 16
    43                              <1> 	endstruc
    44                              <1> 
    45                              <1> 	struc ELD_LIBTABLE
    46 00000000 ????                <1> eldltFormat:		resw 1	; current: 0 = uncompressed, 2 = compressed
    47 00000002 ????                <1> eldltAmount:		resw 1
    48 00000004 ????????            <1> eldltOffset:		resd 1	; from eldhxHeader
    49                              <1> eldltCompressedLength:		; (dword, only present if format 2)
    50                              <1> 	endstruc
    51                              <1> 	endarea ELD_LIBTABLE, 1
    52                              <1> 
    53                              <1> 		; ELD instance header
    54                              <1> 	struc ELD_INSTANCE
    55 00000000 ????                <1> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    56 00000002 ????                <1> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    57 00000004 ????                <1> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    58 00000006 ????                <1> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    59 00000008 ????????????????    <1> eldiIdentifier:		resb 8	; blank-filled text
    60 00000010 ????                <1> eldiFlags:		resw 1	; flags
    61                              <1> eldiListing_size equ 14
    62 00000012 <res Eh>            <1> eldiListing:		resb eldiListing_size
    63                              <1> 				; ASCIZ listing file name
    64                              <1> 	endstruc
    65                              <1> 		; flags for eldiFlags:
    66                              <1> eldifResident:		equ 1
    67                              <1> 
    68                              <1> 		; ELD link info header
    69                              <1> 	struc ELD_LINKINFO
    70 00000000 ????                <1> eldlSignature:		resw 1	; 0E1D1h
    71 00000002 ????????            <1> eldlReserved:		resw 2
    72 00000006 ????                <1> eldlUseLinkHash:	resw 1
    73 00000008 ????                <1> eldlDataAmount:		resw 1
    74 0000000A ????                <1> eldlDataPrefixes:	resw 1
    75 0000000C ????                <1> eldlDataEntries:	resw 1
    76 0000000E ????                <1> eldlDataAddresses:	resw 1
    77 00000010 ????                <1> eldlCodeAmount:		resw 1
    78 00000012 ????                <1> eldlCodePrefixes:	resw 1
    79 00000014 ????                <1> eldlCodeEntries:	resw 1
    80 00000016 ????                <1> eldlCodeAddresses:	resw 1
    81                              <1> 	endstruc
    82                              <1> 
    83                              <1> 	numdef ELD_CODE_VSTART, 9001h
    84                              <1> 	numdef ELD_DATA_VSTART, 8000h
    85                              <1> 	numdef ELD_RELOC_VSTART, 8000h
    86                              <1> 
    87                              <1> 	numdef ELD_RECLAIM_HINT, 0
    88                              <1> 	strdef ELD_LISTING, ""
    89                              <1> 
    90                              <1> %endif
     9                                  %include "eldcall.mac"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> Extensions for lDebug call macros
     4                              <1> 
     5                              <1> Copyright (C) 2008-2023 E. C. Masloch
     6                              <1> 
     7                              <1> Usage of the works is permitted provided that this
     8                              <1> instrument is retained with the works, so that any entity
     9                              <1> that uses the works is notified of this instrument.
    10                              <1> 
    11                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <1> 
    13                              <1> %endif
    14                              <1> 
    15                              <1> %ifndef ELDCALL_MAC
    16                              <1> %define ELDCALL_MAC 1
    17                              <1> 
    18                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
    19                              <1> %include "nasmhash.mac"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> Hashing macros
     5                              <2>  by E. C. Masloch, 2019
     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 __NASMHASH_MAC__
    16                              <2> %assign __NASMHASH_MAC__ 1
    17                              <2> 
    18                              <2> 
    19                              <2> 	%macro hashdef 2+.nolist
    20                              <2> %ifempty %2
    21                              <2>  %assign _%1 1
    22                              <2> %else
    23                              <2> %ifstr %2
    24                              <2>  %define %%string %2
    25                              <2> %elifid %2
    26                              <2>  %defstr %%string %2
    27                              <2> %elifnum %2
    28                              <2>  %defstr %%string %2
    29                              <2> %eliftok %2
    30                              <2>  %defstr %%string %2
    31                              <2> %else
    32                              <2>  %error Unknown input
    33                              <2> %endif
    34                              <2> %strlen %%length %%string
    35                              <2> %assign %%hash 1
    36                              <2> %assign %%index 1
    37                              <2> %rep %%length
    38                              <2>  %substr %%char %%string %%index
    39                              <2>  %assign %%hash (%%hash * 31 + %%char) & 0FFFFh
    40                              <2>  %assign %%index %%index + 1
    41                              <2> %endrep
    42                              <2> %assign _%1 %%hash
    43                              <2> %endif
    44                              <2> 	%endmacro
    45                              <2> 
    46                              <2> 
    47                              <2> %endif
    20                              <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-2023 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"
     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 "eldcheck.mac"
     1                              <3> %if 0
     2                              <3> 
     3                              <3> Extensions for lDebug relocation check macros
     4                              <3> 
     5                              <3> Copyright (C) 2008-2023 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 ELDCHECK_MAC
    16                              <3> %define ELDCHECK_MAC 1
    17                              <3> 
    18                              <3> %assign ELDSTRICT 0
    19                              <3> %assign ELDSTRICTCOUNTER 0
    20                              <3> 
    21                              <3> 	%imacro eldstrict 1.nolist
    22                              <3> %ifidni %1, on
    23                              <3>  %assign ELDSTRICT 1
    24                              <3>  [warning +error=reloc-abs]
    25                              <3>  [warning +reloc-abs]
    26                              <3> %elifidni %1, off
    27                              <3>  %assign ELDSTRICT 0
    28                              <3>  [warning -reloc-abs]
    29                              <3> %else
    30                              <3>  %error Unknown keyword
    31                              <3> %endif
    32                              <3> 	%endmacro
    33                              <3> 
    34                              <3> 	%imacro reloc 1+.nolist
    35                              <3> %if ELDSTRICT
    36                              <3>  %if ELDSTRICTCOUNTER
    37                              <3>   %error Missing relocation
    38                              <3>  %endif
    39                              <3>  [warning -reloc-abs]
    40                              <3>  %assign ELDSTRICTCOUNTER 1
    41                              <3> %endif
    42                              <3> %1
    43                              <3> 	%endmacro
    44                              <3> 
    45                              <3> 	%imacro reloc2 1+.nolist
    46                              <3> %if ELDSTRICT
    47                              <3>  %if ELDSTRICTCOUNTER
    48                              <3>   %error Missing relocation
    49                              <3>  %endif
    50                              <3>  [warning -reloc-abs]
    51                              <3>  %assign ELDSTRICTCOUNTER 2
    52                              <3> %endif
    53                              <3> %1
    54                              <3> 	%endmacro
    55                              <3> 
    56                              <3> 	%imacro eldstrictcheck 0.nolist
    57                              <3> %if ELDSTRICT
    58                              <3>  %ifn ELDSTRICTCOUNTER
    59                              <3>   %error Unexpected relocation
    60                              <3>  %else
    61                              <3>   %assign ELDSTRICTCOUNTER ELDSTRICTCOUNTER - 1
    62                              <3>   %ifn ELDSTRICTCOUNTER
    63                              <3>    [warning +reloc-abs]
    64                              <3>   %endif
    65                              <3>  %endif
    66                              <3> %endif
    67                              <3> 	%endmacro
    68                              <3> 
    69                              <3> %endif
    70                              <3> 
    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> 
    34                              <2> 	%imacro internalcoderelocation 0-1.nolist -2
    35                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    36                              <2> %if ELDLINKER
    37                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    38                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    39                              <2>  %else
    40                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    41                              <2>  %endif
    42                              <2> %else
    43                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    44                              <2>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    45                              <2>  %else
    46                              <2>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    47                              <2>  %endif
    48                              <2> %endif
    49                              <2> 	eldstrictcheck
    50                              <2> 	%endmacro
    51                              <2> 
    52                              <2> 	%imacro internaldatarelocation 0-1.nolist -2
    53                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    54                              <2> %if ELDLINKER
    55                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    56                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    57                              <2>  %else
    58                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    59                              <2>  %endif
    60                              <2> %else
    61                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    62                              <2>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    63                              <2>  %else
    64                              <2>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    65                              <2>  %endif
    66                              <2> %endif
    67                              <2> 	eldstrictcheck
    68                              <2> 	%endmacro
    69                              <2> 
    70                              <2> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    71                              <2> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    72                              <2> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    73                              <2> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    74                              <2> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    75                              <2> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    76                              <2> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    77                              <2> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    78                              <2> 
    79                              <2> 
    80                              <2> %define LINK_DATA_RELOCATIONS ""
    81                              <2> %define LINK_LINKER_DATA_RELOCATIONS ""
    82                              <2> %define LINK_DATA_NAMES db ""
    83                              <2> %define LINK_DATA_DETECTION none, none
    84                              <2> 
    85                              <2> %define LINK_OTHER_DATA_RELOCATIONS ""
    86                              <2> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    87                              <2> %define LINK_OTHER_DATA_NAMES db ""
    88                              <2> %define LINK_OTHER_DATA_DETECTION none, none
    89                              <2> 
    90                              <2> %ifndef ELDOTHER
    91                              <2>  %assign ELDOTHER 0
    92                              <2> %endif
    93                              <2> %assign ELDOTHERLINK 0
    94                              <2> 
    95                              <2> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
    96                              <2> %if ELDOTHER
    97                              <2>  %assign ELDOTHERLINK 1
    98                              <2> %endif
    99                              <2> 	linkdatarelocation %1, %2, %3
   100                              <2> %assign ELDOTHERLINK 0
   101                              <2> 	%endmacro
   102                              <2> 
   103                              <2> 	%imacro linkdatarelocation 1-3.nolist -2, required
   104                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   105                              <2> %ifidni %3, required
   106                              <2>  %assign %%optional 0
   107                              <2> %elifidni %3, optional
   108                              <2>  %assign %%optional 100h
   109                              <2> %else
   110                              <2>  %fatal Unknown optional keyword
   111                              <2> %endif
   112                              <2> %ifidni _CURRENT_SECTION_TYPE, DATA
   113                              <2>  %assign %%DATASECTION 1
   114                              <2> %else
   115                              <2>  %assign %%DATASECTION 0
   116                              <2> %endif
   117                              <2> 	%if ELDOTHERLINK
   118                              <2> %if ELDLINKER
   119                              <2>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   120                              <2> %else
   121                              <2>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   122                              <2> %endif
   123                              <2> 	%else
   124                              <2> %if ELDLINKER
   125                              <2>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   126                              <2> %else
   127                              <2>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   128                              <2> %endif
   129                              <2> 	%endif
   130                              <2> %defstr %%string %1
   131                              <2> %strlen %%length %%string
   132                              <2> %if %%length > 64
   133                              <2>  %error Too long link name: %1
   134                              <2> %endif
   135                              <2> %define LINK_DATA_CHECK %1
   136                              <2> 	%if ELDOTHERLINK
   137                              <2> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   138                              <2> %if LINK_DATA_NEW
   139                              <2>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   140                              <2> 	hashdef HASH, %%string
   141                              <2>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   143                              <2> %else
   144                              <2>  %%name equ LINK_DATA_DUPLICATE
   145                              <2> %endif
   146                              <2> 	%else
   147                              <2> 	linkdata_detect LINK_DATA_DETECTION
   148                              <2> %if LINK_DATA_NEW
   149                              <2>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   150                              <2> 	hashdef HASH, %%string
   151                              <2>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   153                              <2> %else
   154                              <2>  %%name equ LINK_DATA_DUPLICATE
   155                              <2> %endif
   156                              <2> 	%endif
   157                              <2> 	eldstrictcheck
   158                              <2> 	%endmacro
   159                              <2> 
   160                              <2> 	%imacro linkdata_detect 2-*.nolist
   161                              <2> %assign LINK_DATA_NEW 1
   162                              <2> %rep (%0 - 2) / 2
   163                              <2>  %rotate 2
   164                              <2>  %ifidni %1, LINK_DATA_CHECK
   165                              <2>   %assign LINK_DATA_NEW 0
   166                              <2>   %xdefine LINK_DATA_DUPLICATE %2
   167                              <2>   %exitrep
   168                              <2>  %endif
   169                              <2> %endrep
   170                              <2> 	%endmacro
   171                              <2> 
   172                              <2> 	%imacro link_data_dump_names 1-*.nolist
   173                              <2> %rep %0
   174                              <2> 	%1
   175                              <2>  %rotate 1
   176                              <2> %endrep
   177                              <2> 	%endmacro
   178                              <2> 
   179                              <2> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   180                              <2> ; dw LINK_DATA_RELOCATIONS, 0, 0
   181                              <2> ; link_data_dump_names ELDCALL_CODE_NAMES
   182                              <2> 
   183                              <2> %endif
    21                              <1> 
    22                              <1> %assign ELDLINKER 0
    23                              <1> 
    24                              <1> [section relocatedzero nobits vstart=0]
    25                              <1> relocatedzero:
    26                              <1> __SECT__
    27                              <1> 
    28                              <1> 	numdef HOUDINI, 1
    29                              <1> 	numdef HOUDINI_CONDITIONAL, 1
    30                              <1> 
    31                              <1> %imacro houdini 0.nolist
    32                              <1> %if _HOUDINI
    33                              <1>  %if _HOUDINI_CONDITIONAL
    34                              <1> reloc	testopt [ss:relocateddata], 100h
    35                              <1> linkdatarelocation options7, -3
    36                              <1> 	jz %%skip
    37                              <1>  %endif
    38                              <1> reloc	testopt [ss:relocateddata], 100h
    39                              <1> linkdatarelocation internalflags6, -3
    40                              <1> 	jz %%skip
    41                              <1> 	int3
    42                              <1> %%skip:
    43                              <1> %endif
    44                              <1> %endmacro
    45                              <1> 
    46                              <1> %define ELDCALL_CODE_RELOCATIONS ""
    47                              <1> %define ELDCALL_LINKER_CODE_RELOCATIONS ""
    48                              <1> %define ELDCALL_CODE_RELOCATIONS_OPTIONAL ""
    49                              <1> %define ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ""
    50                              <1> %define ELDCALL_CODE_NAMES db ""
    51                              <1> %define ELDCALL_CODE_DETECTION none, none
    52                              <1> %assign ELDCALL_OPTIONAL_STATUS 0		; not any seen yet
    53                              <1> %assign ELDCALL_PMREQUIRED_STATUS 0		; not any seen yet
    54                              <1> 
    55                              <1> 	%imacro extcall 1-2.nolist required
    56                              <1> %ifidni _CURRENT_SECTION_TYPE, DATA
    57                              <1>  %error "ELD call cannot be used in ELD data block"
    58                              <1> %endif
    59                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP
    60                              <1> %ifidni %2, required
    61                              <1>  %assign %%optional 0
    62                              <1> %elifidni %2, optional
    63                              <1>  %assign %%optional 100h
    64                              <1>  %if ELDCALL_OPTIONAL_STATUS == 0
    65                              <1>   %assign ELDCALL_OPTIONAL_STATUS 1
    66                              <1>  %elif ELDCALL_OPTIONAL_STATUS == 1
    67                              <1>  %else
    68                              <1>   %error Optional code link not allowed here
    69                              <1>  %endif
    70                              <1> %elifidni %2, PM required
    71                              <1>  %assign %%optional 300h
    72                              <1>  %assign ELDCALL_PMREQUIRED_STATUS 1
    73                              <1>  %if ELDCALL_OPTIONAL_STATUS == 0
    74                              <1>   %assign ELDCALL_OPTIONAL_STATUS 1
    75                              <1>  %elif ELDCALL_OPTIONAL_STATUS == 1
    76                              <1>  %else
    77                              <1>   %error Optional code link not allowed here
    78                              <1>  %endif
    79                              <1> %else
    80                              <1>  %fatal Unknown optional keyword
    81                              <1> %endif
    82                              <1> %if 0
    83                              <1> [warning -reloc-rel-word]
    84                              <1> 	call near relocatedzero
    85                              <1> [warning +reloc-rel-word]
    86                              <1> %else
    87                              <1> 	db 0E8h
    88                              <1> reloc	dw relocatedzero
    89                              <1> 	eldstrictcheck
    90                              <1> %endif
    91                              <1> 	jmp strict short %%skipparameter
    92                              <1> 	dw 0
    93                              <1> %%skipparameter:
    94                              <1> %if ELDLINKER
    95                              <1>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS ELDCALL_LINKER_CODE_RELOCATIONS, %%entry, %%name
    96                              <1>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional, %%entry, %%name
    97                              <1> %else
    98                              <1>  %xdefine ELDCALL_CODE_RELOCATIONS ELDCALL_CODE_RELOCATIONS, %%entry, %%name
    99                              <1>  %xdefine ELDCALL_CODE_RELOCATIONS_OPTIONAL ELDCALL_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional, %%entry, %%name
   100                              <1> %endif
   101                              <1> %defstr %%string %1
   102                              <1> %strlen %%length %%string
   103                              <1> %if %%length > 64
   104                              <1>  %error Too long link name: %1
   105                              <1> %endif
   106                              <1> %define ELDCALL_CODE_CHECK %1
   107                              <1> 	linkcode_detect ELDCALL_CODE_DETECTION
   108                              <1> %if ELDCALL_CODE_NEW
   109                              <1>  %xdefine ELDCALL_CODE_DETECTION ELDCALL_CODE_DETECTION, %1, %%name
   110                              <1> 	hashdef HASH, %%string
   111                              <1> %xdefine ELDCALL_CODE_NAMES 	ELDCALL_CODE_NAMES, %%name:, dw _HASH, {counted %%string}
   113                              <1> %else
   114                              <1>  %%name equ ELDCALL_CODE_DUPLICATE
   115                              <1> %endif
   116                              <1> 	%endmacro
   117                              <1> 
   118                              <1> 	%imacro linkcode_detect 2-*.nolist
   119                              <1> %assign ELDCALL_CODE_NEW 1
   120                              <1> %rep (%0 - 2) / 2
   121                              <1>  %rotate 2
   122                              <1>  %ifidni %1, ELDCALL_CODE_CHECK
   123                              <1>   %assign ELDCALL_CODE_NEW 0
   124                              <1>   %xdefine ELDCALL_CODE_DUPLICATE %2
   125                              <1>   %exitrep
   126                              <1>  %endif
   127                              <1> %endrep
   128                              <1> 	%endmacro
   129                              <1> 
   130                              <1> 
   131                              <1> %define ELDCALL_CALLCALL_LIST none
   132                              <1> 
   133                              <1> 	%imacro extcallcall 1.nolist
   134                              <1> 	call %1
   135                              <1> %xdefine ELDCALL_CALLCALL_LIST ELDCALL_CALLCALL_LIST, %1
   136                              <1> 	%endmacro
   137                              <1> 
   138                              <1> %assign ELDCALLCALL_DUMPED 0
   139                              <1> 
   140                              <1> 	%imacro eldcall_dump_callcall 1-*.nolist
   141                              <1> %define ELDCALL_CALLCALL_PROCESSED none
   142                              <1>  %rep %0 - 1
   143                              <1>   %rotate 1
   144                              <1>   %define ELDCALL_CHECK %1
   145                              <1> 	eldcall_callcall_detect ELDCALL_CALLCALL_PROCESSED
   146                              <1>   %if ELDCALL_NEW
   147                              <1>    %xdefine ELDCALL_CALLCALL_PROCESSED ELDCALL_CALLCALL_PROCESSED, %1
   148                              <1> 	align 8, nop
   149                              <1> %1:
   150                              <1> 	extcall %1
   151                              <1> 	retn
   152                              <1>   %endif
   153                              <1>  %endrep
   154                              <1> %unimacro extcallcall 1.nolist
   155                              <1> %assign ELDCALLCALL_DUMPED 1
   156                              <1> %define ELDCALL_CALLCALL_LIST none
   157                              <1> 	%endmacro
   158                              <1> 
   159                              <1> 	%imacro eldcall_callcall_detect 1-*.nolist
   160                              <1> %assign ELDCALL_NEW 1
   161                              <1> %rep %0 - 1
   162                              <1>  %rotate 1
   163                              <1>  %ifidni %1, ELDCALL_CHECK
   164                              <1>   %assign ELDCALL_NEW 0
   165                              <1>   %exitrep
   166                              <1>  %endif
   167                              <1> %endrep
   168                              <1> 	%endmacro
   169                              <1> 
   170                              <1> 	%imacro eldcall_dump_names 1-*.nolist
   171                              <1> %rep %0
   172                              <1> 	%1
   173                              <1>  %rotate 1
   174                              <1> %endrep
   175                              <1> 	%endmacro
   176                              <1> 
   177                              <1> ; eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   178                              <1> ; if using optional code links:
   179                              <1> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
   180                              <1> ;  dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
   181                              <1> ; if not using optional code links:
   182                              <1> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
   183                              <1> ;  dw ELDCALL_CODE_RELOCATIONS, 0, 0
   184                              <1> ; eldcall_dump_names ELDCALL_CODE_NAMES
   185                              <1> 
   186                              <1> %endif
    10                                  %include "elddata.mac"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> Extensions for lDebug data relocation macros
     4                              <1> 
     5                              <1> Copyright (C) 2008-2023 E. C. Masloch
     6                              <1> 
     7                              <1> Usage of the works is permitted provided that this
     8                              <1> instrument is retained with the works, so that any entity
     9                              <1> that uses the works is notified of this instrument.
    10                              <1> 
    11                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <1> 
    13                              <1> %endif
    14                              <1> 
    15                              <1> %ifndef ELDDATA_MAC
    16                              <1> %define ELDDATA_MAC 1
    17                              <1> 
    18                              <1> %include "lmacros3.mac"
    19                              <1> %include "nasmhash.mac"
    20                              <1> %include "eldcheck.mac"
    21                              <1> 
    22                              <1> 
    23                              <1> %assign ELDLINKER 0
    24                              <1> 
    25                              <1> %define INTERNAL_CODE_TO_CODE_RELOCATIONS ""
    26                              <1> %define INTERNAL_CODE_TO_DATA_RELOCATIONS ""
    27                              <1> %define INTERNAL_DATA_TO_CODE_RELOCATIONS ""
    28                              <1> %define INTERNAL_DATA_TO_DATA_RELOCATIONS ""
    29                              <1> %define INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS ""
    30                              <1> %define INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS ""
    31                              <1> %define INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS ""
    32                              <1> %define INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS ""
    33                              <1> 
    34                              <1> 	%imacro internalcoderelocation 0-1.nolist -2
    35                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    36                              <1> %if ELDLINKER
    37                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    38                              <1>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    39                              <1>  %else
    40                              <1>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    41                              <1>  %endif
    42                              <1> %else
    43                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    44                              <1>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    45                              <1>  %else
    46                              <1>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    47                              <1>  %endif
    48                              <1> %endif
    49                              <1> 	eldstrictcheck
    50                              <1> 	%endmacro
    51                              <1> 
    52                              <1> 	%imacro internaldatarelocation 0-1.nolist -2
    53                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    54                              <1> %if ELDLINKER
    55                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    56                              <1>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    57                              <1>  %else
    58                              <1>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    59                              <1>  %endif
    60                              <1> %else
    61                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    62                              <1>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    63                              <1>  %else
    64                              <1>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    65                              <1>  %endif
    66                              <1> %endif
    67                              <1> 	eldstrictcheck
    68                              <1> 	%endmacro
    69                              <1> 
    70                              <1> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    71                              <1> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    72                              <1> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    73                              <1> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    74                              <1> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    75                              <1> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    76                              <1> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    77                              <1> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    78                              <1> 
    79                              <1> 
    80                              <1> %define LINK_DATA_RELOCATIONS ""
    81                              <1> %define LINK_LINKER_DATA_RELOCATIONS ""
    82                              <1> %define LINK_DATA_NAMES db ""
    83                              <1> %define LINK_DATA_DETECTION none, none
    84                              <1> 
    85                              <1> %define LINK_OTHER_DATA_RELOCATIONS ""
    86                              <1> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    87                              <1> %define LINK_OTHER_DATA_NAMES db ""
    88                              <1> %define LINK_OTHER_DATA_DETECTION none, none
    89                              <1> 
    90                              <1> %ifndef ELDOTHER
    91                              <1>  %assign ELDOTHER 0
    92                              <1> %endif
    93                              <1> %assign ELDOTHERLINK 0
    94                              <1> 
    95                              <1> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
    96                              <1> %if ELDOTHER
    97                              <1>  %assign ELDOTHERLINK 1
    98                              <1> %endif
    99                              <1> 	linkdatarelocation %1, %2, %3
   100                              <1> %assign ELDOTHERLINK 0
   101                              <1> 	%endmacro
   102                              <1> 
   103                              <1> 	%imacro linkdatarelocation 1-3.nolist -2, required
   104                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   105                              <1> %ifidni %3, required
   106                              <1>  %assign %%optional 0
   107                              <1> %elifidni %3, optional
   108                              <1>  %assign %%optional 100h
   109                              <1> %else
   110                              <1>  %fatal Unknown optional keyword
   111                              <1> %endif
   112                              <1> %ifidni _CURRENT_SECTION_TYPE, DATA
   113                              <1>  %assign %%DATASECTION 1
   114                              <1> %else
   115                              <1>  %assign %%DATASECTION 0
   116                              <1> %endif
   117                              <1> 	%if ELDOTHERLINK
   118                              <1> %if ELDLINKER
   119                              <1>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   120                              <1> %else
   121                              <1>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   122                              <1> %endif
   123                              <1> 	%else
   124                              <1> %if ELDLINKER
   125                              <1>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   126                              <1> %else
   127                              <1>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   128                              <1> %endif
   129                              <1> 	%endif
   130                              <1> %defstr %%string %1
   131                              <1> %strlen %%length %%string
   132                              <1> %if %%length > 64
   133                              <1>  %error Too long link name: %1
   134                              <1> %endif
   135                              <1> %define LINK_DATA_CHECK %1
   136                              <1> 	%if ELDOTHERLINK
   137                              <1> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   138                              <1> %if LINK_DATA_NEW
   139                              <1>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   140                              <1> 	hashdef HASH, %%string
   141                              <1>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   143                              <1> %else
   144                              <1>  %%name equ LINK_DATA_DUPLICATE
   145                              <1> %endif
   146                              <1> 	%else
   147                              <1> 	linkdata_detect LINK_DATA_DETECTION
   148                              <1> %if LINK_DATA_NEW
   149                              <1>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   150                              <1> 	hashdef HASH, %%string
   151                              <1>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   153                              <1> %else
   154                              <1>  %%name equ LINK_DATA_DUPLICATE
   155                              <1> %endif
   156                              <1> 	%endif
   157                              <1> 	eldstrictcheck
   158                              <1> 	%endmacro
   159                              <1> 
   160                              <1> 	%imacro linkdata_detect 2-*.nolist
   161                              <1> %assign LINK_DATA_NEW 1
   162                              <1> %rep (%0 - 2) / 2
   163                              <1>  %rotate 2
   164                              <1>  %ifidni %1, LINK_DATA_CHECK
   165                              <1>   %assign LINK_DATA_NEW 0
   166                              <1>   %xdefine LINK_DATA_DUPLICATE %2
   167                              <1>   %exitrep
   168                              <1>  %endif
   169                              <1> %endrep
   170                              <1> 	%endmacro
   171                              <1> 
   172                              <1> 	%imacro link_data_dump_names 1-*.nolist
   173                              <1> %rep %0
   174                              <1> 	%1
   175                              <1>  %rotate 1
   176                              <1> %endrep
   177                              <1> 	%endmacro
   178                              <1> 
   179                              <1> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   180                              <1> ; dw LINK_DATA_RELOCATIONS, 0, 0
   181                              <1> ; link_data_dump_names ELDCALL_CODE_NAMES
   182                              <1> 
   183                              <1> %endif
    11                                  
    12                                  	cpu 8086
    13                                  
    14                                  	addsection RELOCATEDDATA, nobits vstart=_ELD_RELOC_VSTART
    15                                  relocateddata:
    16                                  
    17                                  	addsection HEADER, start=0
    18                                  
    19                                  	istruc ELD_HEADERX
    20                                  at eldhxHeader
    21                                  		; ELD executable header
    22                                  	istruc ELD_HEADER
    23 00000000 454C4431                at eldhSignature,	db "ELD1"
    24 00000004 000000                  			db 0,0,0
    25 00000007 1A                      			db 26
    26 00000008 50000000                at eldhCodeOffset,	dd CODEOFFSET
    27 0000000C 500A                    at eldhCodeImageLength,	dw code_size
    28 0000000E 0000                    at eldhCodeAllocLength,	dw 0
    29 00000010 A00A0000                at eldhDataOffset,	dd DATAOFFSET
    30 00000014 B001                    at eldhDataImageLength,	dw data_size
    31 00000016 0000                    at eldhDataAllocLength,	dw total_data_size - data_size
    32 00000018 C102                    at eldhCodeEntrypoint,	dw linker - code
    33                                  at eldhReserved
    34 0000001A 00<rep 4h>2800          at eldhExtensionSize,	dw header_extension_end - $$
    35                                  	iend
    36 00000020 [30000000]              at eldhxDescriptionOffset,	dd description
    37 00000024 700B0000                at eldhxHelpOffset,		dd DATAOFFSET + msg.help - datastart
    38                                  header_extension_end:
    39 00000028 00<rep 8h>              	iend
    40                                  
    41 00000030 50726F766964652048-     description:		asciz "Provide HISTORY utility."
    41 00000039 4953544F5259207574-
    41 00000042 696C6974792E00     
    42                                  
    43                                  
    44 00000049 00<rep 7h>              	align 16, db 0
    45                                  
    46                                  CODEOFFSET equ $ - $$
    47                                  	addsection CODE, follows=HEADER vstart=_ELD_CODE_VSTART
    48                                  %define CODEFIXUP - code + 0
    49                                  code:
    50                                  		; ELD instance header
    51                                  	istruc ELD_INSTANCE
    52                                  at eldiStartCode
    53 00000000 00<rep 2h>              at eldiEndCode
    54 00000002 00<rep 2h>              at eldiStartData
    55 00000004 00<rep 2h>              at eldiEndData
    56 00000006 00<rep 2h>48495354-     at eldiIdentifier,	fill 8, 32, db "HISTORY"
    56 0000000C 4F525920           
    57 00000010 00<rep 2h>68697374-     at eldiListing,		asciz _ELD_LISTING
    57 00000016 6F72792E6C737400   
    58 0000001E 00<rep 2h>              	iend
    59                                  
    60                                  
    61                                  command:
    62 00000020 EB08                    	jmp strict short .entry
    63                                  .chain:
    64 00000022 E8[0000]EB020000        	extcall cmd3_not_ext, required	; must NOT be extcallcall
    65 00000029 90                      	times 10 - ($ - command) nop
    66                                  .entry:
    67 0000002A 56                      	push si
    68 0000002B 3C2D                    	cmp al, '-'
    69 0000002D 7503                    	jne @F
    70 0000002F E88E01                  	extcallcall skipcomma
    71                                  @@:
    72 00000032 4E                      	dec si
    73                                  
    74 00000033 BA[0000]                	mov dx, msg.history
    75                                  internaldatarelocation
    76 00000036 E88F01                  	extcallcall isstring?
    77 00000039 7405                    	je .ours
    78 0000003B 5E                      	pop si
    79 0000003C 4E                      	dec si
    80 0000003D AC                      	lodsb
    81 0000003E EBE2                    	jmp .chain
    82                                  
    83                                  .ours:
    84 00000040 58                      	pop ax
    85 00000041 E87C01                  	extcallcall skipcomma
    86 00000044 4E                      	dec si
    87 00000045 C706[0000][0000]        reloc2	mov word [relocateddata], relocateddata
    88                                  linkdatarelocation lastcmd, -4
    89                                  linkdatarelocation dmycmd
    90 0000004B BA[0000]                	mov dx, relocateddata
    91                                  linkdatarelocation msg.uninstall
    92 0000004E E87701                  	extcallcall isstring?
    93 00000051 741D                    	je uninstall
    94 00000053 BA[0800]                	mov dx, msg.clear
    95                                  internaldatarelocation
    96 00000056 E86F01                  	extcallcall isstring?
    97 00000059 7410                    	je clear
    98 0000005B BA[0E00]                	mov dx, msg.show
    99                                  internaldatarelocation
   100 0000005E E86701                  	extcallcall isstring?
   101                                  	; je
   102 00000061 AC                      	lodsb
   103 00000062 E86B01                  	extcallcall chkeol
   104 00000065 E88E00                  	call run_show
   105                                  @@:
   106 00000068 E86D01                  	extcallcall cmd3
   107                                  
   108                                  clear:
   109 0000006B E87E00                  	call run_clear
   110 0000006E EBF8                    	jmp @B
   111                                  
   112                                  uninstall:
   113 00000070 AC                      	lodsb
   114 00000071 E85C01                  	extcallcall chkeol
   115                                  
   116 00000074 8E06[0000]              	mov es, word [relocateddata]
   117                                  linkdatarelocation extdssel
   118 00000078 E86501                  	extcallcall ispm
   119 0000007B 7404                    	jz @F
   120 0000007D 8E06[0000]              	mov es, word [relocateddata]
   121                                  linkdatarelocation extseg
   122                                  @@:
   123 00000081 06                      	push es
   124 00000082 1F                      	pop ds
   125 00000083 31DB                    	xor bx, bx		; = 0 (no prior, modify ext_command_handler)
   126 00000085 BF[2000]                	mov di, command		; di -> us
   127                                  internalcoderelocation
   128 00000088 368B36[0000]            	mov si, word [ss:relocateddata]
   129                                  linkdatarelocation ext_command_handler
   130                                  				; si -> first
   131 0000008D 85F6                    	test si, si		; none installed ?
   132 0000008F 7450                    	jz .error		; error -->
   133                                  
   134                                  .loop:
   135 00000091 39F7                    	cmp di, si		; found ?
   136 00000093 740D                    	je .bx			; yes, use bx -->
   137 00000095 89F3                    	mov bx, si		; bx -> prior handler
   138 00000097 AD                      	lodsw			; skip entrypoint jmp strict short
   139 00000098 AC                      	lodsb			; get first byte of chainer
   140 00000099 3CE9                    	cmp al, 0E9h		; expecting jmp near ?
   141 0000009B 7544                    	jne .error		; no, error -->
   142 0000009D AD                      	lodsw			; get rel16 displacement
   143 0000009E 01C6                    	add si, ax		; -> next handler
   144 000000A0 EBEF                    	jmp .loop
   145                                  
   146                                  .bx:
   147 000000A2 85DB                    	test bx, bx		; any prior ?
   148 000000A4 751A                    	jnz .bxnz		; yes -->
   149 000000A6 AF                      	scasw			; skip entrypoint jmp strict short
   150 000000A7 803DE8                  	cmp byte [di], 0E8h	; is it a call to cmd3_not_ext ?
   151 000000AA 7507                    	jne @F			; no -->
   152                                  				; yes, reset ext_command_handler to zero
   153                                  .setbx:
   154 000000AC 36891E[0000]            	mov word [ss:relocateddata], bx
   155                                  linkdatarelocation ext_command_handler
   156 000000B1 EB1E                    	jmp .done
   157                                  
   158                                  @@:
   159 000000B3 803DE9                  	cmp byte [di], 0E9h	; validate
   160 000000B6 7529                    	jne .error		; failure -->
   161 000000B8 47                      	inc di			; -> rel16 displacement
   162 000000B9 8B1D                    	mov bx, word [di]	; get displacement
   163 000000BB AF                      	scasw			; -> after jmp near
   164 000000BC 01FB                    	add bx, di		; -> next handler
   165 000000BE EBEC                    	jmp .setbx		; set ext_command_handler to next
   166                                  
   167                                  .bxnz:
   168 000000C0 89DE                    	mov si, bx		; -> prior handler with us as downlink
   169 000000C2 87FE                    	xchg di, si		; si -> ours, di -> prior
   170 000000C4 A7                      	cmpsw			; skip entrypoint jmp strict short
   171 000000C5 A4                      	movsb			; copy 0E8h/0E9h
   172 000000C6 AD                      	lodsw			; ax = near rel16 displacement
   173 000000C7 01F0                    	add ax, si		; add in our base (= absolute offset)
   174 000000C9 29F8                    	sub ax, di
   175 000000CB 48                      	dec ax
   176 000000CC 48                      	dec ax			; subtract new base (= relative displacement)
   177 000000CD AB                      	stosw			; store new rel16 displacement
   178 000000CE A5                      	movsw			; jmp strict short
   179 000000CF A5                      	movsw			; linkcall target
   180 000000D0 A4                      	movsb			; trailer
   181                                  .done:
   182 000000D1 8026[1000]FE            	clropt [code + eldiFlags], eldifResident
   183                                  internalcoderelocation -3	; mark block as free
   184 000000D6 BA[1300]                	mov dx, msg.uninstall_done
   185                                  internaldatarelocation
   186                                  @@:
   187 000000D9 16                      	push ss
   188 000000DA 1F                      	pop ds
   189 000000DB E80A01                  	extcallcall putsz
   190 000000DE E8F700                  	extcallcall cmd3	; return
   191                                  
   192                                  .error:
   193 000000E1 B8010E                  	mov ax, 0E01h
   194 000000E4 E80901                  	extcallcall setrc
   195 000000E7 BA[3200]                	mov dx, msg.uninstall_error
   196                                  internaldatarelocation
   197 000000EA EBED                    	jmp @B
   198                                  
   199                                  
   200                                  run_clear:
   201 000000EC E8B000                  	call get_history_first_last
   202 000000EF 8B07                    	mov ax, word [bx]
   203 000000F1 87D3                    	xchg dx, bx
   204 000000F3 8907                    	mov word [bx], ax
   205 000000F5 C3                      	retn
   206                                  
   207                                  
   208                                  run_show:
   209 000000F6 36F606[0100]017409-     	houdini
   209 000000FE 36F606[0100]017401-
   209 00000106 CC                 
   210 00000107 16                      	push ss
   211 00000108 07                      	pop es
   212 00000109 C606[D000]00            	mov byte [history_data_entry], 0
   213                                  internaldatarelocation -3
   214 0000010E B8[0000]                	mov ax, relocateddata
   215                                  linkdatarelocation historyformat, -2, optional
   216 00000111 85C0                    	test ax, ax
   217 00000113 750E                    	jnz @F
   218 00000115 B83D0E                  	mov ax, 0E3Dh
   219 00000118 E8D500                  	extcallcall setrc
   220 0000011B BA[5900]                	mov dx, msg.history_none
   221                                  internaldatarelocation
   222                                  .putsz_end:
   223 0000011E E8C700                  	extcallcall putsz
   224 00000121 EB7B                    	jmp .end
   225                                  
   226                                  @@:
   227 00000123 83F802                  	cmp ax, 2
   228 00000126 720D                    	jb .in_data_entry
   229 00000128 740F                    	je .in_separate
   230                                  
   231 0000012A B83E0E                  	mov ax, 0E3Eh
   232 0000012D E8C000                  	extcallcall setrc
   233 00000130 BA[7B00]                	mov dx, msg.history_unknown
   234                                  internaldatarelocation
   235 00000133 EBE9                    	jmp .putsz_end
   236                                  
   237                                  .in_data_entry:
   238 00000135 F616[D000]              	not byte [history_data_entry]
   239                                  internaldatarelocation
   240                                  .in_separate:
   241 00000139 E86300                  	call get_history_first_last
   242 0000013C 89D6                    	mov si, dx
   243 0000013E 87F3                    	xchg si, bx
   244 00000140 8B34                    	mov si, [si]
   245 00000142 8B1F                    	mov bx, [bx]
   246 00000144 36F606[0100]017409-     houdini
   246 0000014C 36F606[0100]017401-
   246 00000154 CC                 
   247 00000155 4E                      	dec si
   248 00000156 4E                      	dec si
   249 00000157 31D2                    	xor dx, dx
   250 00000159 D006[D000]              	rol byte [history_data_entry], 1
   251                                  internaldatarelocation
   252 0000015D 730A                    	jnc .not_entry
   253 0000015F BA[0000]                	mov dx, relocateddata
   254                                  linkdatarelocation historybuffer, -2, optional
   255 00000162 85D2                    	test dx, dx
   256 00000164 7503                    	jnz @F
   257 00000166 E84400                  	call history_missing
   258                                  @@:
   259                                  .not_entry:
   260                                  
   261                                  .loop:
   262 00000169 BF[0000]                	mov di, relocateddata
   263                                  linkdatarelocation line_out
   264 0000016C 39DE                    	cmp si, bx
   265 0000016E 722E                    	jb .done
   266                                  
   267 00000170 D006[D000]              	rol byte [history_data_entry], 1
   268                                  internaldatarelocation
   269 00000174 720B                    	jc .not_seg
   270 00000176 53                      	push bx
   271 00000177 BB[0000]                	mov bx, relocateddata
   272                                  linkdatarelocation history.segorsel, -2, optional
   273 0000017A 85DB                    	test bx, bx
   274 0000017C 742F                    	jz history_missing	; bx on stack discarded
   275 0000017E 8E1F                    	mov ds, word [bx]
   276 00000180 5B                      	pop bx
   277                                  .not_seg:
   278                                  	; extcallcall decword
   279 00000181 AD                      	lodsw			; ax -> behind entry
   280 00000182 01D0                    	add ax, dx
   281 00000184 8B0C                    	mov cx, [si]		; cx -> behind prior entry, start of this
   282 00000186 01D1                    	add cx, dx
   283 00000188 96                      	xchg ax, si		; si -> behind
   284 00000189 29CE                    	sub si, cx		; si = length
   285 0000018B 87F1                    	xchg si, cx		; cx = length, si -> text
   286 0000018D F3A4                    	rep movsb
   287 0000018F 96                      	xchg ax, si		; restore si -> next high array entry
   288 00000190 83EE04                  	sub si, 4
   289 00000193 16                      	push ss
   290 00000194 1F                      	pop ds
   291 00000195 52                      	 push dx
   292 00000196 53                      	 push bx
   293 00000197 E85E00                  	extcallcall putsline_crlf
   294 0000019A 5B                      	 pop bx
   295 0000019B 5A                      	 pop dx
   296 0000019C EBCB                    	jmp .loop
   297                                  
   298                                  .done:
   299                                  .end:
   300 0000019E C3                      	retn
   301                                  
   302                                  
   303                                  get_history_first_last:
   304 0000019F BB[0000]                	mov bx, relocateddata
   305                                  linkdatarelocation history.first, -2, optional
   306 000001A2 BA[0000]                	mov dx, relocateddata
   307                                  linkdatarelocation history.last, -2, optional
   308 000001A5 85DB                    	test bx, bx
   309 000001A7 7404                    	jz @F
   310 000001A9 85D2                    	test dx, dx
   311 000001AB 750D                    	jnz @FF
   312                                  
   313                                  @@:
   314                                  history_missing:
   315 000001AD B83F0E                  	mov ax, 0E3Fh
   316 000001B0 E83D00                  	extcallcall setrc
   317 000001B3 BA[9700]                	mov dx, msg.history_missing
   318                                  internaldatarelocation
   319 000001B6 E82F00                  	extcallcall putsz
   320 000001B9 59                      	pop cx
   321                                  @@:
   322 000001BA C3                      	retn
   323                                  
   324                                  
   325 000001BB 90<rep 5h>E8[0000]-     	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   325 000001C3 EB020000C3E8[0000]-
   325 000001CB EB020000C3E8[0000]-
   325 000001D3 EB020000C3E8[0000]-
   325 000001DB EB020000C3E8[0000]-
   325 000001E3 EB020000C3E8[0000]-
   325 000001EB EB020000C3E8[0000]-
   325 000001F3 EB020000C3E8[0000]-
   325 000001FB EB020000C3         
   326                                  
   327                                  endinstalled equ ($ + CODEFIXUP + 15) & ~15
   328                                  
   329                                  
   330                                  start:
   331 00000200 8CC3                    	mov bx, es
   332 00000202 16                      	 push ss
   333 00000203 07                      	 pop es
   334 00000204 E8B9FF                  	call skipcomma
   335 00000207 4E                      	dec si
   336 00000208 BA[0000]                	mov dx, relocateddata
   337                                  linkdatarelocation msg.install
   338 0000020B E8BAFF                  	call isstring?
   339 0000020E 744D                    	je install
   340 00000210 BA[0E00]                	mov dx, msg.show
   341                                  internaldatarelocation
   342 00000213 E8B2FF                  	call isstring?
   343 00000216 7418                    	je .show
   344 00000218 BA[0800]                	mov dx, msg.clear
   345                                  internaldatarelocation
   346 0000021B E8AAFF                  	call isstring?
   347 0000021E 7415                    	je .clear
   348                                  
   349 00000220 AC                      	lodsb
   350 00000221 E8ACFF                  	call chkeol
   351 00000224 BA[D000]                	mov dx, msg.help
   352                                  internaldatarelocation
   353 00000227 E8BEFF                  	call putsz
   354                                  @@:
   355 0000022A E80D00                  	call uninstall_oneshot
   356 0000022D 31C0                    	xor ax, ax
   357 0000022F CB                      	retf
   358                                  
   359                                  .show:
   360 00000230 E8C3FE                  	call run_show
   361 00000233 EBF5                    	jmp @B
   362                                  
   363                                  .clear:
   364 00000235 E8B4FE                  	call run_clear
   365 00000238 EBF0                    	jmp @B
   366                                  
   367                                  
   368                                  uninstall_oneshot:
   369 0000023A 36F606[0000]01          	testopt [ss:relocateddata], 1
   370                                  linkdatarelocation options7, -3
   371 00000240 751A                    	jnz @F
   372                                  
   373 00000242 2EA1[0200]              	mov ax, word [cs:code + eldiEndCode]
   374                                  internalcoderelocation
   375 00000246 2E2B06[0000]            	sub ax, word [cs:code + eldiStartCode]
   376                                  internalcoderelocation
   377 0000024B 2906[0000]              	sub word [relocateddata], ax
   378                                  linkdatarelocation extseg_used
   379                                  
   380 0000024F 2EA1[0600]              	mov ax, word [cs:code + eldiEndData]
   381                                  internalcoderelocation
   382 00000253 2E2B06[0400]            	sub ax, word [cs:code + eldiStartData]
   383                                  internalcoderelocation
   384 00000258 2906[0000]              	sub word [relocateddata], ax
   385                                  linkdatarelocation extdata_used
   386                                  @@:
   387 0000025C C3                      	retn
   388                                  
   389                                  
   390                                  DATAOFFSET equ CODEOFFSET + code_size
   391                                  	addsection DATA, follows=CODE vstart=_ELD_DATA_VSTART
   392                                  %define DATAFIXUP - datastart + 0
   393                                  datastart:
   394                                  
   395                                  msg:
   396 00000000 484953544F525900        .history:		asciz "HISTORY"
   397 00000008 434C45415200            .clear:			asciz "CLEAR"
   398 0000000E 53484F5700              .show:			asciz "SHOW"
   399 00000013 484953544F52592075-     .uninstall_done:	db "HISTORY utility uninstalled."
   399 0000001C 74696C69747920756E-
   399 00000025 696E7374616C6C6564-
   399 0000002E 2E                 
   400                                  %if _ELD_RECLAIM_HINT
   401                                  			db " (Don't forget to use reclaim.eld)"
   402                                  %endif
   403 0000002F 0D0A00                  			asciz 13,10
   404 00000032 484953544F52592075-     .uninstall_error:	asciz "HISTORY utility unable to uninstall!",13,10
   404 0000003B 74696C69747920756E-
   404 00000044 61626C6520746F2075-
   404 0000004D 6E696E7374616C6C21-
   404 00000056 0D0A00             
   405 00000059 0D0A4E6F2068697374-     .history_none:		asciz 13,10,"No history format link found.",13,10
   405 00000062 6F727920666F726D61-
   405 0000006B 74206C696E6B20666F-
   405 00000074 756E642E0D0A00     
   406 0000007B 0D0A556E6B6E6F776E-     .history_unknown:	asciz 13,10,"Unknown history format.",13,10
   406 00000084 20686973746F727920-
   406 0000008D 666F726D61742E0D0A-
   406 00000096 00                 
   407 00000097 486973746F7279206C-     .history_missing:	asciz "History last or first displacement or segment missing.",13,10
   407 000000A0 617374206F72206669-
   407 000000A9 72737420646973706C-
   407 000000B2 6163656D656E74206F-
   407 000000BB 72207365676D656E74-
   407 000000C4 206D697373696E672E-
   407 000000CD 0D0A00             
   408                                  
   409                                  uinit_data: equ $
   410                                  
   411 000000D0 484953544F52592075-     .help:		db "HISTORY utility. Available commands:",13,10
   411 000000D9 74696C6974792E2041-
   411 000000E2 7661696C61626C6520-
   411 000000EB 636F6D6D616E64733A-
   411 000000F4 0D0A               
   412 000000F6 0D0A                    		db 13,10
   413 000000F8 53484F57090953686F-     		db "SHOW",9,9,"Show all of history",13,10
   413 00000101 7720616C6C206F6620-
   413 0000010A 686973746F72790D0A 
   414 00000113 434C4541520909436C-     		db "CLEAR",9,9,"Clear history",13,10
   414 0000011C 65617220686973746F-
   414 00000125 72790D0A           
   415 00000129 494E5354414C4C0909-     		db "INSTALL",9,9,"(ELD load only) Install utility resident",13,10
   415 00000132 28454C44206C6F6164-
   415 0000013B 206F6E6C792920496E-
   415 00000144 7374616C6C20757469-
   415 0000014D 6C6974792072657369-
   415 00000156 64656E740D0A       
   416 0000015C 554E494E5354414C4C-     		db "UNINSTALL",9,"(Resident only) Uninstall resident utility",13,10
   416 00000165 09285265736964656E-
   416 0000016E 74206F6E6C79292055-
   416 00000177 6E696E7374616C6C20-
   416 00000180 7265736964656E7420-
   416 00000189 7574696C6974790D0A 
   417 00000192 00                      		asciz
   418 00000193 484953544F52592075-     .installed:		asciz "HISTORY utility installed.",13,10
   418 0000019C 74696C69747920696E-
   418 000001A5 7374616C6C65642E0D-
   418 000001AE 0A00               
   419                                  
   420                                  	align 16, db 0
   421                                  init_data_end:
   422                                  data_size equ $ - datastart
   423                                  transient_data_size equ data_size
   424                                  
   425                                  	absolute uinit_data
   426                                  history_data_entry:
   427 000000D0 ??                      	resb 1
   428                                  
   429 000000D1 <res Fh>                	alignb 16
   430                                  uinit_data_end:
   431                                  resident_data_end:
   432                                  resident_data_size equ resident_data_end - datastart
   433                                  
   434                                  %if uinit_data_end >= init_data_end
   435                                   total_data_size equ $ - datastart
   436                                  %else
   437                                   total_data_size equ init_data_end - datastart
   438                                  %endif
   439                                  %assign _DATA_SIZE total_data_size
   440                                  
   441                                  
   442                                  	usesection CODE
   443                                  
   444                                  install:
   445 0000025D AC                      	lodsb
   446 0000025E E8[0000]EB020000        	extcall chkeol
   447                                  
   448 00000265 36F606[0100]017409-     	houdini
   448 0000026D 36F606[0100]017401-
   448 00000275 CC                 
   449 00000276 8EC3                    	mov es, bx		; => ext seg (writable)
   450                                  
   451 00000278 B8D000                  	mov ax, endresident - endinstalled
   452 0000027B 262906[0200]            	sub word [es:code + eldiEndCode], ax
   453                                  internalcoderelocation		; adjust size
   454 00000280 2906[0000]              	sub word [relocateddata], ax
   455                                  linkdatarelocation extseg_used	; adjust size
   456                                  
   457                                  %if (transient_data_size - resident_data_size) > 0
   458 00000284 B8D000                  	mov ax, transient_data_size - resident_data_size
   459 00000287 262906[0600]            	sub word [es:code + eldiEndData], ax
   460                                  internalcoderelocation		; adjust size
   461 0000028C 2906[0000]              	sub word [relocateddata], ax
   462                                  linkdatarelocation extdata_used	; adjust size
   463                                  %endif
   464                                  
   465 00000290 8B1E[0000]              	mov bx, word [relocateddata]
   466                                  linkdatarelocation ext_command_handler
   467                                  				; -> prior
   468 00000294 BF[2000]                	mov di, command		; -> our handler
   469                                  internalcoderelocation
   470 00000297 85DB                    	test bx, bx		; installing as first ?
   471 00000299 740A                    	jz .only_first		; yes, simple --> (leave as extcall cmd3_not_ext)
   472 0000029B AF                      	scasw			; skip entrypoint jmp strict short
   473 0000029C B0E9                    	mov al, 0E9h		; = jmp near opcode
   474 0000029E AA                      	stosb			; store
   475 0000029F 93                      	xchg ax, bx		; ax -> next handler
   476 000002A0 29F8                    	sub ax, di
   477 000002A2 48                      	dec ax
   478 000002A3 48                      	dec ax			; ax = ax - (di + 2)
   479 000002A4 AB                      	stosw			; store our downlink as rel16 displacement
   480                                  
   481                                  .only_first:
   482 000002A5 26800E[1000]01          	setopt [es:code + eldiFlags], eldifResident
   483                                  internalcoderelocation -3	; mark block as resident
   484 000002AB C706[0000][2000]        	mov word [relocateddata], command
   485                                  linkdatarelocation ext_command_handler, -4
   486                                  internalcoderelocation		; -> our entrypoint
   487                                  
   488 000002B1 F606[0000]04            	testopt [relocateddata], 4
   489                                  linkdatarelocation options7, -3
   490 000002B6 7506                    	jnz @F
   491 000002B8 BA[9301]                	mov dx, msg.installed
   492                                  internaldatarelocation
   493 000002BB E82AFF                  	call putsz
   494                                  @@:
   495 000002BE 31C0                    	xor ax, ax
   496 000002C0 CB                      	retf
   497                                  
   498                                  
   499                                  %include "eldlink.asm"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> Extensions for lDebug linker
     4                              <1> 
     5                              <1> Copyright (C) 2008-2023 E. C. Masloch
     6                              <1> 
     7                              <1> Usage of the works is permitted provided that this
     8                              <1> instrument is retained with the works, so that any entity
     9                              <1> that uses the works is notified of this instrument.
    10                              <1> 
    11                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <1> 
    13                              <1> %endif
    14                              <1> 
    15                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
    16                              <1> %include "eld.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2023 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"
    19                              <2> 
    20                              <2> 		; ELD executable header
    21                              <2> 	struc ELD_HEADER
    22                              <2> eldhSignature:		resb 4	; "ELD1"
    23                              <2> 			resb 3	; reserved
    24                              <2> 			resb 1	; 26 (Ctrl-Z)
    25                              <2> eldhCodeOffset:		resd 1	; position displacement from eldhSignature
    26                              <2> eldhCodeImageLength:	resw 1	; amount bytes, at least 32
    27                              <2> eldhCodeAllocLength:	resw 1	; amount bytes, added to prior. sum < 64 KiB
    28                              <2> eldhDataOffset:		resd 1
    29                              <2> eldhDataImageLength:	resw 1	; (zero allowed)
    30                              <2> eldhDataAllocLength:	resw 1	; (zero allowed)
    31                              <2> eldhCodeEntrypoint:	resw 1	; within code section, used as displacement
    32                              <2> eldhReserved:		resb 4	; reserved
    33                              <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                              <2> eldhxHeader:		resb ELD_HEADER_size
    39                              <2> eldhxDescriptionOffset:	resd 1	; zero if none, from eldhxHeader. <= 128 Bytes
    40                              <2> eldhxHelpOffset:	resd 1	; zero if none, from eldhxHeader
    41                              <2> eldhxLibTable:		resd 1	; zero if none, from eldhxHeader
    42                              <2> 	alignb 16
    43                              <2> 	endstruc
    44                              <2> 
    45                              <2> 	struc ELD_LIBTABLE
    46                              <2> eldltFormat:		resw 1	; current: 0 = uncompressed, 2 = compressed
    47                              <2> eldltAmount:		resw 1
    48                              <2> eldltOffset:		resd 1	; from eldhxHeader
    49                              <2> eldltCompressedLength:		; (dword, only present if format 2)
    50                              <2> 	endstruc
    51                              <2> 	endarea ELD_LIBTABLE, 1
    52                              <2> 
    53                              <2> 		; ELD instance header
    54                              <2> 	struc ELD_INSTANCE
    55                              <2> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    56                              <2> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    57                              <2> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    58                              <2> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    59                              <2> eldiIdentifier:		resb 8	; blank-filled text
    60                              <2> eldiFlags:		resw 1	; flags
    61                              <2> eldiListing_size equ 14
    62                              <2> eldiListing:		resb eldiListing_size
    63                              <2> 				; ASCIZ listing file name
    64                              <2> 	endstruc
    65                              <2> 		; flags for eldiFlags:
    66                              <2> eldifResident:		equ 1
    67                              <2> 
    68                              <2> 		; ELD link info header
    69                              <2> 	struc ELD_LINKINFO
    70                              <2> eldlSignature:		resw 1	; 0E1D1h
    71                              <2> eldlReserved:		resw 2
    72                              <2> eldlUseLinkHash:	resw 1
    73                              <2> eldlDataAmount:		resw 1
    74                              <2> eldlDataPrefixes:	resw 1
    75                              <2> eldlDataEntries:	resw 1
    76                              <2> eldlDataAddresses:	resw 1
    77                              <2> eldlCodeAmount:		resw 1
    78                              <2> eldlCodePrefixes:	resw 1
    79                              <2> eldlCodeEntries:	resw 1
    80                              <2> eldlCodeAddresses:	resw 1
    81                              <2> 	endstruc
    82                              <2> 
    83                              <2> 	numdef ELD_CODE_VSTART, 9001h
    84                              <2> 	numdef ELD_DATA_VSTART, 8000h
    85                              <2> 	numdef ELD_RELOC_VSTART, 8000h
    86                              <2> 
    87                              <2> 	numdef ELD_RECLAIM_HINT, 0
    88                              <2> 	strdef ELD_LISTING, ""
    89                              <2> 
    90                              <2> %endif
    17                              <1> 
    18                              <1> 	cpu 8086
    19                              <1> 
    20                              <1> %if ELDSTRICT
    21                              <1>  %if ELDSTRICTCOUNTER
    22                              <1>   %error Missing relocation
    23                              <1>  %endif
    24                              <1> %endif
    25                              <1> 	eldstrict off		; linker does some relocations
    26                              <1> 
    27                              <1> %ifn ELDCALLCALL_DUMPED
    28                              <1> 	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
    29                              <1> %endif
    30                              <1> 
    31                              <1> 	numdef ELD_IDENTICALISE, 0
    32                              <1> 	numdef ELD_DEBUG, 0
    33                              <1> 	numdef ELD_LINKER_PASSES, 1
    34                              <1> 	strdef LISTING, _ELD_LISTING
    35                              <1> 	numdef ELDCALL_OPTIONAL, ELDCALL_OPTIONAL_STATUS
    36                              <1> %if _ELD_IDENTICALISE
    37                              <1>  ;%assign _ELDCALL_OPTIONAL 1
    38                              <1> %endif
    39                              <1> %ifn _ELDCALL_OPTIONAL
    40                              <1> %assign ELDCALL_OPTIONAL_STATUS 2		; not allowed
    41                              <1> %endif
    42                              <1> 
    43                              <1> 
    44                              <1> endresident: equ ($ + _CURRENT_SECTION %+ FIXUP + 15) & ~15
    45                              <1> 
    46                              <1> %if _ELD_LINKER_PASSES
    47                              <1> %assign ELDLINKER 1
    48                              <1> 
    49                              <1> 	struc LINKTABLE
    50 00000000 ????????            <1> ltCodeToCode:	resw 2
    51 00000004 ????????            <1> ltCodeToData:	resw 2
    52 00000008 ????????            <1> ltDataToCode:	resw 2
    53 0000000C ????????            <1> ltDataToData:	resw 2
    54 00000010 ????????            <1> ltLinkData:	resw 2
    55 00000014 ????????            <1> ltLinkCode:	resw 2
    56                              <1> 	endstruc
    57                              <1> %endif
    58                              <1> 
    59                              <1> 
    60                              <1> linker:
    61                              <1> 		; The first 15 Bytes of the linker should be
    62                              <1> 		;  the same regardless of the linker options
    63                              <1> 		;  used (debug, passes, vstart). This allows
    64                              <1> 		;  the eldcomp ELD to match even if up to 15
    65                              <1> 		;  Bytes of the linker are trailing in the
    66                              <1> 		;  resident part of the ELD.
    67                              <1> 	lframe
    68                              <1>  %if ELDOTHER
    69                              <1> 	lvar dword, linkinfo_other
    70                              <1> 	lvar word, use_hash_other
    71                              <1>  %endif
    72 000002C1 5589E5              <1> 	lenter
    73                              <1> 	lvar dword, instance
    74 000002C4 06                  <1> 	 push es
    75 000002C5 52                  <1> 	 push dx
    76                              <1> 	lvar word, targetsection_low_optional_high
    77 000002C6 50                  <1> 	 push ax
    78                              <1> 	lequ ?targetsection_low_optional_high, targetsection
    79                              <1> 	lequ ?targetsection_low_optional_high + 1, optional
    80                              <1> 	lvar dword, linkinfo
    81 000002C7 1E                  <1> 	 push ds
    82 000002C8 57                  <1> 	 push di
    83                              <1> 	lvar dword, nextreloc
    84 000002C9 06                  <1> 	 push es
    85 000002CA 52                  <1> 	 push dx
    86                              <1> 	lvar dword, entry
    87 000002CB 06                  <1> 	 push es
    88 000002CC 50                  <1> 	 push ax		; placeholder
    89 000002CD 31C0                <1> 	xor ax, ax
    90 000002CF 813DD1E1            <1> 	cmp word [di + eldlSignature], 0E1D1h
    91                              <1> %if ($ - linker) < 16
    92                              <1>  %error Expected invariant first paragraph of linker
    93                              <1> %endif
    94 000002D3 7403E95502          <1> 	jne .error_j
    95 000002D8 837D0601            <1> 	cmp word [di + eldlUseLinkHash], 1
    96 000002DC 7603E94C02          <1> 	ja .error_j
    97 000002E1 7201                <1> 	jb @F
    98 000002E3 48                  <1> 	dec ax
    99                              <1> @@:
   100                              <1> 	lvar word, use_hash
   101 000002E4 50                  <1> 	 push ax
   102                              <1> %if _ELD_IDENTICALISE && _ELD_LINKER_PASSES
   103                              <1> 	mov ax, linktable - code
   104                              <1> 	lvar word, lt
   105                              <1> 	 push ax
   106                              <1> %endif
   107                              <1> %if _ELD_LINKER_PASSES || ELDOTHER
   108 000002E5 31C0                <1> 	xor ax, ax
   109                              <1>  %if _ELD_LINKER_PASSES
   110                              <1> 	lvar word, pass
   111 000002E7 50                  <1> 	 push ax
   112                              <1> 	lvar word, amounterrors
   113 000002E8 50                  <1> 	 push ax
   114                              <1> 	lvar word, name
   115 000002E9 50                  <1> 	 push ax
   116                              <1>  %endif
   117                              <1>  %if ELDOTHER
   118                              <1> 	lvar word, other
   119                              <1> 	 push ax
   120                              <1>  %endif
   121                              <1> %endif
   122 000002EA 56                  <1> 	push si
   123 000002EB 53                  <1> 	push bx
   124                              <1> 
   125                              <1> 			; simple: add instance base (dx) to code
   126 000002EC 06                  <1> 	push es
   127 000002ED 1F                  <1> 	pop ds
   128                              <1> %if _ELD_LINKER_PASSES
   129                              <1> .pass:
   130 000002EE 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   131 000002F1 01D3                <1> 	add bx, dx
   132                              <1>  %if _ELD_IDENTICALISE
   133                              <1> 	add bx, word [bp + ?lt]
   134                              <1> 	mov si, word [ltCodeToCode + bx]
   135                              <1>  %else
   136 000002F3 8BB75C06            <1> 	mov si, word [linktable - code + ltCodeToCode + bx]
   137                              <1>  %endif
   138                              <1> %else
   139                              <1> 	mov si, internalcodetocoderelocations - code
   140                              <1> %endif
   141 000002F7 01D6                <1> 	add si, dx
   142                              <1> @@:
   143 000002F9 AD                  <1> 	lodsw
   144 000002FA 85C0                <1> 	test ax, ax		; was last ?
   145 000002FC 740B                <1> 	jz @F			; yes -->
   146 000002FE 93                  <1> 	xchg bx, ax		; bx = entry
   147 000002FF 01D3                <1> 	add bx, dx		; relocate the entry itself
   148                              <1> %if _ELD_CODE_VSTART
   149 00000301 812F[0000]          <1> 	sub word [bx], code	; undo adjustment
   150                              <1> %endif
   151 00000305 0117                <1> 	add word [bx], dx	; relocate word referenced by entry
   152 00000307 EBF0                <1> 	jmp @B
   153                              <1> 
   154                              <1> @@:
   155                              <1> 			; next, add heap data base (on stack) to code
   156                              <1> %if _ELD_LINKER_PASSES
   157 00000309 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   158 0000030C 01D3                <1> 	add bx, dx
   159                              <1>  %if _ELD_IDENTICALISE
   160                              <1> 	add bx, word [bp + ?lt]
   161                              <1> 	mov si, word [ltCodeToData + bx]
   162                              <1>  %else
   163 0000030E 8BB76006            <1> 	mov si, word [linktable - code + ltCodeToData + bx]
   164                              <1>  %endif
   165                              <1> %else
   166                              <1> 	mov si, internalcodetodatarelocations - code
   167                              <1> %endif
   168 00000312 01D6                <1> 	add si, dx
   169                              <1> @@:
   170 00000314 AD                  <1> 	lodsw
   171 00000315 85C0                <1> 	test ax, ax		; was last ?
   172 00000317 740C                <1> 	jz @F			; yes -->
   173 00000319 93                  <1> 	xchg bx, ax		; bx = entry
   174 0000031A 01D3                <1> 	add bx, dx		; relocate the entry itself
   175 0000031C 58                  <1> 	pop ax			; ax -> heap data
   176 0000031D 50                  <1> 	push ax
   177                              <1> %if _ELD_DATA_VSTART
   178 0000031E 2D[0000]            <1> 	sub ax, datastart	; undo adjustment
   179                              <1> %endif
   180 00000321 0107                <1> 	add word [bx], ax	; relocate word referenced by entry
   181 00000323 EBEF                <1> 	jmp @B
   182                              <1> 
   183                              <1> @@:
   184                              <1> 
   185                              <1> 			; add instance base (dx) to data
   186                              <1> %if _ELD_LINKER_PASSES
   187 00000325 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   188 00000328 01D3                <1> 	add bx, dx
   189                              <1>  %if _ELD_IDENTICALISE
   190                              <1> 	add bx, word [bp + ?lt]
   191                              <1> 	mov si, word [ltDataToCode + bx]
   192                              <1>  %else
   193 0000032A 8BB76406            <1> 	mov si, word [linktable - code + ltDataToCode + bx]
   194                              <1>  %endif
   195                              <1> %else
   196                              <1> 	mov si, internaldatatocoderelocations - code
   197                              <1> %endif
   198 0000032E 01D6                <1> 	add si, dx
   199                              <1> @@:
   200 00000330 AD                  <1> 	lodsw
   201 00000331 83F8FF              <1> 	cmp ax, -1		; was last ?
   202 00000334 740F                <1> 	je @F			; yes -->
   203 00000336 93                  <1> 	xchg bx, ax		; bx = entry
   204 00000337 58                  <1> 	pop ax
   205 00000338 50                  <1> 	push ax
   206 00000339 01C3                <1> 	add bx, ax		; relocate the entry itself
   207                              <1> %if _ELD_CODE_VSTART
   208 0000033B 36812F[0000]        <1> 	sub word [ss:bx], code	; undo adjustment
   209                              <1> %endif
   210 00000340 360117              <1> 	add word [ss:bx], dx	; relocate word referenced by entry
   211 00000343 EBEB                <1> 	jmp @B
   212                              <1> 
   213                              <1> @@:
   214                              <1> 			; next, add heap data base (on stack) to data
   215                              <1> %if _ELD_LINKER_PASSES
   216 00000345 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   217 00000348 01D3                <1> 	add bx, dx
   218                              <1>  %if _ELD_IDENTICALISE
   219                              <1> 	add bx, word [bp + ?lt]
   220                              <1> 	mov si, word [ltDataToData + bx]
   221                              <1>  %else
   222 0000034A 8BB76806            <1> 	mov si, word [linktable - code + ltDataToData + bx]
   223                              <1>  %endif
   224                              <1> %else
   225                              <1> 	mov si, internaldatatodatarelocations - code
   226                              <1> %endif
   227 0000034E 01D6                <1> 	add si, dx
   228                              <1> @@:
   229 00000350 AD                  <1> 	lodsw
   230 00000351 83F8FF              <1> 	cmp ax, -1		; was last ?
   231 00000354 740D                <1> 	je @F			; yes -->
   232 00000356 93                  <1> 	xchg bx, ax		; bx = entry
   233 00000357 58                  <1> 	pop ax			; ax -> heap data
   234 00000358 50                  <1> 	push ax
   235 00000359 01C3                <1> 	add bx, ax		; relocate the entry itself
   236                              <1> %if _ELD_DATA_VSTART
   237 0000035B 2D[0000]            <1> 	sub ax, datastart	; undo adjustment
   238                              <1> %endif
   239 0000035E 360107              <1> 	add word [ss:bx], ax	; relocate word referenced by entry
   240 00000361 EBED                <1> 	jmp @B
   241                              <1> 
   242                              <1> @@:
   243 00000363 8B56FC              <1> 	mov dx, word [bp + ?instance]
   244                              <1> %if _ELD_LINKER_PASSES
   245 00000366 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   246 00000369 01D3                <1> 	add bx, dx
   247                              <1>  %if _ELD_IDENTICALISE
   248                              <1> 	add bx, word [bp + ?lt]
   249                              <1> 	add dx, word [ltLinkData + bx]
   250                              <1>  %else
   251 0000036B 03976C06            <1> 	add dx, word [linktable - code + ltLinkData + bx]
   252                              <1>  %endif
   253                              <1> %else
   254                              <1> 	add dx, linkerdatarelocations - code
   255                              <1> %endif
   256                              <1> .otherloop:
   257 0000036F 8956F2              <1> 	mov word [bp + ?nextreloc], dx
   258                              <1> 
   259                              <1> .datarelocloop:		; must be done before further relocs
   260 00000372 C576F2              <1> 	lds si, [bp + ?nextreloc]
   261 00000375 AD                  <1> 	lodsw			; ax = section indicator
   262 00000376 85C0                <1> 	test ax, ax		; end of table ?
   263 00000378 7503E92301          <1> 	jz .donedatareloc
   264 0000037D 48                  <1> 	dec ax			; al = 1 if data, 0 if code
   265 0000037E 5B                  <1> 	pop bx
   266 0000037F 53                  <1> 	push bx			; bx -> ELD data block
   267 00000380 8946FA              <1> 	mov word [bp + ?targetsection_low_optional_high], ax
   268 00000383 84C0                <1> 	test al, al		; data ?
   269 00000385 AD                  <1> 	lodsw
   270 00000386 7504                <1> 	jnz @F			; yes -->
   271 00000388 0346FC              <1> 	add ax, word [bp + ?instance]
   272                              <1> 				; relocate entry into code
   273 0000038B A9                  <1> 	db __TEST_IMM16		; (skip add)
   274                              <1> @@:
   275 0000038C 01D8                <1> 	add ax, bx		; relocate entry into data
   276 0000038E 8946EE              <1> 	mov word [bp + ?entry], ax
   277 00000391 AD                  <1> 	lodsw
   278 00000392 8976F2              <1> 	mov word [bp + ?nextreloc], si
   279 00000395 E8DC00              <1> 	call .build_match
   280                              <1> %if _ELD_LINKER_PASSES
   281 00000398 73D8                <1> 	jnc .datarelocloop
   282                              <1> %endif
   283 0000039A C45EF6              <1> 	les bx, [bp + ?linkinfo]
   284                              <1> %if ELDOTHER
   285                              <1> 	rol byte [bp + ?other], 1
   286                              <1> 	jnc @F
   287                              <1> 	les bx, [bp + ?linkinfo_other]
   288                              <1> @@:
   289                              <1> %endif
   290 0000039D 268B4F08            <1> 	mov cx, word [es:bx + eldlDataAmount]	; amount data link info
   291 000003A1 268B7F0A            <1> 	mov di, word [es:bx + eldlDataPrefixes]	; -> prefixes or hashes
   292                              <1> .datarelocfind:
   293 000003A5 F2AF                <1> 	repne scasw			; scan initial
   294 000003A7 7541                <1> 	jne .datarelocnotfound
   295 000003A9 57                  <1> 	push di
   296 000003AA 51                  <1> 	push cx
   297 000003AB 56                  <1> 	push si
   298 000003AC 262B7F0A            <1> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   299 000003B0 4F                  <1> 	dec di
   300 000003B1 4F                  <1> 	dec di				; 0-based
   301 000003B2 26037F0C            <1> 	add di, word [es:bx + eldlDataEntries]	; -> entry
   302 000003B6 268B3D              <1> 	mov di, [es:di]			; -> counted suffix/string
   303 000003B9 B500                <1> 	mov ch, 0
   304 000003BB 8A0C                <1> 	mov cl, byte [si]		; cx = length
   305 000003BD 41                  <1> 	inc cx
   306                              <1> 	; cmp al, al			; ZR if length is zero
   307 000003BE F3A6                <1> 	repe cmpsb			; match ?
   308 000003C0 5E                  <1> 	pop si
   309 000003C1 59                  <1> 	pop cx
   310 000003C2 5F                  <1> 	pop di
   311 000003C3 75E0                <1> 	jne .datarelocfind
   312 000003C5 8814                <1> 	mov byte [si], dl
   313 000003C7 262B7F0A            <1> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   314 000003CB 4F                  <1> 	dec di
   315 000003CC 4F                  <1> 	dec di				; 0-based
   316 000003CD 26037F0E            <1> 	add di, word [es:bx + eldlDataAddresses]	; -> address (offset)
   317 000003D1 268B05              <1> 	mov ax, word [es:di]
   318 000003D4 E80700              <1> 	call .address_data_reloc
   319                              <1> %if _ELD_RELOC_VSTART
   320 000003D7 2D[0000]            <1> 	sub ax, relocateddata		; *not* a relocation
   321                              <1> %endif
   322 000003DA 0104                <1> 	add word [si], ax		; relocate
   323 000003DC EB94                <1> 	jmp .datarelocloop
   324                              <1> 
   325                              <1> .address_data_reloc:
   326 000003DE C576EE              <1> 	lds si, [bp + ?entry]		; -> entry if in ELD code instance
   327 000003E1 807EFA00            <1> 	cmp byte [bp + ?targetsection], 0
   328                              <1> 					; relocation in code ?
   329 000003E5 7402                <1> 	je @F				; yes -->
   330 000003E7 16                  <1> 	push ss
   331 000003E8 1F                  <1> 	pop ds				; => our ELD data block
   332                              <1> @@:
   333 000003E9 C3                  <1> 	retn
   334                              <1> 
   335                              <1> .datarelocnotfound:
   336 000003EA 8814                <1> 	mov byte [si], dl
   337 000003EC 807EFB00            <1> 	cmp byte [bp + ?optional], 0
   338                              <1> %if _ELD_DEBUG
   339                              <1> 	jne @F
   340                              <1>  %ifn _ELD_LINKER_PASSES
   341                              <1> 	mov si, 0			; (invalid link)
   342                              <1> linkdatarelocation internalflags6
   343                              <1> 	test si, si
   344                              <1> 	jz .datanotfound
   345                              <1> 	mov si, 0			; (invalid link)
   346                              <1> linkdatarelocation options7
   347                              <1> 	test si, si
   348                              <1> 	jz .datanotfound
   349                              <1>  %else
   350                              <1> 	cmp byte [bp + ?pass], 0
   351                              <1> 	je .datanotfound
   352                              <1>  %endif
   353                              <1> 	houdini
   354                              <1> 	jmp .datanotfound
   355                              <1> @@:
   356                              <1> %else
   357 000003F0 7417                <1> 	je .datanotfound
   358                              <1> %endif
   359                              <1> %if _ELD_LINKER_PASSES
   360 000003F2 36F606[0000]02      <1> 	testopt [ss:relocateddata], 2
   361                              <1> linkdatarelocation options7, -3
   362 000003F8 7406                <1> 	jz @F
   363 000003FA BE[E309]            <1> 	mov si, lmsg.warning_data_optional
   364                              <1> internalcoderelocation
   365 000003FD E82B00              <1> 	call .notfound
   366                              <1> @@:
   367                              <1> %endif
   368 00000400 E8DBFF              <1> 	call .address_data_reloc
   369 00000403 832400              <1> 	and word [si], 0		; indicate optional data link failed
   370 00000406 E969FF              <1> 	jmp .datarelocloop
   371                              <1> 
   372                              <1> 
   373                              <1> %if _ELDCALL_OPTIONAL
   374                              <1> .coderelocnotfound:
   375                              <1> 	mov byte [si], dl
   376                              <1> 	cmp byte [bp + ?optional], 0
   377                              <1> %if _ELD_DEBUG
   378                              <1> 	jne @F
   379                              <1>  %ifn _ELD_LINKER_PASSES
   380                              <1> 	mov si, 0			; (invalid link)
   381                              <1> linkdatarelocation internalflags6
   382                              <1> 	test si, si
   383                              <1> 	jz .codenotfound
   384                              <1> 	mov si, 0			; (invalid link)
   385                              <1> linkdatarelocation options7
   386                              <1> 	test si, si
   387                              <1> 	jz .codenotfound
   388                              <1>  %else
   389                              <1> 	cmp byte [bp + ?pass], 0
   390                              <1> 	je .codenotfound
   391                              <1>  %endif
   392                              <1> 	houdini
   393                              <1> 	jmp .codenotfound
   394                              <1> @@:
   395                              <1> %else
   396                              <1> 	je .codenotfound
   397                              <1> %endif
   398                              <1> 
   399                              <1> %if ELDCALL_PMREQUIRED_STATUS
   400                              <1>  %if _ELD_LINKER_PASSES
   401                              <1>   %assign ELDLINKER 0
   402                              <1>  %endif
   403                              <1> 	mov si, relocateddata
   404                              <1> linkdatarelocation build_option_PM
   405                              <1>  %if _ELD_LINKER_PASSES
   406                              <1>   %assign ELDLINKER 1
   407                              <1>  %endif
   408                              <1> 	test si, si
   409                              <1> 	jz @F
   410                              <1> 	test byte [bp + ?optional], 2
   411                              <1> 	jnz .codenotfound
   412                              <1> @@:
   413                              <1> %endif
   414                              <1> 
   415                              <1> %if _ELD_LINKER_PASSES
   416                              <1> 	testopt [ss:relocateddata], 2
   417                              <1> linkdatarelocation options7, -3
   418                              <1> 	jz @F
   419                              <1> 	mov si, lmsg.warning_code_optional
   420                              <1> internalcoderelocation
   421                              <1> 	call .notfound
   422                              <1> @@:
   423                              <1> %endif
   424                              <1> 	lds si, [bp + ?entry]
   425                              <1> 	mov word [si], 9090h
   426                              <1> 	mov byte [si + 2], 90h		; indicate optional code link failed
   427                              <1> 	jmp .coderelocloop
   428                              <1> %endif
   429                              <1> 
   430                              <1> 
   431                              <1> %if _ELD_LINKER_PASSES
   432                              <1> .datanotfound:
   433 00000409 BE[050A]            <1> 	mov si, lmsg.error_data
   434                              <1> internalcoderelocation
   435 0000040C E81C00              <1> 	call .notfound
   436 0000040F 7203E91901          <1> 	jnc .error_j
   437 00000414 FF46E8              <1> 	inc word [bp + ?amounterrors]
   438 00000417 E958FF              <1> 	jmp .datarelocloop
   439                              <1> 
   440                              <1> .codenotfound:
   441 0000041A BE[1E0A]            <1> 	mov si, lmsg.error_code
   442                              <1> internalcoderelocation
   443 0000041D E80B00              <1> 	call .notfound
   444 00000420 7203E90801          <1> 	jnc .error_j
   445 00000425 FF46E8              <1> 	inc word [bp + ?amounterrors]
   446 00000428 E98400              <1> 	jmp .coderelocloop
   447                              <1> 
   448                              <1> .notfound:
   449 0000042B 807EEA00            <1> 	cmp byte [bp + ?pass], 0
   450 0000042F 743A                <1> 	je @F				; --> (NC)
   451 00000431 16                  <1> 	 push ss
   452 00000432 07                  <1> 	 pop es
   453 00000433 BF[0000]            <1> 	mov di, relocateddata
   454                              <1> linkdatarelocation line_out
   455 00000436 E83300              <1> 	call .copy
   456 00000439 8B76E6              <1> 	mov si, word [bp + ?name]
   457 0000043C AD                  <1> 	lodsw
   458 0000043D E8[0000]EB020000    <1> 	extcall hexword
   459 00000444 56                  <1> 	push si
   460 00000445 BE[370A]            <1> 	mov si, lmsg.error.2
   461                              <1> internalcoderelocation
   462 00000448 E82100              <1> 	call .copy
   463 0000044B 5E                  <1> 	pop si
   464                              <1> %if _ELD_LINKER_PASSES
   465 0000044C 56                  <1> 	push si
   466 0000044D E81C00              <1> 	call .copy
   467 00000450 5E                  <1> 	pop si
   468 00000451 C60400              <1> 	mov byte [si], 0		; mark as failed
   469                              <1> %else
   470                              <1> 	call .copy
   471                              <1> %endif
   472 00000454 B022                <1> 	mov al, '"'
   473 00000456 AA                  <1> 	stosb
   474 00000457 16                  <1> 	 push ss
   475 00000458 1F                  <1> 	 pop ds
   476 00000459 E8[0000]EB020000    <1> 	extcall putsline_crlf
   477 00000460 B8350E              <1> 	mov ax, 0E35h
   478 00000463 E8[0000]EB020000    <1> 	extcall setrc
   479 0000046A F9                  <1> 	stc				; CY, diagnostic displayed
   480                              <1> @@:
   481 0000046B C3                  <1> 	retn
   482                              <1> 
   483                              <1> .copy:
   484 0000046C E8[0000]EB020000    <1> 	extcall copy_single_counted_string
   485 00000473 C3                  <1> 	retn
   486                              <1> %else
   487                              <1> .datanotfound: equ .error_j
   488                              <1> .codenotfound: equ .error_j
   489                              <1> %endif
   490                              <1> 
   491                              <1> .build_match:
   492                              <1> %if _ELD_CODE_VSTART
   493 00000474 2D[0000]            <1> 	sub ax, code
   494                              <1> %endif
   495 00000477 0346FC              <1> 	add ax, word [bp + ?instance]
   496 0000047A 96                  <1> 	xchg si, ax
   497                              <1> %if _ELD_LINKER_PASSES
   498 0000047B 8976E6              <1> 	mov word [bp + ?name], si
   499                              <1> %endif
   500 0000047E AD                  <1> 	lodsw			; = hash, si -> counted string
   501 0000047F 8A14                <1> 	mov dl, byte [si]
   502                              <1> %if _ELD_LINKER_PASSES
   503 00000481 84D2                <1> 	test dl, dl		; marked as already failed ?
   504 00000483 750A                <1> 	jnz @F
   505 00000485 837EE800            <1> 	cmp word [bp + ?amounterrors], 0
   506 00000489 7503E99F00          <1> 	je .error_j
   507 0000048E C3                  <1> 	retn			; (NC)
   508                              <1> 
   509                              <1> @@:
   510                              <1> %endif
   511                              <1> %if ELDOTHER
   512                              <1> 	rol byte [bp + ?other], 1
   513                              <1> 	jnc @F
   514                              <1> 	rol byte [bp + ?use_hash_other], 1
   515                              <1> 	jmp @FF
   516                              <1> 
   517                              <1> @@:
   518                              <1> %endif
   519 0000048F D046EC              <1> 	rol byte [bp + ?use_hash], 1
   520                              <1> @@:
   521 00000492 720A                <1> 	jc @F
   522 00000494 AC                  <1> 	lodsb
   523 00000495 91                  <1> 	xchg cx, ax		; cl = length
   524 00000496 AD                  <1> 	lodsw			; ax = prefix
   525 00000497 49                  <1> 	dec cx
   526 00000498 49                  <1> 	dec cx
   527 00000499 4E                  <1> 	dec si
   528 0000049A 8A14                <1> 	mov dl, byte [si]
   529 0000049C 880C                <1> 	mov byte [si], cl	; si -> counted string suffix
   530                              <1> @@:
   531                              <1> %if _ELD_LINKER_PASSES
   532 0000049E F9                  <1> 	stc			; CY
   533                              <1> %endif
   534 0000049F C3                  <1> 	retn
   535                              <1> 
   536                              <1> 
   537                              <1> .donedatareloc:
   538                              <1> %if ELDOTHER
   539                              <1> 	rol byte [bp + ?other], 1
   540                              <1> 	jc .otherdone
   541                              <1> %endif
   542                              <1> 
   543 000004A0 8B56FC              <1> 	mov dx, word [bp + ?instance]
   544                              <1> %if _ELD_LINKER_PASSES
   545 000004A3 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   546 000004A6 01D3                <1> 	add bx, dx
   547                              <1>  %if _ELD_IDENTICALISE
   548                              <1> 	add bx, word [bp + ?lt]
   549                              <1> 	add dx, word [ltLinkCode + bx]
   550                              <1>  %else
   551 000004A8 03977006            <1> 	add dx, word [linktable - code + ltLinkCode + bx]
   552                              <1>  %endif
   553                              <1> %else
   554                              <1> 	add dx, linkercoderelocations - code
   555                              <1> %endif
   556 000004AC 8956F2              <1> 	mov word [bp + ?nextreloc], dx
   557                              <1> 
   558                              <1> .coderelocloop:
   559 000004AF C576F2              <1> 	lds si, [bp + ?nextreloc]
   560 000004B2 AD                  <1> 	lodsw
   561                              <1> %if _ELDCALL_OPTIONAL
   562                              <1> 	dec ax
   563                              <1> 	js .donecodereloc
   564                              <1> 	mov word [bp + ?targetsection_low_optional_high], ax
   565                              <1> 	lodsw
   566                              <1> %endif
   567 000004B3 0346FC              <1> 	add ax, word [bp + ?instance]
   568 000004B6 8946EE              <1> 	mov word [bp + ?entry], ax
   569 000004B9 AD                  <1> 	lodsw
   570 000004BA 8976F2              <1> 	mov word [bp + ?nextreloc], si
   571                              <1> %ifn _ELDCALL_OPTIONAL
   572 000004BD 85C0                <1> 	test ax, ax
   573 000004BF 747E                <1> 	jz .donecodereloc
   574                              <1> %endif
   575 000004C1 E8B0FF              <1> 	call .build_match
   576                              <1> %if _ELD_LINKER_PASSES
   577 000004C4 73E9                <1> 	jnc .coderelocloop
   578                              <1> %endif
   579 000004C6 C45EF6              <1> 	les bx, [bp + ?linkinfo]
   580 000004C9 268B4F10            <1> 	mov cx, word [es:bx + eldlCodeAmount]	; amount code link info
   581 000004CD 268B7F12            <1> 	mov di, word [es:bx + eldlCodePrefixes]	; -> prefixes or hashes
   582                              <1> .coderelocfind:
   583 000004D1 F2AF                <1> 	repne scasw			; scan initial
   584                              <1> %if _ELDCALL_OPTIONAL
   585                              <1> 	jne .coderelocnotfound
   586                              <1> %else
   587                              <1>  %if _ELD_DEBUG
   588                              <1> 	je @F
   589                              <1> 	houdini
   590                              <1> 	jmp .codenotfound
   591                              <1> @@:
   592                              <1>  %else
   593 000004D3 7403E942FF          <1> 	jne .codenotfound
   594                              <1>  %endif
   595                              <1> %endif
   596 000004D8 57                  <1> 	push di
   597 000004D9 51                  <1> 	push cx
   598 000004DA 56                  <1> 	push si
   599 000004DB 262B7F12            <1> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   600 000004DF 4F                  <1> 	dec di
   601 000004E0 4F                  <1> 	dec di				; 0-based
   602 000004E1 26037F14            <1> 	add di, word [es:bx + eldlCodeEntries]	; -> entry
   603 000004E5 268B3D              <1> 	mov di, [es:di]			; -> counted suffix/string
   604 000004E8 B500                <1> 	mov ch, 0
   605 000004EA 8A0C                <1> 	mov cl, byte [si]		; cx = length
   606 000004EC 41                  <1> 	inc cx
   607                              <1> 	; cmp al, al			; ZR if length is zero
   608 000004ED F3A6                <1> 	repe cmpsb			; match ?
   609 000004EF 5E                  <1> 	pop si
   610 000004F0 59                  <1> 	pop cx
   611 000004F1 5F                  <1> 	pop di
   612 000004F2 75DD                <1> 	jne .coderelocfind
   613 000004F4 8814                <1> 	mov byte [si], dl
   614 000004F6 262B7F12            <1> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   615 000004FA 4F                  <1> 	dec di
   616 000004FB 4F                  <1> 	dec di				; 0-based
   617 000004FC 01FF                <1> 	add di, di			; quadruple index
   618 000004FE 26037F16            <1> 	add di, word [es:bx + eldlCodeAddresses]	; -> address (offset, segment)
   619 00000502 26FF35              <1> 	push word [es:di]
   620 00000505 C576EE              <1> 	lds si, [bp + ?entry]
   621 00000508 8F4405              <1> 	pop word [si + 3 + 2]		; call near imm (3), jmp short (2)
   622                              <1> 					;  patch the destination address
   623 0000050B 803CE8              <1> 	cmp byte [si], 0E8h		; is it as expected ?
   624 0000050E 751D                <1> 	jne .error_j
   625 00000510 268B7D02            <1> 	mov di, word [es:di + 2]
   626 00000514 BB[0000]            <1> 	mov bx, relocateddata
   627                              <1> linkdatarelocation linkcall_table	; ss:bx -> link call table
   628 00000517 36833F01            <1> 	cmp word [ss:bx], 1		; is it initialised to format 1 ?
   629 0000051B 7510                <1> 	jne .error_j			; no -->
   630 0000051D 368B4F02            <1> 	mov cx, word [ss:bx + 2]	; get amount of segments
   631 00000521 E30A                <1> 	jcxz .error_j			; none -->
   632                              <1> @@:
   633 00000523 83C304              <1> 	add bx, 4			; -> next segment
   634 00000526 36393F              <1> 	cmp word [ss:bx], di		; value matches ?
   635 00000529 7405                <1> 	je @F				; yes, found -->
   636 0000052B E2F6                <1> 	loop @B				; try remaining segments
   637                              <1> .error_j:
   638 0000052D E99B00              <1> 	jmp .error
   639                              <1> 
   640                              <1> @@:
   641 00000530 368B5F02            <1> 	mov bx, word [ss:bx + 2]	; -> call destination offset
   642                              <1> 		; si + 3 + delta = bx
   643                              <1> 		; delta = bx - si - 3
   644 00000534 29F3                <1> 	sub bx, si
   645 00000536 83EB03              <1> 	sub bx, 3
   646 00000539 895C01              <1> 	mov word [si + 1], bx		; patch the call instruction
   647 0000053C E970FF              <1> 	jmp .coderelocloop
   648                              <1> 
   649                              <1> .donecodereloc:
   650                              <1> %if _ELD_LINKER_PASSES
   651 0000053F 8B46E8              <1> 	mov ax, word [bp + ?amounterrors]
   652 00000542 85C0                <1> 	test ax, ax
   653 00000544 75E7                <1> 	jnz .error_j
   654 00000546 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   655 00000549 85DB                <1> 	test bx, bx
   656 0000054B 750B                <1> 	jnz @F
   657 0000054D 43                  <1> 	inc bx
   658 0000054E 43                  <1> 	inc bx
   659 0000054F 895EEA              <1> 	mov word [bp + ?pass], bx
   660 00000552 8B56FC              <1> 	mov dx, word [bp + ?instance]
   661 00000555 E996FD              <1> 	jmp .pass
   662                              <1> 
   663                              <1> @@:
   664                              <1> %endif
   665                              <1> 
   666                              <1> %ifnidni _LISTING, ""
   667                              <1> %assign ELDLINKER 0
   668                              <1> .hint:
   669 00000558 16                  <1> 	push ss
   670 00000559 1F                  <1> 	pop ds
   671 0000055A B02D                <1> 	mov al, 2Dh
   672 0000055C E8[0000]EB020000    <1> 	extcall intchk			; ZR if offset = -1 or segment = 0
   673                              <1> 					; CHG: ax, dx, bx
   674 00000563 7437                <1> 	jz .no_hint
   675                              <1> 
   676 00000565 8A26[0000]          <1> 	mov ah, byte [relocateddata]
   677                              <1> linkdatarelocation try_debugger_amis_multiplex_number
   678 00000569 E86600              <1> 	call plex_check
   679 0000056C 7305                <1> 	jnc @F
   680                              <1> 
   681 0000056E B4FF                <1> 	mov ah, 0FFh		; start with multiplex number 0FFh
   682                              <1> .loop_hint:
   683 00000570 E85F00              <1> 	call plex_check
   684                              <1> @@:
   685 00000573 7307                <1> 	jnc .end_hint		; if found --> (NC)
   686 00000575 80EC01              <1> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   687 00000578 73F6                <1> 	jnc .loop_hint		; try next if we didn't check all yet -->
   688 0000057A EB20                <1> 	jmp .no_hint
   689                              <1> 
   690                              <1> .end_hint:
   691 0000057C 50                  <1> 	push ax
   692 0000057D C446FC              <1> 	les ax, [bp + ?instance]
   693 00000580 BF[E507]            <1> 	mov di, listmsg.hint.offset
   694                              <1> internalcoderelocation
   695 00000583 E8[0000]EB020000    <1> 	extcall hexword
   696 0000058A BB[C407]            <1> 	mov bx, listmsg.hint
   697                              <1> internalcoderelocation
   698 0000058D 368B16[0000]        <1> 	mov dx, [ss:relocateddata]
   699                              <1> linkdatarelocation extseg	; must be 86 Mode segment even in PM
   700 00000592 58                  <1> 	pop ax
   701 00000593 B040                <1> 	mov al, 40h		; AMIS message display service
   702 00000595 E8[0000]EB020000    <1> 	extcall call_int2D
   703                              <1> .no_hint:
   704                              <1> %endif
   705                              <1> 
   706                              <1> %if ELDOTHER
   707                              <1> %assign ELDLINKER 0
   708                              <1> 	not byte [bp + ?other]
   709                              <1> 
   710                              <1> 	push ss
   711                              <1> 	pop ds
   712                              <1> 	mov al, 2Dh
   713                              <1> 	extcall intchk			; ZR if offset = -1 or segment = 0
   714                              <1> 					; CHG: ax, dx, bx
   715                              <1> 	jz .no_other
   716                              <1> 
   717                              <1> 	mov ah, byte [relocateddata]
   718                              <1> linkdatarelocation try_debugger_amis_multiplex_number
   719                              <1> 	call plex_check
   720                              <1> 	jnc @F
   721                              <1> 
   722                              <1> 	mov ah, 0FFh		; start with multiplex number 0FFh
   723                              <1> .loop_other:
   724                              <1> 	call plex_check
   725                              <1> @@:
   726                              <1> 	jnc .end_other		; if found --> (NC)
   727                              <1> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   728                              <1> 	jnc .loop_other		; try next if we didn't check all yet -->
   729                              <1> 	jmp .no_other
   730                              <1> 
   731                              <1> .end_other:
   732                              <1> 	mov al, 42h		; AMIS get other link info service
   733                              <1> 	extcall call_int2D
   734                              <1> 	cmp al, 0FFh
   735                              <1> 	jne .no_other
   736                              <1> 
   737                              <1> 	mov ax, si		; selector => PSP
   738                              <1> 	extcall ispm
   739                              <1> 	jz @F
   740                              <1> 	mov ax, dx		; segment => PSP
   741                              <1> @@:
   742                              <1> 	 push ss
   743                              <1> 	 pop ds
   744                              <1> 	mov word [otherds], ax
   745                              <1> internaldatarelocation		; current mode sel/seg
   746                              <1> 	mov word [otherseg], dx
   747                              <1> internaldatarelocation		; remember segment
   748                              <1> 
   749                              <1> 	mov ax, cx		; selector => link info
   750                              <1> 	extcall ispm
   751                              <1> 	jz @F
   752                              <1> 	mov ax, bx		; segment => link info
   753                              <1> @@:
   754                              <1> 	mov word [bp + ?linkinfo_other], di
   755                              <1> 	mov word [bp + ?linkinfo_other + 2], ax
   756                              <1> 
   757                              <1> 	mov ds, ax		; => link info
   758                              <1> 	xor ax, ax
   759                              <1> 	cmp word [di + eldlSignature], 0E1D1h
   760                              <1> 	jne .error_other
   761                              <1> 	cmp word [di + eldlUseLinkHash], 1
   762                              <1> 	ja .error_other
   763                              <1> 	jb @F
   764                              <1> 	dec ax
   765                              <1> @@:
   766                              <1> 	mov word [bp + ?use_hash_other], ax
   767                              <1> 
   768                              <1> 	mov dx, word [bp + ?instance]
   769                              <1> 	add dx, linkerotherdatarelocations - code
   770                              <1> 	jmp .otherloop
   771                              <1> 
   772                              <1> .error_other:
   773                              <1> 	push cs
   774                              <1> 	pop ds
   775                              <1> 	mov ax, 0E33h
   776                              <1> 	extcall setrc
   777                              <1> 	mov dx, lmsg.error_other
   778                              <1> internalcoderelocation
   779                              <1> 	jmp @F
   780                              <1> 
   781                              <1> .no_other:
   782                              <1> 	push cs
   783                              <1> 	pop ds
   784                              <1> 	mov ax, 0E34h
   785                              <1> 	extcall setrc
   786                              <1> 	mov dx, lmsg.no_other
   787                              <1> internalcoderelocation
   788                              <1> @@:
   789                              <1> 	extcall putsz
   790                              <1> 	jmp .error
   791                              <1> 
   792                              <1> .otherdone:
   793                              <1> %endif
   794                              <1> 
   795 0000059C 5B                  <1> 	pop bx				; -> our heap data
   796 0000059D 5E                  <1> 	pop si				; -> our command line tail
   797 0000059E 16                  <1> 	 push ss
   798 0000059F 1F                  <1> 	 pop ds
   799 000005A0 C47EFC              <1> 	les di, [bp + ?instance]
   800 000005A3 268B4502            <1> 	mov ax, word [es:di + eldiEndCode]
   801 000005A7 36F606[0100]017409- <1> houdini
   801 000005AF 36F606[0100]017401- <1>
   801 000005B7 CC                  <1>
   802 000005B8 2D[D002]            <1> 	sub ax, strict word endresident + code
   803                              <1> internalcoderelocation
   804 000005BB 26C74502[D002]      <1> 	mov word [es:di + eldiEndCode], endresident + code
   805                              <1> internalcoderelocation
   806 000005C1 2906[0000]          <1> 	sub word [relocateddata], ax
   807                              <1> linkdatarelocation extseg_used
   808                              <1> %if _DATA_SIZE == 0
   809                              <1> 	xor ax, ax
   810                              <1> 	mov word [es:di + eldiStartData], ax
   811                              <1> 	mov word [es:di + eldiEndData], ax
   812                              <1> %endif
   813 000005C5 89EC5D              <1> 	lleave code
   814                              <1> 		; INP:	es => ELD code segment
   815                              <1> 		;	ds:si -> command line tail
   816                              <1> 		;	ds:bx -> ELD data block
   817                              <1> 		;	ss:sp -> far return address for current mode
   818                              <1> 		; STT:	ds = ss, UP, EI
   819 000005C8 E935FC              <1> 	jmp start
   820                              <1> 
   821                              <1> .error:
   822 000005CB 89EC5D              <1> 	lleave
   823 000005CE B8FFFF              <1> 	mov ax, -1
   824 000005D1 CB                  <1> 	retf
   825                              <1> 
   826                              <1> 
   827                              <1> %ifnidni _LISTING, ""
   828                              <1>  %assign ELDHINT 1
   829                              <1> %else
   830                              <1>  %assign ELDHINT 0
   831                              <1> %endif
   832                              <1> 
   833                              <1> %if ELDOTHER || ELDHINT
   834                              <1> 		; INP:	ah = multiplex number to check
   835                              <1> 		; OUT:	CY if multiplex number unused or no signature match,
   836                              <1> 		;	 bp, ah, ds unmodified
   837                              <1> 		;	NC if match found,
   838                              <1> 		;	 ah = multiplex number (unmodified)
   839                              <1> 		; CHG:	si, di, es, cx, dx
   840                              <1> plex_check:
   841 000005D2 16                  <1> 	push ss
   842 000005D3 1F                  <1> 	pop ds
   843 000005D4 F606[0000]08        <1> 	testopt [relocateddata], 8
   844                              <1> linkdatarelocation internalflags4, -3
   845 000005D9 740B                <1> 	jz @F
   846 000005DB BE[0000]            <1> 	mov si, relocateddata
   847                              <1> linkdatarelocation amis_multiplex_number, -2, optional
   848 000005DE 85F6                <1> 	test si, si
   849 000005E0 7404                <1> 	jz @F
   850 000005E2 3A24                <1> 	cmp ah, byte [si]
   851 000005E4 7420                <1> 	je .notfound		; do not use our own multiplexer -->
   852                              <1> @@:
   853 000005E6 B000                <1> 	mov al, 00h		; AMIS installation check
   854 000005E8 E8[0000]EB020000    <1> 	extcall call_int2D	; AMIS (or "DOS reserved" = iret if no AMIS present)
   855 000005EF 3CFF                <1> 	cmp al, 0FFh
   856 000005F1 7513                <1> 	jne .notfound
   857 000005F3 0E                  <1> 	push cs
   858 000005F4 1F                  <1> 	pop ds
   859 000005F5 BE[B407]            <1> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
   860                              <1> internalcoderelocation
   861 000005F8 E8[0000]EB020000    <1> 	extcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
   862 000005FF B90800              <1> 	mov cx, 8		; Ignore description, only compare vendor and program name
   863 00000602 F3A7                <1> 	repe cmpsw
   864 00000604 7401                <1> 	je .checkret		; ZR, NC = match -->
   865                              <1> .notfound:
   866 00000606 F9                  <1> 	stc			; CY no match
   867                              <1> .checkret:
   868 00000607 C3                  <1> 	retn
   869                              <1> %endif
   870                              <1> 
   871                              <1> 
   872                              <1> 	align 4, db 0
   873                              <1> linkercoderelocations:
   874                              <1> %if _ELDCALL_OPTIONAL
   875                              <1> 	dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
   876                              <1> %else
   877 00000608 2200[ED07]C001-     <1> 	dw ELDCALL_CODE_RELOCATIONS, 0, 0
   877 0000060E [FC07]C801[0808]D0- <1>
   877 00000615 01[1408]D801[1D08]- <1>
   877 0000061C E001[2408]E801-     <1>
   877 00000622 [2B08]F001[3308]F8- <1>
   877 00000629 01[3B08]5E02[1408]- <1>
   877 00000630 5C05[7208]8305-     <1>
   877 00000636 [4B08]9505[7B08]E8- <1>
   877 0000063D 05[7B08]F805[8808]- <1>
   877 00000644 00000000            <1>
   878                              <1> %endif
   879                              <1> 
   880                              <1> %if _ELD_LINKER_PASSES
   881                              <1> linkerlinkercoderelocations:
   882                              <1> %if _ELDCALL_OPTIONAL
   883                              <1> 	dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
   884                              <1> %else
   885 00000648 3D04[4B08]5904-     <1> 	dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
   885 0000064E [3B08]6304[3308]6C- <1>
   885 00000655 04[5508]00000000    <1>
   886                              <1> %endif
   887                              <1> 
   888                              <1> 	align 2, db 0
   889                              <1> linktable:
   890                              <1> 	istruc LINKTABLE
   891                              <1> at ltCodeToCode
   892 0000065C A407                <1> 	dw internallinkercodetocoderelocations - code
   893 0000065E 4807                <1> 	dw internalcodetocoderelocations - code
   894                              <1> at ltCodeToData
   895 00000660 AE07                <1> 	dw internallinkercodetodatarelocations - code
   896 00000662 6A07                <1> 	dw internalcodetodatarelocations - code
   897                              <1> at ltDataToCode
   898 00000664 B007                <1> 	dw internallinkerdatatocoderelocations - code
   899 00000666 8C07                <1> 	dw internaldatatocoderelocations - code
   900                              <1> at ltDataToData
   901 00000668 B207                <1> 	dw internallinkerdatatodatarelocations - code
   902 0000066A 8E07                <1> 	dw internaldatatodatarelocations - code
   903                              <1> at ltLinkData
   904 0000066C 9007                <1> 	dw linkerlinkerdatarelocations - code
   905 0000066E 7406                <1> 	dw linkerdatarelocations - code
   906                              <1> at ltLinkCode
   907 00000670 4806                <1> 	dw linkerlinkercoderelocations - code
   908 00000672 0806                <1> 	dw linkercoderelocations - code
   909                              <1> 	iend
   910                              <1> %endif
   911                              <1> 
   912                              <1> 	align 2, db 0
   913                              <1> linkerdatarelocations:
   914 00000674 01004700[9308]0100- <1> 	dw LINK_DATA_RELOCATIONS, 0
   914 0000067C 4900[9D08]01004C00- <1>
   914 00000684 [A608]01007600-     <1>
   914 0000068A [B608]01007F00-     <1>
   914 00000690 [C108]01008B00-     <1>
   914 00000696 [CA08]0100AF00-     <1>
   914 0000069C [CA08]0100F900-     <1>
   914 000006A2 [E008]01000101-     <1>
   914 000006A8 [EB08]01010F01-     <1>
   914 000006AE [FC08]01004701-     <1>
   914 000006B4 [E008]01004F01-     <1>
   914 000006BA [EB08]01016001-     <1>
   914 000006C0 [0C09]01006A01-     <1>
   914 000006C6 [1C09]01017801-     <1>
   914 000006CC [2709]0101A001-     <1>
   914 000006D2 [3A09]0101A301-     <1>
   914 000006D8 [4A09]01000902-     <1>
   914 000006DE [5909]01003D02-     <1>
   914 000006E4 [E008]01004D02-     <1>
   914 000006EA [6709]01005A02-     <1>
   914 000006F0 [7509]01006802-     <1>
   914 000006F6 [E008]01007002-     <1>
   914 000006FC [EB08]01008202-     <1>
   914 00000702 [6709]01008E02-     <1>
   914 00000708 [7509]01009202-     <1>
   914 0000070E [CA08]0100AD02-     <1>
   914 00000714 [CA08]0100B302-     <1>
   914 0000071A [E008]01006705-     <1>
   914 00000720 [9509]01009005-     <1>
   914 00000726 [C108]0100AA05-     <1>
   914 0000072C [E008]0100B205-     <1>
   914 00000732 [EB08]0100C305-     <1>
   914 00000738 [6709]0100D605-     <1>
   914 0000073E [BA09]0101DC05-     <1>
   914 00000744 [CB09]0000          <1>
   915                              <1> 
   916                              <1> 	align 2, db 0
   917                              <1> internalcodetocoderelocations:
   918 00000748 8600D3004402490251- <1> 	dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
   918 00000751 0256027E028A029502- <1>
   918 0000075A A802AF0281058B05B9- <1>
   918 00000763 05BF05F6050000      <1>
   919                              <1> 
   920                              <1> 	align 2, db 0
   921                              <1> internalcodetodatarelocations:
   922 0000076A 340054005C00D700E8- <1> 	dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
   922 00000773 000B011C0131013701- <1>
   922 0000077C 5B017201B401110219- <1>
   922 00000785 022502B9020000      <1>
   923                              <1> 
   924                              <1> 	align 2, db 0
   925                              <1> internaldatatocoderelocations:
   926 0000078C FFFF                <1> 	dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
   927                              <1> 
   928                              <1> 	align 2, db 0
   929                              <1> internaldatatodatarelocations:
   930 0000078E FFFF                <1> 	dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
   931                              <1> 
   932                              <1> %if _ELD_LINKER_PASSES
   933                              <1> 	align 2, db 0
   934                              <1> linkerlinkerdatarelocations:
   935 00000790 0100F503[E008]0100- <1> 	dw LINK_LINKER_DATA_RELOCATIONS, 0
   935 00000798 3404[1C09]01001505- <1>
   935 000007A0 [8409]0000          <1>
   936                              <1> 
   937                              <1> 	align 2, db 0
   938                              <1> internallinkercodetocoderelocations:
   939 000007A4 FB030A041B04460400- <1> 	dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
   939 000007AD 00                  <1>
   940                              <1> 
   941                              <1> 	align 2, db 0
   942                              <1> internallinkercodetodatarelocations:
   943 000007AE 0000                <1> 	dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
   944                              <1> 
   945                              <1> 	align 2, db 0
   946                              <1> internallinkerdatatocoderelocations:
   947 000007B0 FFFF                <1> 	dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
   948                              <1> 
   949                              <1> 	align 2, db 0
   950                              <1> internallinkerdatatodatarelocations:
   951 000007B2 FFFF                <1> 	dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
   952                              <1> %endif
   953                              <1> 
   954                              <1> %if ELDOTHER
   955                              <1> 	align 2, db 0
   956                              <1> linkerotherdatarelocations:
   957                              <1> 	dw LINK_OTHER_DATA_RELOCATIONS, 0
   958                              <1> 
   959                              <1>  %ifnidn LINK_OTHER_LINKER_DATA_RELOCATIONS, ""
   960                              <1>   %error Other linker data links not supported
   961                              <1>  %endif
   962                              <1> %endif
   963                              <1> 
   964                              <1> %if ELDOTHER || ELDHINT
   965                              <1> 	align 2, db 0
   966                              <1> debuggeramissig:
   967 000007B4 65636D20<rep 5h>    <1> 		fill 8, 32, db "ecm"
   968 000007BC 6C446562756720-     <1> 		fill 8, 32, db "lDebug"
   968 000007BC <rep 2h>            <1>
   969                              <1> %endif
   970                              <1> 
   971                              <1> %ifnidni _LISTING, ""
   972                              <1> listmsg:
   973 000007C4 547261634C6973742D- <1> .hint:		db "TracList-add-offset=",_LISTING,"::"
   973 000007CD 6164642D6F66667365- <1>
   973 000007D6 743D686973746F7279- <1>
   973 000007DF 2E6C73743A3A        <1>
   974 000007E5 2D2D2D2D680D0A00    <1> .hint.offset:	asciz "----h",13,10
   975                              <1> %endif
   976                              <1> 
   977 000007ED 30CD0C636D64335F6E- <1> 	eldcall_dump_names ELDCALL_CODE_NAMES
   977 000007F6 6F745F657874D55509- <1>
   977 000007FF 736B6970636F6D6D61- <1>
   977 00000808 03C309697373747269- <1>
   977 00000811 6E673FDDB90663686B- <1>
   977 0000081A 656F6CBABD04636D64- <1>
   977 00000823 332890046973706D55- <1>
   977 0000082C 1205707574737AB212- <1>
   977 00000835 0573657472636FA20D- <1>
   977 0000083E 707574736C696E655F- <1>
   977 00000847 63726C668481076865- <1>
   977 00000850 78776F7264D0BB1A63- <1>
   977 00000859 6F70795F73696E676C- <1>
   977 00000862 655F636F756E746564- <1>
   977 0000086B 5F737472696E679869- <1>
   977 00000874 06696E7463686B2130- <1>
   977 0000087D 0A63616C6C5F696E74- <1>
   977 00000886 3244B7740873657465- <1>
   977 0000088F 73326478            <1>
   978 00000893 C30B076C617374636D- <1> 	link_data_dump_names LINK_DATA_NAMES
   978 0000089C 646B5D06646D79636D- <1>
   978 000008A5 6454400D6D73672E75- <1>
   978 000008AE 6E696E7374616C6CEB- <1>
   978 000008B7 420865787464737365- <1>
   978 000008C0 6CD52D066578747365- <1>
   978 000008C9 6797B6136578745F63- <1>
   978 000008D2 6F6D6D616E645F6861- <1>
   978 000008DB 6E646C65725ABC086F- <1>
   978 000008E4 7074696F6E7337CD51- <1>
   978 000008ED 0E696E7465726E616C- <1>
   978 000008F6 666C616773362AE70D- <1>
   978 000008FF 686973746F7279666F- <1>
   978 00000908 726D617473830D6869- <1>
   978 00000911 73746F727962756666- <1>
   978 0000091A 657284E3086C696E65- <1>
   978 00000923 5F6F75747D42106869- <1>
   978 0000092C 73746F72792E736567- <1>
   978 00000935 6F7273656C75AE0D68- <1>
   978 0000093E 6973746F72792E6669- <1>
   978 00000947 72737431AA0C686973- <1>
   978 00000950 746F72792E6C617374- <1>
   978 00000959 8D710B6D73672E696E- <1>
   978 00000962 7374616C6CE7D30B65- <1>
   978 0000096B 78747365675F757365- <1>
   978 00000974 64B2400C6578746461- <1>
   978 0000097D 74615F757365646844- <1>
   978 00000986 0E6C696E6B63616C6C- <1>
   978 0000098F 5F7461626C65F09E22- <1>
   978 00000998 7472795F6465627567- <1>
   978 000009A1 6765725F616D69735F- <1>
   978 000009AA 6D756C7469706C6578- <1>
   978 000009B3 5F6E756D626572CB51- <1>
   978 000009BC 0E696E7465726E616C- <1>
   978 000009C5 666C61677334688C15- <1>
   978 000009CE 616D69735F6D756C74- <1>
   978 000009D7 69706C65785F6E756D- <1>
   978 000009E0 626572              <1>
   979                              <1> %if ELDOTHER
   980                              <1> 	link_data_dump_names LINK_OTHER_DATA_NAMES
   981                              <1> %endif
   982                              <1> 
   983                              <1> lmsg:
   984                              <1> %if _ELD_LINKER_PASSES
   985                              <1> %if _ELDCALL_OPTIONAL
   986                              <1> .warning_code_optional:		counted "Optional code link missing, hash="
   987                              <1> %endif
   988 000009E3 214F7074696F6E616C- <1> .warning_data_optional:		counted "Optional data link missing, hash="
   988 000009EC 2064617461206C696E- <1>
   988 000009F5 6B206D697373696E67- <1>
   988 000009FE 2C20686173683D      <1>
   989 00000A05 1844617461206C696E- <1> .error_data:			counted "Data link missing, hash="
   989 00000A0E 6B206D697373696E67- <1>
   989 00000A17 2C20686173683D      <1>
   990 00000A1E 18436F6465206C696E- <1> .error_code:			counted "Code link missing, hash="
   990 00000A27 6B206D697373696E67- <1>
   990 00000A30 2C20686173683D      <1>
   991 00000A37 0A682C206C6162656C- <1> .error.2:			counted "h, label ",'"'
   991 00000A40 2022                <1>
   992                              <1> %endif
   993                              <1> %if ELDOTHER
   994                              <1> .no_other:		asciz "ELD linker: No other link info found!",13,10
   995                              <1> .error_other:		asciz "ELD linker: Other link info unknown format!",13,10
   996                              <1> %endif
   997                              <1> 
   998 00000A42 00<rep Eh>          <1> 	align 16, db 0
   500                                  
   501                                  	align 16
   502                                  code_size equ $ - code
