     1                                  
     2                                  ; Public Domain
     3                                  
     4                                  ; test install command: install; di 2D; di uninstall
     5                                  ; test run command: 2D; .; .
     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-2025 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> eldhxDateTimeOffset:	resd 1	; zero if none, from eldhxHeader
    43                              <1> 	alignb 16
    44                              <1> 	endstruc
    45                              <1> 
    46                              <1> 	struc ELD_TRAILER_HEADER
    47 00000000 ????????????????    <1> eldthSignature:		resb 8	; "ELD1TAIL"
    48 00000008 ????????            <1> eldthHeaderOffset:	resd 1	; negative displacement from eldthSignature,
    49                              <1> 				;  add this dword to the seek offset
    50 0000000C ????                <1> eldthReserved:		resw 1	; reserved, must be initialised to zero
    51 0000000E ????                <1> eldthChecksum:		resw 1	; sum of all words in trailer header = 0
    52                              <1> 	endstruc
    53                              <1> 	endarea ELD_TRAILER_HEADER, 1
    54                              <1> 
    55                              <1> 	struc ELD_LIBTABLE
    56 00000000 ????                <1> eldltFormat:		resw 1
    57                              <1> 	; 0 = uncompressed
    58                              <1> 	; 2 = heatshrink compressed
    59                              <1> 	; 3 = lzexedat -4 compressed
    60                              <1> 	; 4 = lzexedat -4 -l compressed
    61 00000002 ????                <1> eldltAmount:		resw 1
    62 00000004 ????????            <1> eldltOffset:		resd 1	; from eldhxHeader
    63                              <1> eldltCompressedLength:		; (dword, only present if format 2, 3, or 4)
    64                              <1> 	endstruc
    65                              <1> 	endarea ELD_LIBTABLE, 1
    66                              <1> 
    67                              <1> 		; ELD instance header
    68                              <1> 	struc ELD_INSTANCE
    69 00000000 ????                <1> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    70 00000002 ????                <1> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    71 00000004 ????                <1> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    72 00000006 ????                <1> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    73 00000008 ????????????????    <1> eldiIdentifier:		resb 8	; blank-filled text
    74 00000010 ????                <1> eldiFlags:		resw 1	; flags
    75                              <1> eldiListing_size equ 14
    76 00000012 <res Eh>            <1> eldiListing:		resb eldiListing_size
    77                              <1> 				; ASCIZ listing file name
    78                              <1> 	endstruc
    79                              <1> 		; flags for eldiFlags:
    80                              <1> eldifResident:		equ 1
    81                              <1> 
    82                              <1> 		; ELD link info header
    83                              <1> 	struc ELD_LINKINFO
    84 00000000 ????                <1> eldlSignature:		resw 1	; 0E1D1h
    85 00000002 ????????            <1> eldlReserved:		resw 2
    86 00000006 ????                <1> eldlUseLinkHash:	resw 1
    87 00000008 ????                <1> eldlDataAmount:		resw 1
    88 0000000A ????                <1> eldlDataPrefixes:	resw 1
    89 0000000C ????                <1> eldlDataEntries:	resw 1
    90 0000000E ????                <1> eldlDataAddresses:	resw 1
    91 00000010 ????                <1> eldlCodeAmount:		resw 1
    92 00000012 ????                <1> eldlCodePrefixes:	resw 1
    93 00000014 ????                <1> eldlCodeEntries:	resw 1
    94 00000016 ????                <1> eldlCodeAddresses:	resw 1
    95                              <1> 	endstruc
    96                              <1> 
    97                              <1> 	numdef ELD_CODE_VSTART, 9001h
    98                              <1> 	numdef ELD_DATA_VSTART, 8000h
    99                              <1> 	numdef ELD_RELOC_VSTART, 8000h
   100                              <1> 
   101                              <1> 	numdef ELD_RECLAIM_HINT, 0
   102                              <1> 	strdef ELD_LISTING, ""
   103                              <1> 	numdef ELD_DATETIME, 0
   104                              <1> 
   105                              <1> %if _ELD_DATETIME
   106                              <1>  %define PUT_ELDHX_DATETIME_OFFSET at eldhxDateTimeOffset, dd DATAOFFSET + datetime - datastart
   107                              <1>  %macro PUT_ELD_DATETIME 0.nolist
   108                              <1> datetime:	asciz __UTC_DATE__,'T',__UTC_TIME__,'Z'
   109                              <1> 		asciz		; for future extension
   110                              <1>  %endmacro
   111                              <1> %else
   112                              <1>  %define PUT_ELDHX_DATETIME_OFFSET
   113                              <1>  %define PUT_ELD_DATETIME
   114                              <1> %endif
   115                              <1> 
   116                              <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-2024 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-2024 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELDDATA_MAC
    16                              <2> %define ELDDATA_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
     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> %assign ELDDATA_OPTIONAL_STATUS 0		; not any seen yet
    34                              <2> %assign ELDDATA_PMREQUIRED_STATUS 0		; not any seen yet
    35                              <2> %assign ELDDATA_NEXT_STATUS 0			; not any seen yet
    36                              <2> %assign ELDDATA_NEXT_ENTRY -1
    37                              <2> %assign ELDDATA_NEXT_SECTION -1
    38                              <2> %assign ELDDATA_NEXT_OTHER -1
    39                              <2> 
    40                              <2> 	%imacro internalcoderelocation 0-1.nolist -2
    41                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    42                              <2> %if ELDLINKER
    43                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    44                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    45                              <2>  %else
    46                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    47                              <2>  %endif
    48                              <2> %else
    49                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    50                              <2>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    51                              <2>  %else
    52                              <2>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    53                              <2>  %endif
    54                              <2> %endif
    55                              <2> 	eldstrictcheck
    56                              <2> 	%endmacro
    57                              <2> 
    58                              <2> 	%imacro internaldatarelocation 0-1.nolist -2
    59                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    60                              <2> %if ELDLINKER
    61                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    62                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    63                              <2>  %else
    64                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    65                              <2>  %endif
    66                              <2> %else
    67                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    68                              <2>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    69                              <2>  %else
    70                              <2>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    71                              <2>  %endif
    72                              <2> %endif
    73                              <2> 	eldstrictcheck
    74                              <2> 	%endmacro
    75                              <2> 
    76                              <2> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    77                              <2> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    78                              <2> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    79                              <2> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    80                              <2> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    81                              <2> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    82                              <2> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    83                              <2> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    84                              <2> 
    85                              <2> 
    86                              <2> %define LINK_DATA_RELOCATIONS ""
    87                              <2> %define LINK_LINKER_DATA_RELOCATIONS ""
    88                              <2> %define LINK_DATA_NAMES db ""
    89                              <2> %define LINK_DATA_DETECTION none, none
    90                              <2> 
    91                              <2> %define LINK_OTHER_DATA_RELOCATIONS ""
    92                              <2> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    93                              <2> %define LINK_OTHER_DATA_NAMES db ""
    94                              <2> %define LINK_OTHER_DATA_DETECTION none, none
    95                              <2> 
    96                              <2> %ifndef ELDOTHER
    97                              <2>  %assign ELDOTHER 0
    98                              <2> %endif
    99                              <2> %assign ELDOTHERLINK 0
   100                              <2> 
   101                              <2> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
   102                              <2> %if ELDOTHER
   103                              <2>  %assign ELDOTHERLINK 1
   104                              <2> %endif
   105                              <2> 	linkdatarelocation %1, %2, %3
   106                              <2> %assign ELDOTHERLINK 0
   107                              <2> 	%endmacro
   108                              <2> 
   109                              <2> 	%imacro linkdatarelocation 1-4.nolist -2, required, single
   110                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   111                              <2> %ifidni %3, required
   112                              <2>  %assign %%optional 0
   113                              <2> %elifidni %3, optional
   114                              <2>  %assign %%optional 100h
   115                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   116                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   117                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   118                              <2>  %else
   119                              <2>   %error Optional data link not allowed here
   120                              <2>  %endif
   121                              <2> %elifidni %3, PM required
   122                              <2>  %assign %%optional 300h
   123                              <2>  %assign ELDDATA_PMREQUIRED_STATUS 1
   124                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   125                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   126                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   127                              <2>  %else
   128                              <2>   %error Optional data link not allowed here
   129                              <2>  %endif
   130                              <2> %else
   131                              <2>  %fatal Unknown optional keyword
   132                              <2> %endif
   133                              <2> %ifidni _CURRENT_SECTION_TYPE, DATA
   134                              <2>  %assign %%DATASECTION 1
   135                              <2> %else
   136                              <2>  %assign %%DATASECTION 0
   137                              <2> %endif
   138                              <2> %ifidni %4, single
   139                              <2>  %if ELDDATA_NEXT_STATUS == 1		; after next ?
   140                              <2>   %error Unexpected single data link after next data link
   141                              <2>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   142                              <2>   %assign ELDDATA_NEXT_STATUS 3		; note single with next/last present
   143                              <2>  %endif
   144                              <2>  %assign %%next 0
   145                              <2> %elifidni %4, next
   146                              <2>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   147                              <2>   %assign ELDDATA_NEXT_STATUS 1		; in next
   148                              <2>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   149                              <2>   %assign ELDDATA_NEXT_STATUS 1		; in next
   150                              <2>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   151                              <2>   %assign ELDDATA_NEXT_STATUS 1		; in next
   152                              <2>  %elif ELDDATA_NEXT_STATUS == 1		; repeated next ?
   153                              <2>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   156                              <2>    %error Unexpected next data link
   157                              <2>   %endif
   158                              <2>  %else
   159                              <2>   %error Next data link not allowed here
   160                              <2>  %endif
   161                              <2>  %ifn %%optional
   162                              <2>   %error Next data link only valid as optional or PM required
   163                              <2>  %endif
   164                              <2>  %assign %%next 400h
   165                              <2>  %assign ELDDATA_NEXT_ENTRY %%entry
   166                              <2>  %assign ELDDATA_NEXT_SECTION %%DATASECTION
   167                              <2>  %assign ELDDATA_NEXT_OTHER ELDOTHERLINK
   168                              <2> %elifidni %4, last
   169                              <2>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   170                              <2>   %error Next last data link not allowed here
   171                              <2>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   172                              <2>   %error Next last data link not allowed here
   173                              <2>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   174                              <2>   %error Next last data link not allowed here
   175                              <2>  %elif ELDDATA_NEXT_STATUS == 1		; after next ?
   176                              <2>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   179                              <2>    %error Unexpected next data link
   180                              <2>   %endif
   181                              <2>   %assign ELDDATA_NEXT_STATUS 2		; note now after last
   182                              <2>  %else
   183                              <2>   %error Next data link not allowed here
   184                              <2>  %endif
   185                              <2>  %assign %%next 800h
   186                              <2>  %assign ELDDATA_NEXT_ENTRY -1
   187                              <2>  %assign ELDDATA_NEXT_SECTION -1
   188                              <2> %else
   189                              <2>  %fatal Unknown next keyword
   190                              <2> %endif
   191                              <2> 	%if ELDOTHERLINK
   192                              <2> %if ELDLINKER
   193                              <2>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   194                              <2> %else
   195                              <2>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   196                              <2> %endif
   197                              <2> 	%else
   198                              <2> %if ELDLINKER
   199                              <2>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   200                              <2> %else
   201                              <2>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   202                              <2> %endif
   203                              <2> 	%endif
   204                              <2> %defstr %%string %1
   205                              <2> %strlen %%length %%string
   206                              <2> %if %%length > 64
   207                              <2> 	; Could be increased, but mustn't exceed 127 bytes
   208                              <2> 	;  because flag 80h is used to mark optional links
   209                              <2> 	;  that failed to be matched.
   210                              <2>  %error Too long link name: %1
   211                              <2> %endif
   212                              <2> %define LINK_DATA_CHECK %1
   213                              <2> 	%if ELDOTHERLINK
   214                              <2> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   215                              <2> %if LINK_DATA_NEW
   216                              <2>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   217                              <2> 	hashdef HASH, %%string
   218                              <2>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   220                              <2> %else
   221                              <2>  %%name equ LINK_DATA_DUPLICATE
   222                              <2> %endif
   223                              <2> 	%else
   224                              <2> 	linkdata_detect LINK_DATA_DETECTION
   225                              <2> %if LINK_DATA_NEW
   226                              <2>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   227                              <2> 	hashdef HASH, %%string
   228                              <2>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   230                              <2> %else
   231                              <2>  %%name equ LINK_DATA_DUPLICATE
   232                              <2> %endif
   233                              <2> 	%endif
   234                              <2> 	eldstrictcheck
   235                              <2> 	%endmacro
   236                              <2> 
   237                              <2> 	%imacro linkdata_detect 2-*.nolist
   238                              <2> %assign LINK_DATA_NEW 1
   239                              <2> %rep (%0 - 2) / 2
   240                              <2>  %rotate 2
   241                              <2>  %ifidni %1, LINK_DATA_CHECK
   242                              <2>   %assign LINK_DATA_NEW 0
   243                              <2>   %xdefine LINK_DATA_DUPLICATE %2
   244                              <2>   %exitrep
   245                              <2>  %endif
   246                              <2> %endrep
   247                              <2> 	%endmacro
   248                              <2> 
   249                              <2> 	%imacro link_data_dump_names 1-*.nolist
   250                              <2> %rep %0
   251                              <2> 	%1
   252                              <2>  %rotate 1
   253                              <2> %endrep
   254                              <2> 	%endmacro
   255                              <2> 
   256                              <2> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   257                              <2> ; dw LINK_DATA_RELOCATIONS, 0, 0
   258                              <2> ; link_data_dump_names ELDCALL_CODE_NAMES
   259                              <2> 
   260                              <2> %endif
    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> %assign ELDCALL_NEXT_STATUS 0			; not any seen yet
    55                              <1> %assign ELDCALL_NEXT_ENTRY -1
    56                              <1> 
    57                              <1> 	%imacro extcall 1-3.nolist required, single
    58                              <1> %ifidni _CURRENT_SECTION_TYPE, DATA
    59                              <1>  %error "ELD call cannot be used in ELD data block"
    60                              <1> %endif
    61                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP
    62                              <1> %ifidni %2, required
    63                              <1>  %assign %%optional 0
    64                              <1> %elifidni %2, optional
    65                              <1>  %assign %%optional 100h
    66                              <1>  %if ELDCALL_OPTIONAL_STATUS == 0
    67                              <1>   %assign ELDCALL_OPTIONAL_STATUS 1
    68                              <1>  %elif ELDCALL_OPTIONAL_STATUS == 1
    69                              <1>  %else
    70                              <1>   %error Optional code link not allowed here
    71                              <1>  %endif
    72                              <1> %elifidni %2, PM required
    73                              <1>  %assign %%optional 300h
    74                              <1>  %assign ELDCALL_PMREQUIRED_STATUS 1
    75                              <1>  %if ELDCALL_OPTIONAL_STATUS == 0
    76                              <1>   %assign ELDCALL_OPTIONAL_STATUS 1
    77                              <1>  %elif ELDCALL_OPTIONAL_STATUS == 1
    78                              <1>  %else
    79                              <1>   %error Optional code link not allowed here
    80                              <1>  %endif
    81                              <1> %else
    82                              <1>  %fatal Unknown optional keyword
    83                              <1> %endif
    84                              <1> %ifidni %3, single
    85                              <1>  %if ELDCALL_NEXT_STATUS == 1		; after next ?
    86                              <1>   %error Unexpected single code link after next code link
    87                              <1>  %elif ELDCALL_NEXT_STATUS == 2		; after last ?
    88                              <1>   %assign ELDCALL_NEXT_STATUS 3		; note single with next/last present
    89                              <1>  %endif
    90                              <1>  %assign %%next 0
    91                              <1> %elifidni %3, next
    92                              <1>  %if ELDCALL_NEXT_STATUS == 0		; no next/last yet ?
    93                              <1>   %assign ELDCALL_NEXT_STATUS 1		; in next
    94                              <1>  %elif ELDCALL_NEXT_STATUS == 2		; after last ?
    95                              <1>   %assign ELDCALL_NEXT_STATUS 1		; in next
    96                              <1>  %elif ELDCALL_NEXT_STATUS == 3		; after single ?
    97                              <1>   %assign ELDCALL_NEXT_STATUS 1		; in next
    98                              <1>  %elif ELDCALL_NEXT_STATUS == 1		; repeated next ?
    99                              <1>   %if ELDCALL_NEXT_ENTRY != %%entry
   100                              <1>    %error Unexpected next code link
   101                              <1>   %endif
   102                              <1>  %else
   103                              <1>   %error Next code link not allowed here
   104                              <1>  %endif
   105                              <1>  %ifn %%optional
   106                              <1>   %error Next code link only valid as optional or PM required
   107                              <1>  %endif
   108                              <1>  %assign %%next 400h
   109                              <1>  %assign ELDCALL_NEXT_ENTRY %%entry
   110                              <1> %elifidni %3, last
   111                              <1>  %if ELDCALL_NEXT_STATUS == 0		; no next/last yet ?
   112                              <1>   %error Next last code link not allowed here
   113                              <1>  %elif ELDCALL_NEXT_STATUS == 2		; after last ?
   114                              <1>   %error Next last code link not allowed here
   115                              <1>  %elif ELDCALL_NEXT_STATUS == 3		; after single ?
   116                              <1>   %error Next last code link not allowed here
   117                              <1>  %elif ELDCALL_NEXT_STATUS == 1		; after next ?
   118                              <1>   %if ELDCALL_NEXT_ENTRY != %%entry
   119                              <1>    %error Unexpected next code link
   120                              <1>   %endif
   121                              <1>   %assign ELDCALL_NEXT_STATUS 2		; note now after last
   122                              <1>  %else
   123                              <1>   %error Next code link not allowed here
   124                              <1>  %endif
   125                              <1>  %assign %%next 800h
   126                              <1>  %assign ELDCALL_NEXT_ENTRY -1
   127                              <1>  %assign ELDCALL_NEXT_SECTION -1
   128                              <1> %else
   129                              <1>  %fatal Unknown next keyword
   130                              <1> %endif
   131                              <1> %if %%next != 400h
   132                              <1> %if 0
   133                              <1> [warning -reloc-rel-word]
   134                              <1> 	call near relocatedzero
   135                              <1> [warning +reloc-rel-word]
   136                              <1> %else
   137                              <1> 	db 0E8h
   138                              <1> reloc	dw relocatedzero
   139                              <1> 	eldstrictcheck
   140                              <1> %endif
   141                              <1> 	jmp strict short %%skipparameter
   142                              <1> 	dw 0
   143                              <1> %%skipparameter:
   144                              <1> %endif
   145                              <1> %if ELDLINKER
   146                              <1>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS ELDCALL_LINKER_CODE_RELOCATIONS, %%entry, %%name
   147                              <1>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional + %%next, %%entry, %%name
   148                              <1> %else
   149                              <1>  %xdefine ELDCALL_CODE_RELOCATIONS ELDCALL_CODE_RELOCATIONS, %%entry, %%name
   150                              <1>  %xdefine ELDCALL_CODE_RELOCATIONS_OPTIONAL ELDCALL_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional + %%next, %%entry, %%name
   151                              <1> %endif
   152                              <1> %defstr %%string %1
   153                              <1> %strlen %%length %%string
   154                              <1> %if %%length > 64
   155                              <1> 	; Could be increased, but mustn't exceed 127 bytes
   156                              <1> 	;  because flag 80h is used to mark optional links
   157                              <1> 	;  that failed to be matched.
   158                              <1>  %error Too long link name: %1
   159                              <1> %endif
   160                              <1> %define ELDCALL_CODE_CHECK %1
   161                              <1> 	linkcode_detect ELDCALL_CODE_DETECTION
   162                              <1> %if ELDCALL_CODE_NEW
   163                              <1>  %xdefine ELDCALL_CODE_DETECTION ELDCALL_CODE_DETECTION, %1, %%name
   164                              <1> 	hashdef HASH, %%string
   165                              <1> %xdefine ELDCALL_CODE_NAMES 	ELDCALL_CODE_NAMES, %%name:, dw _HASH, {counted %%string}
   167                              <1> %else
   168                              <1>  %%name equ ELDCALL_CODE_DUPLICATE
   169                              <1> %endif
   170                              <1> 	%endmacro
   171                              <1> 
   172                              <1> 	%imacro linkcode_detect 2-*.nolist
   173                              <1> %assign ELDCALL_CODE_NEW 1
   174                              <1> %rep (%0 - 2) / 2
   175                              <1>  %rotate 2
   176                              <1>  %ifidni %1, ELDCALL_CODE_CHECK
   177                              <1>   %assign ELDCALL_CODE_NEW 0
   178                              <1>   %xdefine ELDCALL_CODE_DUPLICATE %2
   179                              <1>   %exitrep
   180                              <1>  %endif
   181                              <1> %endrep
   182                              <1> 	%endmacro
   183                              <1> 
   184                              <1> 
   185                              <1> %define ELDCALL_CALLCALL_LIST none
   186                              <1> %define ELDCALL_CALLCALL_PROCESSED_PRIOR ""
   187                              <1> 
   188                              <1> 	%imacro extcallcall 1.nolist
   189                              <1> 	call %1
   190                              <1> %xdefine ELDCALL_CALLCALL_LIST ELDCALL_CALLCALL_LIST, %1
   191                              <1> 	%endmacro
   192                              <1> 
   193                              <1> %assign ELDCALLCALL_DUMPED 0
   194                              <1> 
   195                              <1> 	%imacro eldcall_dump_callcall 1-*.nolist
   196                              <1> %xdefine ELDCALL_CALLCALL_PROCESSED ELDCALL_CALLCALL_PROCESSED_PRIOR
   197                              <1>  %rep %0 - 1
   198                              <1>   %rotate 1
   199                              <1>   %define ELDCALL_CHECK %1
   200                              <1> 	eldcall_callcall_detect ELDCALL_CALLCALL_PROCESSED
   201                              <1>   %if ELDCALL_NEW
   202                              <1>    %xdefine ELDCALL_CALLCALL_PROCESSED ELDCALL_CALLCALL_PROCESSED, %1
   203                              <1> 	align 8, nop
   204                              <1> %1:
   205                              <1> 	extcall %1
   206                              <1> 	retn
   207                              <1>   %endif
   208                              <1>  %endrep
   209                              <1> %assign ELDCALLCALL_DUMPED 1
   210                              <1> %define ELDCALL_CALLCALL_LIST none
   211                              <1> 	%endmacro
   212                              <1> 
   213                              <1> 	%imacro eldcall_new_callcall 0.nolist
   214                              <1> %if ELDCALLCALL_DUMPED
   215                              <1>  %xdefine ELDCALL_CALLCALL_PROCESSED_PRIOR   ELDCALL_CALLCALL_PROCESSED_PRIOR, ELDCALL_CALLCALL_PROCESSED
   217                              <1>  %assign ELDCALLCALL_DUMPED 0
   218                              <1>  %define ELDCALL_CALLCALL_LIST none
   219                              <1> %endif
   220                              <1> 	%endmacro
   221                              <1> 
   222                              <1> 	%imacro eldcall_callcall_detect 1-*.nolist
   223                              <1> %assign ELDCALL_NEW 1
   224                              <1> %rep %0
   225                              <1>  %ifidni %1, ELDCALL_CHECK
   226                              <1>   %assign ELDCALL_NEW 0
   227                              <1>   %exitrep
   228                              <1>  %endif
   229                              <1>  %rotate 1
   230                              <1> %endrep
   231                              <1> 	%endmacro
   232                              <1> 
   233                              <1> 	%imacro eldcall_dump_names 1-*.nolist
   234                              <1> %rep %0
   235                              <1> 	%1
   236                              <1>  %rotate 1
   237                              <1> %endrep
   238                              <1> 	%endmacro
   239                              <1> 
   240                              <1> ; eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   241                              <1> ; if using optional code links:
   242                              <1> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
   243                              <1> ;  dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
   244                              <1> ; if not using optional code links:
   245                              <1> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
   246                              <1> ;  dw ELDCALL_CODE_RELOCATIONS, 0, 0
   247                              <1> ; eldcall_dump_names ELDCALL_CODE_NAMES
   248                              <1> 
   249                              <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-2024 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> %assign ELDDATA_OPTIONAL_STATUS 0		; not any seen yet
    34                              <1> %assign ELDDATA_PMREQUIRED_STATUS 0		; not any seen yet
    35                              <1> %assign ELDDATA_NEXT_STATUS 0			; not any seen yet
    36                              <1> %assign ELDDATA_NEXT_ENTRY -1
    37                              <1> %assign ELDDATA_NEXT_SECTION -1
    38                              <1> %assign ELDDATA_NEXT_OTHER -1
    39                              <1> 
    40                              <1> 	%imacro internalcoderelocation 0-1.nolist -2
    41                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    42                              <1> %if ELDLINKER
    43                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    44                              <1>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    45                              <1>  %else
    46                              <1>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    47                              <1>  %endif
    48                              <1> %else
    49                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    50                              <1>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    51                              <1>  %else
    52                              <1>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    53                              <1>  %endif
    54                              <1> %endif
    55                              <1> 	eldstrictcheck
    56                              <1> 	%endmacro
    57                              <1> 
    58                              <1> 	%imacro internaldatarelocation 0-1.nolist -2
    59                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    60                              <1> %if ELDLINKER
    61                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    62                              <1>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    63                              <1>  %else
    64                              <1>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    65                              <1>  %endif
    66                              <1> %else
    67                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    68                              <1>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    69                              <1>  %else
    70                              <1>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    71                              <1>  %endif
    72                              <1> %endif
    73                              <1> 	eldstrictcheck
    74                              <1> 	%endmacro
    75                              <1> 
    76                              <1> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    77                              <1> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    78                              <1> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    79                              <1> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    80                              <1> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    81                              <1> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    82                              <1> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    83                              <1> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    84                              <1> 
    85                              <1> 
    86                              <1> %define LINK_DATA_RELOCATIONS ""
    87                              <1> %define LINK_LINKER_DATA_RELOCATIONS ""
    88                              <1> %define LINK_DATA_NAMES db ""
    89                              <1> %define LINK_DATA_DETECTION none, none
    90                              <1> 
    91                              <1> %define LINK_OTHER_DATA_RELOCATIONS ""
    92                              <1> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    93                              <1> %define LINK_OTHER_DATA_NAMES db ""
    94                              <1> %define LINK_OTHER_DATA_DETECTION none, none
    95                              <1> 
    96                              <1> %ifndef ELDOTHER
    97                              <1>  %assign ELDOTHER 0
    98                              <1> %endif
    99                              <1> %assign ELDOTHERLINK 0
   100                              <1> 
   101                              <1> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
   102                              <1> %if ELDOTHER
   103                              <1>  %assign ELDOTHERLINK 1
   104                              <1> %endif
   105                              <1> 	linkdatarelocation %1, %2, %3
   106                              <1> %assign ELDOTHERLINK 0
   107                              <1> 	%endmacro
   108                              <1> 
   109                              <1> 	%imacro linkdatarelocation 1-4.nolist -2, required, single
   110                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   111                              <1> %ifidni %3, required
   112                              <1>  %assign %%optional 0
   113                              <1> %elifidni %3, optional
   114                              <1>  %assign %%optional 100h
   115                              <1>  %if ELDDATA_OPTIONAL_STATUS == 0
   116                              <1>   %assign ELDDATA_OPTIONAL_STATUS 1
   117                              <1>  %elif ELDDATA_OPTIONAL_STATUS == 1
   118                              <1>  %else
   119                              <1>   %error Optional data link not allowed here
   120                              <1>  %endif
   121                              <1> %elifidni %3, PM required
   122                              <1>  %assign %%optional 300h
   123                              <1>  %assign ELDDATA_PMREQUIRED_STATUS 1
   124                              <1>  %if ELDDATA_OPTIONAL_STATUS == 0
   125                              <1>   %assign ELDDATA_OPTIONAL_STATUS 1
   126                              <1>  %elif ELDDATA_OPTIONAL_STATUS == 1
   127                              <1>  %else
   128                              <1>   %error Optional data link not allowed here
   129                              <1>  %endif
   130                              <1> %else
   131                              <1>  %fatal Unknown optional keyword
   132                              <1> %endif
   133                              <1> %ifidni _CURRENT_SECTION_TYPE, DATA
   134                              <1>  %assign %%DATASECTION 1
   135                              <1> %else
   136                              <1>  %assign %%DATASECTION 0
   137                              <1> %endif
   138                              <1> %ifidni %4, single
   139                              <1>  %if ELDDATA_NEXT_STATUS == 1		; after next ?
   140                              <1>   %error Unexpected single data link after next data link
   141                              <1>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   142                              <1>   %assign ELDDATA_NEXT_STATUS 3		; note single with next/last present
   143                              <1>  %endif
   144                              <1>  %assign %%next 0
   145                              <1> %elifidni %4, next
   146                              <1>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   147                              <1>   %assign ELDDATA_NEXT_STATUS 1		; in next
   148                              <1>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   149                              <1>   %assign ELDDATA_NEXT_STATUS 1		; in next
   150                              <1>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   151                              <1>   %assign ELDDATA_NEXT_STATUS 1		; in next
   152                              <1>  %elif ELDDATA_NEXT_STATUS == 1		; repeated next ?
   153                              <1>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   156                              <1>    %error Unexpected next data link
   157                              <1>   %endif
   158                              <1>  %else
   159                              <1>   %error Next data link not allowed here
   160                              <1>  %endif
   161                              <1>  %ifn %%optional
   162                              <1>   %error Next data link only valid as optional or PM required
   163                              <1>  %endif
   164                              <1>  %assign %%next 400h
   165                              <1>  %assign ELDDATA_NEXT_ENTRY %%entry
   166                              <1>  %assign ELDDATA_NEXT_SECTION %%DATASECTION
   167                              <1>  %assign ELDDATA_NEXT_OTHER ELDOTHERLINK
   168                              <1> %elifidni %4, last
   169                              <1>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   170                              <1>   %error Next last data link not allowed here
   171                              <1>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   172                              <1>   %error Next last data link not allowed here
   173                              <1>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   174                              <1>   %error Next last data link not allowed here
   175                              <1>  %elif ELDDATA_NEXT_STATUS == 1		; after next ?
   176                              <1>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   179                              <1>    %error Unexpected next data link
   180                              <1>   %endif
   181                              <1>   %assign ELDDATA_NEXT_STATUS 2		; note now after last
   182                              <1>  %else
   183                              <1>   %error Next data link not allowed here
   184                              <1>  %endif
   185                              <1>  %assign %%next 800h
   186                              <1>  %assign ELDDATA_NEXT_ENTRY -1
   187                              <1>  %assign ELDDATA_NEXT_SECTION -1
   188                              <1> %else
   189                              <1>  %fatal Unknown next keyword
   190                              <1> %endif
   191                              <1> 	%if ELDOTHERLINK
   192                              <1> %if ELDLINKER
   193                              <1>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   194                              <1> %else
   195                              <1>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   196                              <1> %endif
   197                              <1> 	%else
   198                              <1> %if ELDLINKER
   199                              <1>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   200                              <1> %else
   201                              <1>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   202                              <1> %endif
   203                              <1> 	%endif
   204                              <1> %defstr %%string %1
   205                              <1> %strlen %%length %%string
   206                              <1> %if %%length > 64
   207                              <1> 	; Could be increased, but mustn't exceed 127 bytes
   208                              <1> 	;  because flag 80h is used to mark optional links
   209                              <1> 	;  that failed to be matched.
   210                              <1>  %error Too long link name: %1
   211                              <1> %endif
   212                              <1> %define LINK_DATA_CHECK %1
   213                              <1> 	%if ELDOTHERLINK
   214                              <1> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   215                              <1> %if LINK_DATA_NEW
   216                              <1>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   217                              <1> 	hashdef HASH, %%string
   218                              <1>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   220                              <1> %else
   221                              <1>  %%name equ LINK_DATA_DUPLICATE
   222                              <1> %endif
   223                              <1> 	%else
   224                              <1> 	linkdata_detect LINK_DATA_DETECTION
   225                              <1> %if LINK_DATA_NEW
   226                              <1>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   227                              <1> 	hashdef HASH, %%string
   228                              <1>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   230                              <1> %else
   231                              <1>  %%name equ LINK_DATA_DUPLICATE
   232                              <1> %endif
   233                              <1> 	%endif
   234                              <1> 	eldstrictcheck
   235                              <1> 	%endmacro
   236                              <1> 
   237                              <1> 	%imacro linkdata_detect 2-*.nolist
   238                              <1> %assign LINK_DATA_NEW 1
   239                              <1> %rep (%0 - 2) / 2
   240                              <1>  %rotate 2
   241                              <1>  %ifidni %1, LINK_DATA_CHECK
   242                              <1>   %assign LINK_DATA_NEW 0
   243                              <1>   %xdefine LINK_DATA_DUPLICATE %2
   244                              <1>   %exitrep
   245                              <1>  %endif
   246                              <1> %endrep
   247                              <1> 	%endmacro
   248                              <1> 
   249                              <1> 	%imacro link_data_dump_names 1-*.nolist
   250                              <1> %rep %0
   251                              <1> 	%1
   252                              <1>  %rotate 1
   253                              <1> %endrep
   254                              <1> 	%endmacro
   255                              <1> 
   256                              <1> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   257                              <1> ; dw LINK_DATA_RELOCATIONS, 0, 0
   258                              <1> ; link_data_dump_names ELDCALL_CODE_NAMES
   259                              <1> 
   260                              <1> %endif
    11                                  %include "AMIS.MAC"
     1                              <1> [list -]
    12                                  
    13                                  	cpu 8086
    14                                  
    15                                  	addsection RELOCATEDDATA, nobits vstart=_ELD_RELOC_VSTART
    16                                  relocateddata:
    17                                  
    18                                  	addsection HEADER, start=0
    19                                  
    20                                  	istruc ELD_HEADERX
    21                                  at eldhxHeader
    22                                  		; ELD executable header
    23                                  	istruc ELD_HEADER
    24 00000000 454C4431                at eldhSignature,	db "ELD1"
    25 00000004 000000                  			db 0,0,0
    26 00000007 1A                      			db 26
    27 00000008 60000000                at eldhCodeOffset,	dd CODEOFFSET
    28 0000000C B011                    at eldhCodeImageLength,	dw code_size
    29 0000000E 0000                    at eldhCodeAllocLength,	dw 0
    30 00000010 10120000                at eldhDataOffset,	dd DATAOFFSET
    31 00000014 8001                    at eldhDataImageLength,	dw data_size
    32 00000016 0000                    at eldhDataAllocLength,	dw total_data_size - data_size
    33 00000018 9B08                    at eldhCodeEntrypoint,	dw linker - code
    34                                  at eldhReserved
    35 0000001A 00<rep 4h>2400          at eldhExtensionSize,	dw header_extension_end - $$
    36                                  	iend
    37 00000020 [30000000]              at eldhxDescriptionOffset,	dd description
    38                                  PUT_ELDHX_DATETIME_OFFSET
    39                                  header_extension_end:
    40 00000024 00<rep Ch>              	iend
    41                                  
    42 00000030 50726F766964652044-     description:		asciz "Provide DI (Dump Interrupt vectors) command."
    42 00000039 49202844756D702049-
    42 00000042 6E7465727275707420-
    42 0000004B 766563746F72732920-
    42 00000054 636F6D6D616E642E00 
    43                                  
    44                                  
    45 0000005D 00<rep 3h>              	align 16, db 0
    46                                  
    47                                  CODEOFFSET equ $ - $$
    48                                  	addsection CODE, follows=HEADER vstart=_ELD_CODE_VSTART
    49                                  %define CODEFIXUP - code + 0
    50                                  code:
    51                                  		; ELD instance header
    52                                  	istruc ELD_INSTANCE
    53                                  at eldiStartCode
    54 00000000 00<rep 2h>              at eldiEndCode
    55 00000002 00<rep 2h>              at eldiStartData
    56 00000004 00<rep 2h>              at eldiEndData
    57 00000006 00<rep 2h>44492063-     at eldiIdentifier,	fill 8, 32, db "DI cmd"
    57 0000000C 6D6420<rep 2h>     
    58 00000010 00<rep 2h>64692E6C-     at eldiListing,		asciz _ELD_LISTING
    58 00000016 737400             
    59 00000019 00<rep 7h>              	iend
    60                                  
    61                                  
    62                                  command:
    63 00000020 EB08                    	jmp strict short .entry
    64                                  .chain:
    65 00000022 E8[0000]EB020000        	extcall cmd3_not_ext, required	; must NOT be extcallcall
    66 00000029 90                      	times 10 - ($ - command) nop
    67                                  .entry:
    68 0000002A 56                      	push si
    69 0000002B 3C2D                    	cmp al, '-'
    70 0000002D 7503                    	jne @F
    71 0000002F E8FE06                  	extcallcall skipcomma
    72                                  @@:
    73 00000032 4E                      	dec si
    74                                  
    75 00000033 AD                      	lodsw
    76 00000034 25DFDF                  	and ax, ~2020h
    77 00000037 3D4449                  	cmp ax, "DI"
    78 0000003A 7405                    	je @F
    79                                  .transfer_to_chain:
    80 0000003C 5E                      	pop si
    81 0000003D 4E                      	dec si
    82 0000003E AC                      	lodsb
    83 0000003F EBE1                    	jmp .chain
    84                                  
    85                                  @@:
    86 00000041 8A04                    	mov al, [si]
    87 00000043 24DF                    	and al, ~20h
    88 00000045 3C50                    	cmp al, 'P'
    89 00000047 74F3                    	je .transfer_to_chain
    90                                  
    91                                  .ours:
    92 00000049 58                      	pop ax
    93 0000004A E8E306                  	extcallcall skipcomma
    94 0000004D 4E                      	dec si
    95 0000004E C706[0000][0000]        reloc2	mov word [relocateddata], relocateddata
    96                                  linkdatarelocation lastcmd, -4
    97                                  linkdatarelocation dmycmd
    98 00000054 BA[0000]                	mov dx, relocateddata
    99                                  linkdatarelocation msg.uninstall
   100 00000057 E8DE06                  	extcallcall isstring?
   101 0000005A 7406                    	je uninstall
   102 0000005C E87F00                  	call gateout
   103 0000005F E8DE06                  	extcallcall cmd3
   104                                  
   105                                  uninstall:
   106 00000062 AC                      	lodsb
   107 00000063 E8E206                  	extcallcall chkeol
   108                                  
   109 00000066 8E06[0000]              	mov es, word [relocateddata]
   110                                  linkdatarelocation extdssel
   111 0000006A E8E306                  	extcallcall ispm
   112 0000006D 7404                    	jz @F
   113 0000006F 8E06[0000]              	mov es, word [relocateddata]
   114                                  linkdatarelocation extseg
   115                                  @@:
   116 00000073 06                      	push es
   117 00000074 1F                      	pop ds
   118 00000075 31DB                    	xor bx, bx		; = 0 (no prior, modify ext_command_handler)
   119 00000077 BF[2000]                	mov di, command		; di -> us
   120                                  internalcoderelocation
   121 0000007A 368B36[0000]            	mov si, word [ss:relocateddata]
   122                                  linkdatarelocation ext_command_handler
   123                                  				; si -> first
   124 0000007F 85F6                    	test si, si		; none installed ?
   125 00000081 7450                    	jz .error		; error -->
   126                                  
   127                                  .loop:
   128 00000083 39F7                    	cmp di, si		; found ?
   129 00000085 740D                    	je .bx			; yes, use bx -->
   130 00000087 89F3                    	mov bx, si		; bx -> prior handler
   131 00000089 AD                      	lodsw			; skip entrypoint jmp strict short
   132 0000008A AC                      	lodsb			; get first byte of chainer
   133 0000008B 3CE9                    	cmp al, 0E9h		; expecting jmp near ?
   134 0000008D 7544                    	jne .error		; no, error -->
   135 0000008F AD                      	lodsw			; get rel16 displacement
   136 00000090 01C6                    	add si, ax		; -> next handler
   137 00000092 EBEF                    	jmp .loop
   138                                  
   139                                  .bx:
   140 00000094 85DB                    	test bx, bx		; any prior ?
   141 00000096 751A                    	jnz .bxnz		; yes -->
   142 00000098 AF                      	scasw			; skip entrypoint jmp strict short
   143 00000099 803DE8                  	cmp byte [di], 0E8h	; is it a call to cmd3_not_ext ?
   144 0000009C 7507                    	jne @F			; no -->
   145                                  				; yes, reset ext_command_handler to zero
   146                                  .setbx:
   147 0000009E 36891E[0000]            	mov word [ss:relocateddata], bx
   148                                  linkdatarelocation ext_command_handler
   149 000000A3 EB1E                    	jmp .done
   150                                  
   151                                  @@:
   152 000000A5 803DE9                  	cmp byte [di], 0E9h	; validate
   153 000000A8 7529                    	jne .error		; failure -->
   154 000000AA 47                      	inc di			; -> rel16 displacement
   155 000000AB 8B1D                    	mov bx, word [di]	; get displacement
   156 000000AD AF                      	scasw			; -> after jmp near
   157 000000AE 01FB                    	add bx, di		; -> next handler
   158 000000B0 EBEC                    	jmp .setbx		; set ext_command_handler to next
   159                                  
   160                                  .bxnz:
   161 000000B2 89DE                    	mov si, bx		; -> prior handler with us as downlink
   162 000000B4 87FE                    	xchg di, si		; si -> ours, di -> prior
   163 000000B6 A7                      	cmpsw			; skip entrypoint jmp strict short
   164 000000B7 A4                      	movsb			; copy 0E8h/0E9h
   165 000000B8 AD                      	lodsw			; ax = near rel16 displacement
   166 000000B9 01F0                    	add ax, si		; add in our base (= absolute offset)
   167 000000BB 29F8                    	sub ax, di
   168 000000BD 48                      	dec ax
   169 000000BE 48                      	dec ax			; subtract new base (= relative displacement)
   170 000000BF AB                      	stosw			; store new rel16 displacement
   171 000000C0 A5                      	movsw			; jmp strict short
   172 000000C1 A5                      	movsw			; linkcall target
   173 000000C2 A4                      	movsb			; trailer
   174                                  .done:
   175 000000C3 8026[1000]FE            	clropt [code + eldiFlags], eldifResident
   176                                  internalcoderelocation -3	; mark block as free
   177 000000C8 BA[0000]                	mov dx, msg.uninstall_done
   178                                  internaldatarelocation
   179                                  @@:
   180 000000CB 16                      	push ss
   181 000000CC 1F                      	pop ds
   182 000000CD E88806                  	extcallcall putsz
   183 000000D0 E86D06                  	extcallcall cmd3	; return
   184                                  
   185                                  .error:
   186 000000D3 B8010E                  	mov ax, 0E01h
   187 000000D6 E88706                  	extcallcall setrc
   188 000000D9 BA[1A00]                	mov dx, msg.uninstall_error
   189                                  internaldatarelocation
   190 000000DC EBED                    	jmp @B
   191                                  
   192                                  
   193                                  %define relocated(address) relocateddata
   194                                  %assign ELD 1
   195                                  %assign _PM 1
   196                                  %assign _LOADER 0
   197                                  %assign _AUXBUFFMAXSIZE 24 * 1024
   198                                  %assign _AUXBUFFSIZE 8192 + 16
   199                                  
   200                                  %include "dishared.asm"
     1                              <1> 
     2                              <1> %if 0
     3                              <1> 
     4                              <1> lDebug DI commands - Dump data
     5                              <1> 
     6                              <1> Copyright (C) 1995-2003 Paul Vojta
     7                              <1> Copyright (C) 2008-2025 E. C. Masloch
     8                              <1> 
     9                              <1> Usage of the works is permitted provided that this
    10                              <1> instrument is retained with the works, so that any entity
    11                              <1> that uses the works is notified of this instrument.
    12                              <1> 
    13                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    14                              <1> 
    15                              <1> %endif
    16                              <1> 
    17                              <1> 
    18                              <1> 		; DI command
    19                              <1> gateout:
    20 000000DE 31C9                <1> 	xor cx, cx
    21 000000E0 AC                  <1> 	lodsb
    22                              <1> %if !_LOADER
    23 000000E1 E88406              <1> 	extcallcall uppercase
    24 000000E4 3C52                <1> 	cmp al, 'R'
    25 000000E6 7502                <1> 	jne @F
    26 000000E8 41                  <1> 	inc cx		; always 86 Mode
    27 000000E9 AC                  <1> 	lodsb
    28                              <1> @@:
    29 000000EA E87B06              <1> 	extcallcall uppercase
    30 000000ED 3C4D                <1> 	cmp al, 'M'
    31 000000EF 7503                <1> 	jne @F
    32 000000F1 FEC5                <1> 	inc ch		; show MCB names
    33 000000F3 AC                  <1> 	lodsb
    34                              <1> @@:
    35 000000F4 E87106              <1> 	extcallcall uppercase
    36 000000F7 3C4C                <1> 	cmp al, 'L'
    37 000000F9 7504                <1> 	jne @F
    38 000000FB 80CD02              <1> 	or ch, 2	; follow AMIS interrupt lists
    39 000000FE AC                  <1> 	lodsb
    40                              <1> @@:
    41                              <1> %endif
    42 000000FF E86E06              <1> 	extcallcall skipcomm0
    43                              <1> 
    44 00000102 4E                  <1> 	dec si
    45 00000103 BA[0000]            <1> 	mov dx, relocated(msg.in)
    46                              <1> linkdatarelocation msg.in
    47 00000106 E82F06              <1> 	extcallcall isstring?
    48 00000109 7560                <1> 	jne .not_in
    49                              <1> 
    50 0000010B E82206              <1> 	extcallcall skipcomma
    51 0000010E 4E                  <1> 	dec si
    52 0000010F 56                  <1> 	push si
    53 00000110 51                  <1> 	push cx
    54                              <1> .in.loop:
    55 00000111 E86406              <1> 	extcallcall skipwhite
    56 00000114 4E                  <1> 	dec si
    57                              <1> 
    58 00000115 E86806              <1> 	extcallcall get_value_range; OUT:	cx:di = from, bx:dx = to
    59 00000118 730D                <1> 	jnc @F
    60 0000011A 7508                <1> 	jnz .error
    61 0000011C 81FFFF00            <1> 	cmp di, 255
    62 00000120 7702                <1> 	ja .error
    63 00000122 E317                <1> 	jcxz .in.next
    64                              <1> .error:
    65 00000124 E9FB05              <1> 	jmp error
    66                              <1> 
    67                              <1> @@:
    68 00000127 81FFFF00            <1> 	cmp di, 255
    69 0000012B 77F7                <1> 	ja .error
    70 0000012D E302                <1> 	jcxz @F
    71 0000012F EBF3                <1> 	jmp .error
    72                              <1> 
    73                              <1> @@:
    74 00000131 85DB                <1> 	test bx, bx
    75 00000133 75EF                <1> 	jnz .error
    76 00000135 81FAFF00            <1> 	cmp dx, 255
    77 00000139 77E9                <1> 	ja .error
    78                              <1> 
    79                              <1> .in.next:
    80                              <1> @@:
    81 0000013B E84A06              <1> 	extcallcall skipwh0
    82 0000013E 3C2C                <1> 	cmp al, ','
    83 00000140 74CF                <1> 	je .in.loop
    84 00000142 E80306              <1> 	extcallcall chkeol
    85 00000145 59                  <1> 	pop cx
    86 00000146 E89500              <1> 	call .prepare
    87 00000149 5E                  <1> 	pop si
    88                              <1> 
    89                              <1> .indo.loop:
    90 0000014A E82B06              <1> 	extcallcall skipwhite
    91 0000014D 4E                  <1> 	dec si
    92                              <1> 
    93 0000014E 51                  <1> 	push cx
    94 0000014F E82E06              <1> 	extcallcall get_value_range; OUT:	cx:di = from, bx:dx = to
    95 00000152 59                  <1> 	pop cx
    96 00000153 720D                <1> 	jc .indo.next
    97                              <1> 
    98 00000155 89FB                <1> 	mov bx, di
    99 00000157 A8                  <1> 	db __TEST_IMM8		; (skip inc)
   100                              <1> @@:
   101 00000158 43                  <1> 	inc bx
   102 00000159 52                  <1> 	push dx
   103 0000015A E89D00              <1> 	call .do
   104 0000015D 5A                  <1> 	pop dx
   105 0000015E 39D3                <1> 	cmp bx, dx
   106 00000160 72F6                <1> 	jb @B
   107                              <1> 
   108                              <1> .indo.next:
   109 00000162 4E                  <1> 	dec si
   110 00000163 E81206              <1> 	extcallcall skipwhite
   111 00000166 3C2C                <1> 	cmp al, ','
   112 00000168 74E0                <1> 	je .indo.loop
   113 0000016A C3                  <1> 	retn
   114                              <1> 
   115                              <1> 
   116                              <1> 
   117                              <1> .not_in:
   118 0000016B AC                  <1> 	lodsb
   119 0000016C E82106              <1> 	extcallcall getbyte; get byte into DL
   120 0000016F 30F6                <1> 	xor dh, dh
   121 00000171 89D3                <1> 	mov bx, dx
   122 00000173 E8FA05              <1> 	extcallcall skipcomm0
   123 00000176 BA0100              <1> 	mov dx, 1
   124 00000179 E81C06              <1> 	extcallcall iseol?
   125 0000017C 7453                <1> 	je .onlyone
   126 0000017E E8E705              <1> 	extcallcall uppercase
   127 00000181 3C4C                <1> 	cmp al, 'L'
   128 00000183 753F                <1> 	jne .notlength
   129 00000185 E8A805              <1> 	extcallcall skipcomma
   130 00000188 E81506              <1> 	extcallcall getword; get byte into DL
   131 0000018B 85D2                <1> 	test dx, dx
   132 0000018D 741A                <1> 	jz .err
   133 0000018F 81FA0001            <1> 	cmp dx, 100h
   134 00000193 740A                <1> 	je .checkrange
   135 00000195 50                  <1> 	push ax
   136 00000196 80E41F              <1> 	and ah, 1Fh
   137 00000199 80FC08              <1> 	cmp ah, 8
   138 0000019C 58                  <1> 	pop ax
   139 0000019D 770A                <1> 	ja .err
   140                              <1> .checkrange:
   141 0000019F 52                  <1> 	push dx
   142 000001A0 01DA                <1> 	add dx, bx
   143 000001A2 81FA0001            <1> 	cmp dx, 100h
   144 000001A6 5A                  <1> 	pop dx
   145 000001A7 7625                <1> 	jna .rangeok
   146                              <1> .err:
   147 000001A9 E97605              <1> 	jmp error
   148                              <1> 
   149                              <1> .last:
   150 000001AC 31DB                <1> 	xor bx, bx
   151 000001AE 8A1E[6801]          <1> 	mov bl, byte [lastint]
   152                              <1> internaldatarelocation
   153 000001B2 8B0E[7001]          <1> 	mov cx, word [lastint_is_86m_and_mcb]
   154                              <1> internaldatarelocation
   155 000001B6 BA0100              <1> 	mov dx, 1
   156 000001B9 FEC3                <1> 	inc bl
   157 000001BB 7514                <1> 	jnz .onlyone
   158 000001BD C706[0000][0000]    <1> 	mov word [relocated(lastcmd)], relocated(dmycmd)
   159                              <1> linkdatarelocation lastcmd, -4
   160                              <1> linkdatarelocation dmycmd
   161 000001C3 C3                  <1> 	retn
   162                              <1> 
   163                              <1> .notlength:
   164 000001C4 E8C905              <1> 	extcallcall getbyte
   165 000001C7 30F6                <1> 	xor dh, dh
   166 000001C9 28DA                <1> 	sub dl, bl
   167 000001CB 72DC                <1> 	jc .err
   168 000001CD 42                  <1> 	inc dx
   169                              <1> .rangeok:
   170 000001CE E87705              <1> 	extcallcall chkeol
   171                              <1> .onlyone:
   172 000001D1 E80A00              <1> 	call .prepare
   173 000001D4 89D6                <1> 	mov si, dx	; save count
   174                              <1> .next:
   175 000001D6 E82100              <1> 	call .do
   176 000001D9 43                  <1> 	inc bx
   177 000001DA 4E                  <1> 	dec si
   178 000001DB 75F9                <1> 	jnz .next
   179 000001DD C3                  <1> 	retn
   180                              <1> 
   181                              <1> 
   182                              <1> .prepare:
   183 000001DE F6C502              <1> 	test ch, 2
   184 000001E1 7403                <1> 	jz @F
   185 000001E3 E8C205              <1> 	extcallcall guard_auxbuff
   186                              <1> @@:
   187                              <1> %if ELD
   188 000001E6 C706[0000][AC01]    <1> 	mov word [relocateddata], .last
   189                              <1> linkdatarelocation lastcmd_transfer_ext_address, -4
   190                              <1> internalcoderelocation
   191 000001EC C706[0000][0000]    <1> 	mov word [relocateddata], relocateddata
   192                              <1> linkdatarelocation lastcmd, -4
   193                              <1> linkdatarelocation lastcmd_transfer_ext_entry
   194                              <1> %else
   195                              <1> 	mov word [lastcmd], .last
   196                              <1> %endif
   197 000001F2 890E[7001]          <1> 	mov word [lastint_is_86m_and_mcb], cx
   198                              <1> internaldatarelocation
   199                              <1> %if ELD
   200 000001F6 E8B705              <1> 	extcallcall prephack
   201 000001F9 C3                  <1> 	retn
   202                              <1> %else
   203                              <1> 	jmp prephack
   204                              <1> %endif
   205                              <1> 
   206                              <1> 
   207                              <1> 		; INP:	bx = interrupt number
   208                              <1> 		;	cx = options
   209                              <1> 		; CHG:	di, eax. edx, bp
   210                              <1> 		; STT:	ds = es = ss
   211                              <1> 		;	prephack called
   212                              <1> .do:
   213 000001FA 881E[6801]          <1> 	mov byte [lastint], bl
   214                              <1> internaldatarelocation
   215 000001FE E8B705              <1> 	extcallcall handle_serial_flags_ctrl_c
   216 00000201 E8BC05              <1> 	extcallcall dohack
   217 00000204 BF[0000]            <1> 	mov di, relocated(line_out)
   218                              <1> linkdatarelocation line_out
   219 00000207 B8696E              <1> 	mov ax, "in"
   220 0000020A AB                  <1> 	stosw
   221 0000020B B87420              <1> 	mov ax, "t "
   222 0000020E AB                  <1> 	stosw
   223 0000020F 88D8                <1> 	mov al, bl
   224 00000211 E8B405              <1> 	extcallcall hexbyte
   225 00000214 B020                <1> 	mov al, 32
   226 00000216 AA                  <1> 	stosb
   227                              <1> %if _PM
   228 00000217 84C9                <1> 	test cl, cl
   229 00000219 754C                <1> 	jnz .rm
   230 0000021B E83205              <1> 	extcallcall ispm
   231 0000021E 7547                <1> 	jnz .rm
   232                              <1> 
   233 00000220 B80402              <1> 	mov ax, 0204h
   234 00000223 80FB20              <1> 	cmp bl, 20h
   235 00000226 80D701              <1> 	adc bh, 1	; if below, bh = 2
   236                              <1> .loopexception:
   237 00000229 51                  <1> 	push cx
   238 0000022A CD31                <1> 	int 31h
   239 0000022C 89C8                <1> 	mov ax, cx
   240 0000022E 59                  <1> 	pop cx
   241 0000022F 7303E9C300          <1> 	jc .failed
   242 00000234 E89905              <1> 	extcallcall hexword
   243 00000237 B03A                <1> 	mov al, ':'
   244 00000239 AA                  <1> 	stosb
   245                              <1> %if ELD && 1
   246 0000023A F606[0100]80        <1> 	testopt [relocateddata], 8000h
   247                              <1> linkdatarelocation internalflags, -3
   248 0000023F 7401                <1> 	jz @F
   249 00000241 66                  <1> 	o32
   250                              <1> @@:
   251                              <1> %else
   252                              <1> 	_386_PM_o32	; mov eax, edx
   253                              <1> %endif
   254 00000242 89D0                <1> 	mov ax, dx
   255 00000244 803E[0000]00        <1> 	cmp byte [relocated(dpmi32)], 0
   256                              <1> linkdatarelocation dpmi32, -3
   257 00000249 7403                <1> 	jz .gate16
   258 0000024B E88A05              <1> 	extcallcall hexword_high
   259                              <1> .gate16:
   260 0000024E E87F05              <1> 	extcallcall hexword
   261 00000251 B020                <1> 	mov al, 32
   262 00000253 AA                  <1> 	stosb
   263 00000254 B80202              <1> 	mov ax, 0202h
   264 00000257 FECF                <1> 	dec bh
   265 00000259 75CE                <1> 	jnz .loopexception
   266 0000025B 4F                  <1> 	dec di
   267 0000025C E88105              <1> 	extcallcall unhack
   268 0000025F 53                  <1> 	push bx
   269 00000260 51                  <1> 	push cx
   270 00000261 E88405              <1> 	extcallcall putsline_crlf
   271 00000264 59                  <1> 	pop cx
   272 00000265 5B                  <1> 	pop bx
   273 00000266 C3                  <1> 	retn
   274                              <1> 
   275                              <1> .rm:
   276                              <1> %endif
   277 00000267 53                  <1> 	push bx
   278 00000268 51                  <1> 	push cx
   279 00000269 56                  <1> 	push si
   280                              <1> 
   281 0000026A 53                  <1> 	push bx
   282 0000026B 31ED                <1> 	xor bp, bp
   283 0000026D D1E3                <1> 	shl bx, 1
   284 0000026F D1E3                <1> 	shl bx, 1
   285 00000271 31D2                <1> 	xor dx, dx
   286                              <1> %if _PM
   287 00000273 E87A05              <1> 	extcallcall setes2dx
   288                              <1> %else
   289                              <1> 	mov es, dx			; es => IVT
   290                              <1> %endif
   291 00000276 268B4702            <1> 	mov ax, word [es:bx + 2]	; ax = segment
   292 0000027A 268B17              <1> 	mov dx, word [es:bx]
   293 0000027D 5B                  <1> 	pop bx
   294                              <1> 
   295                              <1> %if !_LOADER
   296 0000027E F6C502              <1> 	test ch, 2
   297 00000281 7403E98200          <1> 	jnz int_list
   298                              <1> %endif
   299                              <1> 
   300                              <1> .loop_chain:
   301 00000286 50                  <1> 	push ax				; segment
   302 00000287 52                  <1> 	push dx
   303                              <1> 
   304 00000288 16                  <1> 	 push ss
   305 00000289 07                  <1> 	 pop es				; ! es = ss
   306 0000028A E84305              <1> 	extcallcall hexword
   307 0000028D B03A                <1> 	mov al, ':'
   308 0000028F AA                  <1> 	stosb
   309 00000290 89D0                <1> 	mov ax, dx
   310 00000292 E83B05              <1> 	extcallcall hexword
   311                              <1> 
   312 00000295 5B                  <1> 	pop bx
   313 00000296 5A                  <1> 	pop dx				; segment
   314                              <1> 
   315 00000297 8916[6E01]          <1> 	mov word [intaddress + 2], dx
   316                              <1> internaldatarelocation
   317 0000029B 891E[6C01]          <1> 	mov word [intaddress], bx
   318                              <1> internaldatarelocation
   319                              <1> 
   320 0000029F 45                  <1> 	inc bp
   321 000002A0 81FD0001            <1> 	cmp bp, 256
   322 000002A4 774C                <1> 	ja .toomany			; --> (! es = ss)
   323                              <1> 
   324 000002A6 E82703              <1> 	call check_int_chain
   325 000002A9 722C                <1> 	jc .end_chain
   326                              <1> 
   327 000002AB 52                  <1> 	push dx				; segment
   328 000002AC 50                  <1> 	push ax
   329 000002AD 16                  <1> 	 push ss
   330 000002AE 07                  <1> 	 pop es
   331 000002AF E82E05              <1> 	extcallcall unhack
   332 000002B2 51                  <1> 	push cx
   333 000002B3 E84205              <1> 	extcallcall copy_single_counted_string
   334 000002B6 59                  <1> 	pop cx
   335 000002B7 E8C503              <1> 	call .mcbname
   336 000002BA 51                  <1> 	push cx
   337 000002BB E82A05              <1> 	extcallcall putsline_crlf
   338 000002BE 59                  <1> 	pop cx
   339 000002BF E8F604              <1> 	extcallcall handle_serial_flags_ctrl_c
   340 000002C2 E8FB04              <1> 	extcallcall dohack
   341 000002C5 BF[0000]            <1> 	mov di, relocated(line_out)
   342                              <1> linkdatarelocation line_out
   343 000002C8 B8202D              <1> 	mov ax, " -"
   344 000002CB AB                  <1> 	stosw
   345 000002CC B82D3E              <1> 	mov ax, "->"
   346 000002CF AB                  <1> 	stosw
   347 000002D0 B020                <1> 	mov al, 32
   348 000002D2 AA                  <1> 	stosb
   349                              <1> 
   350 000002D3 5A                  <1> 	pop dx
   351 000002D4 58                  <1> 	pop ax				; (ax = segment)
   352 000002D5 EBAF                <1> 	jmp .loop_chain
   353                              <1> 
   354                              <1> .end_chain:
   355 000002D7 16                  <1> 	 push ss
   356 000002D8 07                  <1> 	 pop es
   357 000002D9 750A                <1> 	jnz @F
   358                              <1> .end_chain_string:
   359 000002DB E80205              <1> 	extcallcall unhack
   360 000002DE 51                  <1> 	push cx
   361 000002DF E81605              <1> 	extcallcall copy_single_counted_string
   362 000002E2 59                  <1> 	pop cx
   363 000002E3 EB03                <1> 	jmp @FF
   364                              <1> @@:
   365 000002E5 E8F804              <1> 	extcallcall unhack
   366                              <1> @@:
   367 000002E8 E89403              <1> 	call .mcbname
   368 000002EB E8FA04              <1> 	extcallcall putsline_crlf
   369                              <1> .86next:
   370 000002EE 5E                  <1> 	pop si
   371 000002EF 59                  <1> 	pop cx
   372 000002F0 5B                  <1> 	pop bx
   373 000002F1 C3                  <1> 	retn
   374                              <1> 
   375                              <1> .toomany:
   376 000002F2 BE[D700]            <1> 	mov si, msg.di_toomany
   377                              <1> internaldatarelocation
   378 000002F5 EBE4                <1> 	jmp .end_chain_string
   379                              <1> 
   380                              <1>  %if _PM
   381                              <1> .failed:
   382 000002F7 E8E604              <1> 	extcallcall unhack
   383 000002FA 5A                  <1> 	pop dx				; discard a near return address
   384 000002FB BA[5201]            <1> 	mov dx, gatewrong
   385                              <1> internaldatarelocation
   386 000002FE B83401              <1> 	mov ax, 0134h
   387 00000301 E85C04              <1> 	extcallcall setrc
   388                              <1> %if ELD
   389 00000304 E85104              <1> 	extcallcall putsz
   390 00000307 C3                  <1> 	retn
   391                              <1> %else
   392                              <1> 	jmp putsz
   393                              <1> %endif
   394                              <1>  %endif
   395                              <1> 
   396                              <1> 
   397                              <1> %if 0
   398                              <1> 
   399                              <1> For the DIL command we fill the auxiliary buffer with entries
   400                              <1> for each interrupt entrypoint. They are found by starting from
   401                              <1> the IVT as well as the AMIS interrupt lists. Of course, any
   402                              <1> entrypoint may be found from more than one point.
   403                              <1> 
   404                              <1> The format is as follows:
   405                              <1> 
   406                              <1> dword - vector
   407                              <1> word - flags and AMIS multiplex number (low byte)
   408                              <1> 	flag 200h = unclaimed, AMIS multiplex number not initialised
   409                              <1> 	flag 100h = immediately from IVT (and is the very first entry in auxbuff)
   410                              <1> 	if this word is -1 then it is not an entry, it is a terminator
   411                              <1> word - which entry in an AMIS interrupt list
   412                              <1> 
   413                              <1> A terminator is an entry with all ones (-1).
   414                              <1> Two consecutive terminators indicate the last chain ended.
   415                              <1> After a single terminator another chain follows.
   416                              <1> Any chain after the very first is a hidden chain,
   417                              <1> that is, its handlers are not reachable from the IVT
   418                              <1> by walking the downlinks.
   419                              <1> 
   420                              <1> A hidden chain may be found which eventually feeds into
   421                              <1> another hidden chain found previously. In this case, the
   422                              <1> new unique handlers (at least 1) are prepended to the
   423                              <1> pre-existing hidden chain, and the downlinks past this
   424                              <1> point are not walked further (as they're already known).
   425                              <1> 
   426                              <1> If an AMIS interface points to a handler that we already
   427                              <1> know (in the first IVT-based chain or any hidden chain)
   428                              <1> then its downlink will not be walked again. However, the
   429                              <1> multiplex number and list index will be entered into the
   430                              <1> entry for this interrupt handler.
   431                              <1> 
   432                              <1> Finally, after the IVT and all interrupt lists of all AMIS
   433                              <1> multiplexers have been processed, the auxbuff list is used
   434                              <1> to display the found chains (one IVT, any amount hidden).
   435                              <1> 
   436                              <1> %endif
   437                              <1> 
   438                              <1> %if !_LOADER
   439                              <1> int_list:
   440 00000308 57                  <1> 	push di
   441 00000309 51                  <1> 	push cx
   442 0000030A 53                  <1> 	push bx
   443 0000030B 92                  <1> 	xchg ax, dx			; dx = segment
   444                              <1> 
   445 0000030C 368E06[0000]        <1> 	mov es, word [ss:relocated(auxbuff_segorsel)]
   446                              <1> linkdatarelocation auxbuff_segorsel
   447 00000311 31FF                <1> 	xor di, di			; -> auxbuff
   448 00000313 AB                  <1> 	stosw				; store offset
   449 00000314 92                  <1> 	xchg ax, dx			; dx = offset
   450 00000315 AB                  <1> 	stosw				; store segment
   451 00000316 92                  <1> 	xchg ax, dx			; dx = segment
   452 00000317 93                  <1> 	xchg bx, ax			; bx = offset
   453 00000318 B80003              <1> 	mov ax, 300h			; flag for IVT | unused
   454 0000031B AB                  <1> 	stosw				; which multiplex number
   455 0000031C 31C0                <1> 	xor ax, ax
   456 0000031E AB                  <1> 	stosw				; which int list entry = none = 0
   457                              <1> 
   458                              <1> .loop_ivt_chain:
   459 0000031F E8AE02              <1> 	call check_int_chain
   460 00000322 721A                <1> 	jc .end_ivt_chain
   461                              <1> 
   462                              <1> %if ! ELD && _AUXBUFFSIZE == _AUXBUFFMAXSIZE
   463                              <1> 	cmp di, _AUXBUFFSIZE - 8 * 3	; enough for 1 entry + 2 terminators ?
   464                              <1> %else
   465 00000324 363B3E[0000]        <1> 	cmp di, word [ss:relocated(auxbuff_current_size_minus_24)]
   466                              <1> linkdatarelocation auxbuff_current_size_minus_24
   467                              <1> %endif
   468 00000329 773A                <1> 	ja .error
   469 0000032B 368E06[0000]        <1> 	mov es, word [ss:relocated(auxbuff_segorsel)]
   470                              <1> linkdatarelocation auxbuff_segorsel
   471 00000330 AB                  <1> 	stosw				; store offset
   472 00000331 92                  <1> 	xchg ax, dx
   473 00000332 AB                  <1> 	stosw				; store segment
   474 00000333 92                  <1> 	xchg ax, dx
   475 00000334 93                  <1> 	xchg bx, ax
   476 00000335 B80002              <1> 	mov ax, 200h			; flag for unused
   477 00000338 AB                  <1> 	stosw				; found in chain = 200h
   478 00000339 31C0                <1> 	xor ax, ax
   479 0000033B AB                  <1> 	stosw
   480 0000033C EBE1                <1> 	jmp .loop_ivt_chain
   481                              <1> 
   482                              <1> .end_ivt_chain:
   483 0000033E B8FFFF              <1> 	mov ax, -1
   484 00000341 368E06[0000]        <1> 	mov es, word [ss:relocated(auxbuff_segorsel)]
   485                              <1> linkdatarelocation auxbuff_segorsel
   486 00000346 B90800              <1> 	mov cx, 8
   487 00000349 F3AB                <1> 	rep stosw			; terminator is all-ones
   488                              <1> 					; (two terminators actually)
   489                              <1> 
   490 0000034B B02D                <1> 	mov al, 2Dh
   491 0000034D E8B004              <1> 	extcallcall intchk			; ZR if offset = -1 or segment = 0
   492                              <1> 					; CHG: ax, dx, bx
   493 00000350 7412                <1> 	jz .done
   494                              <1> 
   495 00000352 31C0                <1> 	xor ax, ax
   496                              <1> .loopplex:
   497 00000354 B000                <1> 	mov al, 00h			; AMIS installation check
   498                              <1> 		; function 0 changes dx, di, cx, al
   499                              <1> %if _PM
   500 00000356 E8AF04              <1> 	extcallcall call_int2D
   501                              <1> %else
   502                              <1> 	int 2Dh				; enquire whether there's anyone
   503                              <1> 					;  but we don't care who it might be
   504                              <1> %endif
   505 00000359 FEC0                <1> 	inc al				; = FFh ?
   506 0000035B 7503E91101          <1> 	jz .search			; yes, it is in use -->
   507                              <1> .nextplex:
   508 00000360 FEC4                <1> 	inc ah
   509 00000362 75F0                <1> 	jnz .loopplex			; try next multiplexer -->
   510                              <1> 
   511                              <1> .done:
   512 00000364 A8                  <1> 	db __TEST_IMM8			; (NC)
   513                              <1> .error:
   514 00000365 F9                  <1> 	stc
   515                              <1> 
   516 00000366 5B                  <1> 	pop bx
   517 00000367 59                  <1> 	pop cx
   518 00000368 5F                  <1> 	pop di
   519 00000369 16                  <1> 	 push ss
   520 0000036A 1F                  <1> 	 pop ds
   521 0000036B 16                  <1> 	 push ss
   522 0000036C 07                  <1> 	 pop es
   523                              <1> 
   524 0000036D BE[5400]            <1> 	mov si, msg.di_error
   525                              <1> internaldatarelocation
   526 00000370 7303E9B900          <1> 	jc .error_string
   527                              <1> 
   528 00000375 31F6                <1> 	xor si, si
   529                              <1> 
   530                              <1> .loop_chain:
   531 00000377 8E1E[0000]          <1> 	mov ds, word [relocated(auxbuff_segorsel)]
   532                              <1> linkdatarelocation auxbuff_segorsel
   533 0000037B AD                  <1> 	lodsw
   534 0000037C 92                  <1> 	xchg ax, dx
   535 0000037D AD                  <1> 	lodsw
   536 0000037E 833CFF              <1> 	cmp word [si], -1
   537 00000381 8D7404              <1> 	lea si, [si + 4]
   538 00000384 747A                <1> 	je .next_seq
   539                              <1> 
   540                              <1> .next_chain:
   541 00000386 16                  <1> 	 push ss
   542 00000387 1F                  <1> 	 pop ds
   543                              <1> 
   544 00000388 50                  <1> 	push ax				; segment
   545 00000389 52                  <1> 	push dx
   546                              <1> 
   547 0000038A 16                  <1> 	 push ss
   548 0000038B 07                  <1> 	 pop es
   549 0000038C E84104              <1> 	extcallcall hexword
   550 0000038F B03A                <1> 	mov al, ':'
   551 00000391 AA                  <1> 	stosb
   552 00000392 89D0                <1> 	mov ax, dx
   553 00000394 E83904              <1> 	extcallcall hexword
   554                              <1> 
   555 00000397 5B                  <1> 	pop bx
   556 00000398 5A                  <1> 	pop dx				; segment
   557                              <1> 
   558 00000399 8916[6E01]          <1> 	mov word [intaddress + 2], dx
   559                              <1> internaldatarelocation
   560 0000039D 891E[6C01]          <1> 	mov word [intaddress], bx
   561                              <1> internaldatarelocation
   562                              <1> 
   563 000003A1 56                  <1> 	push si
   564 000003A2 E82B02              <1> 	call check_int_chain
   565 000003A5 722E                <1> 	jc .end_chain
   566                              <1> 
   567 000003A7 16                  <1> 	 push ss
   568 000003A8 07                  <1> 	 pop es
   569 000003A9 E83404              <1> 	extcallcall unhack
   570 000003AC 51                  <1> 	push cx
   571 000003AD E84804              <1> 	extcallcall copy_single_counted_string
   572 000003B0 59                  <1> 	pop cx
   573 000003B1 5E                  <1> 	pop si
   574 000003B2 E88B00              <1> 	call .mpx
   575 000003B5 56                  <1> 	push si
   576 000003B6 E8C602              <1> 	call gateout.mcbname
   577 000003B9 51                  <1> 	push cx
   578 000003BA E82B04              <1> 	extcallcall putsline_crlf
   579 000003BD 59                  <1> 	pop cx
   580 000003BE E8F703              <1> 	extcallcall handle_serial_flags_ctrl_c
   581 000003C1 E8FC03              <1> 	extcallcall dohack
   582 000003C4 BF[0000]            <1> 	mov di, relocated(line_out)
   583                              <1> linkdatarelocation line_out
   584 000003C7 B8202D              <1> 	mov ax, " -"
   585 000003CA AB                  <1> 	stosw
   586 000003CB B82D3E              <1> 	mov ax, "->"
   587 000003CE AB                  <1> 	stosw
   588 000003CF B020                <1> 	mov al, 32
   589 000003D1 AA                  <1> 	stosb
   590                              <1> 
   591 000003D2 5E                  <1> 	pop si
   592 000003D3 EBA2                <1> 	jmp .loop_chain
   593                              <1> 
   594                              <1> .end_chain:
   595 000003D5 16                  <1> 	 push ss
   596 000003D6 07                  <1> 	 pop es
   597 000003D7 750A                <1> 	jnz @F
   598 000003D9 E80404              <1> 	extcallcall unhack
   599 000003DC 51                  <1> 	push cx
   600 000003DD E81804              <1> 	extcallcall copy_single_counted_string
   601 000003E0 59                  <1> 	pop cx
   602 000003E1 EB03                <1> 	jmp @FF
   603                              <1> @@:
   604 000003E3 E8FA03              <1> 	extcallcall unhack
   605                              <1> @@:
   606 000003E6 5E                  <1> 	pop si
   607 000003E7 E85600              <1> 	call .mpx
   608 000003EA 56                  <1> 	push si
   609 000003EB E89102              <1> 	call gateout.mcbname
   610 000003EE 51                  <1> 	push cx
   611 000003EF E8F603              <1> 	extcallcall putsline_crlf
   612 000003F2 59                  <1> 	pop cx
   613 000003F3 BF[0000]            <1> 	mov di, relocated(line_out)
   614                              <1> linkdatarelocation line_out
   615 000003F6 E8BF03              <1> 	extcallcall handle_serial_flags_ctrl_c
   616 000003F9 E8C403              <1> 	extcallcall dohack
   617 000003FC 5E                  <1> 	pop si
   618 000003FD E977FF              <1> 	jmp .loop_chain
   619                              <1> 
   620                              <1> .next_seq:
   621 00000400 AD                  <1> 	lodsw
   622 00000401 92                  <1> 	xchg ax, dx
   623 00000402 AD                  <1> 	lodsw
   624 00000403 833CFF              <1> 	cmp word [si], -1
   625 00000406 8D7404              <1> 	lea si, [si + 4]
   626 00000409 741A                <1> 	je @F
   627                              <1> 
   628 0000040B 16                  <1> 	 push ss
   629 0000040C 1F                  <1> 	 pop ds
   630 0000040D 16                  <1> 	 push ss
   631 0000040E 07                  <1> 	 pop es
   632 0000040F E8CE03              <1> 	extcallcall unhack
   633 00000412 51                  <1> 	push cx
   634 00000413 56                  <1> 	push si
   635 00000414 BE[5C00]            <1> 	mov si, msg.di_hidden
   636                              <1> internaldatarelocation
   637 00000417 E8DE03              <1> 	extcallcall copy_single_counted_string
   638 0000041A 5E                  <1> 	pop si
   639 0000041B 59                  <1> 	pop cx
   640 0000041C E89903              <1> 	extcallcall handle_serial_flags_ctrl_c
   641 0000041F E89E03              <1> 	extcallcall dohack
   642                              <1> 
   643 00000422 E961FF              <1> 	jmp .next_chain
   644                              <1> 
   645                              <1> @@:
   646 00000425 16                  <1> 	 push ss
   647 00000426 1F                  <1> 	 pop ds
   648 00000427 16                  <1> 	 push ss
   649 00000428 07                  <1> 	 pop es
   650 00000429 E8B403              <1> 	extcallcall unhack
   651 0000042C EB0F                <1> 	jmp @F
   652                              <1> 
   653                              <1> 
   654                              <1> .error_string:
   655 0000042E E8C703              <1> 	extcallcall copy_single_counted_string
   656                              <1> 
   657 00000431 E8AC03              <1> 	extcallcall unhack
   658 00000434 E8B103              <1> 	extcallcall putsline_crlf
   659 00000437 B83301              <1> 	mov ax, 0133h
   660 0000043A E82303              <1> 	extcallcall setrc
   661                              <1> @@:
   662                              <1> %if 0	; _DEBUG
   663                              <1> 	mov es, word [auxbuff_segorsel]
   664                              <1> 	int3
   665                              <1> 	push ss
   666                              <1> 	pop es
   667                              <1> %endif
   668 0000043D E9AEFE              <1> 	jmp gateout.86next
   669                              <1> 
   670                              <1> 
   671                              <1> .mpx:
   672 00000440 8E06[0000]          <1> 	mov es, word [relocated(auxbuff_segorsel)]
   673                              <1> linkdatarelocation auxbuff_segorsel
   674 00000444 268B44FC            <1> 	mov ax, word [es:si - 4]
   675 00000448 268B54FE            <1> 	mov dx, word [es:si - 2]
   676 0000044C 16                  <1> 	push ss
   677 0000044D 07                  <1> 	pop es
   678 0000044E F6C402              <1> 	test ah, 2
   679 00000451 751D                <1> 	jnz @F
   680 00000453 56                  <1> 	push si
   681 00000454 51                  <1> 	push cx
   682 00000455 BE[4001]            <1> 	mov si, msg.di_multiplex.1
   683                              <1> internaldatarelocation
   684 00000458 E89D03              <1> 	extcallcall copy_single_counted_string
   685 0000045B E86A03              <1> 	extcallcall hexbyte
   686 0000045E BE[4701]            <1> 	mov si, msg.di_multiplex.2
   687                              <1> internaldatarelocation
   688 00000461 E89403              <1> 	extcallcall copy_single_counted_string
   689 00000464 92                  <1> 	xchg ax, dx
   690 00000465 E86803              <1> 	extcallcall hexword
   691 00000468 BE[4F01]            <1> 	mov si, msg.di_multiplex.3
   692                              <1> internaldatarelocation
   693 0000046B E88A03              <1> 	extcallcall copy_single_counted_string
   694 0000046E 59                  <1> 	pop cx
   695 0000046F 5E                  <1> 	pop si
   696                              <1> @@:
   697 00000470 C3                  <1> 	retn
   698                              <1> 
   699                              <1> 
   700                              <1> 		; INP:	ah = multiplex number of AMIS TSR to search through
   701                              <1> 		;	ss:sp-> interrupt number (byte), must be preserved
   702                              <1> 		; CHG:	es, di, dx, bx
   703                              <1> .search:
   704 00000471 B004                <1> 	mov al, 04h
   705 00000473 5B                  <1> 	pop bx
   706 00000474 53                  <1> 	push bx				; low byte is the interrupt number
   707                              <1> 		; function 4 changes dx, bx, al
   708                              <1> %if _PM
   709 00000475 E89003              <1> 	extcallcall call_int2D
   710                              <1> %else
   711                              <1> 	int 2Dh
   712                              <1> %endif
   713 00000478 3C03                <1> 	cmp al, 03h			; returned its interrupt entry ?
   714                              <1> 		; RBIL doesn't explicitly state that this interrupt entry has to
   715                              <1> 		; be IISP compatible. But I'm too lazy to look up the older AMIS,
   716                              <1> 		; and SearchIISPChain checks the interrupt entry anyway.
   717 0000047A 743D                <1> 	je .search_dxbx
   718 0000047C 3C04                <1> 	cmp al, 04h			; returned list of hooked interrupts ?
   719 0000047E 7403E9DDFE          <1> 	jne .nextplex			; no, try next multiplexer -->
   720 00000483 89DF                <1> 	mov di, bx
   721 00000485 5B                  <1> 	pop bx
   722 00000486 53                  <1> 	push bx				; bl = interrupt number
   723 00000487 31C9                <1> 	xor cx, cx			; = index into list
   724 00000489 88D8                <1> 	mov al, bl
   725                              <1> .search_intlist_seg:
   726                              <1> %if _PM
   727 0000048B E86203              <1> 	extcallcall setes2dx
   728                              <1> %else
   729                              <1> 	mov es, dx			; es:di-> list
   730                              <1> %endif
   731                              <1> .search_intlist:		; Search the returned list for the required interrupt number.
   732 0000048E AE                  <1> 	scasb				; our interrupt number ?
   733 0000048F 740E                <1> 	je .search_found_intlist
   734 00000491 26807DFF2D          <1> 	cmp byte [es:di-1], 2Dh		; was last in list ?
   735 00000496 7503E9C5FE          <1> 	je .nextplex
   736 0000049B AF                  <1> 	scasw				; skip pointer
   737 0000049C 41                  <1> 	inc cx
   738 0000049D EBEF                <1> 	jmp short .search_intlist	; try next entry -->
   739                              <1> 
   740                              <1> .search_found_intlist:
   741 0000049F 268B1D              <1> 	mov bx, word [es:di]		; dx:bx = es:bx -> IISP entry
   742 000004A2 AF                  <1> 	scasw				; skip pointer
   743 000004A3 52                  <1> 	push dx				; preserve dx for .search_intlist_seg
   744 000004A4 57                  <1> 	push di
   745 000004A5 E82200              <1> 	call .add
   746 000004A8 5F                  <1> 	pop di
   747 000004A9 5A                  <1> 	pop dx
   748 000004AA 7303E9B6FE          <1> 	jc .error
   749                              <1> 	; je .search_found		; found entry -->
   750                              <1> 		; This specific jump supports TSRs that hook the same
   751                              <1> 		; interrupt more than once; jumping to .nextplex instead
   752                              <1> 		; (as previously) aborts the search after the first match
   753                              <1> 		; in the interrupt list. This support might become useful.
   754 000004AF 3C2D                <1> 	cmp al, 2Dh			; was last in list ?
   755 000004B1 7503E9AAFE          <1> 	je .nextplex
   756 000004B6 41                  <1> 	inc cx
   757 000004B7 EBD2                <1> 	jmp short .search_intlist_seg
   758                              <1> 
   759                              <1> .search_dxbx:
   760                              <1> %if _PM
   761 000004B9 E83403              <1> 	extcallcall setes2dx
   762                              <1> %else
   763                              <1> 	mov es, dx			; es:bx-> (IISP) interrupt entry
   764                              <1> %endif
   765                              <1> 		; The entry we found now is possibly behind the non-IISP entry that
   766                              <1> 		; terminated our first SearchIISPChain call (at .hard). We then
   767                              <1> 		; possibly might find our entry in this hidden part of the chain.
   768 000004BC B9FFFF              <1> 	mov cx, -1			; indicator for return = 3 (no list)
   769 000004BF E80800              <1> 	call .add
   770 000004C2 7303E99EFE          <1> 	jc .error
   771                              <1> 	; jne .nextplex			; didn't find our entry in the chain -->
   772 000004C7 E996FE              <1> 	jmp .nextplex
   773                              <1> 
   774                              <1> 
   775                              <1> int_list.add:
   776 000004CA 31FF                <1> 	xor di, di			; start at beginning of buffer
   777 000004CC 368E1E[0000]        <1> 	mov ds, word [ss:relocated(auxbuff_segorsel)]
   778                              <1> linkdatarelocation auxbuff_segorsel
   779                              <1> 					; ds => auxbuff
   780 000004D1 BEFFFF              <1> 	mov si, -1			; check all
   781 000004D4 E8D600              <1> 	call .check			; check for match
   782 000004D7 7516                <1> 	jne @F				; not matched, di -> second terminator
   783 000004D9 F6450502            <1> 	testopt [di + 4], 200h		; not yet claimed by a multiplexer ?
   784 000004DD 7503E9C900          <1> 	jz .error			; no, error -->
   785 000004E2 886504              <1> 	mov byte [di + 4], ah		; store the multiplex number
   786 000004E5 806505FD            <1> 	clropt [di + 4], 200h		; indicate it is claimed
   787 000004E9 894D06              <1> 	mov word [di + 6], cx		; = how many list entries before ours,
   788                              <1> 					;  or = -1 if not from a list
   789 000004EC E9BB00              <1> 	jmp .done
   790                              <1> 
   791                              <1> @@:
   792                              <1> 		; ds:di -> second terminator (will be overwritten)
   793                              <1> %if ! ELD && _AUXBUFFSIZE == _AUXBUFFMAXSIZE
   794                              <1> 	cmp di, _AUXBUFFSIZE - 8 * 3	; enough for 1 entry + 2 terminators ?
   795                              <1> %else
   796 000004EF 363B3E[0000]        <1> 	cmp di, word [ss:relocated(auxbuff_current_size_minus_24)]
   797                              <1> linkdatarelocation auxbuff_current_size_minus_24
   798                              <1> %endif
   799 000004F4 7603E9B200          <1> 	ja .error
   800 000004F9 8D75F8              <1> 	lea si, [di - 8]		; check up to this point later
   801                              <1> 					;  si -> first of two terminators
   802                              <1> 
   803 000004FC 93                  <1> 	xchg ax, bx
   804 000004FD 368E06[0000]        <1> 	mov es, word [ss:relocated(auxbuff_segorsel)]
   805                              <1> linkdatarelocation auxbuff_segorsel
   806                              <1> 					; => auxbuff
   807 00000502 AB                  <1> 	stosw				; store offset
   808 00000503 92                  <1> 	xchg ax, dx			; dx = offset
   809 00000504 AB                  <1> 	stosw				; store segment
   810 00000505 92                  <1> 	xchg ax, dx			; dx = segment
   811 00000506 93                  <1> 	xchg ax, bx			; dx:bx = vector -> handler
   812 00000507 50                  <1> 	push ax
   813 00000508 B000                <1> 	mov al, 0			; flags = 0 (claimed, not IVT)
   814 0000050A 86C4                <1> 	xchg al, ah
   815 0000050C AB                  <1> 	stosw				; which multiplex number
   816 0000050D 89C8                <1> 	mov ax, cx
   817 0000050F AB                  <1> 	stosw				; which int list entry
   818 00000510 58                  <1> 	pop ax				; preserve multiplex number
   819                              <1> 
   820                              <1> .loop_chain:
   821 00000511 50                  <1> 	push ax
   822 00000512 56                  <1> 	push si
   823 00000513 E8BA00              <1> 	call check_int_chain		; does it go on ?
   824 00000516 5E                  <1> 	pop si
   825 00000517 5B                  <1> 	pop bx
   826 00000518 727F                <1> 	jc .end_chain			; no -->
   827                              <1> 
   828                              <1> %if ! ELD && _AUXBUFFSIZE == _AUXBUFFMAXSIZE
   829                              <1> 	cmp di, _AUXBUFFSIZE - 8 * 3	; enough for 1 entry + 2 terminators ?
   830                              <1> %else
   831 0000051A 363B3E[0000]        <1> 	cmp di, word [ss:relocated(auxbuff_current_size_minus_24)]
   832                              <1> linkdatarelocation auxbuff_current_size_minus_24
   833                              <1> %endif
   834 0000051F 7603E98700          <1> 	ja .error
   835 00000524 368E06[0000]        <1> 	mov es, word [ss:relocated(auxbuff_segorsel)]
   836                              <1> linkdatarelocation auxbuff_segorsel
   837 00000529 AB                  <1> 	stosw				; store offset
   838 0000052A 92                  <1> 	xchg ax, dx
   839 0000052B AB                  <1> 	stosw				; store segment
   840 0000052C 92                  <1> 	xchg ax, dx
   841 0000052D 93                  <1> 	xchg bx, ax			; ah = multiplex number, bx = offset
   842 0000052E 50                  <1> 	push ax
   843 0000052F B80002              <1> 	mov ax, 200h
   844 00000532 AB                  <1> 	stosw				; found in chain = 200h (unclaimed)
   845 00000533 31C0                <1> 	xor ax, ax
   846 00000535 AB                  <1> 	stosw
   847 00000536 58                  <1> 	pop ax
   848 00000537 57                  <1> 	push di
   849 00000538 31FF                <1> 	xor di, di			; start at beginning
   850 0000053A E87000              <1> 	call .check			; already listed in another chain ?
   851 0000053D 7403                <1> 	je @F
   852 0000053F 5F                  <1> 	pop di
   853 00000540 EBCF                <1> 	jmp .loop_chain			; no, try to walk downlink -->
   854                              <1> 
   855                              <1> @@:
   856 00000542 5B                  <1> 	pop bx
   857                              <1> 
   858                              <1> 		; The idea is that if the AMIS interrupt list
   859                              <1> 		;  pointed to an entry not yet matched then
   860                              <1> 		;  it is the start of a hidden chain. If a
   861                              <1> 		;  subsequent handler in this hidden chain
   862                              <1> 		;  points to another handler that does match
   863                              <1> 		;  this can only be a valid case if this other
   864                              <1> 		;  handler also was the start of a hidden chain.
   865                              <1> 		; If this is the case, prepend the unique new
   866                              <1> 		;  handlers to that hidden chain in the buffer.
   867 00000543 F6450501            <1> 	testopt [di + 4], 100h		; is it from the IVT ? (very first entry)
   868 00000547 7562                <1> 	jnz .error			; yes, error -->
   869 00000549 837DFCFF            <1> 	cmp word [di - 8 + 4], -1	; is it the start of a hidden chain ?
   870 0000054D 755C                <1> 	jne .error			; no, error -->
   871                              <1> 		; di -> match (insert to move here)
   872                              <1> 		; bx -> after repeat
   873                              <1> 		; bx - 8 -> repeat
   874                              <1> 		; bx - 16 -> last entry to move (at least 1 to move)
   875                              <1> 		; si -> single terminator
   876                              <1> 		; si + 8 -> first entry to move (at least 1 to move)
   877                              <1> 
   878 0000054F 83EB10              <1> 	sub bx, 16			; -> last entry to move
   879                              <1> 
   880                              <1> .insert:
   881                              <1> 		; di -> match (insert to move here)
   882                              <1> 		; bx + 8 -> repeat
   883                              <1> 		; bx -> last entry to move
   884                              <1> 		; si -> single terminator
   885                              <1> 		; si + 8 -> first entry to move
   886                              <1> 
   887 00000552 FF7706              <1> 	push word [bx + 6]
   888 00000555 FF7704              <1> 	push word [bx + 4]
   889 00000558 FF7702              <1> 	push word [bx + 2]
   890 0000055B FF37                <1> 	push word [bx]			; get the last entry
   891 0000055D 57                  <1> 	push di
   892 0000055E 56                  <1> 	push si
   893 0000055F 51                  <1> 	push cx				; preserve interrupt list index
   894 00000560 368E06[0000]        <1> 	mov es, word [ss:relocated(auxbuff_segorsel)]
   895                              <1> linkdatarelocation auxbuff_segorsel
   896 00000565 89F9                <1> 	mov cx, di			; = where to insert
   897                              <1> 					;  -> first to displace
   898 00000567 F7D9                <1> 	neg cx
   899 00000569 89DE                <1> 	mov si, bx			; -> after end of source
   900 0000056B 8D7F08              <1> 	lea di, [bx + 8]		; -> after end of dest
   901 0000056E 01F1                <1> 	add cx, si			; after end of source - first to displace
   902                              <1> 					; = how many bytes to displace
   903 00000570 D1E9                <1> 	shr cx, 1
   904 00000572 FD                  <1> 	std				; _AMD_ERRATUM_109_WORKAROUND as below
   905 00000573 A7                  <1> 	cmpsw				; si -= 2, di -= 2
   906                              <1> 
   907                              <1> 	numdef AMD_ERRATUM_109_WORKAROUND, 1
   908                              <1> 		; Refer to comment in init.asm init_movp.
   909                              <1> 
   910                              <1> %if _AMD_ERRATUM_109_WORKAROUND
   911 00000574 E308                <1> 	jcxz @FF
   912 00000576 83F914              <1> 	cmp cx, 20
   913 00000579 7703                <1> 	ja @FF
   914                              <1> @@:
   915 0000057B A5                  <1> 	movsw
   916 0000057C E2FD                <1> 	loop @B
   917                              <1> @@:
   918                              <1> %endif
   919 0000057E F3A5                <1> 	rep movsw			; relocate up the following entries
   920                              <1> 					;  by 8 bytes (size of 1 entry)
   921 00000580 FC                  <1> 	cld
   922 00000581 59                  <1> 	pop cx
   923 00000582 5E                  <1> 	pop si
   924 00000583 5F                  <1> 	pop di
   925 00000584 8F05                <1> 	pop word [di]
   926 00000586 8F4502              <1> 	pop word [di + 2]
   927 00000589 8F4504              <1> 	pop word [di + 4]
   928 0000058C 8F4506              <1> 	pop word [di + 6]		; insert moved entry
   929 0000058F 83C608              <1> 	add si, 8			; -> at moved single terminator
   930                              <1> 
   931                              <1> 		; di -> match (inserted here, insert next here)
   932                              <1> 		; bx + 8 -> repeat
   933                              <1> 		; bx -> last entry to move (if any)
   934                              <1> 		; si -> single terminator
   935                              <1> 		; si + 8 -> first entry to move
   936 00000592 39DE                <1> 	cmp si, bx			; if last to move != terminator
   937 00000594 75BC                <1> 	jne .insert			; then move another ->
   938 00000596 89F7                <1> 	mov di, si			; -> where to put double terminator
   939                              <1> 
   940 00000598 93                  <1> 	xchg ax, bx
   941                              <1> .end_chain:
   942 00000599 53                  <1> 	push bx
   943 0000059A 51                  <1> 	push cx				; preserve interrupt list index
   944 0000059B B8FFFF              <1> 	mov ax, -1
   945 0000059E 368E06[0000]        <1> 	mov es, word [ss:relocated(auxbuff_segorsel)]
   946                              <1> linkdatarelocation auxbuff_segorsel
   947 000005A3 B90800              <1> 	mov cx, 8
   948 000005A6 F3AB                <1> 	rep stosw			; terminator is all-ones
   949                              <1> 					; (two terminators actually)
   950 000005A8 59                  <1> 	pop cx
   951 000005A9 58                  <1> 	pop ax				; preserve multiplex number
   952                              <1> 
   953                              <1> .done:
   954 000005AA A8                  <1> 	db __TEST_IMM8			; (NC)
   955                              <1> .error:
   956 000005AB F9                  <1> 	stc
   957                              <1> 
   958 000005AC C3                  <1> 	retn
   959                              <1> 
   960                              <1> 
   961                              <1> 		; INP:	dx:bx = 86 Mode far pointer to handler
   962                              <1> 		;	di -> to check
   963                              <1> 		;	si = end of area to check (-1 = check all)
   964                              <1> 		; OUT:	ZR if match found, ds:di -> matching entry
   965                              <1> 		;	NZ if no match found,
   966                              <1> 		;	 di -> at second consecutive terminator
   967                              <1> 		;	 or di >= si
   968                              <1> 		; CHG:	-
   969                              <1> 		; STT:	ds => auxbuff
   970                              <1> 		; REM:	continues loop if di < si and the flags word
   971                              <1> 		;	 is not -1 in two consecutive entries.
   972                              <1> 		;	an entry with a flags word -1 is skipped.
   973                              <1> .check:
   974 000005AD 391D                <1> 	cmp word [di + 0], bx
   975 000005AF 7506                <1> 	jne .mismatch
   976 000005B1 395502              <1> 	cmp word [di + 2], dx
   977 000005B4 7501                <1> 	jne .mismatch
   978                              <1> .match:
   979 000005B6 C3                  <1> 	retn				; (ZR)
   980                              <1> 
   981                              <1> .mismatch:
   982 000005B7 83C708              <1> 	add di, 8
   983                              <1> 
   984 000005BA 39F7                <1> 	cmp di, si
   985 000005BC 730F                <1> 	jae .checkret
   986                              <1> 
   987 000005BE 837D04FF            <1> 	cmp word [di + 4], -1
   988 000005C2 75E9                <1> 	jne .check
   989                              <1> 
   990 000005C4 83C708              <1> 	add di, 8
   991 000005C7 837D04FF            <1> 	cmp word [di + 4], -1
   992 000005CB 75E0                <1> 	jne .check
   993                              <1> .checkret:
   994 000005CD 85FF                <1> 	test di, di			; (NZ)
   995 000005CF C3                  <1> 	retn
   996                              <1> %endif	; !_LOADER
   997                              <1> 
   998                              <1> 
   999                              <1> 		; INP:	dx:bx = 86 Mode far pointer to int handler
  1000                              <1> 		; OUT:	NC if chain found,
  1001                              <1> 		;	 dx:ax = 86 Mode far pointer to next
  1002                              <1> 		;	 ss:si -> type message (counted)
  1003                              <1> 		;	CY if chain not found,
  1004                              <1> 		;	 NZ if no chain
  1005                              <1> 		;	 ZR if chain but next is FFFFh:FFFFh,
  1006                              <1> 		;	  ss:si -> type message
  1007                              <1> 		; STT:	es != ss, ds != ss
  1008                              <1> check_int_chain:
  1009                              <1> %if _PM
  1010 000005D0 E81D02              <1> 	extcallcall setes2dx
  1011                              <1> %else
  1012                              <1> 	mov es, dx			; es:bx -> entrypoint
  1013                              <1> %endif
  1014 000005D3 E83A02              <1> 	extcallcall IsIISPEntry?
  1015 000005D6 7531                <1> 	jnz .not_iisp
  1016                              <1> 
  1017 000005D8 26FF7704            <1> 	push word [es:bx + ieNext + 2]
  1018 000005DC 26FF7702            <1> 	push word [es:bx + ieNext]
  1019                              <1> 
  1020 000005E0 BE[8000]            <1> 	mov si, msg.di_uninst_iisp
  1021                              <1> internaldatarelocation
  1022 000005E3 26813F90EA          <1> 	cmp word [ es:bx + ieEntry ], 0EA90h	; nop\jmp far imm16:imm16 ?
  1023 000005E8 7414                <1> 	je @F
  1024 000005EA BE[6400]            <1> 	mov si, msg.di_iisp
  1025                              <1> internaldatarelocation
  1026 000005ED 26807F09EB          <1> 	cmp byte [ es:bx + ieJmphwreset ], 0EBh	; jmp short ?
  1027 000005F2 7507                <1> 	jne .nonstd
  1028 000005F4 26813FEB10          <1> 	cmp word [ es:bx + ieEntry ], 010EBh	; jmp short $+18 ?
  1029 000005F9 7403                <1> 	je @F
  1030                              <1> .nonstd:
  1031 000005FB BE[6C00]            <1> 	mov si, msg.di_nonstd_iisp
  1032                              <1> internaldatarelocation
  1033                              <1> @@:
  1034 000005FE 58                  <1> 	pop ax
  1035 000005FF 5A                  <1> 	pop dx				; segment
  1036                              <1> 
  1037 00000600 50                  <1> 	push ax
  1038 00000601 21D0                <1> 	and ax, dx
  1039 00000603 40                  <1> 	inc ax
  1040 00000604 58                  <1> 	pop ax
  1041 00000605 7476                <1> 	jz .CY
  1042                              <1> 
  1043 00000607 F8                  <1> 	clc
  1044 00000608 C3                  <1> 	retn
  1045                              <1> 
  1046                              <1> 
  1047                              <1> .not_iisp:
  1048 00000609 83FBF8              <1> 	cmp bx, -8
  1049 0000060C 771A                <1> 	ja .not_fd
  1050 0000060E 26803FE8            <1> 	cmp byte [es:bx], 0E8h
  1051 00000612 7514                <1> 	jne .not_fd
  1052 00000614 26807F03EA          <1> 	cmp byte [es:bx + 3], 0EAh
  1053 00000619 750D                <1> 	jne .not_fd
  1054 0000061B 26FF7706            <1> 	push word [es:bx + 4 + 2]
  1055 0000061F 26FF7704            <1> 	push word [es:bx + 4]
  1056 00000623 BE[9400]            <1> 	mov si, msg.di_freedos_reloc
  1057                              <1> internaldatarelocation
  1058 00000626 EBD6                <1> 	jmp @B
  1059                              <1> 
  1060                              <1> .not_fd:
  1061 00000628 83FBFB              <1> 	cmp bx, -5
  1062 0000062B 7713                <1> 	ja .not_jmpfar
  1063 0000062D BE[A700]            <1> 	mov si, msg.di_jmpfar
  1064                              <1> internaldatarelocation
  1065 00000630 26803FEA            <1> 	cmp byte [es:bx], 0EAh
  1066 00000634 750A                <1> 	jne .not_jmpfar
  1067 00000636 26FF7703            <1> 	push word [es:bx + 1 + 2]
  1068 0000063A 26FF7701            <1> 	push word [es:bx + 1]
  1069 0000063E EBBE                <1> 	jmp @B
  1070                              <1> 
  1071                              <1> .not_jmpfar:
  1072 00000640 BE[B600]            <1> 	mov si, msg.di_jmpfarindirect
  1073                              <1> internaldatarelocation
  1074 00000643 26803FEB            <1> 	cmp byte [es:bx], 0EBh
  1075 00000647 750D                <1> 	jne .not_testhook_try_jmpfarindirect
  1076 00000649 BE[CA00]            <1> 	mov si, msg.di_testhook
  1077                              <1> internaldatarelocation
  1078 0000064C 268A4701            <1> 	mov al, byte [es:bx + 1]
  1079 00000650 98                  <1> 	cbw
  1080 00000651 83C002              <1> 	add ax, 2
  1081 00000654 01C3                <1> 	add bx, ax
  1082                              <1> .not_testhook_try_jmpfarindirect:
  1083 00000656 83FBFA              <1> 	cmp bx, -6
  1084 00000659 7720                <1> 	ja .not_testhook_or_jmpfarindirect
  1085 0000065B 26813F2EFF          <1> 	cmp word [es:bx], 0FF2Eh
  1086 00000660 7519                <1> 	jne .not_testhook_or_jmpfarindirect
  1087 00000662 26807F022E          <1> 	cmp byte [es:bx + 2], 2Eh
  1088 00000667 7512                <1> 	jne .not_testhook_or_jmpfarindirect
  1089 00000669 268B5F03            <1> 	mov bx, word [es:bx + 3]
  1090 0000066D 83FBFC              <1> 	cmp bx, -4
  1091 00000670 7709                <1> 	ja .not_testhook_or_jmpfarindirect
  1092 00000672 26FF7702            <1> 	push word [es:bx + 2]
  1093 00000676 26FF37              <1> 	push word [es:bx]
  1094 00000679 EB83                <1> 	jmp @B
  1095                              <1> 
  1096                              <1> .not_testhook_or_jmpfarindirect:
  1097 0000067B 85E4                <1> 	test sp, sp			; NZ
  1098                              <1> .CY:
  1099 0000067D F9                  <1> 	stc
  1100 0000067E C3                  <1> 	retn
  1101                              <1> 
  1102                              <1> 
  1103                              <1> gateout.mcbname:
  1104                              <1> %if !_LOADER
  1105 0000067F F6C501              <1> 	test ch, 1
  1106 00000682 7503E99A00          <1> 	jz .ret
  1107 00000687 8B16[0000]          <1> 	mov dx, word [relocated(firstmcb)]
  1108                              <1> linkdatarelocation firstmcb
  1109 0000068B 83FAFF              <1> 	cmp dx, -1
  1110 0000068E 7503E98E00          <1> 	je .ret
  1111 00000693 51                  <1> 	push cx
  1112 00000694 A1[6C01]            <1> 	mov ax, word [intaddress]
  1113                              <1> internaldatarelocation
  1114 00000697 B104                <1> 	mov cl, 4
  1115 00000699 D3E8                <1> 	shr ax, cl
  1116 0000069B 0306[6E01]          <1> 	add ax, word [intaddress + 2]	; => segment of handler
  1117                              <1> internaldatarelocation
  1118 0000069F 7251                <1> 	jc .hma
  1119                              <1> .loop:
  1120                              <1> %if _PM
  1121 000006A1 E84C01              <1> 	extcallcall setes2dx
  1122                              <1> %else
  1123                              <1> 	mov es, dx
  1124                              <1> %endif
  1125 000006A4 89D1                <1> 	mov cx, dx
  1126 000006A6 26030E0300          <1> 	add cx, word [es:3]
  1127 000006AB 41                  <1> 	inc cx
  1128 000006AC 39D0                <1> 	cmp ax, dx
  1129 000006AE 7247                <1> 	jb .next
  1130 000006B0 39C8                <1> 	cmp ax, cx
  1131 000006B2 7343                <1> 	jae .next
  1132 000006B4 268B160100          <1> 	mov dx, word [es:1]
  1133 000006B9 BE[0401]            <1> 	mov si, msg.di_system_mcb
  1134                              <1> internaldatarelocation
  1135 000006BC 83FA50              <1> 	cmp dx, 50h
  1136 000006BF 725A                <1> 	jb .copy
  1137 000006C1 4A                  <1> 	dec dx
  1138                              <1> %if _PM
  1139 000006C2 E82B01              <1> 	extcallcall setes2dx
  1140                              <1> %else
  1141                              <1> 	mov es, dx
  1142                              <1> %endif
  1143 000006C5 06                  <1> 	 push es
  1144 000006C6 1F                  <1> 	 pop ds
  1145 000006C7 16                  <1> 	 push ss
  1146 000006C8 07                  <1> 	 pop es
  1147 000006C9 B020                <1> 	mov al, 32
  1148 000006CB AA                  <1> 	stosb
  1149 000006CC 89F8                <1> 	mov ax, di
  1150 000006CE BE0800              <1> 	mov si, 8
  1151 000006D1 89F1                <1> 	mov cx, si
  1152 000006D3 57                  <1> 	push di
  1153 000006D4 F3A4                <1> 	rep movsb
  1154 000006D6 B000                <1> 	mov al, 0
  1155 000006D8 AA                  <1> 	stosb			; append zero-value byte
  1156 000006D9 5F                  <1> 	pop di			; -> name in buffer
  1157 000006DA 16                  <1> 	 push ss
  1158 000006DB 1F                  <1> 	 pop ds
  1159                              <1> @@:
  1160 000006DC AE                  <1> 	scasb			; is it zero ?
  1161 000006DD 75FD                <1> 	jne @B			; no, continue -->
  1162                              <1> 				; first dec makes it -> at the zero
  1163                              <1> @@:
  1164 000006DF 4F                  <1> 	dec di
  1165 000006E0 39F8                <1> 	cmp ax, di
  1166 000006E2 7408                <1> 	je .empty
  1167 000006E4 807DFF20            <1> 	cmp byte [di - 1], 32
  1168 000006E8 74F5                <1> 	je @B
  1169 000006EA EB34                <1> 	jmp .ret_cx
  1170                              <1> 
  1171                              <1> .empty:
  1172 000006EC 4F                  <1> 	dec di
  1173 000006ED BE[F400]            <1> 	mov si, msg.di_empty
  1174                              <1> internaldatarelocation
  1175 000006F0 EB29                <1> 	jmp .copy
  1176                              <1> 
  1177                              <1> .hma:
  1178 000006F2 BE[2E01]            <1> 	mov si, msg.di_hma
  1179                              <1> internaldatarelocation
  1180 000006F5 EB24                <1> 	jmp .copy
  1181                              <1> 
  1182                              <1> .next:
  1183 000006F7 89CA                <1> 	mov dx, cx
  1184 000006F9 3B16[0000]          <1> 	cmp dx, word [relocated(firstumcb)]
  1185                              <1> linkdatarelocation firstumcb
  1186                              <1> 				; is next one the first UMCB ?
  1187 000006FD 74A2                <1> 	je .loop		; yes, ignore the "Z" (if any) -->
  1188 000006FF 26803E00004D        <1> 	cmp byte [es:0], "M"	; check current signature
  1189 00000705 749A                <1> 	je .loop		; if "M" then loop to next -->
  1190                              <1> 
  1191 00000707 8B36[0000]          <1> 	mov si, word [relocated(firstumcb)]
  1192                              <1> linkdatarelocation firstumcb
  1193 0000070B 46                  <1> 	inc si
  1194 0000070C 7503                <1> 	jnz @F
  1195 0000070E BE00A0              <1> 	mov si, 0A000h
  1196                              <1> @@:
  1197 00000711 39F0                <1> 	cmp ax, si
  1198 00000713 BE[1001]            <1> 	mov si, msg.di_system_upper
  1199                              <1> internaldatarelocation
  1200 00000716 7303                <1> 	jae @F
  1201 00000718 BE[1F01]            <1> 	mov si, msg.di_system_low
  1202                              <1> internaldatarelocation
  1203                              <1> @@:
  1204                              <1> .copy:
  1205 0000071B 16                  <1> 	 push ss
  1206 0000071C 07                  <1> 	 pop es
  1207 0000071D E8D800              <1> 	extcallcall copy_single_counted_string
  1208                              <1> .ret_cx:
  1209 00000720 59                  <1> 	pop cx
  1210                              <1> .ret:
  1211                              <1> %endif	; !_LOADER
  1212 00000721 C3                  <1> 	retn
   201                                  
   202                                  error:
   203 00000722 E8[0000]EB020000        	extcall error
   204                                  
   205 00000729 90<rep 7h>E8[0000]-     	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   205 00000733 EB020000C3E8[0000]-
   205 0000073B EB020000C3E8[0000]-
   205 00000743 EB020000C3E8[0000]-
   205 0000074B EB020000C3E8[0000]-
   205 00000753 EB020000C3E8[0000]-
   205 0000075B EB020000C3E8[0000]-
   205 00000763 EB020000C3E8[0000]-
   205 0000076B EB020000C3E8[0000]-
   205 00000773 EB020000C3E8[0000]-
   205 0000077B EB020000C3E8[0000]-
   205 00000783 EB020000C3E8[0000]-
   205 0000078B EB020000C3E8[0000]-
   205 00000793 EB020000C3E8[0000]-
   205 0000079B EB020000C3E8[0000]-
   205 000007A3 EB020000C3E8[0000]-
   205 000007AB EB020000C3E8[0000]-
   205 000007B3 EB020000C3E8[0000]-
   205 000007BB EB020000C3E8[0000]-
   205 000007C3 EB020000C3E8[0000]-
   205 000007CB EB020000C3E8[0000]-
   205 000007D3 EB020000C3E8[0000]-
   205 000007DB EB020000C3E8[0000]-
   205 000007E3 EB020000C3E8[0000]-
   205 000007EB EB020000C3E8[0000]-
   205 000007F3 EB020000C3E8[0000]-
   205 000007FB EB020000C3E8[0000]-
   205 00000803 EB020000C3E8[0000]-
   205 0000080B EB020000C3E8[0000]-
   205 00000813 EB020000C3         
   206                                  
   207                                  endinstalled equ ($ + CODEFIXUP + 15) & ~15
   208                                  
   209                                  
   210                                  start:
   211 00000818 8CC3                    	mov bx, es
   212 0000081A 16                      	 push ss
   213 0000081B 07                      	 pop es
   214 0000081C E811FF                  	call skipcomma
   215 0000081F 4E                      	dec si
   216 00000820 BA[0000]                	mov dx, relocateddata
   217                                  linkdatarelocation msg.install
   218 00000823 E812FF                  	call isstring?
   219 00000826 742C                    	je install
   220 00000828 E8B3F8                  	call gateout
   221 0000082B E80300                  	call uninstall_oneshot
   222 0000082E 31C0                    	xor ax, ax
   223 00000830 CB                      	retf
   224                                  
   225                                  
   226                                  uninstall_oneshot:
   227 00000831 36F606[0000]01          	testopt [ss:relocateddata], 1
   228                                  linkdatarelocation options7, -3
   229 00000837 751A                    	jnz @F
   230                                  
   231 00000839 2EA1[0200]              	mov ax, word [cs:code + eldiEndCode]
   232                                  internalcoderelocation
   233 0000083D 2E2B06[0000]            	sub ax, word [cs:code + eldiStartCode]
   234                                  internalcoderelocation
   235 00000842 2906[0000]              	sub word [relocateddata], ax
   236                                  linkdatarelocation extseg_used
   237                                  
   238 00000846 2EA1[0600]              	mov ax, word [cs:code + eldiEndData]
   239                                  internalcoderelocation
   240 0000084A 2E2B06[0400]            	sub ax, word [cs:code + eldiStartData]
   241                                  internalcoderelocation
   242 0000084F 2906[0000]              	sub word [relocateddata], ax
   243                                  linkdatarelocation extdata_used
   244                                  @@:
   245 00000853 C3                      	retn
   246                                  
   247                                  
   248                                  install:
   249 00000854 AC                      	lodsb
   250 00000855 E8[0000]EB020000        	extcall chkeol
   251                                  
   252                                  	houdini
   253 0000085C 8EC3                    	mov es, bx		; => ext seg (writable)
   254 0000085E B88000                  	mov ax, endresident - endinstalled
   255 00000861 262906[0200]            	sub word [es:code + eldiEndCode], ax
   256                                  internalcoderelocation		; adjust size
   257 00000866 2906[0000]              	sub word [relocateddata], ax
   258                                  linkdatarelocation extseg_used	; adjust size
   259 0000086A 8B1E[0000]              	mov bx, word [relocateddata]
   260                                  linkdatarelocation ext_command_handler
   261                                  				; -> prior
   262 0000086E BF[2000]                	mov di, command		; -> our handler
   263                                  internalcoderelocation
   264 00000871 85DB                    	test bx, bx		; installing as first ?
   265 00000873 740A                    	jz .only_first		; yes, simple --> (leave as extcall cmd3_not_ext)
   266 00000875 AF                      	scasw			; skip entrypoint jmp strict short
   267 00000876 B0E9                    	mov al, 0E9h		; = jmp near opcode
   268 00000878 AA                      	stosb			; store
   269 00000879 93                      	xchg ax, bx		; ax -> next handler
   270 0000087A 29F8                    	sub ax, di
   271 0000087C 48                      	dec ax
   272 0000087D 48                      	dec ax			; ax = ax - (di + 2)
   273 0000087E AB                      	stosw			; store our downlink as rel16 displacement
   274                                  
   275                                  .only_first:
   276 0000087F 26800E[1000]01          	setopt [es:code + eldiFlags], eldifResident
   277                                  internalcoderelocation -3	; mark block as resident
   278 00000885 C706[0000][2000]        	mov word [relocateddata], command
   279                                  linkdatarelocation ext_command_handler, -4
   280                                  internalcoderelocation		; -> our entrypoint
   281                                  
   282 0000088B F606[0000]04            	testopt [relocateddata], 4
   283                                  linkdatarelocation options7, -3
   284 00000890 7506                    	jnz @F
   285 00000892 BA[3C00]                	mov dx, msg.installed
   286                                  internaldatarelocation
   287 00000895 E8C0FE                  	call putsz
   288                                  @@:
   289 00000898 31C0                    	xor ax, ax
   290 0000089A CB                      	retf
   291                                  
   292                                  
   293                                  DATAOFFSET equ CODEOFFSET + code_size
   294                                  	addsection DATA, follows=CODE vstart=_ELD_DATA_VSTART
   295                                  %define DATAFIXUP - datastart + 0
   296                                  datastart:
   297                                  PUT_ELD_DATETIME
   298                                  
   299                                  
   300                                  msg:
   301 00000000 444920636F6D6D616E-     .uninstall_done:	db "DI command uninstalled."
   301 00000009 6420756E696E737461-
   301 00000012 6C6C65642E         
   302                                  %if _ELD_RECLAIM_HINT
   303                                  			db " (Don't forget to use reclaim.eld)"
   304                                  %endif
   305 00000017 0D0A00                  			asciz 13,10
   306 0000001A 444920636F6D6D616E-     .uninstall_error:	asciz "DI command unable to uninstall!",13,10
   306 00000023 6420756E61626C6520-
   306 0000002C 746F20756E696E7374-
   306 00000035 616C6C210D0A00     
   307 0000003C 444920636F6D6D616E-     .installed:		asciz "DI command installed.",13,10
   307 00000045 6420696E7374616C6C-
   307 0000004E 65642E0D0A00       
   308                                  %include "dimsg.asm"
     1                              <1> 
     2                              <1> %if 0
     3                              <1> 
     4                              <1> lDebug DI command messages
     5                              <1> 
     6                              <1> Copyright (C) 2008-2023 E. C. Masloch
     7                              <1> 
     8                              <1> Usage of the works is permitted provided that this
     9                              <1> instrument is retained with the works, so that any entity
    10                              <1> that uses the works is notified of this instrument.
    11                              <1> 
    12                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                              <1> 
    14                              <1> %endif
    15                              <1> 
    16 00000054 07204572726F7221    <1> .di_error:	counted " Error!"
    17 0000005C 0768696464656E20    <1> .di_hidden:	counted "hidden "
    18 00000064 0720284949535029    <1> .di_iisp:	counted " (IISP)"
    19 0000006C 1320286E6F6E737461- <1> .di_nonstd_iisp:counted " (nonstandard IISP)"
    19 00000075 6E6461726420494953- <1>
    19 0000007E 5029                <1>
    20 00000080 132028756E696E7374- <1> .di_uninst_iisp:counted " (uninstalled IISP)"
    20 00000089 616C6C656420494953- <1>
    20 00000092 5029                <1>
    21                              <1> .di_freedos_reloc:
    22 00000094 1220284644206B6572- <1> 		counted " (FD kernel reloc)"
    22 0000009D 6E656C2072656C6F63- <1>
    22 000000A6 29                  <1>
    23 000000A7 0E2028666172206A6D- <1> .di_jmpfar:	counted " (far jmp imm)"
    23 000000B0 7020696D6D29        <1>
    24                              <1> .di_jmpfarindirect:
    25 000000B6 132028666172206A6D- <1> 		counted " (far jmp indirect)"
    25 000000BF 7020696E6469726563- <1>
    25 000000C8 7429                <1>
    26 000000CA 0C2028746573742068- <1> .di_testhook:	counted " (test hook)"
    26 000000D3 6F6F6B29            <1>
    27 000000D7 1C2028746F6F206D61- <1> .di_toomany:	counted " (too many chained handlers)"
    27 000000E0 6E7920636861696E65- <1>
    27 000000E9 642068616E646C6572- <1>
    27 000000F2 7329                <1>
    28 000000F4 0F20656D707479204D- <1> .di_empty:	counted " empty MCB name"
    28 000000FD 4342206E616D65      <1>
    29 00000104 0B2073797374656D20- <1> .di_system_mcb:	counted " system MCB"
    29 0000010D 4D4342              <1>
    30                              <1> .di_system_upper:
    31 00000110 0E2073797374656D20- <1> 		counted " system in UMA"
    31 00000119 696E20554D41        <1>
    32 0000011F 0E2073797374656D20- <1> .di_system_low:	counted " system in LMA"
    32 00000128 696E204C4D41        <1>
    33 0000012E 112068696768206D65- <1> .di_hma:	counted " high memory area"
    33 00000137 6D6F72792061726561  <1>
    34 00000140 06205B6D70783A      <1> .di_multiplex.1:counted " [mpx:"
    35 00000147 0768206C6973743A    <1> .di_multiplex.2:counted "h list:"
    36 0000014F 02685D              <1> .di_multiplex.3:counted "h]"
    37                              <1> 
    38                              <1> %if _PM
    39                              <1> gatewrong:	equ $
    40 00000152 67617465206E6F7420- <1> 		asciz "gate not accessible",13,10
    40 0000015B 61636365737369626C- <1>
    40 00000164 650D0A00            <1>
    41                              <1> %endif
   309                                  
   310 00000168 00                      lastint:		db 0
   311 00000169 00<rep 3h>              	align 4, db 0
   312 0000016C 00000000                intaddress:		dd 0
   313 00000170 0000                    lastint_is_86m_and_mcb:	dw 0
   314                                  uinit_data:
   315                                  
   316 00000172 00<rep Eh>              	align 16, db 0
   317                                  data_size equ $ - datastart
   318                                  
   319                                  	absolute uinit_data
   320                                  
   321 00000172 <res Eh>                	alignb 16
   322                                  uinit_data_end:
   323                                  
   324                                  total_data_size equ $ - datastart
   325                                  %assign _DATA_SIZE total_data_size
   326                                  
   327                                  	usesection CODE
   328                                  
   329                                  %include "eldlink.asm"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> Extensions for lDebug linker
     4                              <1> 
     5                              <1> Copyright (C) 2008-2025 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-2025 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELD_MAC
    16                              <2> %define ELD_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
    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> eldhxDateTimeOffset:	resd 1	; zero if none, from eldhxHeader
    43                              <2> 	alignb 16
    44                              <2> 	endstruc
    45                              <2> 
    46                              <2> 	struc ELD_TRAILER_HEADER
    47                              <2> eldthSignature:		resb 8	; "ELD1TAIL"
    48                              <2> eldthHeaderOffset:	resd 1	; negative displacement from eldthSignature,
    49                              <2> 				;  add this dword to the seek offset
    50                              <2> eldthReserved:		resw 1	; reserved, must be initialised to zero
    51                              <2> eldthChecksum:		resw 1	; sum of all words in trailer header = 0
    52                              <2> 	endstruc
    53                              <2> 	endarea ELD_TRAILER_HEADER, 1
    54                              <2> 
    55                              <2> 	struc ELD_LIBTABLE
    56                              <2> eldltFormat:		resw 1
    57                              <2> 	; 0 = uncompressed
    58                              <2> 	; 2 = heatshrink compressed
    59                              <2> 	; 3 = lzexedat -4 compressed
    60                              <2> 	; 4 = lzexedat -4 -l compressed
    61                              <2> eldltAmount:		resw 1
    62                              <2> eldltOffset:		resd 1	; from eldhxHeader
    63                              <2> eldltCompressedLength:		; (dword, only present if format 2, 3, or 4)
    64                              <2> 	endstruc
    65                              <2> 	endarea ELD_LIBTABLE, 1
    66                              <2> 
    67                              <2> 		; ELD instance header
    68                              <2> 	struc ELD_INSTANCE
    69                              <2> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    70                              <2> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    71                              <2> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    72                              <2> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    73                              <2> eldiIdentifier:		resb 8	; blank-filled text
    74                              <2> eldiFlags:		resw 1	; flags
    75                              <2> eldiListing_size equ 14
    76                              <2> eldiListing:		resb eldiListing_size
    77                              <2> 				; ASCIZ listing file name
    78                              <2> 	endstruc
    79                              <2> 		; flags for eldiFlags:
    80                              <2> eldifResident:		equ 1
    81                              <2> 
    82                              <2> 		; ELD link info header
    83                              <2> 	struc ELD_LINKINFO
    84                              <2> eldlSignature:		resw 1	; 0E1D1h
    85                              <2> eldlReserved:		resw 2
    86                              <2> eldlUseLinkHash:	resw 1
    87                              <2> eldlDataAmount:		resw 1
    88                              <2> eldlDataPrefixes:	resw 1
    89                              <2> eldlDataEntries:	resw 1
    90                              <2> eldlDataAddresses:	resw 1
    91                              <2> eldlCodeAmount:		resw 1
    92                              <2> eldlCodePrefixes:	resw 1
    93                              <2> eldlCodeEntries:	resw 1
    94                              <2> eldlCodeAddresses:	resw 1
    95                              <2> 	endstruc
    96                              <2> 
    97                              <2> 	numdef ELD_CODE_VSTART, 9001h
    98                              <2> 	numdef ELD_DATA_VSTART, 8000h
    99                              <2> 	numdef ELD_RELOC_VSTART, 8000h
   100                              <2> 
   101                              <2> 	numdef ELD_RECLAIM_HINT, 0
   102                              <2> 	strdef ELD_LISTING, ""
   103                              <2> 	numdef ELD_DATETIME, 0
   104                              <2> 
   105                              <2> %if _ELD_DATETIME
   106                              <2>  %define PUT_ELDHX_DATETIME_OFFSET at eldhxDateTimeOffset, dd DATAOFFSET + datetime - datastart
   107                              <2>  %macro PUT_ELD_DATETIME 0.nolist
   108                              <2> datetime:	asciz __UTC_DATE__,'T',__UTC_TIME__,'Z'
   109                              <2> 		asciz		; for future extension
   110                              <2>  %endmacro
   111                              <2> %else
   112                              <2>  %define PUT_ELDHX_DATETIME_OFFSET
   113                              <2>  %define PUT_ELD_DATETIME
   114                              <2> %endif
   115                              <2> 
   116                              <2> %endif
    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> 	numdef ELDDATA_OPTIONAL, ELDDATA_OPTIONAL_STATUS
    37                              <1> 	numdef ELDDATA_NEXT, ELDDATA_NEXT_STATUS
    38                              <1> 	numdef ELDCALL_NEXT, ELDCALL_NEXT_STATUS
    39                              <1> %if _ELD_IDENTICALISE
    40                              <1>  ;%assign _ELDCALL_OPTIONAL 1
    41                              <1> %endif
    42                              <1> %ifn _ELDCALL_OPTIONAL
    43                              <1> %assign ELDCALL_OPTIONAL_STATUS 2		; not allowed
    44                              <1> %endif
    45                              <1> ;%ifn _ELDDATA_OPTIONAL
    46                              <1> ;%assign ELDDATA_OPTIONAL_STATUS 2		; not allowed
    47                              <1> ;%endif
    48                              <1> 	gendef MAP, ""
    49                              <1> 
    50                              <1> %ifnidni _MAP, ""
    51                              <1>  [map all _MAP]
    52                              <1> %endif
    53                              <1> 
    54                              <1> 
    55                              <1> endresident: equ ($ + _CURRENT_SECTION %+ FIXUP + 15) & ~15
    56                              <1> 
    57                              <1> %if _ELD_LINKER_PASSES
    58                              <1> %assign ELDLINKER 1
    59                              <1> 
    60                              <1> 	struc LINKTABLE
    61 00000000 ????????            <1> ltCodeToCode:	resw 2
    62 00000004 ????????            <1> ltCodeToData:	resw 2
    63 00000008 ????????            <1> ltDataToCode:	resw 2
    64 0000000C ????????            <1> ltDataToData:	resw 2
    65 00000010 ????????            <1> ltLinkData:	resw 2
    66 00000014 ????????            <1> ltLinkCode:	resw 2
    67                              <1> 	endstruc
    68                              <1> %endif
    69                              <1> 
    70                              <1> 
    71                              <1> 		; INP:	es:dx -> loaded initial ELD image
    72                              <1> 		;	 ELD instance structure filled
    73                              <1> 		;	es => ELD code area
    74                              <1> 		;	ds:di -> link info
    75                              <1> 		;	ss:bx -> loaded initial data
    76                              <1> 		;	ss:si -> command line tail
    77                              <1> 		;	cs:ip -> entrypoint
    78                              <1> 		;	ss:sp -> far return address for current mode
    79                              <1> 		; STT:	UP, EI
    80                              <1> linker:
    81                              <1> 		; The first 15 Bytes of the linker should be
    82                              <1> 		;  the same regardless of the linker options
    83                              <1> 		;  used (debug, passes, vstart). This allows
    84                              <1> 		;  the eldcomp ELD to match even if up to 15
    85                              <1> 		;  Bytes of the linker are trailing in the
    86                              <1> 		;  resident part of the ELD.
    87                              <1> 	lframe
    88                              <1>  %if ELDOTHER
    89                              <1> 	lvar dword, linkinfo_other
    90                              <1> 	lvar word, use_hash_other
    91                              <1>  %endif
    92 0000089B 5589E5              <1> 	lenter
    93                              <1> 	lvar dword, instance
    94 0000089E 06                  <1> 	 push es
    95 0000089F 52                  <1> 	 push dx		; -> start of where we're loaded in ELD cs
    96                              <1> 	lvar word, targetsection_low_optional_high
    97 000008A0 50                  <1> 	 push ax		; placeholder
    98                              <1> 	lequ ?targetsection_low_optional_high, targetsection
    99                              <1> 	lequ ?targetsection_low_optional_high + 1, optional
   100                              <1> 	lvar dword, linkinfo
   101 000008A1 1E                  <1> 	 push ds
   102 000008A2 57                  <1> 	 push di		; -> link info (in debugger ss or message seg)
   103                              <1> 	lvar dword, nextreloc
   104 000008A3 06                  <1> 	 push es		; => ELD cs
   105 000008A4 52                  <1> 	 push dx		; placeholder
   106                              <1> 	lvar dword, entry
   107 000008A5 06                  <1> 	 push es		; => ELD cs
   108 000008A6 50                  <1> 	 push ax		; placeholder
   109 000008A7 31C0                <1> 	xor ax, ax
   110 000008A9 813DD1E1            <1> 	cmp word [di + eldlSignature], 0E1D1h
   111                              <1> %if ($ - linker) < 16
   112                              <1>  %error Expected invariant first paragraph of linker
   113                              <1> %endif
   114 000008AD 7403                <1> 	je @F
   115                              <1> .error_j1:
   116 000008AF E9C602              <1> 	jmp .error		; signature mismatch -->
   117                              <1> @@:
   118 000008B2 837D0601            <1> 	cmp word [di + eldlUseLinkHash], 1
   119 000008B6 77F7                <1> 	ja .error_j1		; unknown use link hash number -->
   120 000008B8 7201                <1> 	jb @F
   121                              <1> %if _ELDDATA_NEXT || _ELDCALL_NEXT
   122                              <1> 	dec al			; = -1 if hash used
   123                              <1> %else
   124 000008BA 48                  <1> 	dec ax
   125                              <1> %endif
   126                              <1> @@:
   127                              <1> 	lvar word, use_hash_low_skip_last_high
   128 000008BB 50                  <1> 	 push ax		; = -1 if hash used, else 0
   129                              <1> 	lequ ?use_hash_low_skip_last_high, use_hash
   130                              <1> 	lequ ?use_hash_low_skip_last_high + 1, skip_last
   131                              <1> %if _ELD_IDENTICALISE && _ELD_LINKER_PASSES
   132                              <1> 	mov ax, linktable - code
   133                              <1> 	lvar word, lt
   134                              <1> 	 push ax		; -> link tables (a single reference)
   135                              <1> %endif
   136                              <1> %if _ELD_LINKER_PASSES || ELDOTHER || _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   137 000008BC 31C0                <1> 	xor ax, ax
   138                              <1>  %if _ELD_LINKER_PASSES
   139                              <1> 	lvar word, pass
   140 000008BE 50                  <1> 	 push ax		; = 0 for linker itself, = 2 for application
   141                              <1> 	lvar word, amounterrors
   142 000008BF 50                  <1> 	 push ax		; how many distinct errors encountered in pass 2
   143                              <1>  %endif
   144                              <1>  %if _ELD_LINKER_PASSES || _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   145                              <1> 	lvar word, name
   146 000008C0 50                  <1> 	 push ax		; -> name currently being sought (in our table)
   147                              <1>  %endif
   148                              <1>  %if ELDOTHER
   149                              <1> 	lvar word, other
   150                              <1> 	 push ax		; byte: 0 = own data links, -1 = other data links
   151                              <1>  %endif
   152                              <1>  %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   153                              <1> 	lvar word, optionalmissing
   154                              <1> 	 push ax
   155                              <1>  %endif
   156                              <1> %endif
   157 000008C1 56                  <1> 	push si			; -> command line tail
   158 000008C2 53                  <1> 	push bx			; -> data block in ELD data area (segment ss)
   159                              <1> 
   160                              <1> 			; simple: add instance base (dx) to code
   161 000008C3 06                  <1> 	push es
   162 000008C4 1F                  <1> 	pop ds			; ds = es => ELD cs
   163                              <1> %if _ELD_LINKER_PASSES
   164                              <1> .pass:
   165 000008C5 8B5EEA              <1> 	mov bx, word [bp + ?pass]	; 0 or 2
   166 000008C8 01D3                <1> 	add bx, dx		; -> start of the ELD instance in cs, +0 or +2
   167                              <1>  %if _ELD_IDENTICALISE
   168                              <1> 	add bx, word [bp + ?lt]	; add in single reference to linktable
   169                              <1> 	mov si, word [ltCodeToCode + bx]
   170                              <1>  %else
   171 000008CA 8BB7640C            <1> 	mov si, word [linktable - code + ltCodeToCode + bx]
   172                              <1>  %endif
   173                              <1> %else
   174                              <1> 	mov si, internalcodetocoderelocations - code
   175                              <1> %endif		 		; si -> table for code to code (linker or app)
   176 000008CE 01D6                <1> 	add si, dx		; relocate the table pointer itself
   177                              <1> @@:
   178 000008D0 AD                  <1> 	lodsw
   179 000008D1 85C0                <1> 	test ax, ax		; was last ?
   180 000008D3 740B                <1> 	jz @F			; yes -->
   181 000008D5 93                  <1> 	xchg bx, ax		; bx = entry
   182 000008D6 01D3                <1> 	add bx, dx		; relocate the entry itself
   183                              <1> %if _ELD_CODE_VSTART
   184 000008D8 812F[0000]          <1> 	sub word [bx], code	; undo adjustment
   185                              <1> %endif
   186 000008DC 0117                <1> 	add word [bx], dx	; relocate word referenced by entry
   187 000008DE EBF0                <1> 	jmp @B
   188                              <1> 
   189                              <1> @@:
   190                              <1> 			; next, add heap data base (on stack) to code
   191                              <1> %if _ELD_LINKER_PASSES
   192 000008E0 8B5EEA              <1> 	mov bx, word [bp + ?pass]	; 0 or 2
   193 000008E3 01D3                <1> 	add bx, dx		; -> start of the ELD instance in cs, +0 or +2
   194                              <1>  %if _ELD_IDENTICALISE
   195                              <1> 	add bx, word [bp + ?lt]	; add in single reference to linktable
   196                              <1> 	mov si, word [ltCodeToData + bx]
   197                              <1>  %else
   198 000008E5 8BB7680C            <1> 	mov si, word [linktable - code + ltCodeToData + bx]
   199                              <1>  %endif
   200                              <1> %else
   201                              <1> 	mov si, internalcodetodatarelocations - code
   202                              <1> %endif				; si -> table for code to data (linker or app)
   203 000008E9 01D6                <1> 	add si, dx		; relocate the table pointer itself
   204                              <1> @@:
   205 000008EB AD                  <1> 	lodsw
   206 000008EC 85C0                <1> 	test ax, ax		; was last ?
   207 000008EE 740C                <1> 	jz @F			; yes -->
   208 000008F0 93                  <1> 	xchg bx, ax		; bx = entry
   209 000008F1 01D3                <1> 	add bx, dx		; relocate the entry itself
   210                              <1> 		; ! access the offset of the data area block, topmost on stack
   211 000008F3 58                  <1> 	pop ax			; ax -> heap data
   212 000008F4 50                  <1> 	push ax
   213                              <1> %if _ELD_DATA_VSTART
   214 000008F5 2D[0000]            <1> 	sub ax, datastart	; undo adjustment
   215                              <1> %endif
   216 000008F8 0107                <1> 	add word [bx], ax	; relocate word referenced by entry
   217 000008FA EBEF                <1> 	jmp @B
   218                              <1> 
   219                              <1> @@:
   220                              <1> 
   221                              <1> 			; add instance base (dx) to data
   222                              <1> %if _ELD_LINKER_PASSES
   223 000008FC 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   224 000008FF 01D3                <1> 	add bx, dx
   225                              <1>  %if _ELD_IDENTICALISE
   226                              <1> 	add bx, word [bp + ?lt]
   227                              <1> 	mov si, word [ltDataToCode + bx]
   228                              <1>  %else
   229 00000901 8BB76C0C            <1> 	mov si, word [linktable - code + ltDataToCode + bx]
   230                              <1>  %endif
   231                              <1> %else
   232                              <1> 	mov si, internaldatatocoderelocations - code
   233                              <1> %endif
   234 00000905 01D6                <1> 	add si, dx
   235                              <1> @@:
   236 00000907 AD                  <1> 	lodsw
   237 00000908 83F8FF              <1> 	cmp ax, -1		; was last ?
   238 0000090B 740F                <1> 	je @F			; yes -->
   239 0000090D 93                  <1> 	xchg bx, ax		; bx = entry
   240                              <1> 		; ! access the offset of the data area block, topmost on stack
   241 0000090E 58                  <1> 	pop ax
   242 0000090F 50                  <1> 	push ax
   243 00000910 01C3                <1> 	add bx, ax		; relocate the entry itself
   244                              <1> %if _ELD_CODE_VSTART
   245 00000912 36812F[0000]        <1> 	sub word [ss:bx], code	; undo adjustment
   246                              <1> %endif
   247 00000917 360117              <1> 	add word [ss:bx], dx	; relocate word referenced by entry
   248 0000091A EBEB                <1> 	jmp @B
   249                              <1> 
   250                              <1> @@:
   251                              <1> 			; next, add heap data base (on stack) to data
   252                              <1> %if _ELD_LINKER_PASSES
   253 0000091C 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   254 0000091F 01D3                <1> 	add bx, dx
   255                              <1>  %if _ELD_IDENTICALISE
   256                              <1> 	add bx, word [bp + ?lt]
   257                              <1> 	mov si, word [ltDataToData + bx]
   258                              <1>  %else
   259 00000921 8BB7700C            <1> 	mov si, word [linktable - code + ltDataToData + bx]
   260                              <1>  %endif
   261                              <1> %else
   262                              <1> 	mov si, internaldatatodatarelocations - code
   263                              <1> %endif
   264 00000925 01D6                <1> 	add si, dx
   265                              <1> @@:
   266 00000927 AD                  <1> 	lodsw
   267 00000928 83F8FF              <1> 	cmp ax, -1		; was last ?
   268 0000092B 740D                <1> 	je @F			; yes -->
   269 0000092D 93                  <1> 	xchg bx, ax		; bx = entry
   270                              <1> 		; ! access the offset of the data area block, topmost on stack
   271 0000092E 58                  <1> 	pop ax			; ax -> heap data
   272 0000092F 50                  <1> 	push ax
   273 00000930 01C3                <1> 	add bx, ax		; relocate the entry itself
   274                              <1> %if _ELD_DATA_VSTART
   275 00000932 2D[0000]            <1> 	sub ax, datastart	; undo adjustment
   276                              <1> %endif
   277 00000935 360107              <1> 	add word [ss:bx], ax	; relocate word referenced by entry
   278 00000938 EBED                <1> 	jmp @B
   279                              <1> 
   280                              <1> @@:
   281 0000093A 8B56FC              <1> 	mov dx, word [bp + ?instance]
   282                              <1> 				; reset (why??) -> ELD instance in ELD cs
   283                              <1> %if _ELD_LINKER_PASSES
   284 0000093D 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   285 00000940 01D3                <1> 	add bx, dx
   286                              <1>  %if _ELD_IDENTICALISE
   287                              <1> 	add bx, word [bp + ?lt]
   288                              <1> 	add dx, word [ltLinkData + bx]
   289                              <1>  %else
   290 00000942 0397740C            <1> 	add dx, word [linktable - code + ltLinkData + bx]
   291                              <1>  %endif
   292                              <1> %else
   293                              <1> 	add dx, linkerdatarelocations - code
   294                              <1> %endif
   295                              <1> .otherloop:
   296 00000946 8956F2              <1> 	mov word [bp + ?nextreloc], dx
   297                              <1> 				; -> data link relocation table
   298                              <1> 
   299                              <1> .datarelocloop:		; must be done before further relocs
   300 00000949 C576F2              <1> 	lds si, [bp + ?nextreloc]
   301 0000094C AD                  <1> 	lodsw			; ax = section indicator
   302 0000094D 85C0                <1> 	test ax, ax		; end of table ?
   303 0000094F 7503E90401          <1> 	jz .donedatareloc
   304 00000954 48                  <1> 	dec ax			; al = 1 if data, 0 if code (NB ah may != 0)
   305                              <1> 		; ! access the offset of the data area block, topmost on stack
   306 00000955 5B                  <1> 	pop bx
   307 00000956 53                  <1> 	push bx			; bx -> ELD data block
   308 00000957 8946FA              <1> 	mov word [bp + ?targetsection_low_optional_high], ax
   309 0000095A 84C0                <1> 	test al, al		; data ?
   310 0000095C AD                  <1> 	lodsw
   311 0000095D 7504                <1> 	jnz @F			; yes -->
   312 0000095F 0346FC              <1> 	add ax, word [bp + ?instance]
   313                              <1> 				; relocate entry into code
   314 00000962 A9                  <1> 	db __TEST_IMM16		; (skip add)
   315                              <1> @@:
   316 00000963 01D8                <1> 	add ax, bx		; relocate entry into data
   317 00000965 8946EE              <1> 	mov word [bp + ?entry], ax
   318                              <1> 				; save away -> where to patch
   319 00000968 AD                  <1> 	lodsw			; get unrelocated -> name
   320 00000969 8976F2              <1> 	mov word [bp + ?nextreloc], si
   321                              <1> 				; update -> behind relocation table entry
   322                              <1> %if _ELDDATA_NEXT
   323                              <1> 	rol byte [bp + ?skip_last], 1	; skipping ?
   324                              <1> 	jnc @F				; no -->
   325                              <1> 	test byte [bp + ?optional], 8	; is it a last relocation ?
   326                              <1> 	jz .datarelocloop		; no, leave skip_last set -->
   327                              <1> 	not byte [bp + ?skip_last]	; disable skip_last
   328                              <1> 	jmp .datarelocloop
   329                              <1> @@:
   330                              <1> %endif
   331 0000096C E8BD00              <1> 	call .build_match	; get ax = scan value, si -> counted string,
   332                              <1> 				;  dl = original value at byte [si]
   333                              <1> 				; NC if symbol already not found before
   334                              <1> 				; CY if to search for the symbol
   335                              <1> %if _ELD_LINKER_PASSES
   336 0000096F 73D8                <1> 	jnc .datarelocloop	; if duplicate of a not found symbol -->
   337                              <1> %endif
   338 00000971 C45EF6              <1> 	les bx, [bp + ?linkinfo]
   339                              <1> %if ELDOTHER
   340                              <1> 	rol byte [bp + ?other], 1
   341                              <1> 	jnc @F
   342                              <1> 	les bx, [bp + ?linkinfo_other]
   343                              <1> @@:
   344                              <1> %endif				; es:bx -> link info table of the ELD host
   345 00000974 268B4F08            <1> 	mov cx, word [es:bx + eldlDataAmount]	; amount data link info
   346 00000978 268B7F0A            <1> 	mov di, word [es:bx + eldlDataPrefixes]	; -> prefixes or hashes
   347                              <1> .datarelocfind:
   348 0000097C 83F901              <1> 	cmp cx, 1			; NZ if cx == 0
   349 0000097F F2AF                <1> 	repne scasw			; scan initial
   350                              <1> %if _ELDDATA_OPTIONAL
   351                              <1> 	jne .datanotfound_may_be_optional
   352                              <1> %else
   353 00000981 7541                <1> 	jne .datanotfound
   354                              <1> %endif
   355 00000983 57                  <1> 	push di
   356 00000984 51                  <1> 	push cx
   357 00000985 56                  <1> 	push si
   358 00000986 262B7F0A            <1> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   359 0000098A 4F                  <1> 	dec di
   360 0000098B 4F                  <1> 	dec di				; 0-based
   361 0000098C 26037F0C            <1> 	add di, word [es:bx + eldlDataEntries]	; -> entry
   362 00000990 268B3D              <1> 	mov di, [es:di]			; -> counted suffix/string
   363 00000993 B500                <1> 	mov ch, 0
   364 00000995 8A0C                <1> 	mov cl, byte [si]		; cx = length
   365 00000997 41                  <1> 	inc cx
   366                              <1> 	; cmp al, al			; ZR if length is zero
   367 00000998 F3A6                <1> 	repe cmpsb			; match ?
   368 0000099A 5E                  <1> 	pop si
   369 0000099B 59                  <1> 	pop cx
   370 0000099C 5F                  <1> 	pop di
   371 0000099D 75DD                <1> 	jne .datarelocfind		; if not found this time,
   372                              <1> 					;  scan for next initial -->
   373 0000099F 8814                <1> 	mov byte [si], dl		; restore the original byte at counter
   374 000009A1 262B7F0A            <1> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   375 000009A5 4F                  <1> 	dec di
   376 000009A6 4F                  <1> 	dec di				; 0-based
   377 000009A7 26037F0E            <1> 	add di, word [es:bx + eldlDataAddresses]	; -> address (offset)
   378 000009AB 268B05              <1> 	mov ax, word [es:di]		; get link data from the table
   379 000009AE E80700              <1> 	call .address_data_reloc
   380                              <1> %if _ELD_RELOC_VSTART
   381 000009B1 2D[0000]            <1> 	sub ax, relocateddata		; *not* a relocation
   382                              <1> %endif
   383 000009B4 0104                <1> 	add word [si], ax		; relocate
   384                              <1> %if _ELDDATA_NEXT
   385                              <1> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   386                              <1> 	jz .datarelocloop
   387                              <1> 	mov byte [bp + ?skip_last], -1	; skip subsequent next/last relocs
   388                              <1> %endif
   389 000009B6 EB91                <1> 	jmp .datarelocloop
   390                              <1> 
   391                              <1> .address_data_reloc:
   392 000009B8 C576EE              <1> 	lds si, [bp + ?entry]		; -> entry if in ELD code instance
   393 000009BB 807EFA00            <1> 	cmp byte [bp + ?targetsection], 0
   394                              <1> 					; relocation in code ?
   395 000009BF 7402                <1> 	je @F				; yes -->
   396 000009C1 16                  <1> 	push ss
   397 000009C2 1F                  <1> 	pop ds				; => our ELD data block
   398                              <1> @@:
   399 000009C3 C3                  <1> 	retn
   400                              <1> 
   401                              <1> %if _ELDDATA_OPTIONAL
   402                              <1> .datanotfound_may_be_optional:
   403                              <1> 	mov byte [si], dl		; restore the original byte at counter
   404                              <1> %if _ELDDATA_NEXT
   405                              <1> 	test byte [bp + ?optional], 3	; is it an optional relocation ?
   406                              <1> %else
   407                              <1> 	cmp byte [bp + ?optional], 0	; is it an optional relocation ?
   408                              <1> %endif
   409                              <1> %if _ELD_DEBUG
   410                              <1> 	jnz @F
   411                              <1>  %ifn _ELD_LINKER_PASSES
   412                              <1> 	mov si, 0			; (invalid link)
   413                              <1> linkdatarelocation internalflags6
   414                              <1> 	test si, si
   415                              <1> 	jz .datanotfound
   416                              <1> 	mov si, 0			; (invalid link)
   417                              <1> linkdatarelocation options7
   418                              <1> 	test si, si
   419                              <1> 	jz .datanotfound
   420                              <1>  %else
   421                              <1> 	cmp byte [bp + ?pass], 0
   422                              <1> 	je .datanotfound
   423                              <1>  %endif
   424                              <1> 	houdini				; (the above conditions are for this)
   425                              <1> 	jmp .datanotfound
   426                              <1> @@:
   427                              <1> %else
   428                              <1> 	jz .datanotfound		; no, handle as an error -->
   429                              <1> %endif
   430                              <1> 
   431                              <1> %if ELDDATA_PMREQUIRED_STATUS
   432                              <1> 	mov si, relocateddata
   433                              <1> linkdatarelocation build_option_PM
   434                              <1> 	test si, si			; is it a PM build ?
   435                              <1> 	jz @F				; no --> (treat PM required as optional)
   436                              <1> 	test byte [bp + ?optional], 2	; optional status is PM required ?
   437                              <1> 	jnz .datanotfound		; yes, handle as an error -->
   438                              <1> @@:
   439                              <1> %endif
   440                              <1> 
   441                              <1> %if _ELD_LINKER_PASSES
   442                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   443                              <1> 	rol byte [bp + ?optionalmissing], 1
   444                              <1> 	jnc .optionaldatamissingmsg
   445                              <1> 	mov si, [bp + ?name]
   446                              <1> 	or byte [si], 80h
   447                              <1> 	not byte [bp + ?optionalmissing]
   448                              <1> 	jmp @F
   449                              <1> .optionaldatamissingmsg:
   450                              <1> %endif
   451                              <1> 	testopt [ss:relocateddata], 2	; debug optional link ?
   452                              <1> linkdatarelocation options7, -3
   453                              <1> 	jz @F				; no -->
   454                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   455                              <1> 	mov byte [bp + ?optionalmissing + 1], -1
   456                              <1> %endif
   457                              <1> 	mov si, lmsg.warning_data_optional
   458                              <1> internalcoderelocation
   459                              <1> 	call .notfound			; display a warning
   460                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   461                              <1> 	not byte [bp + ?optionalmissing + 1]
   462                              <1> %endif
   463                              <1> @@:
   464                              <1> %endif
   465                              <1> %if _ELDDATA_NEXT
   466                              <1> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   467                              <1> 	jnz .datarelocloop
   468                              <1> %endif
   469                              <1> 	call .address_data_reloc
   470                              <1> 	and word [si], 0		; indicate optional data link failed
   471                              <1> 	jmp .datarelocloop
   472                              <1> %endif
   473                              <1> 
   474                              <1> 
   475                              <1> %if _ELDCALL_OPTIONAL
   476                              <1> .codenotfound_may_be_optional:
   477                              <1> 	mov byte [si], dl		; restore the original byte at counter
   478                              <1> %if _ELDCALL_NEXT
   479                              <1> 	test byte [bp + ?optional], 3	; is it an optional relocation ?
   480                              <1> %else
   481                              <1> 	cmp byte [bp + ?optional], 0	; is it an optional relocation ?
   482                              <1> %endif
   483                              <1> %if _ELD_DEBUG
   484                              <1> 	jnz @F
   485                              <1>  %ifn _ELD_LINKER_PASSES
   486                              <1> 	mov si, 0			; (invalid link)
   487                              <1> linkdatarelocation internalflags6
   488                              <1> 	test si, si
   489                              <1> 	jz .codenotfound
   490                              <1> 	mov si, 0			; (invalid link)
   491                              <1> linkdatarelocation options7
   492                              <1> 	test si, si
   493                              <1> 	jz .codenotfound
   494                              <1>  %else
   495                              <1> 	cmp byte [bp + ?pass], 0
   496                              <1> 	je .codenotfound
   497                              <1>  %endif
   498                              <1> 	houdini				; (the above conditions are for this)
   499                              <1> 	jmp .codenotfound
   500                              <1> @@:
   501                              <1> %else
   502                              <1> 	jz .codenotfound		; no, handle as an error -->
   503                              <1> %endif
   504                              <1> 
   505                              <1> %if ELDCALL_PMREQUIRED_STATUS
   506                              <1>  %if _ELD_LINKER_PASSES
   507                              <1>   %assign ELDLINKER 0
   508                              <1>  %endif
   509                              <1> 	mov si, relocateddata
   510                              <1> linkdatarelocation build_option_PM
   511                              <1>  %if _ELD_LINKER_PASSES
   512                              <1>   %assign ELDLINKER 1
   513                              <1>  %endif
   514                              <1> 	test si, si			; is it a PM build ?
   515                              <1> 	jz @F				; no --> (treat PM required as optional)
   516                              <1> 	test byte [bp + ?optional], 2	; optional status is PM required ?
   517                              <1> 	jnz .codenotfound		; yes, handle as an error -->
   518                              <1> @@:
   519                              <1> %endif
   520                              <1> 
   521                              <1> %if _ELD_LINKER_PASSES
   522                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   523                              <1> 	rol byte [bp + ?optionalmissing], 1
   524                              <1> 	jnc .optionalcodemissingmsg
   525                              <1> 	mov si, [bp + ?name]
   526                              <1> 	or byte [si], 80h
   527                              <1> 	not byte [bp + ?optionalmissing]
   528                              <1> 	jmp @F
   529                              <1> .optionalcodemissingmsg:
   530                              <1> %endif
   531                              <1> 	testopt [ss:relocateddata], 2	; debug optional link ?
   532                              <1> linkdatarelocation options7, -3
   533                              <1> 	jz @F				; no -->
   534                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   535                              <1> 	mov byte [bp + ?optionalmissing + 1], -1
   536                              <1> %endif
   537                              <1> 	mov si, lmsg.warning_code_optional
   538                              <1> internalcoderelocation
   539                              <1> 	call .notfound			; display a warning
   540                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   541                              <1> 	not byte [bp + ?optionalmissing + 1]
   542                              <1> %endif
   543                              <1> @@:
   544                              <1> %endif
   545                              <1> %if _ELDCALL_NEXT
   546                              <1> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   547                              <1> 	jnz .coderelocloop
   548                              <1> %endif
   549                              <1> 	lds si, [bp + ?entry]		; -> code site (must be in ELD cs)
   550                              <1> 	mov word [si], 9090h
   551                              <1> 	mov byte [si + 2], 90h		; indicate optional code link failed
   552                              <1> 					;  (NOP out the 3-byte call near imm)
   553                              <1> 	jmp .coderelocloop
   554                              <1> %endif
   555                              <1> 
   556                              <1> 
   557                              <1> %if _ELD_LINKER_PASSES
   558                              <1> .datanotfound:
   559 000009C4 BE[6811]            <1> 	mov si, lmsg.error_data
   560                              <1> internalcoderelocation
   561 000009C7 E81900              <1> 	call .notfound			; display error
   562 000009CA 7306                <1> 	jnc .error_j3			; NC if in pass 0, error out now -->
   563 000009CC FF46E8              <1> 	inc word [bp + ?amounterrors]	; count the amount of errors
   564 000009CF E977FF              <1> 	jmp .datarelocloop		; go to next relocation entry -->
   565                              <1> 
   566                              <1> .error_j3:
   567 000009D2 E9A301              <1> 	jmp .error
   568                              <1> 
   569                              <1> .codenotfound:
   570 000009D5 BE[8111]            <1> 	mov si, lmsg.error_code
   571                              <1> internalcoderelocation
   572 000009D8 E80800              <1> 	call .notfound			; display error
   573 000009DB 73F5                <1> 	jnc .error_j3			; NC if in pass 0 -->
   574 000009DD FF46E8              <1> 	inc word [bp + ?amounterrors]	; count the amount of errors
   575 000009E0 E98400              <1> 	jmp .coderelocloop		; go to next -->
   576                              <1> 
   577                              <1> .notfound:
   578 000009E3 807EEA00            <1> 	cmp byte [bp + ?pass], 0	; pass 0 ?
   579 000009E7 743A                <1> 	je .notfound.retn		; yes, do not try displaying --> (NC)
   580 000009E9 16                  <1> 	 push ss
   581 000009EA 07                  <1> 	 pop es
   582 000009EB BF[0000]            <1> 	mov di, relocateddata
   583                              <1> linkdatarelocation line_out		; es:di -> line_out buffer
   584 000009EE E83300              <1> 	call .copy			; copy prefix message
   585 000009F1 8B76E6              <1> 	mov si, word [bp + ?name]
   586 000009F4 AD                  <1> 	lodsw				; = hash
   587 000009F5 E8[0000]EB020000    <1> 	extcall hexword			; display the hash in hex
   588 000009FC 56                  <1> 	push si
   589 000009FD BE[9A11]            <1> 	mov si, lmsg.error.2
   590                              <1> internalcoderelocation
   591 00000A00 E82100              <1> 	call .copy			; display message fragment
   592 00000A03 5E                  <1> 	pop si
   593                              <1> %if _ELD_LINKER_PASSES
   594 00000A04 56                  <1> 	push si
   595 00000A05 E81C00              <1> 	call .copy			; copy over the full name
   596 00000A08 5E                  <1> 	pop si
   597                              <1>  %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   598                              <1> 	or byte [si], 80h		; mark as failed optional link
   599                              <1> 	rol byte [bp + ?optionalmissing + 1], 1
   600                              <1> 					; was it optional ?
   601                              <1> 	jc @F				; yes -->
   602                              <1>  %endif
   603 00000A09 C60400              <1> 	mov byte [si], 0		; mark as failed (counter byte = 0)
   604                              <1> @@:
   605                              <1> %else
   606                              <1> 	call .copy
   607                              <1> %endif
   608 00000A0C B022                <1> 	mov al, '"'
   609 00000A0E AA                  <1> 	stosb				; end message with a closing quote mark
   610 00000A0F 16                  <1> 	 push ss
   611 00000A10 1F                  <1> 	 pop ds
   612 00000A11 E8[0000]EB020000    <1> 	extcall putsline_crlf		; display diagnostic line
   613 00000A18 B8350E              <1> 	mov ax, 0E35h
   614 00000A1B E8[0000]EB020000    <1> 	extcall setrc
   615 00000A22 F9                  <1> 	stc				; CY, diagnostic displayed
   616                              <1> .notfound.retn:
   617 00000A23 C3                  <1> 	retn
   618                              <1> 
   619                              <1> .copy:		; (cannot use extcallcall here)
   620 00000A24 E8[0000]EB020000    <1> 	extcall copy_single_counted_string
   621 00000A2B C3                  <1> 	retn
   622                              <1> %else
   623                              <1> .datanotfound: equ .error
   624                              <1> .codenotfound: equ .error
   625                              <1> %endif
   626                              <1> 
   627                              <1> .build_match:
   628                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   629                              <1> 	mov byte [bp + ?optionalmissing], 0
   630                              <1> 		; This is needed for eldtestj.asm with debugoptlink.
   631                              <1> 		;  The optional data link sets flag 80h, then the
   632                              <1> 		;  required data link to the same symbol sets this
   633                              <1> 		;  flag but doesn't reset it. So the first optional
   634                              <1> 		;  code link still had this set. Reset here to fix.
   635                              <1> %endif
   636                              <1> %if _ELD_CODE_VSTART
   637 00000A2C 2D[0000]            <1> 	sub ax, code			; revert adjustment (= displacement)
   638                              <1> %endif
   639 00000A2F 0346FC              <1> 	add ax, word [bp + ?instance]	; make displacement into -> name string
   640 00000A32 96                  <1> 	xchg si, ax			; si -> hash word, counted name string
   641                              <1> %if _ELD_LINKER_PASSES || _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   642 00000A33 8976E6              <1> 	mov word [bp + ?name], si	; save away for diagnostics
   643                              <1> %endif
   644 00000A36 AD                  <1> 	lodsw			; = hash, si -> counted string
   645 00000A37 8A14                <1> 	mov dl, byte [si]	; dl = original start byte of match
   646                              <1> %if _ELD_LINKER_PASSES
   647 00000A39 84D2                <1> 	test dl, dl		; marked as already failed ?
   648                              <1> 				;  (80h = optional, 0 = required)
   649 00000A3B 750A                <1> 	jnz @F			; no -->
   650 00000A3D 837EE800            <1> 	cmp word [bp + ?amounterrors], 0
   651                              <1> 				; validate error status
   652 00000A41 7503E9A500          <1> 	je .error_j		; no error known ?! cancel quickly -->
   653 00000A46 C3                  <1> 	retn			; (NC)
   654                              <1> 
   655                              <1> @@:
   656                              <1> %else
   657                              <1> 	test dl, dl
   658                              <1> %endif
   659                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   660                              <1> 	jns @F
   661                              <1> 	and dl, 7Fh
   662                              <1> 	mov byte [si], dl
   663                              <1> 	mov byte [bp + ?optionalmissing], -1
   664                              <1> @@:
   665                              <1> %endif
   666                              <1> %if ELDOTHER
   667                              <1> 	rol byte [bp + ?other], 1
   668                              <1> 	jnc @F
   669                              <1> 	rol byte [bp + ?use_hash_other], 1
   670                              <1> 	jmp @FF
   671                              <1> 
   672                              <1> @@:
   673                              <1> %endif
   674 00000A47 D046EC              <1> 	rol byte [bp + ?use_hash], 1
   675                              <1> @@:
   676                              <1> 		; If to use the hash, then ax = hash and si ->
   677                              <1> 		;  the entire symbol name as a counted string.
   678 00000A4A 720A                <1> 	jc @F			; if to use hash, return now -->
   679 00000A4C AC                  <1> 	lodsb			; al = length
   680 00000A4D 91                  <1> 	xchg cx, ax		; cl = length
   681 00000A4E AD                  <1> 	lodsw			; ax = prefix
   682 00000A4F 49                  <1> 	dec cx
   683 00000A50 49                  <1> 	dec cx			; cl = adjusted length
   684 00000A51 4E                  <1> 	dec si			; -> second byte of prefix
   685 00000A52 8A14                <1> 	mov dl, byte [si]	; dl = original start byte of match
   686 00000A54 880C                <1> 	mov byte [si], cl	; si -> counted string suffix
   687                              <1> 		; (this name entry has been edited to provide the
   688                              <1> 		;  name suffix as a counted string, as required by
   689                              <1> 		;  the old-style non-hash link info tables.
   690                              <1> 		; it will be reset later by writing dl to si -> the
   691                              <1> 		;  first byte of the match string.)
   692                              <1> @@:
   693                              <1> %if _ELD_LINKER_PASSES
   694 00000A56 F9                  <1> 	stc			; CY
   695                              <1> %endif
   696 00000A57 C3                  <1> 	retn
   697                              <1> 
   698                              <1> 
   699                              <1> .donedatareloc:
   700                              <1> %if ELDOTHER
   701                              <1> 	rol byte [bp + ?other], 1
   702                              <1> 	jc .otherdone		; other link only has data links,
   703                              <1> 				;  so at this point we're done -->
   704                              <1> %endif
   705                              <1> 
   706 00000A58 8B56FC              <1> 	mov dx, word [bp + ?instance]
   707                              <1> %if _ELD_LINKER_PASSES
   708 00000A5B 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   709 00000A5E 01D3                <1> 	add bx, dx
   710                              <1>  %if _ELD_IDENTICALISE
   711                              <1> 	add bx, word [bp + ?lt]
   712                              <1> 	add dx, word [ltLinkCode + bx]
   713                              <1>  %else
   714 00000A60 0397780C            <1> 	add dx, word [linktable - code + ltLinkCode + bx]
   715                              <1>  %endif
   716                              <1> %else
   717                              <1> 	add dx, linkercoderelocations - code
   718                              <1> %endif
   719 00000A64 8956F2              <1> 	mov word [bp + ?nextreloc], dx
   720                              <1> 
   721                              <1> .coderelocloop:
   722 00000A67 C576F2              <1> 	lds si, [bp + ?nextreloc]
   723 00000A6A AD                  <1> 	lodsw
   724                              <1> %if _ELDCALL_OPTIONAL || _ELDCALL_NEXT
   725                              <1> 	dec ax				; optional word is 1-based, get 0-based
   726                              <1> 	js .donecodereloc
   727                              <1> 	mov word [bp + ?targetsection_low_optional_high], ax
   728                              <1> 	lodsw
   729                              <1> %endif
   730 00000A6B 0346FC              <1> 	add ax, word [bp + ?instance]
   731 00000A6E 8946EE              <1> 	mov word [bp + ?entry], ax
   732 00000A71 AD                  <1> 	lodsw
   733 00000A72 8976F2              <1> 	mov word [bp + ?nextreloc], si
   734                              <1> %ifn _ELDCALL_OPTIONAL || _ELDCALL_NEXT
   735 00000A75 85C0                <1> 	test ax, ax			; if no optional word, check -> match
   736 00000A77 7503E98100          <1> 	jz .donecodereloc
   737                              <1> %endif
   738                              <1> %if _ELDCALL_NEXT
   739                              <1> 	rol byte [bp + ?skip_last], 1	; skipping ?
   740                              <1> 	jnc @F				; no -->
   741                              <1> 	test byte [bp + ?optional], 8	; is it a last relocation ?
   742                              <1> 	jz .coderelocloop		; no, leave skip_last set -->
   743                              <1> 	not byte [bp + ?skip_last]	; disable skip_last
   744                              <1> 	jmp .coderelocloop
   745                              <1> @@:
   746                              <1> %endif
   747 00000A7C E8ADFF              <1> 	call .build_match
   748                              <1> %if _ELD_LINKER_PASSES
   749 00000A7F 73E6                <1> 	jnc .coderelocloop
   750                              <1> %endif
   751 00000A81 C45EF6              <1> 	les bx, [bp + ?linkinfo]
   752 00000A84 268B4F10            <1> 	mov cx, word [es:bx + eldlCodeAmount]	; amount code link info
   753 00000A88 268B7F12            <1> 	mov di, word [es:bx + eldlCodePrefixes]	; -> prefixes or hashes
   754                              <1> .coderelocfind:
   755 00000A8C 83F901              <1> 	cmp cx, 1			; NZ if cx == 0
   756 00000A8F F2AF                <1> 	repne scasw			; scan initial
   757                              <1> %if _ELDCALL_OPTIONAL
   758                              <1> 	jne .codenotfound_may_be_optional
   759                              <1> %else
   760                              <1>  %if _ELD_DEBUG
   761                              <1> 	je @F
   762                              <1> 	houdini
   763                              <1> 	jmp .codenotfound
   764                              <1> @@:
   765                              <1>  %else
   766 00000A91 7403E93FFF          <1> 	jne .codenotfound
   767                              <1>  %endif
   768                              <1> %endif
   769 00000A96 57                  <1> 	push di
   770 00000A97 51                  <1> 	push cx
   771 00000A98 56                  <1> 	push si
   772 00000A99 262B7F12            <1> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   773 00000A9D 4F                  <1> 	dec di
   774 00000A9E 4F                  <1> 	dec di				; 0-based
   775 00000A9F 26037F14            <1> 	add di, word [es:bx + eldlCodeEntries]	; -> entry
   776 00000AA3 268B3D              <1> 	mov di, [es:di]			; -> counted suffix/string
   777 00000AA6 B500                <1> 	mov ch, 0
   778 00000AA8 8A0C                <1> 	mov cl, byte [si]		; cx = length
   779 00000AAA 41                  <1> 	inc cx
   780                              <1> 	; cmp al, al			; ZR if length is zero
   781 00000AAB F3A6                <1> 	repe cmpsb			; match ?
   782 00000AAD 5E                  <1> 	pop si
   783 00000AAE 59                  <1> 	pop cx
   784 00000AAF 5F                  <1> 	pop di
   785 00000AB0 75DA                <1> 	jne .coderelocfind
   786 00000AB2 8814                <1> 	mov byte [si], dl
   787 00000AB4 262B7F12            <1> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   788 00000AB8 4F                  <1> 	dec di
   789 00000AB9 4F                  <1> 	dec di				; 0-based
   790 00000ABA 01FF                <1> 	add di, di			; quadruple index
   791 00000ABC 26037F16            <1> 	add di, word [es:bx + eldlCodeAddresses]	; -> address (offset, segment)
   792 00000AC0 26FF35              <1> 	push word [es:di]
   793 00000AC3 C576EE              <1> 	lds si, [bp + ?entry]
   794 00000AC6 8F4405              <1> 	pop word [si + 3 + 2]		; call near imm (3), jmp short (2)
   795                              <1> 					;  patch the destination address
   796 00000AC9 803CE8              <1> 	cmp byte [si], 0E8h		; is it as expected ?
   797 00000ACC 751D                <1> 	jne .error_j
   798 00000ACE 268B7D02            <1> 	mov di, word [es:di + 2]
   799 00000AD2 BB[0000]            <1> 	mov bx, relocateddata
   800                              <1> linkdatarelocation linkcall_table	; ss:bx -> link call table
   801 00000AD5 36833F01            <1> 	cmp word [ss:bx], 1		; is it initialised to format 1 ?
   802 00000AD9 7510                <1> 	jne .error_j			; no -->
   803 00000ADB 368B4F02            <1> 	mov cx, word [ss:bx + 2]	; get amount of segments
   804 00000ADF E30A                <1> 	jcxz .error_j			; none -->
   805                              <1> @@:
   806 00000AE1 83C304              <1> 	add bx, 4			; -> next segment
   807 00000AE4 36393F              <1> 	cmp word [ss:bx], di		; value matches ?
   808 00000AE7 7405                <1> 	je @F				; yes, found -->
   809 00000AE9 E2F6                <1> 	loop @B				; try remaining segments
   810                              <1> .error_j:
   811 00000AEB E98A00              <1> 	jmp .error
   812                              <1> 
   813                              <1> @@:
   814 00000AEE 368B5F02            <1> 	mov bx, word [ss:bx + 2]	; -> call destination offset
   815                              <1> 		; si + 3 + delta = bx
   816                              <1> 		; delta = bx - si - 3
   817 00000AF2 29F3                <1> 	sub bx, si
   818 00000AF4 83EB03              <1> 	sub bx, 3
   819 00000AF7 895C01              <1> 	mov word [si + 1], bx		; patch the call instruction
   820                              <1> %if _ELDCALL_NEXT
   821                              <1> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   822                              <1> 	jz .coderelocloop
   823                              <1> 	mov byte [bp + ?skip_last], -1	; skip subsequent next/last relocs
   824                              <1> %endif
   825 00000AFA E96AFF              <1> 	jmp .coderelocloop
   826                              <1> 
   827                              <1> .donecodereloc:
   828                              <1> %if _ELD_LINKER_PASSES
   829 00000AFD 8B46E8              <1> 	mov ax, word [bp + ?amounterrors]
   830 00000B00 85C0                <1> 	test ax, ax
   831 00000B02 75E7                <1> 	jnz .error_j
   832 00000B04 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   833 00000B07 85DB                <1> 	test bx, bx
   834 00000B09 750B                <1> 	jnz @F
   835 00000B0B 43                  <1> 	inc bx
   836 00000B0C 43                  <1> 	inc bx
   837 00000B0D 895EEA              <1> 	mov word [bp + ?pass], bx
   838 00000B10 8B56FC              <1> 	mov dx, word [bp + ?instance]
   839 00000B13 E9AFFD              <1> 	jmp .pass
   840                              <1> 
   841                              <1> @@:
   842                              <1> %endif
   843                              <1> 
   844                              <1> %ifnidni _LISTING, ""
   845                              <1> %assign ELDLINKER 0
   846                              <1> .hint:
   847 00000B16 16                  <1> 	push ss
   848 00000B17 1F                  <1> 	pop ds
   849 00000B18 B02D                <1> 	mov al, 2Dh
   850 00000B1A E8[0000]EB020000    <1> 	extcall intchk			; ZR if offset = -1 or segment = 0
   851                              <1> 					; CHG: ax, dx, bx
   852 00000B21 7437                <1> 	jz .no_hint
   853                              <1> 
   854                              <1> %if ELDOTHER
   855                              <1> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
   856                              <1> internalcoderelocation
   857                              <1> %endif
   858                              <1> 
   859 00000B23 8A26[0000]          <1> 	mov ah, byte [relocateddata]
   860                              <1> linkdatarelocation try_debugger_amis_multiplex_number
   861 00000B27 E85500              <1> 	call plex_check
   862 00000B2A 7305                <1> 	jnc @F
   863                              <1> 
   864 00000B2C B4FF                <1> 	mov ah, 0FFh		; start with multiplex number 0FFh
   865                              <1> .loop_hint:
   866 00000B2E E84E00              <1> 	call plex_check
   867                              <1> @@:
   868 00000B31 7307                <1> 	jnc .end_hint		; if found --> (NC)
   869 00000B33 80EC01              <1> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   870 00000B36 73F6                <1> 	jnc .loop_hint		; try next if we didn't check all yet -->
   871 00000B38 EB20                <1> 	jmp .no_hint
   872                              <1> 
   873                              <1> .end_hint:
   874 00000B3A 50                  <1> 	push ax
   875 00000B3B C446FC              <1> 	les ax, [bp + ?instance]
   876 00000B3E BF[4E0E]            <1> 	mov di, listmsg.hint.offset
   877                              <1> internalcoderelocation
   878 00000B41 E8[0000]EB020000    <1> 	extcall hexword
   879 00000B48 BB[320E]            <1> 	mov bx, listmsg.hint
   880                              <1> internalcoderelocation
   881 00000B4B 368B16[0000]        <1> 	mov dx, [ss:relocateddata]
   882                              <1> linkdatarelocation extseg	; must be 86 Mode segment even in PM
   883 00000B50 58                  <1> 	pop ax
   884 00000B51 B040                <1> 	mov al, 40h		; AMIS message display service
   885 00000B53 E8[0000]EB020000    <1> 	extcall call_int2D
   886                              <1> .no_hint:
   887                              <1> %endif
   888                              <1> 
   889                              <1> %if ELDOTHER
   890                              <1> %assign ELDLINKER 0
   891                              <1> 	not byte [bp + ?other]
   892                              <1> 
   893                              <1> 	push ss
   894                              <1> 	pop ds
   895                              <1> 	mov al, 2Dh
   896                              <1> 	extcall intchk			; ZR if offset = -1 or segment = 0
   897                              <1> 					; CHG: ax, dx, bx
   898                              <1> 	jz .no_other
   899                              <1> 
   900                              <1> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
   901                              <1> internalcoderelocation
   902                              <1> 
   903                              <1> 	mov ah, byte [relocateddata]
   904                              <1> linkdatarelocation try_debugger_amis_multiplex_number
   905                              <1> 	call plex_check
   906                              <1> 	jnc @F
   907                              <1> 
   908                              <1> 	mov ah, 0FFh		; start with multiplex number 0FFh
   909                              <1> .loop_other_debug:
   910                              <1> 	call plex_check
   911                              <1> @@:
   912                              <1> 	jnc .end_other		; if found --> (NC)
   913                              <1> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   914                              <1> 	jnc .loop_other_debug	; try next if we didn't check all yet -->
   915                              <1> 
   916                              <1> 	mov si, loaderamissig	; ds:si -> our AMIS name strings
   917                              <1> internalcoderelocation
   918                              <1> 
   919                              <1> 	mov ah, byte [relocateddata]
   920                              <1> linkdatarelocation try_debugger_amis_multiplex_number
   921                              <1> 	call plex_check
   922                              <1> 	jnc @F
   923                              <1> 
   924                              <1> 	mov ah, 0FFh		; start with multiplex number 0FFh
   925                              <1> .loop_other_loader:
   926                              <1> 	call plex_check
   927                              <1> @@:
   928                              <1> 	jnc .end_other		; if found --> (NC)
   929                              <1> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   930                              <1> 	jnc .loop_other_loader	; try next if we didn't check all yet -->
   931                              <1> 
   932                              <1> 	jmp .no_other
   933                              <1> 
   934                              <1> .end_other:
   935                              <1> 	mov al, 42h		; AMIS get other link info service
   936                              <1> 	extcall call_int2D
   937                              <1> 	cmp al, 0FFh
   938                              <1> 	jne .no_other
   939                              <1> 
   940                              <1> 	mov ax, si		; selector => PSP
   941                              <1> 	extcall ispm
   942                              <1> 	jz @F
   943                              <1> 	mov ax, dx		; segment => PSP
   944                              <1> @@:
   945                              <1> 	 push ss
   946                              <1> 	 pop ds
   947                              <1> 	mov word [otherds], ax
   948                              <1> internaldatarelocation		; current mode sel/seg
   949                              <1> 	mov word [otherseg], dx
   950                              <1> internaldatarelocation		; remember segment
   951                              <1> 
   952                              <1> 	mov ax, cx		; selector => link info
   953                              <1> 	extcall ispm
   954                              <1> 	jz @F
   955                              <1> 	mov ax, bx		; segment => link info
   956                              <1> @@:
   957                              <1> 	mov word [bp + ?linkinfo_other], di
   958                              <1> 	mov word [bp + ?linkinfo_other + 2], ax
   959                              <1> 
   960                              <1> 	mov ds, ax		; => link info
   961                              <1> 	xor ax, ax
   962                              <1> 	cmp word [di + eldlSignature], 0E1D1h
   963                              <1> 	jne .error_other
   964                              <1> 	cmp word [di + eldlUseLinkHash], 1
   965                              <1> 	ja .error_other
   966                              <1> 	jb @F
   967                              <1> 	dec ax
   968                              <1> @@:
   969                              <1> 	mov word [bp + ?use_hash_other], ax
   970                              <1> 
   971                              <1> 	mov dx, word [bp + ?instance]
   972                              <1> 	add dx, linkerotherdatarelocations - code
   973                              <1> 	jmp .otherloop
   974                              <1> 
   975                              <1> .error_other:
   976                              <1> 	push cs
   977                              <1> 	pop ds
   978                              <1> 	mov ax, 0E33h
   979                              <1> 	extcall setrc
   980                              <1> 	mov dx, lmsg.error_other
   981                              <1> internalcoderelocation
   982                              <1> 	jmp @F
   983                              <1> 
   984                              <1> .no_other:
   985                              <1> 	push cs
   986                              <1> 	pop ds
   987                              <1> 	mov ax, 0E34h
   988                              <1> 	extcall setrc
   989                              <1> 	mov dx, lmsg.no_other
   990                              <1> internalcoderelocation
   991                              <1> @@:
   992                              <1> 	extcall putsz
   993                              <1> .error_j2:
   994                              <1> 	jmp .error
   995                              <1> 
   996                              <1> .otherdone:
   997                              <1>  %if _ELD_LINKER_PASSES
   998                              <1> 	mov ax, word [bp + ?amounterrors]
   999                              <1> 	test ax, ax
  1000                              <1> 	jnz .error_j2
  1001                              <1>  %endif
  1002                              <1> %endif
  1003                              <1> 
  1004 00000B5A 5B                  <1> 	pop bx				; -> our heap data
  1005 00000B5B 5E                  <1> 	pop si				; -> our command line tail
  1006 00000B5C 16                  <1> 	 push ss
  1007 00000B5D 1F                  <1> 	 pop ds
  1008 00000B5E C47EFC              <1> 	les di, [bp + ?instance]
  1009 00000B61 268B4502            <1> 	mov ax, word [es:di + eldiEndCode]
  1010                              <1> houdini
  1011 00000B65 2D[A008]            <1> 	sub ax, strict word endresident + code
  1012                              <1> internalcoderelocation
  1013 00000B68 26C74502[A008]      <1> 	mov word [es:di + eldiEndCode], endresident + code
  1014                              <1> internalcoderelocation
  1015 00000B6E 2906[0000]          <1> 	sub word [relocateddata], ax
  1016                              <1> linkdatarelocation extseg_used
  1017                              <1> %if _DATA_SIZE == 0
  1018                              <1> 	xor ax, ax
  1019                              <1> 	mov word [es:di + eldiStartData], ax
  1020                              <1> 	mov word [es:di + eldiEndData], ax
  1021                              <1> %endif
  1022 00000B72 89EC5D              <1> 	lleave code
  1023                              <1> 		; INP:	es => ELD code segment
  1024                              <1> 		;	ds:si -> command line tail
  1025                              <1> 		;	ds:bx -> ELD data block
  1026                              <1> 		;	ss:sp -> far return address for current mode
  1027                              <1> 		; STT:	ds = ss, UP, EI
  1028 00000B75 E9A0FC              <1> 	jmp start
  1029                              <1> 
  1030                              <1> .error:
  1031 00000B78 89EC5D              <1> 	lleave
  1032 00000B7B B8FFFF              <1> 	mov ax, -1
  1033 00000B7E CB                  <1> 	retf
  1034                              <1> 
  1035                              <1> 
  1036                              <1> %ifnidni _LISTING, ""
  1037                              <1>  %assign ELDHINT 1
  1038                              <1> %else
  1039                              <1>  %assign ELDHINT 0
  1040                              <1> %endif
  1041                              <1> 
  1042                              <1> %if ELDOTHER || ELDHINT
  1043                              <1> 		; INP:	ah = multiplex number to check
  1044                              <1> 		;	(if ELDOTHER:)
  1045                              <1> 		;	 cs:si -> 16-byte AMIS signature to check
  1046                              <1> 		; OUT:	CY if multiplex number unused or no signature match,
  1047                              <1> 		;	 bp, ah, ds unmodified
  1048                              <1> 		;	NC if match found,
  1049                              <1> 		;	 ah = multiplex number (unmodified)
  1050                              <1> 		; CHG:	di, es, cx, dx
  1051                              <1> 		;	(if ELDOTHER:) bx
  1052                              <1> 		;	(if not ELDOTHER:) si
  1053                              <1> plex_check:
  1054 00000B7F 16                  <1> 	push ss
  1055 00000B80 1F                  <1> 	pop ds
  1056 00000B81 F606[0000]08        <1> 	testopt [relocateddata], 8
  1057                              <1> linkdatarelocation internalflags4, -3
  1058 00000B86 740B                <1> 	jz @F
  1059                              <1> %if ELDOTHER
  1060                              <1> 	mov bx, relocateddata
  1061                              <1> linkdatarelocation amis_multiplex_number, -2, optional
  1062                              <1> 	test bx, bx
  1063                              <1> 	jz @F
  1064                              <1> 	cmp ah, byte [bx]
  1065                              <1> 	je .notfound		; do not use our own multiplexer -->
  1066                              <1> %else
  1067 00000B88 BE[0000]            <1> 	mov si, relocateddata
  1068                              <1> linkdatarelocation amis_multiplex_number, -2, optional
  1069 00000B8B 85F6                <1> 	test si, si
  1070 00000B8D 7404                <1> 	jz @F
  1071 00000B8F 3A24                <1> 	cmp ah, byte [si]
  1072 00000B91 7420                <1> 	je .notfound		; do not use our own multiplexer -->
  1073                              <1> %endif
  1074                              <1> @@:
  1075 00000B93 B000                <1> 	mov al, 00h		; AMIS installation check
  1076 00000B95 E8[0000]EB020000    <1> 	extcall call_int2D	; AMIS (or "DOS reserved" = iret if no AMIS present)
  1077 00000B9C 3CFF                <1> 	cmp al, 0FFh
  1078 00000B9E 7513                <1> 	jne .notfound
  1079 00000BA0 0E                  <1> 	push cs
  1080 00000BA1 1F                  <1> 	pop ds
  1081                              <1> %if ELDOTHER
  1082                              <1> 	push si
  1083                              <1> 	extcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
  1084                              <1> 	mov cx, 8		; Ignore description, only compare vendor and program name
  1085                              <1> 	repe cmpsw
  1086                              <1> 	pop si
  1087                              <1> %else
  1088 00000BA2 BE[220E]            <1> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
  1089                              <1> internalcoderelocation
  1090 00000BA5 E8[0000]EB020000    <1> 	extcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
  1091 00000BAC B90800              <1> 	mov cx, 8		; Ignore description, only compare vendor and program name
  1092 00000BAF F3A7                <1> 	repe cmpsw
  1093                              <1> %endif
  1094 00000BB1 7401                <1> 	je .checkret		; ZR, NC = match -->
  1095                              <1> .notfound:
  1096 00000BB3 F9                  <1> 	stc			; CY no match
  1097                              <1> .checkret:
  1098 00000BB4 C3                  <1> 	retn
  1099                              <1> %endif
  1100                              <1> 
  1101                              <1> 
  1102 00000BB5 00<rep 3h>          <1> 	align 4, db 0
  1103                              <1> linkercoderelocations:
  1104                              <1> %if _ELDCALL_OPTIONAL || _ELDCALL_NEXT
  1105                              <1> 	dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
  1106                              <1> %else
  1107 00000BB8 2200[560E]2207-     <1> 	dw ELDCALL_CODE_RELOCATIONS, 0, 0
  1107 00000BBE [650E]3007[6D0E]38- <1>
  1107 00000BC5 07[790E]4007[850E]- <1>
  1107 00000BCC 4807[8C0E]5007-     <1>
  1107 00000BD2 [950E]5807[9C0E]60- <1>
  1107 00000BD9 07[A40E]6807[AC0E]- <1>
  1107 00000BE0 7007[B80E]7807-     <1>
  1107 00000BE6 [C40E]8007[D00E]88- <1>
  1107 00000BED 07[E20E]9007[EC0E]- <1>
  1107 00000BF4 9807[F60E]A007-     <1>
  1107 00000BFA [FF0E]A807[090F]B0- <1>
  1107 00000C01 07[190F]B807[240F]- <1>
  1107 00000C08 C007[410F]C807-     <1>
  1107 00000C0E [4A0F]D007[540F]D8- <1>
  1107 00000C15 07[5E0F]E007[6D0F]- <1>
  1107 00000C1C E807[760F]F007-     <1>
  1107 00000C22 [860F]F807[910F]00- <1>
  1107 00000C29 08[AE0F]0808[B70F]- <1>
  1107 00000C30 1008[C40F]5508-     <1>
  1107 00000C36 [8C0E]1A0B[AE0F]41- <1>
  1107 00000C3D 0B[540F]530B[B70F]- <1>
  1107 00000C44 950B[B70F]A50B-     <1>
  1107 00000C4A [860F]00000000      <1>
  1108                              <1> %endif
  1109                              <1> 
  1110                              <1> %if _ELD_LINKER_PASSES
  1111                              <1> linkerlinkercoderelocations:
  1112                              <1> %if _ELDCALL_OPTIONAL || _ELDCALL_NEXT
  1113                              <1> 	dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
  1114                              <1> %else
  1115 00000C50 F509[540F]110A-     <1> 	dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
  1115 00000C56 [760F]1B0A[A40E]24- <1>
  1115 00000C5D 0A[910F]00000000    <1>
  1116                              <1> %endif
  1117                              <1> 
  1118                              <1> 	align 2, db 0
  1119                              <1> linktable:
  1120                              <1> 	istruc LINKTABLE
  1121                              <1> at ltCodeToCode
  1122 00000C64 140E                <1> 	dw internallinkercodetocoderelocations - code
  1123 00000C66 9E0D                <1> 	dw internalcodetocoderelocations - code
  1124                              <1> at ltCodeToData
  1125 00000C68 1C0E                <1> 	dw internallinkercodetodatarelocations - code
  1126 00000C6A C00D                <1> 	dw internalcodetodatarelocations - code
  1127                              <1> at ltDataToCode
  1128 00000C6C 1E0E                <1> 	dw internallinkerdatatocoderelocations - code
  1129 00000C6E 020E                <1> 	dw internaldatatocoderelocations - code
  1130                              <1> at ltDataToData
  1131 00000C70 200E                <1> 	dw internallinkerdatatodatarelocations - code
  1132 00000C72 040E                <1> 	dw internaldatatodatarelocations - code
  1133                              <1> at ltLinkData
  1134 00000C74 060E                <1> 	dw linkerlinkerdatarelocations - code
  1135 00000C76 7C0C                <1> 	dw linkerdatarelocations - code
  1136                              <1> at ltLinkCode
  1137 00000C78 500C                <1> 	dw linkerlinkercoderelocations - code
  1138 00000C7A B80B                <1> 	dw linkercoderelocations - code
  1139                              <1> 	iend
  1140                              <1> %endif
  1141                              <1> 
  1142                              <1> 	align 2, db 0
  1143                              <1> linkerdatarelocations:
  1144 00000C7C 01005000[D30F]0100- <1> 	dw LINK_DATA_RELOCATIONS, 0
  1144 00000C84 5200[DD0F]01005500- <1>
  1144 00000C8C [E60F]01006800-     <1>
  1144 00000C92 [F60F]01007100-     <1>
  1144 00000C98 [0110]01007D00-     <1>
  1144 00000C9E [0A10]0100A100-     <1>
  1144 00000CA4 [0A10]01000401-     <1>
  1144 00000CAA [2010]0100BF01-     <1>
  1144 00000CB0 [D30F]0100C101-     <1>
  1144 00000CB6 [DD0F]0100E801-     <1>
  1144 00000CBC [2910]0100EE01-     <1>
  1144 00000CC2 [D30F]0100F001-     <1>
  1144 00000CC8 [4810]01000502-     <1>
  1144 00000CCE [6510]01003C02-     <1>
  1144 00000CD4 [7010]01004602-     <1>
  1144 00000CDA [8010]0100C602-     <1>
  1144 00000CE0 [6510]01000F03-     <1>
  1144 00000CE6 [8910]01002703-     <1>
  1144 00000CEC [9C10]01002E03-     <1>
  1144 00000CF2 [8910]01004403-     <1>
  1144 00000CF8 [8910]01007903-     <1>
  1144 00000CFE [8910]0100C503-     <1>
  1144 00000D04 [6510]0100F403-     <1>
  1144 00000D0A [6510]01004204-     <1>
  1144 00000D10 [8910]0100CF04-     <1>
  1144 00000D16 [8910]0100F204-     <1>
  1144 00000D1C [9C10]01000005-     <1>
  1144 00000D22 [8910]01001D05-     <1>
  1144 00000D28 [9C10]01002705-     <1>
  1144 00000D2E [8910]01006305-     <1>
  1144 00000D34 [8910]0100A105-     <1>
  1144 00000D3A [8910]01008906-     <1>
  1144 00000D40 [BC10]0100FB06-     <1>
  1144 00000D46 [C710]01000907-     <1>
  1144 00000D4C [C710]01002108-     <1>
  1144 00000D52 [D310]01003408-     <1>
  1144 00000D58 [E110]01004408-     <1>
  1144 00000D5E [EC10]01005108-     <1>
  1144 00000D64 [FA10]01006808-     <1>
  1144 00000D6A [EC10]01006C08-     <1>
  1144 00000D70 [0A10]01008708-     <1>
  1144 00000D76 [0A10]01008D08-     <1>
  1144 00000D7C [E110]0100250B-     <1>
  1144 00000D82 [1A11]01004E0B-     <1>
  1144 00000D88 [0110]0100700B-     <1>
  1144 00000D8E [EC10]0100830B-     <1>
  1144 00000D94 [3F11]0101890B-     <1>
  1144 00000D9A [5011]0000          <1>
  1145                              <1> 
  1146                              <1> 	align 2, db 0
  1147                              <1> internalcodetocoderelocations:
  1148 00000D9E 7800C500EA013B0840- <1> 	dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
  1148 00000DA7 0848084D0864086F08- <1>
  1148 00000DB0 820889083F0B490B66- <1>
  1148 00000DB9 0B6C0BA30B0000      <1>
  1149                              <1> 
  1150                              <1> 	align 2, db 0
  1151                              <1> internalcodetodatarelocations:
  1152 00000DC0 C900DA00B001B401F4- <1> 	dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
  1152 00000DC9 01FC0199029D02F302- <1>
  1152 00000DD2 FC026E039B039F0315- <1>
  1152 00000DDB 0456045F046904E105- <1>
  1152 00000DE4 EB05FC0524062E0641- <1>
  1152 00000DED 064A0695069D06BA06- <1>
  1152 00000DF6 EE06F3061407190793- <1>
  1152 00000DFF 080000              <1>
  1153                              <1> 
  1154                              <1> 	align 2, db 0
  1155                              <1> internaldatatocoderelocations:
  1156 00000E02 FFFF                <1> 	dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
  1157                              <1> 
  1158                              <1> 	align 2, db 0
  1159                              <1> internaldatatodatarelocations:
  1160 00000E04 FFFF                <1> 	dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
  1161                              <1> 
  1162                              <1> %if _ELD_LINKER_PASSES
  1163                              <1> 	align 2, db 0
  1164                              <1> linkerlinkerdatarelocations:
  1165 00000E06 0100EC09[6510]0100- <1> 	dw LINK_LINKER_DATA_RELOCATIONS, 0
  1165 00000E0E D30A[0911]0000      <1>
  1166                              <1> 
  1167                              <1> 	align 2, db 0
  1168                              <1> internallinkercodetocoderelocations:
  1169 00000E14 C509D609FE090000    <1> 	dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
  1170                              <1> 
  1171                              <1> 	align 2, db 0
  1172                              <1> internallinkercodetodatarelocations:
  1173 00000E1C 0000                <1> 	dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
  1174                              <1> 
  1175                              <1> 	align 2, db 0
  1176                              <1> internallinkerdatatocoderelocations:
  1177 00000E1E FFFF                <1> 	dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
  1178                              <1> 
  1179                              <1> 	align 2, db 0
  1180                              <1> internallinkerdatatodatarelocations:
  1181 00000E20 FFFF                <1> 	dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
  1182                              <1> %endif
  1183                              <1> 
  1184                              <1> %if ELDOTHER
  1185                              <1> 	align 2, db 0
  1186                              <1> linkerotherdatarelocations:
  1187                              <1> 	dw LINK_OTHER_DATA_RELOCATIONS, 0
  1188                              <1> 
  1189                              <1>  %ifnidn LINK_OTHER_LINKER_DATA_RELOCATIONS, ""
  1190                              <1>   %error Other linker data links not supported
  1191                              <1>  %endif
  1192                              <1> %endif
  1193                              <1> 
  1194                              <1> %if ELDOTHER || ELDHINT
  1195                              <1> 	align 2, db 0
  1196                              <1> debuggeramissig:
  1197 00000E22 65636D20<rep 5h>    <1> 		fill 8, 32, db "ecm"
  1198 00000E2A 6C446562756720-     <1> 		fill 8, 32, db "lDebug"
  1198 00000E2A <rep 2h>            <1>
  1199                              <1> %endif
  1200                              <1> 
  1201                              <1> %if ELDOTHER
  1202                              <1> 	align 2, db 0
  1203                              <1> loaderamissig:
  1204                              <1> 		fill 8, 32, db "ecm"
  1205                              <1> 		fill 8, 32, db "Loader"
  1206                              <1> %endif
  1207                              <1> 
  1208                              <1> %ifnidni _LISTING, ""
  1209                              <1> listmsg:
  1210 00000E32 547261634C6973742D- <1> .hint:		db "TracList-add-offset=",_LISTING,"::"
  1210 00000E3B 6164642D6F66667365- <1>
  1210 00000E44 743D64692E6C73743A- <1>
  1210 00000E4D 3A                  <1>
  1211 00000E4E 2D2D2D2D680D0A00    <1> .hint.offset:	asciz "----h",13,10
  1212                              <1> %endif
  1213                              <1> 
  1214 00000E56 30CD0C636D64335F6E- <1> 	eldcall_dump_names ELDCALL_CODE_NAMES
  1214 00000E5F 6F745F657874A7AA05- <1>
  1214 00000E68 6572726F72D5550973- <1>
  1214 00000E71 6B6970636F6D6D6103- <1>
  1214 00000E7A C3096973737472696E- <1>
  1214 00000E83 673FBABD04636D6433- <1>
  1214 00000E8C DDB90663686B656F6C- <1>
  1214 00000E95 2890046973706D5512- <1>
  1214 00000E9E 05707574737AB21205- <1>
  1214 00000EA7 7365747263F1230975- <1>
  1214 00000EB0 7070657263617365A4- <1>
  1214 00000EB9 5509736B6970636F6D- <1>
  1214 00000EC2 6D3029EF09736B6970- <1>
  1214 00000ECB 7768697465650F0F67- <1>
  1214 00000ED4 65745F76616C75655F- <1>
  1214 00000EDD 72616E67657FAE0773- <1>
  1214 00000EE6 6B69707768303D8207- <1>
  1214 00000EEF 67657462797465E83A- <1>
  1214 00000EF8 066973656F6C3F3FE8- <1>
  1214 00000F01 07676574776F72641C- <1>
  1214 00000F0A E30D67756172645F61- <1>
  1214 00000F13 757862756666CFF108- <1>
  1214 00000F1C 707265706861636BDC- <1>
  1214 00000F25 F81A68616E646C655F- <1>
  1214 00000F2E 73657269616C5F666C- <1>
  1214 00000F37 6167735F6374726C5F- <1>
  1214 00000F40 636DC906646F686163- <1>
  1214 00000F49 6B821B076865786279- <1>
  1214 00000F52 746584810768657877- <1>
  1214 00000F5B 6F72647D670C686578- <1>
  1214 00000F64 776F72645F68696768- <1>
  1214 00000F6D 7B1406756E6861636B- <1>
  1214 00000F76 6FA20D707574736C69- <1>
  1214 00000F7F 6E655F63726C66B774- <1>
  1214 00000F88 087365746573326478- <1>
  1214 00000F91 D0BB1A636F70795F73- <1>
  1214 00000F9A 696E676C655F636F75- <1>
  1214 00000FA3 6E7465645F73747269- <1>
  1214 00000FAC 6E67986906696E7463- <1>
  1214 00000FB5 686B21300A63616C6C- <1>
  1214 00000FBE 5F696E74324435670C- <1>
  1214 00000FC7 497349495350456E74- <1>
  1214 00000FD0 72793F              <1>
  1215 00000FD3 C30B076C617374636D- <1> 	link_data_dump_names LINK_DATA_NAMES
  1215 00000FDC 646B5D06646D79636D- <1>
  1215 00000FE5 6454400D6D73672E75- <1>
  1215 00000FEE 6E696E7374616C6CEB- <1>
  1215 00000FF7 420865787464737365- <1>
  1215 00001000 6CD52D066578747365- <1>
  1215 00001009 6797B6136578745F63- <1>
  1215 00001012 6F6D6D616E645F6861- <1>
  1215 0000101B 6E646C6572F391066D- <1>
  1215 00001024 73672E696E7EC01C6C- <1>
  1215 0000102D 617374636D645F7472- <1>
  1215 00001036 616E736665725F6578- <1>
  1215 0000103F 745F61646472657373- <1>
  1215 00001048 7CC71A6C617374636D- <1>
  1215 00001051 645F7472616E736665- <1>
  1215 0000105A 725F6578745F656E74- <1>
  1215 00001063 727984E3086C696E65- <1>
  1215 0000106C 5F6F7574899F0D696E- <1>
  1215 00001075 7465726E616C666C61- <1>
  1215 0000107E 6773C83E0664706D69- <1>
  1215 00001087 33328B001061757862- <1>
  1215 00001090 7566665F7365676F72- <1>
  1215 00001099 73656C20711D617578- <1>
  1215 000010A2 627566665F63757272- <1>
  1215 000010AB 656E745F73697A655F- <1>
  1215 000010B4 6D696E75735F3234DD- <1>
  1215 000010BD 030866697273746D63- <1>
  1215 000010C6 62C640096669727374- <1>
  1215 000010CF 756D63628D710B6D73- <1>
  1215 000010D8 672E696E7374616C6C- <1>
  1215 000010E1 5ABC086F7074696F6E- <1>
  1215 000010EA 7337E7D30B65787473- <1>
  1215 000010F3 65675F75736564B240- <1>
  1215 000010FC 0C657874646174615F- <1>
  1215 00001105 7573656468440E6C69- <1>
  1215 0000110E 6E6B63616C6C5F7461- <1>
  1215 00001117 626C65F09E22747279- <1>
  1215 00001120 5F6465627567676572- <1>
  1215 00001129 5F616D69735F6D756C- <1>
  1215 00001132 7469706C65785F6E75- <1>
  1215 0000113B 6D626572CB510E696E- <1>
  1215 00001144 7465726E616C666C61- <1>
  1215 0000114D 677334688C15616D69- <1>
  1215 00001156 735F6D756C7469706C- <1>
  1215 0000115F 65785F6E756D626572  <1>
  1216                              <1> %if ELDOTHER
  1217                              <1> 	link_data_dump_names LINK_OTHER_DATA_NAMES
  1218                              <1> %endif
  1219                              <1> 
  1220                              <1> lmsg:
  1221                              <1> %if _ELD_LINKER_PASSES
  1222                              <1> %if _ELDCALL_OPTIONAL
  1223                              <1> .warning_code_optional:		counted "Optional code link missing, hash="
  1224                              <1> %endif
  1225                              <1> %if _ELDDATA_OPTIONAL
  1226                              <1> .warning_data_optional:		counted "Optional data link missing, hash="
  1227                              <1> %endif
  1228 00001168 1844617461206C696E- <1> .error_data:			counted "Data link missing, hash="
  1228 00001171 6B206D697373696E67- <1>
  1228 0000117A 2C20686173683D      <1>
  1229 00001181 18436F6465206C696E- <1> .error_code:			counted "Code link missing, hash="
  1229 0000118A 6B206D697373696E67- <1>
  1229 00001193 2C20686173683D      <1>
  1230 0000119A 0A682C206C6162656C- <1> .error.2:			counted "h, label ",'"'
  1230 000011A3 2022                <1>
  1231                              <1> %endif
  1232                              <1> %if ELDOTHER
  1233                              <1> .no_other:		asciz "ELD linker: No other link info found!",13,10
  1234                              <1> .error_other:		asciz "ELD linker: Other link info unknown format!",13,10
  1235                              <1> %endif
  1236                              <1> 
  1237 000011A5 00<rep Bh>          <1> 	align 16, db 0
   330                                  
   331                                  	align 16
   332                                  code_size equ $ - code
