     1                                  
     2                                  ; Public Domain
     3                                  
     4                                  ; test install command: install; ext extname help; extname uninstall
     5                                  ; test run command: help; .; .
     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 "iniload.mac"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> lDebug iniload/boot interfacing structs and 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> 
    16                              <1> 	struc BS
    17 00000000 ??????              <1> bsJump:	resb 3
    18 00000003 ????????????????    <1> bsOEM:	resb 8
    19                              <1> bsBPB:
    20                              <1> 	endstruc
    21                              <1> 
    22                              <1> 	struc EBPB		;        BPB sec
    23 00000000 ????                <1> bpbBytesPerSector:	resw 1	; offset 00h 0Bh
    24 00000002 ??                  <1> bpbSectorsPerCluster:	resb 1	; offset 02h 0Dh
    25 00000003 ????                <1> bpbReservedSectors:	resw 1	; offset 03h 0Eh
    26 00000005 ??                  <1> bpbNumFATs:		resb 1	; offset 05h 10h
    27 00000006 ????                <1> bpbNumRootDirEnts:	resw 1	; offset 06h 11h -- 0 for FAT32
    28 00000008 ????                <1> bpbTotalSectors:	resw 1	; offset 08h 13h
    29 0000000A ??                  <1> bpbMediaID:		resb 1	; offset 0Ah 15h
    30 0000000B ????                <1> bpbSectorsPerFAT:	resw 1	; offset 0Bh 16h -- 0 for FAT32
    31 0000000D ????                <1> bpbCHSSectors:		resw 1	; offset 0Dh 18h
    32 0000000F ????                <1> bpbCHSHeads:		resw 1	; offset 0Fh 1Ah
    33 00000011 ????????            <1> bpbHiddenSectors:	resd 1	; offset 11h 1Ch
    34 00000015 ????????            <1> bpbTotalSectorsLarge:	resd 1	; offset 15h 20h
    35                              <1> bpbNew:				; offset 19h 24h
    36                              <1> 
    37 00000019 ????????            <1> ebpbSectorsPerFATLarge:	resd 1	; offset 19h 24h
    38 0000001D ????                <1> ebpbFSFlags:		resw 1	; offset 1Dh 28h
    39 0000001F ????                <1> ebpbFSVersion:		resw 1	; offset 1Fh 2Ah
    40 00000021 ????????            <1> ebpbRootCluster:	resd 1	; offset 21h 2Ch
    41 00000025 ????                <1> ebpbFSINFOSector:	resw 1	; offset 25h 30h
    42 00000027 ????                <1> ebpbBackupSector:	resw 1	; offset 27h 32h
    43 00000029 <res Ch>            <1> ebpbReserved:		resb 12	; offset 29h 34h
    44                              <1> ebpbNew:			; offset 35h 40h
    45                              <1> 	endstruc
    46                              <1> 
    47                              <1> 	struc BPBN		; ofs B16 S16 B32 S32
    48 00000000 ??                  <1> bpbnBootUnit:		resb 1	; 00h 19h 24h 35h 40h
    49 00000001 ??                  <1> 			resb 1	; 01h 1Ah 25h 36h 41h
    50 00000002 ??                  <1> bpbnExtBPBSignature:	resb 1	; 02h 1Bh 26h 37h 42h -- 29h for valid BPBN
    51 00000003 ????????            <1> bpbnSerialNumber:	resd 1	; 03h 1Ch 27h 38h 43h
    52 00000007 <res Bh>            <1> bpbnVolumeLabel:	resb 11	; 07h 20h 2Bh 3Ch 47h
    53 00000012 ????????????????    <1> bpbnFilesystemID:	resb 8	; 12h 2Bh 36h 47h 52h
    54                              <1> 	endstruc		; 1Ah 33h 3Eh 4Fh 5Ah
    55                              <1> 
    56                              <1> 	struc DIRENTRY
    57 00000000 ????????????????    <1> deName:		resb 8
    58 00000008 ??????              <1> deExt:		resb 3
    59 0000000B ??                  <1> deAttrib:	resb 1
    60 0000000C ??                  <1> dePlusSize:	resb 1
    61 0000000D ??????????????      <1> 		resb 7
    62 00000014 ????                <1> deClusterHigh:	resw 1
    63 00000016 ????                <1> deTime:		resw 1
    64 00000018 ????                <1> deDate:		resw 1
    65 0000001A ????                <1> deClusterLow:	resw 1
    66 0000001C ????????            <1> deSize:		resd 1
    67                              <1> 	endstruc
    68                              <1> 
    69                              <1> ATTR_READONLY	equ 1
    70                              <1> ATTR_HIDDEN	equ 2
    71                              <1> ATTR_SYSTEM	equ 4
    72                              <1> ATTR_VOLLABEL	equ 8
    73                              <1> ATTR_DIRECTORY	equ 10h
    74                              <1> ATTR_ARCHIVE	equ 20h
    75                              <1> 
    76                              <1> lsvclSignature		equ "CL"
    77                              <1> lsvclBufferLength	equ 256
    78                              <1> 
    79                              <1> 	struc LOADSTACKVARS, -10h
    80 FFFFFFF0 ????????            <1> lsvFirstCluster:	resd 1
    81 FFFFFFF4 ????????            <1> lsvFATSector:		resd 1
    82 FFFFFFF8 ????                <1> lsvFATSeg:		resw 1
    83 FFFFFFFA ????                <1> lsvLoadSeg:		resw 1
    84 FFFFFFFC ????????            <1> lsvDataStart:		resd 1
    85                              <1> 	endstruc
    86                              <1> 
    87                              <1> 	struc LOADDATA, LOADSTACKVARS - 10h
    88 FFFFFFE0 ????                <1> ldMemoryTop:	resw 1
    89 FFFFFFE2 ????                <1> ldLoadTop:	resw 1
    90 FFFFFFE4 ????                <1> ldSectorSeg:	resw 1
    91 FFFFFFE6 ??                  <1> ldFATType:	resb 1
    92                              <1> ldFlags:
    93 FFFFFFE7 ??                  <1> ldHasLBA:	resb 1
    94 FFFFFFE8 ????                <1> ldClusterSize:	resw 1
    95 FFFFFFEA ????                <1> ldParaPerSector:resw 1
    96                              <1> ldDirCluster:			; dword
    97                              <1> ldLoadingSeg:		; word
    98                              <1> ldQueryPatchValue:	; word
    99                              <1> lsvCommandLine:		; word
   100                              <1> .start:		equ $ - lsvclBufferLength
   101 FFFFFFEC ????                <1> .signature:	resw 1
   102                              <1> ldLoadUntilSeg:		; word
   103                              <1> lsvExtra:		; word
   104 FFFFFFEE ??                  <1> .partition:	resb 1	; byte
   105 FFFFFFEF ??                  <1> .flags:		resb 1	; byte
   106                              <1> 	endstruc
   107                              <1> 
   108                              <1> ldhlfPreserveLoader	equ 4
   109                              <1> 
   110                              <1> lsvefNoDataStart	equ 1
   111                              <1> lsvefPartitionNumber	equ 2
   112                              <1> lsvefPreserveLoader	equ 4
   113                              <1> 
   114                              <1> %if lsvefPreserveLoader != ldhlfPreserveLoader
   115                              <1>  %error Unexpected flag values
   116                              <1> %endif
   117                              <1> 
   118                              <1> 	struc LOADCMDLINE, LOADDATA - lsvclBufferLength
   119                              <1> ldCommandLine:
   120 FFFFFEE0 <res 100h>          <1> .start:		resb lsvclBufferLength
   121                              <1> 	endstruc
   122                              <1> 
   123                              <1> ldfHasLBA:	equ 1
   124                              <1> ldfFATInvalid:	equ 2
   125                              <1> ldfFATBuffered:	equ 4
   126                              <1> ldfDataBuffered: equ 8
   127                              <1> 
   128                              <1> 	struc LOADDATA2, LOADDATA - 10h
   129 FFFFFFD0 ????????            <1> ldRootSector:		resd 1
   130 FFFFFFD4 ????                <1> ldEntriesPerSector:	resw 1
   131                              <1> ldDataSegment:		; word
   132 FFFFFFD6 ????                <1> ldLastAvailableSector:	resw 1
   133                              <1> ldDataSector:		; dword
   134 FFFFFFD8 ????                <1> ldParasLeft:		resw 1
   135 FFFFFFDA ????                <1> ldParasDone:		resw 1
   136                              <1> 	endstruc
   137                              <1> 
   138                              <1> 	struc LOADDATA3, LOADDATA2 - 10h
   139 FFFFFFC0 ????????            <1> ldMaxCluster:		resd 1
   140 FFFFFFC4 ????????            <1> ldFileSize:		resd 1
   141 FFFFFFC8 ????????            <1> ldCurrentCluster:	resd 1
   142 FFFFFFCC ????????            <1> ldCurrentSeek:		resd 1
   143                              <1> 	endstruc
   144                              <1> 
   145                              <1> 	struc LOADERIMAGEIDENT
   146 00000000 ????????            <1> liiSignature:		resb 4		; "NLDR"
   147 00000004 ????                <1> liiVersion:		resb 2		; "00"
   148 00000006 ????                <1> liiChecksum:		resw 1		; word sum of first 8 words = 0
   149 00000008 ????                <1> liiAmountParagraphs:	resw 1
   150 0000000A ????????????        <1> liiReserved:		resw 3
   151 00000010 ????                <1> liiEntryQuerySize:	resw 1		; 0 if not supported
   152                              <1> 		; INP:	cs => NLDR image ident
   153                              <1> 		;	ip = this word field content
   154                              <1> 		;	ax = 60h
   155                              <1> 		; OUT:	ax => behind memory requested (should be >= 60h)
   156                              <1> 		; CHG:	es, ds, di, si, bx, cx, dx
   157                              <1> 		; STT:	far called, UP, EI
   158 00000012 ????                <1> liiEntryRelocate:	resw 1		; 0 if not supported
   159                              <1> 		; INP:	cs => NLDR image ident
   160                              <1> 		;	ip = this word field content
   161                              <1> 		;	ax = 60h
   162                              <1> 		; OUT:	ax => relocated NLDR segment (usually 60h)
   163                              <1> 		; CHG:	es, ds, di, si, bx, cx, dx
   164                              <1> 		; STT:	far called, UP, EI
   165 00000014 ????                <1> liiEntryDebug:		resw 1		; 0 if not supported
   166                              <1> 		; INP:	es = ds = cs = ss => relocated NLDR
   167                              <1> 		;	ip = this word field content
   168                              <1> 		;	sp = next word field content
   169                              <1> 		; STT:	running as debuggee, UP, EI
   170 00000016 ????                <1> liiStackPointer:	resw 1
   171                              <1> 	endstruc
   172                              <1> 
   173                              <1> 	struc LBAPACKET
   174 00000000 ????                <1> lpSize:		resw 1
   175 00000002 ????                <1> lpCount:	resw 1
   176 00000004 ????????            <1> lpBuffer:	resd 1
   177 00000008 ????????????????    <1> lpSector:	resq 1
   178                              <1> 	endstruc
   179                              <1> 
   180                              <1> 	struc PARTINFO
   181 00000000 ??                  <1> piBoot:		resb 1
   182 00000001 ??????              <1> piStartCHS:	resb 3
   183 00000004 ??                  <1> piType:		resb 1
   184 00000005 ??????              <1> piEndCHS:	resb 3
   185 00000008 ????????            <1> piStart:	resd 1
   186 0000000C ????????            <1> piLength:	resd 1
   187                              <1> 	endstruc
   188                              <1> 
   189                              <1> ptEmpty:		equ 0
   190                              <1> ptFAT12:		equ 1
   191                              <1> ptFAT16_16BIT_CHS:	equ 4
   192                              <1> ptExtendedCHS:		equ 5
   193                              <1> ptFAT16_CHS:		equ 6
   194                              <1> ptFAT32_CHS:		equ 0Bh
   195                              <1> ptFAT32:		equ 0Ch
   196                              <1> ptFAT16:		equ 0Eh
   197                              <1> ptExtended:		equ 0Fh
   198                              <1> ptLinux:		equ 83h
   199                              <1> ptExtendedLinux:	equ 85h
   200                              <1> 
   201                              <1> 
   202                              <1> 		; Flags of load_unit_flags
   203                              <1> lufForceCHS:		equ 1
   204                              <1> lufForceLBA:		equ 2
   205                              <1> lufForceGeometry:	equ 4
   206                              <1> luf_mask_writable equ lufForceCHS | lufForceLBA | lufForceGeometry
    12                                  
    13                                  	numdef BOOTLDR, 1
    14                                  	numdef DATABUFFER, 1
    15                                  	numdef ELDTRAILER, 1
    16                                  	numdef LIBSCAN, 1
    17                                  
    18                                  %assign _CATCHINT0C 0
    19                                  %assign _CATCHINT0D 0
    20                                  %assign _CATCHINTFAULTCOND 0
    21                                  %assign _LOADER 0
    22                                  %assign _DEBUG 0
    23                                  %assign _DELAY_BEFORE_BP 0
    24                                  %assign _DHIGHLIGHT 0
    25                                  %assign _GETLINEHIGHLIGHT 0
    26                                  %assign _IMMASM 0
    27                                  %assign _INPUT_FILE_BOOT 0
    28                                  %assign _INPUT_FILE_HANDLES 0
    29                                  %assign _MS_0RANGE_COMPAT 0
    30                                  %assign _PM 0
    31                                  %assign _RH 0
    32                                  %assign _SYMBOLIC 0
    33                                  %assign _VXCHG 0
    34                                  %include "options.mac"
     1                              <1> 
     2                              <1> %if 0
     3                              <1> 
     4                              <1> lDebug options and internal flags
     5                              <1> 
     6                              <1> Copyright (C) 2008-2025 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                              <1> 
    17                              <1> dispregs32	equ	  1	; RX: 32-bit register display (R, T/P/G)
    18                              <1> traceints	equ	  2	; TM: trace into interrupts (T)
    19                              <1> cpdepchars	equ	  4	; allow dumping of CP-dependent characters (D, DX)
    20                              <1> fakeindos	equ	  8	; always assume InDOS flag non-zero (all)
    21                              <1> nonpagingdevice	equ	 10h	; disallow paged output with [more] prompt (all exc. P, T)
    22                              <1> 	; This option was never used anywhere:
    23                              <1> ; pagingdevice	equ	 20h	; allow paged output with [more] prompt (all exc. P, T)
    24                              <1> 				; paged output is by default on if the output device is StdOut, else off
    25                              <1> hexrn		equ	 40h	; display raw hexadecimal content of FPU registers (RN)
    26                              <1> ;novdd		equ	 80h	; don't use a registered NTVDM VDD (L, W)
    27                              <1> nondospaging	equ	100h	; paging: don't use DOS for input when waiting for a key
    28                              <1> opt1_86mnohlt	equ	200h	; (86 Mode:) HLT doesn't work, don't use it
    29                              <1> biosidles	equ	400h	; don't idle with HLT or Int2F.1680, only call BIOS Int16.00
    30                              <1> opt_usegetinput	equ	800h	; use getinput for int 21h interactive input
    31                              <1> use_si_units	equ    1000h	; in disp_*_size use SI units (kB = 1000, etc)
    32                              <1> use_jedec_units	equ    2000h	; in disp_*_size use JEDEC units (kB = 1024)
    33                              <1> enable_serial	equ    4000h	; enable serial I/O (preferred over DOS or BIOS terminal)
    34                              <1> int8_disable_serial equ	   8000h	; disable serial I/O when breaking due to intr8
    35                              <1> gg_do_not_skip_bp equ	 1_0000h	; gg: do not skip a breakpoint (bb or gg)
    36                              <1> gg_no_autorepeat equ	 2_0000h	; gg: do not auto-repeat
    37                              <1> tp_do_not_skip_bp equ	 4_0000h	; T/TP/P: do not skip a (bb) breakpoint
    38                              <1> gg_bb_hit_no_repeat equ	 8_0000h	; gg: do not auto-repeat after bb hit
    39                              <1> tp_bb_hit_no_repeat equ	10_0000h	; T/TP/P: do not auto-repeat after bb hit
    40                              <1> gg_unexpected_no_repeat equ 20_0000h	; gg: do not auto-repeat after unexpectedinterrupt
    41                              <1> tp_unexpected_no_repeat equ 40_0000h	; T/TP/P
    42                              <1> ss_no_dump:		equ 80_0000h
    43                              <1> %if _SYMBOLIC
    44                              <1> dd_no_blanks_sym:	equ 100_0000h
    45                              <1> zz_no_pm_xms:		equ 200_0000h
    46                              <1> %endif
    47                              <1> rr_disasm_no_rept:	equ 1000_0000h
    48                              <1> rr_disasm_no_show:	equ 2000_0000h
    49                              <1> opt_cmdline_quiet_input:equ 4000_0000h
    50                              <1> opt_cmdline_quiet_output:equ 8000_0000h
    51                              <1> %if _SYMBOLIC
    52                              <1> DEFAULTOPTIONS	equ zz_no_pm_xms
    53                              <1> %else
    54                              <1> DEFAULTOPTIONS	equ 0
    55                              <1> %endif
    56                              <1> 
    57                              <1> 
    58                              <1> opt2_db_header:		equ 1
    59                              <1> opt2_db_trailer:	equ 2
    60                              <1> opt2_dw_header:		equ 10h
    61                              <1> opt2_dw_trailer:	equ 20h
    62                              <1> opt2_dd_header:		equ 100h
    63                              <1> opt2_dd_trailer:	equ 200h
    64                              <1> opt2_getinput_dpmi:	equ 800h
    65                              <1> opt2_hh_compat:		equ 1000h
    66                              <1> opt2_getc_idle:		equ 2000h
    67                              <1> opt2_getc_idle_dpmi:	equ 4000h
    68                              <1> opt2_re_cancel_tpg:	equ 8000h
    69                              <1> opt2_nn_compat:		equ 1_0000h
    70                              <1> opt2_nn_capitalise:	equ 2_0000h
    71                              <1> %if _MS_0RANGE_COMPAT
    72                              <1> opt2_0range_compat:	equ 4_0000h
    73                              <1> %endif
    74                              <1> opt2_rr16_compat:	equ 8_0000h
    75                              <1> opt2_r_prompt_compat:	equ 10_0000h
    76                              <1> opt2_r_separate:	equ 20_0000h
    77                              <1> opt2_r_linebreak_always:equ 40_0000h
    78                              <1> opt2_dpminohlt:		equ 8000_0000h	; DPMI doesn't like hlt
    79                              <1> DEFAULTOPTIONS2	equ opt2_dw_header | opt2_dd_header | opt2_getc_idle_dpmi | opt2_dpminohlt
    80                              <1> 
    81                              <1> 
    82                              <1> opt3_tt_no_paging:	equ 1
    83                              <1> opt3_tp_no_paging:	equ 2
    84                              <1> opt3_pp_no_paging:	equ 4
    85                              <1> opt3_gg_no_paging:	equ 8
    86                              <1> opt3_silence_paging_set:equ 100h
    87                              <1> opt3_silence_paging_on:	equ 200h
    88                              <1> opt3_paging_rc:		equ 1000h
    89                              <1> opt3_paging_yy:		equ 2000h
    90                              <1> opt3_paging_re:		equ 4000h
    91                              <1> opt3_r_highlight_diff:	equ 10000h
    92                              <1> opt3_r_highlight_dumb:	equ 20000h
    93                              <1> opt3_r_highlight_full:	equ 40000h
    94                              <1> opt3_r_highlight_eip:	equ 80000h
    95                              <1> %if _PM
    96                              <1> opt3_ss_b_bit_set:	equ   10_0000h
    97                              <1>  %if _BREAK_INSTALLDPMI
    98                              <1> opt3_break_installdpmi:	equ   20_0000h
    99                              <1>  %endif
   100                              <1> %endif
   101                              <1> %if _DHIGHLIGHT
   102                              <1> opt3_d_highlight:	equ   80_0000h
   103                              <1> %endif
   104                              <1> %if _GETLINEHIGHLIGHT
   105                              <1> opt3_getline_highlight:	equ  100_0000h
   106                              <1> %endif
   107                              <1> opt3_no_idle_2F:	equ  200_0000h
   108                              <1> %if _DELAY_BEFORE_BP
   109                              <1> opt3_delay_before_bp:	equ  400_0000h
   110                              <1> %endif
   111                              <1> opt3_no_call_amis:	equ  800_0000h
   112                              <1> opt3_disable_autorepeat:equ 1000_0000h
   113                              <1> opt3_check_ctrlc_keyb:	equ 2000_0000h
   114                              <1> opt3_check_ctrlc_0bh:	equ 4000_0000h
   115                              <1> opt3_tsr_quit_leave_tf:	equ 8000_0000h
   116                              <1> DEFAULTOPTIONS3	equ opt3_tt_no_paging | opt3_tp_no_paging 		| opt3_pp_no_paging | opt3_gg_no_paging 		| opt3_check_ctrlc_keyb | opt3_check_ctrlc_0bh
   119                              <1> 
   120                              <1> 
   121                              <1> opt4_int_2F_hook:	equ 2
   122                              <1> opt4_int_08_hook:	equ 4
   123                              <1> opt4_int_2D_hook:	equ 8
   124                              <1> %if _CATCHINTFAULTCOND
   125                              <1> opt4_int_fault_hook:	equ 10h
   126                              <1> %endif
   127                              <1> opt4_int_serial_force:	equ 1_0000h
   128                              <1> opt4_int_2F_force:	equ 2_0000h
   129                              <1> opt4_int_08_force:	equ 4_0000h
   130                              <1> opt4_int_2D_force:	equ 8_0000h
   131                              <1> %if _CATCHINT0D
   132                              <1> opt4_int_0D_force:	equ   10_0000h
   133                              <1> %endif
   134                              <1> %if _CATCHINT0C
   135                              <1> opt4_int_0C_force:	equ   20_0000h
   136                              <1> %endif
   137                              <1> opt4_int_00_force:	equ  100_0000h
   138                              <1> opt4_int_01_force:	equ  200_0000h
   139                              <1> opt4_int_03_force:	equ  400_0000h
   140                              <1> opt4_int_06_force:	equ  800_0000h
   141                              <1> opt4_int_18_force:	equ 1000_0000h
   142                              <1> opt4_int_19_force:	equ 2000_0000h
   143                              <1> opt4_int_09_force:	equ 4000_0000h	; not used at the same time as 15h
   144                              <1> opt4_int_15_force:	equ 4000_0000h	; not used at the same time as 09h
   145                              <1> opt4_int_07_force:	equ 8000_0000h
   146                              <1> DEFAULTOPTIONS4 equ opt4_int_2F_hook
   147                              <1> 
   148                              <1> 
   149                              <1> %if _VXCHG
   150                              <1> opt6_vv_mode:		equ 1
   151                              <1> opt6_vv_keep:		equ 2
   152                              <1> opt6_vv_int16:		equ 10h
   153                              <1>  %if _VXCHG_DEFAULT_ON
   154                              <1> DEFAULTOPTIONS6 equ opt6_share_serial_irq | opt6_vv_mode
   155                              <1>  %else
   156                              <1> DEFAULTOPTIONS6 equ opt6_share_serial_irq
   157                              <1>  %endif
   158                              <1> %else
   159                              <1> DEFAULTOPTIONS6 equ opt6_share_serial_irq
   160                              <1> %endif
   161                              <1> %if _DEBUG
   162                              <1> opt6_debug_exception_late:	equ  20h
   163                              <1> opt6_debug_exception_early:	equ  40h
   164                              <1>  %if _DEBUG_COND
   165                              <1> opt6_debug_exception:	equ  80h
   166                              <1> opt6_debug_mode:	equ 100h
   167                              <1>  %endif
   168                              <1> %endif
   169                              <1> opt6_bios_output:	equ 200h
   170                              <1> opt6_flat_binary:	equ 400h
   171                              <1> opt6_big_stack:		equ 800h
   172                              <1> opt6_40_columns:	equ 1000h
   173                              <1> opt6_40_indent_odd:	equ 2000h
   174                              <1> opt6_40_dash:		equ 4000h
   175                              <1> opt6_share_serial_irq:	equ 1_0000h
   176                              <1> opt6_serial_EOI_call:	equ 2_0000h
   177                              <1> %if _RH
   178                              <1> opt6_rh_mode:		equ 10_0000h
   179                              <1> %endif
   180                              <1> %if _DEBUG
   181                              <1> opt6_debug_putrunint_early:	equ  40_0000h
   182                              <1>  %if _DEBUG_COND
   183                              <1> opt6_debug_putrunint:		equ  80_0000h
   184                              <1>  %endif
   185                              <1> %endif
   186                              <1> opt6_bios_io:		equ 100_0000h
   187                              <1> opt6_immasm_display_uu:	equ 200_0000h
   188                              <1> opt6_immasm_debug:	equ 400_0000h
   189                              <1> opt6_immasm_flag:	equ 800_0000h
   190                              <1> opt6_immasm_nobranch:	equ 1000_0000h
   191                              <1> opt6_r_flags_style2:	equ 2000_0000h
   192                              <1> opt6_r_flags_style3:	equ 4000_0000h
   193                              <1> opt6_r_linebreak_conditional:	equ 8000_0000h
   194                              <1> 
   195                              <1> 
   196                              <1> DEFAULTOPTIONS7 equ opt7_no_tsr_ll
   197                              <1> opt7_no_free_oneshot_eld:	equ 1
   198                              <1> opt7_debug_optional_link:	equ 2
   199                              <1> opt7_quiet_install:		equ 4
   200                              <1> opt7_quick_run:			equ 8
   201                              <1> opt7_houdini:			equ 100h
   202                              <1> opt7_debug_run:			equ 200h
   203                              <1> opt7_no_ensure:			equ 1000h
   204                              <1> opt7_no_tsr_ll:			equ 2000h
   205                              <1> 
   206                              <1> 
   207                              <1> oldpacket	equ	  1	; Int25/Int26 packet method available (L, W)
   208                              <1> newpacket	equ	  2	; Int21.7305 packet method available (L, W)
   209                              <1> ntpacket	equ	  4	; VDD registered and usable (L, W)
   210                              <1> pagedcommand	equ	  8	; allows paging in puts
   211                              <1> notstdinput	equ	 10h	; DEBUG's StdIn isn't a device with StdIn bit (is file or other device)
   212                              <1> inputfile	equ	 20h	; DEBUG's StdIn is a file, notstdinput also set
   213                              <1> notstdoutput	equ	 40h	; DEBUG's StdOut isn't a device with StdOut bit (is file or other device)
   214                              <1> outputfile	equ	  80h	; DEBUG's StdOut is a file, notstdoutput also set
   215                              <1> hooked2F	equ	 100h	; Int2F hooked
   216                              <1> nohook2F	equ	 200h	; don't hook Int2F.1687 (required for Win9x, DosEmu?)
   217                              <1> unused_dif1_dpminohlt equ 400h	; DPMI doesn't like hlt
   218                              <1> protectedmode	equ	 800h	; in (DPMI) protected mode
   219                              <1> debuggeeA20	equ	1000h	; state of debuggee's A20
   220                              <1> debuggerA20	equ	2000h	; state of debugger's A20 (will be on if possible)
   221                              <1> nodosloaded	equ	4000h	; No DOS loaded currently (Boot loader mode)
   222                              <1> has386		equ	8000h	; CPU is a 386
   223                              <1> usecharcounter	equ    1_0000h	; don't reset charcounter between calls to puts
   224                              <1> runningnt	equ    2_0000h	; running in NTVDM
   225                              <1> canswitchmode	equ    4_0000h	; can switch modes (auxbuff large enough, DPMI mode switch set up)
   226                              <1> modeswitched	equ    8_0000h	; switched mode (now in the mode that we weren't entered in)
   227                              <1> promptwaiting	equ   10_0000h	; puts: any more output needs to display a prompt first
   228                              <1> switchbuffer	equ   20_0000h	; mode switch needs a buffer (auxbuff)
   229                              <1> tsrmode		equ   40_0000h	; in TSR mode; DPI and DPP not valid
   230                              <1> attachedterm	equ   80_0000h	; the attached process terminated
   231                              <1> runningdosemu	equ  100_0000h	; running in dosemu
   232                              <1> ; load_is_ldp	equ  200_0000h	; boot load: partition specified as "ldp"
   233                              <1> tt_while:	equ  400_0000h	; tt: while condition specified
   234                              <1> tt_p:		equ  800_0000h	; tt: proceed past repeated string instructions
   235                              <1> tt_silent_mode:	equ 1000_0000h	; tt: run should be silent (dump at end)
   236                              <1> tt_silence:	equ 2000_0000h	; tt: silent writing (write to auxbuff instead)
   237                              <1> tt_no_bb:	equ 4000_0000h	; tt: do not use bb breakpoints
   238                              <1> tt_no_bb_first:	equ 8000_0000h	; tt: do not use bb breakpoints at first
   239                              <1> 
   240                              <1> 
   241                              <1> dif2_gg_is_first:	equ   1
   242                              <1> dif2_gg_skip_non_cseip:	equ   2
   243                              <1> dif2_gg_skip_cseip:	equ   4
   244                              <1> dif2_gg_is_gg:		equ   8
   245                              <1> dif2_gg_first_detected:	equ  10h
   246                              <1> dif2_gg_again:		equ  20h
   247                              <1> dif2_tpg_proceed_bp_set:equ  40h
   248                              <1> dif2_tpg_keep_proceed_bp: equ 80h
   249                              <1> dif2_tpg_have_bp:	equ 100h
   250                              <1> dif2_tpg_adjusted_cseip:equ 200h
   251                              <1> dif2_tpg_do_not_adjust:	equ 400h
   252                              <1> dif2_bp_failure:	equ 800h
   253                              <1> dif2_is_pp:		equ 1000h
   254                              <1> %if _SYMBOLIC
   255                              <1> dif2_createdprocess:	equ 800_0000h	; created empty debuggee process
   256                              <1> dif2_sym_req_xms:	equ 2000h
   257                              <1> dif2_sym_req_86mm:	equ 4000h
   258                              <1> dif2_sym_req_mask equ dif2_sym_req_86mm | dif2_sym_req_xms
   259                              <1> dif2_no_pm_xms:		equ 1_0000h
   260                              <1> dif2_xms_detection_done:equ 2_0000h
   261                              <1> %endif
   262                              <1> %if _INPUT_FILE_HANDLES
   263                              <1> dif2_input_file:	equ 10_0000h
   264                              <1> dif2_closed_input_file:	equ 20_0000h
   265                              <1> %endif
   266                              <1> dif2_did_getline_file:	equ 40_0000h
   267                              <1> %if _SYMBOLIC
   268                              <1> dif2_poison:		equ 80_0000h
   269                              <1> %endif
   270                              <1> dif2_boot_loaded_kernel:equ 100_0000h
   271                              <1> %if _INPUT_FILE_BOOT
   272                              <1> dif2_input_file_boot:	equ 200_0000h
   273                              <1> dif2_closed_input_file_boot:	equ 400_0000h
   274                              <1> %endif
   275                              <1> dif2_in_silence_dump:	equ 1000_0000h
   276                              <1> dif2_int31_segment:	equ 2000_0000h
   277                              <1> dif2_nn_compat:		equ 4000_0000h
   278                              <1> dif2_nn_capitalise:	equ 8000_0000h
   279                              <1> 
   280                              <1> 
   281                              <1> dif3_load_is_ldp:	equ 1	; boot load: partition specified as "ldp"
   282                              <1> dif3_load_is_sdp:	equ 2	; boot load: partition specified as "sdp"
   283                              <1> dif3_load_is_ydp:	equ 4	; boot load: partition specified as "ydp"
   284                              <1> dif3_load_is_dp:	equ dif3_load_is_ldp 				| dif3_load_is_sdp 				| dif3_load_is_ydp
   287                              <1> dif3_load_dir_dir:	equ 8
   288                              <1> dif3_input_terminal_override:	equ 10h
   289                              <1> dif3_input_serial_override:	equ 20h
   290                              <1> dif3_if_not:		equ 40h
   291                              <1> dif3_partition_changed:	equ 80h
   292                              <1> ;
   293                              <1> dif3_input_cmdline:	equ 100h; input reading from cmdline_buffer
   294                              <1> dif3_input_cmdline_closed: equ 200h
   295                              <1> dif3_at_line_end:	equ 400h
   296                              <1> dif3_quiet_input_single:equ 800h
   297                              <1> dif3_quiet_output:	equ 1000h
   298                              <1> dif3_unquiet_error:	equ 2000h
   299                              <1> dif3_unquiet_prompt:	equ 4000h
   300                              <1> dif3_unquiet:		equ dif3_unquiet_error | dif3_unquiet_prompt
   301                              <1> dif3_return_eof:	equ 8000h
   302                              <1> dif3_highlighting:	equ 1_0000h
   303                              <1> dif3_do_not_highlight:	equ 2_0000h
   304                              <1> dif3_int10_highlight:	equ 2_0000h
   305                              <1> dif3_nosymbols_1:	equ 4_0000h
   306                              <1> dif3_nosymbols_2:	equ 8_0000h
   307                              <1> %if _PM
   308                              <1> dif3_ss_b_bit_set:	equ  10_0000h
   309                              <1> %endif
   310                              <1> dif3_gotint19:		equ  20_0000h
   311                              <1> dif3_prior_pm:		equ  40_0000h
   312                              <1> %if _DELAY_BEFORE_BP
   313                              <1> dif3_delayed		equ  80_0000h
   314                              <1> %endif
   315                              <1> dif3_input_re:		equ 100_0000h	; input reading from re_buffer
   316                              <1> dif3_input_re_closed:	equ 200_0000h
   317                              <1> dif3_accept_getrange_0:	equ 400_0000h
   318                              <1> %if _INPUT_FILE_HANDLES || _INPUT_FILE_BOOT
   319                              <1> dif3_in_if:		equ 800_0000h
   320                              <1> %endif
   321                              <1> dif3_auxbuff_guarded_1:	equ 1000_0000h
   322                              <1> dif3_auxbuff_guarded_2:	equ 2000_0000h
   323                              <1> dif3_auxbuff_guarded_3:	equ 4000_0000h
   324                              <1> dif3_sss_is_reverse:	equ 8000_0000h
   325                              <1> 
   326                              <1> 
   327                              <1> dif4_int_serial_hooked:	equ 1
   328                              <1> dif4_int_2F_hooked:	equ 2
   329                              <1> dif4_int_08_hooked:	equ 4
   330                              <1> dif4_int_2D_hooked:	equ 8
   331                              <1> %if _CATCHINTFAULTCOND && _CATCHINT0D
   332                              <1> dif4_int_0D_hooked:	equ 10h
   333                              <1> %endif
   334                              <1> %if _CATCHINTFAULTCOND && _CATCHINT0C
   335                              <1> dif4_int_0C_hooked:	equ 20h
   336                              <1> %endif
   337                              <1> %if _LOADER
   338                              <1> dif4_int_18_hooked:	equ 1000h
   339                              <1> dif4_int_19_hooked:	equ 2000h
   340                              <1> %endif
   341                              <1> 
   342                              <1> 
   343                              <1> %if _VXCHG
   344                              <1> dif6_vv_mode:		equ 1
   345                              <1> %endif
   346                              <1> dif6_in_hook2F:		equ 2
   347                              <1> dif6_in_amis_hook2F:	equ 4
   348                              <1> dif6_debug_mode:	equ 100h
   349                              <1> dif6_locked:		equ 200h
   350                              <1> dif6_mcp:		equ 400h
   351                              <1> %if _RH
   352                              <1> dif6_rh_mode_was:	equ  8_0000h
   353                              <1> dif6_rh_mode:		equ 10_0000h
   354                              <1> dif6_rh_mode_2:		equ 20_0000h
   355                              <1> %endif
   356                              <1> dif6_device_mode:	equ 40_0000h
   357                              <1> dif6_cpdepchars:	equ 80_0000h
   358                              <1> %if _IMMASM
   359                              <1> dif6_immasm_no_output:	equ 100_0000h
   360                              <1> dif6_immasm:		equ 200_0000h
   361                              <1> dif6_immasm_rel8:	equ 400_0000h
   362                              <1> %endif
   363                              <1> 
   364                              <1> 
   365                              <1> disasm_lowercase	equ 1
   366                              <1> disasm_commablank	equ 2
   367                              <1> disasm_nasm		equ 4
   368                              <1> disasm_lowercase_refmem:equ 8
   369                              <1> disasm_show_short:	equ 10h
   370                              <1> disasm_show_near:	equ 20h
   371                              <1> disasm_show_far:	equ 40h
   372                              <1> disasm_nec:		equ 80h
   373                              <1> disasm_40_columns:	equ 100h
   374                              <1> disasm_no_indent:	equ 200h
   375                              <1> disasm_msdebug_mnemonofs: equ 400h
   376                              <1> disasm_a16_memref:	equ 1000h
   377                              <1> disasm_a32_memref:	equ 2000h
   378                              <1> disasm_a16_string:	equ 4000h
   379                              <1> disasm_a32_string:	equ 8000h
   380                              <1> disasm_hide_modrm:	equ 10000h
   381                              <1> disasm_asize_loop_nasm:	equ 20000h
   382                              <1> disasm_modrm_always:	equ 40000h
   383                              <1> DEFAULTASMOPTIONS equ disasm_lowercase|disasm_commablank|disasm_nasm 	| disasm_a16_memref | disasm_a32_memref 	| disasm_a16_string | disasm_a32_string
   386                              <1> 
   387                              <1> 	; serial_flags values
   388                              <1> sf_init_done:	equ 1
   389                              <1> sf_ctrl_c:	equ 2
   390                              <1> sf_double_ctrl_c:	equ 4
   391                              <1> sf_built_in_fifo:	equ 8
   392                              <1> sf_use_serial:		equ 10h
    35                                  
    36                                  	cpu 8086
    37                                  
    38                                  	addsection RELOCATEDDATA, nobits vstart=_ELD_RELOC_VSTART
    39                                  relocateddata:
    40                                  
    41                                  	addsection HEADER, start=0
    42                                  
    43                                  	istruc ELD_HEADERX
    44                                  at eldhxHeader
    45                                  		; ELD executable header
    46                                  	istruc ELD_HEADER
    47 00000000 454C4431                at eldhSignature,	db "ELD1"
    48 00000004 000000                  			db 0,0,0
    49 00000007 1A                      			db 26
    50 00000008 70000000                at eldhCodeOffset,	dd CODEOFFSET
    51 0000000C 1015                    at eldhCodeImageLength,	dw code_size
    52 0000000E 0000                    at eldhCodeAllocLength,	dw 0
    53 00000010 80150000                at eldhDataOffset,	dd DATAOFFSET
    54 00000014 9002                    at eldhDataImageLength,	dw data_size
    55 00000016 F001                    at eldhDataAllocLength,	dw total_data_size - data_size
    56 00000018 9909                    at eldhCodeEntrypoint,	dw linker - code
    57                                  at eldhReserved
    58 0000001A 00<rep 4h>2800          at eldhExtensionSize,	dw header_extension_end - $$
    59                                  	iend
    60 00000020 [30000000]              at eldhxDescriptionOffset,	dd description
    61 00000024 F3160000                at eldhxHelpOffset,		dd DATAOFFSET + msg.help - datastart
    62                                  PUT_ELDHX_DATETIME_OFFSET
    63                                  header_extension_end:
    64 00000028 00<rep 8h>              	iend
    65                                  
    66 00000030 50726F766964652066-     description:	asciz "Provide filename extension guessing and warning for EXT/Y."
    66 00000039 696C656E616D652065-
    66 00000042 7874656E73696F6E20-
    66 0000004B 6775657373696E6720-
    66 00000054 616E64207761726E69-
    66 0000005D 6E6720666F72204558-
    66 00000066 542F592E00         
    67                                  
    68                                  
    69 0000006B 00<rep 5h>              	align 16, db 0
    70                                  
    71                                  CODEOFFSET equ $ - $$
    72                                  	addsection CODE, follows=HEADER vstart=_ELD_CODE_VSTART
    73                                  %define CODEFIXUP - code + 0
    74                                  code:
    75                                  code_start:
    76                                  		; ELD instance header
    77                                  	istruc ELD_INSTANCE
    78                                  at eldiStartCode
    79 00000000 00<rep 2h>              at eldiEndCode
    80 00000002 00<rep 2h>              at eldiStartData
    81 00000004 00<rep 2h>              at eldiEndData
    82 00000006 00<rep 2h>4558544E-     at eldiIdentifier,	fill 8, 32, db "EXTNAME"
    82 0000000C 414D4520           
    83 00000010 00<rep 2h>6578746E-     at eldiListing,		asciz _ELD_LISTING
    83 00000016 616D652E6C737400   
    84 0000001E 00<rep 2h>              	iend
    85                                  %if _LIBSCAN
    86 00000020 4E414D454C494230        		db "NAMELIB0"
    87 00000028 [5E01]                  		dw nothinglib
    88                                  internaldatarelocation
    89 0000002A [5E02]                  		dw nothinglib.end
    90                                  internaldatarelocation
    91                                  %endif
    92                                  
    93                                  DATAOFFSET equ CODEOFFSET + code_size
    94                                  	addsection DATA, follows=CODE vstart=_ELD_DATA_VSTART
    95                                  %define DATAFIXUP - datastart + 0
    96                                  datastart:
    97                                  PUT_ELD_DATETIME
    98                                  
    99                                  
   100                                  	usesection CODE
   101                                  
   102                                  command:
   103 0000002C EB08                    	jmp strict short .entry
   104                                  .chain:
   105 0000002E E8[0000]EB020000        	extcall cmd3_not_ext, required	; must NOT be extcallcall
   106 00000035 90                      	times 10 - ($ - command) nop
   107                                  .entry:
   108 00000036 56                      	push si
   109 00000037 3C2D                    	cmp al, '-'
   110 00000039 7503                    	jne @F
   111 0000003B E81A08                  	extcallcall skipcomma
   112                                  @@:
   113 0000003E 4E                      	dec si
   114                                  
   115 0000003F BA[7E00]                	mov dx, msg.extname
   116                                  internaldatarelocation
   117 00000042 E81B08                  	extcallcall isstring?
   118 00000045 7418                    	je .ourcommand
   119                                  
   120 00000047 31DB                    	xor bx, bx		; = 0 means EXT command
   121 00000049 BA[7A00]                	mov dx, msg.ext
   122                                  internaldatarelocation
   123 0000004C E81108                  	extcallcall isstring?
   124 0000004F 7463                    	je .ourmodify
   125                                  
   126 00000051 4B                      	dec bx			; = -1 means Y command
   127 00000052 AC                      	lodsb
   128 00000053 E81208                  	extcallcall uppercase
   129 00000056 3C59                    	cmp al, 'Y'
   130 00000058 745A                    	je .ourmodify
   131                                  
   132                                  .transfer:
   133 0000005A 5E                      	pop si
   134                                  ..@transfer_to_chain_si:
   135 0000005B 4E                      	dec si
   136 0000005C AC                      	lodsb
   137 0000005D EBCF                    	jmp .chain
   138                                  
   139                                  .ourcommand:
   140 0000005F 58                      	pop ax
   141 00000060 E8F507                  	extcallcall skipcomma
   142 00000063 4E                      	dec si
   143 00000064 C706[0000][0000]        reloc2	mov word [relocateddata], relocateddata
   144                                  linkdatarelocation lastcmd, -4
   145                                  linkdatarelocation dmycmd
   146 0000006A BA[0000]                	mov dx, relocateddata
   147                                  linkdatarelocation msg.uninstall
   148 0000006D E8F007                  	extcallcall isstring?
   149 00000070 7503E97007              	je uninstall
   150 00000075 BB[0100]                	mov bx, warnextension
   151                                  internaldatarelocation
   152 00000078 B9[ED00]                	mov cx, msg.warnextoption
   153                                  internaldatarelocation
   154 0000007B BA[A500]                	mov dx, msg.warnext
   155                                  internaldatarelocation
   156 0000007E E8DF07                  	extcallcall isstring?
   157 00000081 741A                    	je .option_ZR
   158 00000083 BB[0000]                	mov bx, guessextension
   159                                  internaldatarelocation
   160 00000086 B9[CB00]                	mov cx, msg.guessextoption
   161                                  internaldatarelocation
   162 00000089 BA[9C00]                	mov dx, msg.guessext
   163                                  internaldatarelocation
   164 0000008C E8D107                  	extcallcall isstring?
   165                                  %if _LIBSCAN
   166 0000008F 740C                    	je .option_ZR
   167 00000091 BB[0200]                	mov bx, debuglib
   168                                  internaldatarelocation
   169 00000094 B9[1901]                	mov cx, msg.debugliboption
   170                                  internaldatarelocation
   171 00000097 BA[AD00]                	mov dx, msg.debuglib
   172                                  internaldatarelocation
   173 0000009A E8C307                  	extcallcall isstring?
   174                                  %endif
   175                                  .option_ZR:
   176 0000009D 7503E99206              	je option
   177                                  
   178                                  %if _LIBSCAN
   179 000000A2 BA[9400]                	mov dx, msg.lib
   180                                  internaldatarelocation
   181 000000A5 E8B807                  	extcallcall isstring?
   182 000000A8 7503E93006              	je libcontrol
   183                                  %endif
   184 000000AD AC                      	lodsb
   185 000000AE E8BF07                  	extcallcall chkeol
   186 000000B1 E8C407                  	extcallcall cmd3
   187                                  
   188                                  
   189                                  .ourmodify:
   190 000000B4 881E[0000]              	mov byte [relocateddata], bl
   191                                  linkdatarelocation yy_is_script
   192 000000B8 E89D07                  	extcallcall skipcomma
   193                                  %if _LIBSCAN
   194 000000BB 4E                      	dec si
   195 000000BC 8936[6E02]              	mov word [header], si
   196                                  internaldatarelocation
   197 000000C0 46                      	inc si
   198                                  %endif
   199 000000C1 C706[0000][0000]        reloc2	mov word [relocateddata], relocateddata
   200                                  linkdatarelocation lastcmd, -4
   201                                  linkdatarelocation dmycmd
   202                                  
   203                                  %if _BOOTLDR
   204 000000C7 31DB                    	xor bx, bx
   205 000000C9 E8B407                  	extcallcall InDOS
   206 000000CC 7412                    	jz @F
   207 000000CE F606[0100]40            reloc	testopt [relocateddata], nodosloaded
   208                                  linkdatarelocation internalflags, -3
   209 000000D3 7485                    	jz .transfer		; InDOS while not bootloaded -->
   210 000000D5 4B                      	dec bx
   211 000000D6 F606[0300]70            	testopt [relocateddata], dif3_auxbuff_guarded_1 		| dif3_auxbuff_guarded_2 		| dif3_auxbuff_guarded_3
   214                                  linkdatarelocation internalflags3, -3
   215 000000DB 7403E97AFF              	jnz .transfer		; bootloaded with no auxbuff -->
   216                                  @@:
   217 000000E0 881E[7202]              	mov byte [isbootloaded], bl
   218                                  internaldatarelocation
   219                                  %else
   220                                  	extcallcall InDOS
   221                                  	jnz .transfer
   222                                  %endif
   223                                  
   224 000000E4 F606[0300]04            	testopt [relocateddata], tt_while
   225                                  linkdatarelocation internalflags_with_tt_while, -3
   226 000000E9 7403E96CFF              	jnz .transfer
   227                                  
   228 000000EE 5A                      	pop dx
   229 000000EF BB[0000]                	mov bx, relocateddata
   230                                  linkdatarelocation line_out
   231                                  %if _BOOTLDR
   232 000000F2 D006[7202]              	rol byte [isbootloaded], 1
   233                                  internaldatarelocation
   234 000000F6 7305                    	jnc @F
   235 000000F8 E88D07                  	extcallcall yy_boot_parse_name_bx_buffer
   236 000000FB EB03                    	jmp @FF
   237                                  @@:
   238                                  %endif
   239 000000FD E89007                  	extcallcall yy_common_parse_name_bx_buffer
   240                                  				; si + 1 -> trailer, bx -> NUL-terminated pathname
   241                                  @@:
   242 00000100 4E                      	dec si
   243 00000101 8936[7002]              	mov word [trailer], si
   244                                  internaldatarelocation
   245                                  
   246                                  analyse_pathname:
   247 00000105 89DE                    	mov si, bx
   248 00000107 31D2                    	xor dx, dx
   249 00000109 B000                    	mov al, 0
   250                                  @@:
   251 0000010B 3C2F                    	cmp al, '/'
   252 0000010D 7410                    	je .slash
   253 0000010F 3C5C                    	cmp al, '\'
   254 00000111 740C                    	je .slash
   255 00000113 3C3A                    	cmp al, ':'
   256 00000115 7408                    	je .colon
   257 00000117 3C2E                    	cmp al, '.'
   258 00000119 7507                    	jne .next
   259                                  .dot:
   260 0000011B B201                    	mov dl, 1		; set dl (fn with dot)
   261 0000011D EB03                    	jmp .next
   262                                  
   263                                  .slash:
   264                                  .colon:
   265 0000011F BA0001                  	mov dx, 100h		; set dh (is a pathname), reset dl (fn with dot)
   266                                  .next:
   267 00000122 AC                      	lodsb
   268 00000123 3C00                    	cmp al, 0
   269 00000125 75E4                    	jne @B
   270 00000127 4E                      	dec si			; bx -> name, si -> terminator
   271                                  				; dh = nonzero if a pathname not just filename
   272                                  				; dl = nonzero if filename contains a dot
   273 00000128 89F1                    	mov cx, si
   274 0000012A 29D9                    	sub cx, bx		; es:bx -> name, cx = length
   275                                  
   276                                  
   277                                  check_warn_extension:
   278 0000012C 52                      	push dx
   279                                  
   280 0000012D 84D2                    	test dl, dl		; last component has a dot ?
   281 0000012F 742F                    	jz .done		; no, do not warn -->
   282                                  
   283 00000131 D006[0100]              	rol byte [warnextension], 1
   284                                  internaldatarelocation
   285 00000135 7329                    	jnc .done		; warning disabled -->
   286                                  
   287 00000137 83F904                  	cmp cx, 4		; can fit an expected extension ?
   288 0000013A 721E                    	jb .warn		; no, warn -->
   289                                  
   290 0000013C 83EE04                  	sub si, 4		; -> possible extension
   291 0000013F BF[0400]                	mov di, msg.extensions_eld
   292                                  internaldatarelocation		; es:di -> allowed extensions
   293 00000142 D006[0000]              	rol byte [relocateddata], 1
   294                                  linkdatarelocation yy_is_script
   295 00000146 7303                    	jnc @F
   296 00000148 BF[0F00]                	mov di, msg.extensions_sld
   297                                  internaldatarelocation		; es:di -> allowed extensions
   298                                  @@:
   299                                  .loop:
   300 0000014B 89FA                    	mov dx, di
   301 0000014D E81007                  	extcallcall isstring?	; is it this one ?
   302 00000150 740E                    	je .done		; yes, do not warn -->
   303 00000152 83C705                  	add di, 5
   304 00000155 803D00                  	cmp byte [di], 0	; was last ?
   305 00000158 75F1                    	jne .loop
   306                                  .warn:
   307 0000015A BA[1500]                	mov dx, msg.extension_warning
   308                                  internaldatarelocation
   309 0000015D E83807                  	extcallcall putsz
   310                                  
   311                                  .done:
   312 00000160 5A                      	pop dx
   313                                  
   314                                  
   315                                  detect_extension:
   316                                  %ifn _LIBSCAN
   317                                  	test dl, dl		; last component has a dot ?
   318                                  	jnz .done		; yes, do not try open -->
   319                                  %endif
   320                                  
   321 00000161 BF[0000]                	mov di, relocateddata
   322                                  linkdatarelocation while_buffer
   323 00000164 E86004                  	call check_filename
   324 00000167 725A                    	jc .try_scriptspath
   325 00000169 744F                    	jz .done		; no extension needs to be appended -->
   326                                  
   327                                  .finish:
   328 0000016B 8D55FB                  	lea dx, [di - 5]
   329                                  %if 0
   330                                  	mov bx, word [relocateddata]
   331                                  linkdatarelocation terminator_in_line_in.offset
   332                                  	mov al, byte [relocateddata]
   333                                  linkdatarelocation terminator_in_line_in.value
   334                                  	mov byte [bx], al	; undo
   335                                  %endif
   336                                  
   337 0000016E E82F07                  	extcallcall yy_reset_buf
   338                                  
   339 00000171 BE[0100]                	mov si, relocateddata + 1
   340                                  linkdatarelocation line_in
   341 00000174 B400                    	mov ah, 0
   342 00000176 8A04                    	mov al, byte [si]
   343 00000178 3CFA                    	cmp al, 254 - 4		; has space ?
   344 0000017A 773E                    	ja .done
   345 0000017C 800404                  	add byte [si], 4	; add length of extension
   346                                  
   347 0000017F 46                      	inc si			; -> text
   348 00000180 01C6                    	add si, ax		; -> CR
   349 00000182 8D7C04                  	lea di, [si + 4]	; -> destination for CR (extension length)
   350 00000185 8B0E[7002]              	mov cx, word [trailer]
   351                                  internaldatarelocation
   352 00000189 51                      	push cx			; -> trailer
   353 0000018A F7D9                    	neg cx			; minus -> trailer
   354 0000018C 01F1                    	add cx, si		; -> CR minus -> trailer
   355 0000018E 41                      	inc cx			; include CR to be moved
   356 0000018F 51                      	 push cx
   357 00000190 E85300                  	call moveup
   358 00000193 59                      	 pop cx
   359 00000194 5F                      	pop di			; -> trailer source (4 bytes of space)
   360 00000195 89D6                    	mov si, dx		; -> filename extension we guessed
   361 00000197 A5                      	movsw
   362 00000198 A5                      	movsw			; write extension
   363                                  
   364 00000199 BE[0000]                	mov si, relocateddata
   365                                  linkdatarelocation indirect_array_errfix, -2, optional
   366 0000019C 85F6                    	test si, si		; not supported ?
   367 0000019E 7402                    	jz @F
   368 000001A0 8B34                    	mov si, [si]		; -> errfix.eld array, or 0
   369                                  @@:
   370 000001A2 85F6                    	test si, si
   371 000001A4 7414                    	jz .transfer
   372                                  
   373 000001A6 01C6                    	add si, ax		; -> array entry for CR
   374 000001A8 46                      	inc si			; -> entry for byte after CR
   375 000001A9 41                      	inc cx			; count byte after CD
   376 000001AA 8D7C04                  	lea di, [si + 4]	; -> destination for byte after CR
   377                                  				;  (calculated from extension length)
   378 000001AD E83600                  	call moveup
   379 000001B0 FD                      	std
   380 000001B1 8A04                    	mov al, [si]
   381 000001B3 AA                      	stosb
   382 000001B4 AA                      	stosb
   383 000001B5 AA                      	stosb
   384 000001B6 AA                      	stosb
   385 000001B7 FC                      	cld
   386                                  
   387 000001B8 EB00                    	jmp .transfer
   388                                  
   389                                  .done:
   390                                  %if 0
   391                                  	mov di, word [relocateddata]
   392                                  linkdatarelocation terminator_in_line_in.offset
   393                                  	mov al, byte [relocateddata]
   394                                  linkdatarelocation terminator_in_line_in.value
   395                                  	mov byte [di], al	; undo
   396                                  %endif
   397                                  
   398                                  .transfer:
   399 000001BA BE[0200]                	mov si, relocateddata + 2
   400                                  linkdatarelocation line_in
   401 000001BD E8E806                  	extcallcall skipwhite
   402 000001C0 E998FE                  	jmp ..@transfer_to_chain_si
   403                                  
   404                                  
   405                                  .try_scriptspath:
   406                                  
   407                                  %if _LIBSCAN
   408 000001C3 891E[6C02]              	mov word [nothingoffset], bx
   409                                  internaldatarelocation
   410                                  %endif
   411 000001C7 89DF                    	mov di, bx
   412                                  		; INP:	di -> filepath tried
   413                                  		;	word [yy_try_scriptspath]
   414                                  		; OUT:	ZR if to retry,
   415                                  		;	 bx -> new filepath
   416                                  		;	NZ if not
   417                                  		; STT:	es = ds = ss
   418 000001C9 E8E406                  	extcallcall retry_open_scriptspath
   419 000001CC 752B                    	jnz nothingfound	; not retrying -->
   420                                  
   421 000001CE 89DF                    	mov di, bx
   422 000001D0 B000                    	mov al, 0
   423 000001D2 B9FFFF                  	mov cx, -1
   424 000001D5 F2AE                    	repne scasb
   425 000001D7 F7D1                    	not cx			; neg cx, dec cx
   426 000001D9 49                      	dec cx
   427                                  
   428 000001DA BF[0000]                	mov di, relocateddata
   429                                  linkdatarelocation while_buffer
   430 000001DD E8E703                  	call check_filename
   431 000001E0 7217                    	jc nothingfound		; not found -->
   432 000001E2 74D6                    	jz .done		; no extension needs to be appended -->
   433 000001E4 EB85                    	jmp .finish		; found with an extension -->
   434                                  
   435                                  
   436                                  moveup:
   437 000001E6 FD                      	std
   438 000001E7 83F914                  	cmp cx, 20
   439 000001EA 7703                    	ja @FF
   440                                  @@:
   441 000001EC A4                      	movsb
   442 000001ED E2FD                    	loop @B
   443                                  @@:
   444 000001EF F3A4                    	rep movsb
   445 000001F1 FC                      	cld
   446 000001F2 C3                      	retn
   447                                  
   448                                  
   449                                  %ifn _LIBSCAN
   450                                   nothingfound equ detect_extension.done
   451                                  %endif
   452                                  
   453                                  %if _LIBSCAN
   454                                  notfound_invalid:
   455 000001F3 8B26[6A02]              	mov sp, word [nothingsp]
   456                                  internaldatarelocation
   457 000001F7 EBC1                    	jmp detect_extension.done
   458                                  
   459                                  
   460                                  nothingfound:
   461                                  .done equ notfound_invalid
   462 000001F9 8926[6A02]              	mov word [nothingsp], sp
   463                                  internaldatarelocation
   464                                  
   465 000001FD D006[0000]              	rol byte [relocateddata], 1
   466                                  linkdatarelocation yy_is_script	; is it a Y command ?
   467 00000201 72F0                    	jc .done		; yes, skip special handling -->
   468 00000203 84F6                    	test dh, dh		; pathname contains colons or slashes ?
   469 00000205 75EC                    	jnz .done		; yes, skip special handling -->
   470                                  
   471 00000207 D006[0200]              	rol byte [debuglib], 1
   472                                  internaldatarelocation
   473 0000020B 731F                    	jnc @F
   474                                  
   475 0000020D BA[4600]                	mov dx, msg.nothingfound.1
   476                                  internaldatarelocation
   477 00000210 E88506                  	extcallcall putsz
   478 00000213 8B16[6C02]              	mov dx, word [nothingoffset]
   479                                  internaldatarelocation
   480 00000217 E87E06                  	extcallcall putsz
   481 0000021A BA[6100]                	mov dx, msg.nothingfound.2
   482                                  internaldatarelocation
   483 0000021D E87806                  	extcallcall putsz
   484 00000220 BA[5E01]                	mov dx, nothinglib
   485                                  internaldatarelocation
   486 00000223 E87206                  	extcallcall putsz
   487 00000226 BA[7600]                	mov dx, msg.nothingfound.3
   488                                  internaldatarelocation
   489 00000229 E86C06                  	extcallcall putsz
   490                                  
   491                                  @@:
   492 0000022C 31C0                    	xor ax, ax
   493                                  
   494 0000022E 3806[5E01]              	cmp byte [nothinglib], al
   495                                  internaldatarelocation
   496 00000232 74BF                    	je .done
   497                                  
   498 00000234 B9FFFF                  	mov cx, -1
   499 00000237 8B3E[6C02]              	mov di, [nothingoffset]
   500                                  internaldatarelocation
   501 0000023B 89FB                    	mov bx, di
   502 0000023D F2AE                    	repne scasb
   503 0000023F F7D1                    	not cx
   504 00000241 49                      	dec cx
   505 00000242 74AF                    	jz notfound_invalid
   506                                  
   507 00000244 83F904                  	cmp cx, 4
   508 00000247 7227                    	jb .notext
   509 00000249 8D77FC                  	lea si, [bx - 4]
   510 0000024C 01CE                    	add si, cx
   511 0000024E 803C2E                  	cmp byte [si], '.'
   512 00000251 751D                    	jne .notext
   513 00000253 8B4402                  	mov ax, word [si + 2]
   514 00000256 25DFDF                  	and ax, ~2020h
   515 00000259 3D4C44                  	cmp ax, "LD"
   516 0000025C 7512                    	jne .notext
   517 0000025E 8A4401                  	mov al, byte [si + 1]
   518 00000261 24DF                    	and al, ~20h
   519 00000263 3C45                    	cmp al, 'E'
   520 00000265 7404                    	je .ext
   521 00000267 3C58                    	cmp al, 'X'
   522 00000269 7505                    	jne .notext
   523                                  .ext:
   524 0000026B 83E904                  	sub cx, 4
   525 0000026E 7483                    	jz notfound_invalid
   526                                  .notext:
   527                                  
   528 00000270 83F908                  	cmp cx, 8
   529 00000273 7603E97BFF              	ja notfound_invalid
   530 00000278 89DE                    	mov si, bx
   531 0000027A BF[5E02]                	mov di, namebuffer
   532                                  internaldatarelocation
   533 0000027D 89CA                    	mov dx, cx
   534                                  @@:
   535 0000027F AC                      	lodsb
   536 00000280 E8E505                  	extcallcall uppercase
   537 00000283 AA                      	stosb
   538 00000284 E2F9                    	loop @B
   539 00000286 F7DA                    	neg dx
   540 00000288 83C208                  	add dx, 8
   541 0000028B 87CA                    	xchg cx, dx
   542 0000028D B020                    	mov al, 32
   543 0000028F F3AA                    	rep stosb
   544                                  
   545 00000291 BB[5E01]                	mov bx, nothinglib
   546                                  internaldatarelocation
   547                                  %if _BOOTLDR
   548 00000294 F606[0100]40            reloc	testopt [relocateddata], nodosloaded
   549                                  linkdatarelocation internalflags, -3
   550 00000299 7437                    	jz libdos
   551                                  libboot:
   552 0000029B E81A06                  	extcallcall init_bootcmd
   553                                  ;reloc	mov word [boot_parsed], bx
   554                                  ;internaldatarelocation
   555                                  
   556                                  boot_no_wild:
   557 0000029E E81F06                  	extcallcall yy_boot_open_file2	; calls initialise_fs
   558 000002A1 8026[0300]EF            reloc	clropt [relocateddata], dif3_auxbuff_guarded_1
   559                                  linkdatarelocation internalflags3, -3
   560                                  
   561                                  %if _DATABUFFER
   562 000002A6 F606[0100]40            reloc	testopt [relocateddata], nodosloaded
   563                                  linkdatarelocation internalflags, -3
   564 000002AB 7420                    	jz .skipdatabuffer
   565 000002AD B104                    	mov cl, 4
   566 000002AF 8CD0                    	mov ax, ss
   567 000002B1 BB[8002]                reloc	mov bx, databuffer
   568                                  internaldatarelocation
   569 000002B4 F6C30F                  	test bl, 15
   570 000002B7 7514                    	jnz .skipdatabuffer
   571 000002B9 D3EB                    	shr bx, cl
   572 000002BB 01D8                    	add ax, bx
   573 000002BD A3[0600]                reloc	mov word [relocateddata - LOADDATA2 + ldDataSegment], ax
   574                                  linkdatarelocation load_data
   575 000002C0 31C0                    	xor ax, ax
   576 000002C2 A3[0A00]                reloc	mov word [relocateddata - LOADDATA2 + ldDataSector + 2], ax
   577                                  linkdatarelocation load_data
   578 000002C5 A3[0800]                reloc	mov word [relocateddata - LOADDATA2 + ldDataSector], ax
   579                                  linkdatarelocation load_data
   580 000002C8 800E[1700]08            reloc	setopt [relocateddata - LOADDATA2 + ldFlags], ldfDataBuffered
   581                                  linkdatarelocation load_data, -3
   582                                  .skipdatabuffer:
   583                                  %endif
   584                                  
   585 000002CD B8[0000]                reloc	mov ax, relocateddata
   586                                  linkdatarelocation load_data_lowest	; make yy_boot_get and yy_boot_update no-ops
   587 000002D0 EB13                    	jmp libcommon
   588                                  %endif
   589                                  
   590                                  libdos:
   591 000002D2 E8AB05                  	extcallcall InDOS
   592 000002D5 7403E91606              	jnz error
   593                                  
   594 000002DA E8AA04                  	call open_file
   595 000002DD 7303E9D8FE              	jc detect_extension.done
   596                                  
   597 000002E2 A3[0000]                reloc	mov word [relocateddata], ax
   598                                  linkdatarelocation ext_handle
   599                                  @@:
   600                                  libcommon:
   601                                  
   602                                  
   603                                  		; INP:	file is opened
   604                                  		;	file seek is at ELD/SLD header
   605                                  		;	ax = file handle or bootloaded file structure offset
   606                                  		;	 (write to bx for file access functions)
   607                                  		;	word [nothingoffset] -> ASCIZ name of entry to search
   608                                  	lframe
   609                                  	lvar dword, liboffset
   610                                  	lvar dword, libnext
   611                                  	lvar word, libamount
   612                                  	lvar 12 + 2, libentry
   613                                  	lequ ?libentry, state
   614                                  	lequ ?libentry + 2, tail
   615                                  	lequ ?libentry + 4, next
   616                                  	lequ ?libentry + 6, helpstarted
   617 000002E5 5589E58D66E8            	lenter
   618                                  	lvar word, handle
   619 000002EB 50                      	 push ax
   620 000002EC 93                      	xchg bx, ax		; bx = handle
   621                                  
   622 000002ED 31C0                    	xor ax, ax
   623                                  	lvar dword, eldheader
   624 000002EF 50                      	 push ax
   625 000002F0 50                      	 push ax
   626                                  
   627                                  %if _ELDTRAILER
   628 000002F1 B80242                  	mov ax, 4202h
   629 000002F4 31C9                    	xor cx, cx
   630 000002F6 31D2                    	xor dx, dx
   631 000002F8 E87D02                  	call seek_compressed_or_dos_or_boot_io
   632 000002FB 7303E9B301              	jc .io_error
   633                                  
   634 00000300 85D2                    	test dx, dx
   635 00000302 7505                    	jnz @F
   636 00000304 83F830                  	cmp ax, ELD_HEADER_size + ELD_TRAILER_HEADER_size
   637 00000307 7267                    	jb .no_trailer
   638                                  @@:
   639                                  
   640 00000309 B80142                  	mov ax, 4201h
   641 0000030C B9FFFF                  	mov cx, -1
   642 0000030F BAF0FF                  	mov dx, - ELD_TRAILER_HEADER_size
   643 00000312 E86302                  	call seek_compressed_or_dos_or_boot_io
   644 00000315 7303E99901              	jc .io_error
   645                                  
   646 0000031A 52                      	push dx
   647 0000031B 50                      	push ax
   648                                  
   649 0000031C B91000                  	mov cx, fromwords(ELD_TRAILER_HEADER_size_w)
   650 0000031F 29CC                    	sub sp, cx
   651 00000321 89E2                    	mov dx, sp
   652                                  
   653 00000323 B43F                    	mov ah, 3Fh
   654 00000325 E85002                  	call read_compressed_or_dos_or_boot_io
   655 00000328 7303E98601              	jc .io_error
   656 0000032D 89E7                    	mov di, sp
   657 0000032F 89E6                    	mov si, sp
   658                                  
   659 00000331 39C8                    	cmp ax, cx
   660 00000333 7538                    	jne .no_trailer_pop
   661                                  
   662 00000335 31D2                    	xor dx, dx
   663 00000337 D1E9                    	shr cx, 1
   664                                  @@:
   665 00000339 AD                      	lodsw
   666 0000033A 01C2                    	add dx, ax
   667 0000033C E2FB                    	loop @B
   668 0000033E 752D                    	jnz .no_trailer_pop
   669                                  
   670 00000340 58                      	pop ax
   671 00000341 3D454C                  	cmp ax, "EL"
   672 00000344 7527                    	jne .no_trailer_pop
   673 00000346 58                      	pop ax
   674 00000347 3D4431                  	cmp ax, "D1"
   675 0000034A 7521                    	jne .no_trailer_pop
   676 0000034C 58                      	pop ax
   677 0000034D 3D5441                  	cmp ax, "TA"
   678 00000350 751B                    	jne .no_trailer_pop
   679 00000352 58                      	pop ax
   680 00000353 3D494C                  	cmp ax, "IL"
   681 00000356 7515                    	jne .no_trailer_pop
   682                                  
   683 00000358 5E                      	pop si
   684 00000359 59                      	pop cx			; cx:si = displacement to subtract
   685 0000035A 58                      	pop ax			; reserved
   686 0000035B 58                      	pop ax			; checksum
   687                                  
   688 0000035C 58                      	pop ax
   689 0000035D 5A                      	pop dx			; dx:ax = offset of trailer header
   690 0000035E 01F0                    	add ax, si
   691 00000360 11CA                    	adc dx, cx		; dx:ax = offset of header
   692 00000362 7203E94C01              	jnc .io_error
   693                                  
   694 00000367 8946E2                  	mov word [bp + ?eldheader], ax
   695 0000036A 8956E4                  	mov word [bp + ?eldheader + 2], dx
   696                                  
   697                                  .no_trailer_pop:
   698 0000036D 8D6514                  	lea sp, [di + fromwords(ELD_TRAILER_HEADER_size_w) + 4]
   699                                  
   700                                  .no_trailer:
   701 00000370 B80042                  	mov ax, 4200h
   702 00000373 8B56E2                  	mov dx, word [bp + ?eldheader]
   703 00000376 8B4EE4                  	mov cx, word [bp + ?eldheader + 2]
   704 00000379 E8FC01                  	call seek_compressed_or_dos_or_boot_io
   705 0000037C 7303E93201              	jc .io_error
   706                                  
   707                                  .no_trailer_no_seek:
   708                                  %endif
   709                                  
   710 00000381 B43F                    	mov ah, 3Fh
   711 00000383 B92000                  	mov cx, fromwords(ELD_HEADER_size_w)
   712                                  	lvar fromwords(ELD_HEADER_size_w), header
   713 00000386 29CC                    	sub sp, cx
   714 00000388 89E2                    	mov dx, sp
   715 0000038A E8EB01                  	call read_compressed_or_dos_or_boot_io
   716 0000038D 7303E92101              	jc .io_error
   717 00000392 39C8                    	cmp ax, cx
   718 00000394 750C                    	jne .invalid_check_sld_NZ
   719 00000396 817EC2454C              	cmp word [bp + ?header + eldhSignature], "EL"
   720 0000039B 7505                    	jne .invalid_check_sld_NZ
   721 0000039D 817EC44431              	cmp word [bp + ?header + eldhSignature + 2], "D1"
   722                                  .invalid_check_sld_NZ:
   723 000003A2 7403E90C01              	jne .invalid_check_sld
   724                                  	; houdini
   725                                  	; cmp word [bp + ?header + eldhExtensionSize], eldhxDescriptionOffset + 4
   726                                  	; jb .nodesc
   727                                  
   728 000003A7 837EE02C                	cmp word [bp + ?header + eldhExtensionSize], eldhxLibTable + 4
   729 000003AB 7303E90301              	jb .nolib
   730 000003B0 83EC04                  	sub sp, 4
   731 000003B3 BA2800                  	mov dx, eldhxLibTable
   732 000003B6 31C9                    	xor cx, cx
   733 000003B8 0356E2                  	add dx, word [bp + ?eldheader]
   734 000003BB 134EE4                  	adc cx, word [bp + ?eldheader + 2]
   735 000003BE B80042                  	mov ax, 4200h
   736 000003C1 E8B401                  	call seek_compressed_or_dos_or_boot_io
   737 000003C4 7303E9EA00              	jc .io_error
   738 000003C9 89E2                    	mov dx, sp
   739 000003CB B90400                  	mov cx, 4
   740 000003CE B43F                    	mov ah, 3Fh
   741 000003D0 E8A501                  	call read_compressed_or_dos_or_boot_io
   742 000003D3 7303E9DB00              	jc .io_error
   743 000003D8 39C8                    	cmp ax, cx
   744 000003DA 7403E9D400              	jne .invalid
   745 000003DF 5A                      	pop dx
   746 000003E0 59                      	pop cx
   747 000003E1 89D0                    	mov ax, dx
   748 000003E3 09C8                    	or ax, cx
   749 000003E5 7503E9C900              	jz .nolib
   750 000003EA 0356E2                  	add dx, word [bp + ?eldheader]
   751 000003ED 134EE4                  	adc cx, word [bp + ?eldheader + 2]
   752 000003F0 B80042                  	mov ax, 4200h
   753 000003F3 E88201                  	call seek_compressed_or_dos_or_boot_io
   754 000003F6 7303E9B800              	jc .io_error
   755                                  
   756 000003FB B90800                  	mov cx, fromwords(ELD_LIBTABLE_size_w)
   757 000003FE 29CC                    	sub sp, cx
   758 00000400 89E2                    	mov dx, sp
   759 00000402 B43F                    	mov ah, 3Fh
   760 00000404 E87101                  	call read_compressed_or_dos_or_boot_io
   761 00000407 7303E9A700              	jc .io_error
   762 0000040C 39C8                    	cmp ax, cx
   763 0000040E 7403E9A000              	jne .invalid
   764 00000413 89E7                    	mov di, sp
   765                                  
   766                                  
   767                                  
   768 00000415 31D2                    	xor dx, dx		; init to zero compression layers
   769 00000417 8B05                    	mov ax, word [di + eldltFormat]
   770                                  		; 0 = uncompressed
   771                                  		; 2 = compressed heatshrink
   772                                  		; 3 = compressed lzexedat -4
   773                                  		; 4 = compressed lzexedat -4 -l
   774 00000419 83F804                  	cmp ax, 4
   775 0000041C 7603E99200              	ja .invalid
   776 00000421 3C01                    	cmp al, 1
   777 00000423 7503E98B00              	je .invalid
   778 00000428 7214                    	jb @F
   779                                  ;reloc	mov byte [depack_format], al
   780                                  ;internaldatarelocation
   781                                  
   782 0000042A B90400                  	mov cx, 4
   783 0000042D BA[6602]                reloc	mov dx, libtab_compressed_length
   784                                  internaldatarelocation
   785 00000430 B43F                    	mov ah, 3Fh
   786 00000432 E84301                  	call read_compressed_or_dos_or_boot_io
   787 00000435 727C                    	jc .io_error
   788 00000437 39C8                    	cmp ax, cx
   789 00000439 7578                    	jne .invalid
   790                                  
   791 0000043B BA0100                  	mov dx, 1
   792                                  @@:
   793 0000043E 8B4D02                  	mov cx, word [di + eldltAmount]
   794 00000441 85C9                    	test cx, cx
   795 00000443 746E                    	jz .nolib
   796 00000445 894EF6                  	mov word [bp + ?libamount], cx
   797 00000448 8B4504                  	mov ax, word [di + eldltOffset]
   798 0000044B 0346E2                  	add ax, word [bp + ?eldheader]
   799 0000044E 8946FC                  	mov word [bp + ?liboffset], ax
   800 00000451 8B4506                  	mov ax, word [di + eldltOffset + 2]
   801 00000454 1346E4                  	adc ax, word [bp + ?eldheader + 2]
   802 00000457 8946FE                  	mov word [bp + ?liboffset + 2], ax
   803                                  
   804 0000045A 83C408                  	add sp, fromwords(ELD_LIBTABLE_size_w)
   805                                  
   806 0000045D 31D2                    	xor dx, dx
   807 0000045F 52                      	push dx
   808 00000460 52                      	push dx
   809                                  
   810                                  .looplib:
   811 00000461 8D56E8                  	lea dx, [bp + ?libentry]
   812 00000464 B90C00                  	mov cx, 12
   813 00000467 B43F                    	mov ah, 3Fh
   814 00000469 E80C01                  	call read_compressed_or_dos_or_boot_io
   815 0000046C 7245                    	jc .io_error
   816 0000046E 39C8                    	cmp ax, cx
   817 00000470 7541                    	jne .invalid
   818                                  
   819 00000472 31C9                    	xor cx, cx
   820 00000474 31D2                    	xor dx, dx
   821 00000476 B80142                  	mov ax, 4201h
   822 00000479 E8FC00                  	call seek_compressed_or_dos_or_boot_io
   823 0000047C 7235                    	jc .io_error
   824 0000047E 8946F8                  	mov word [bp + ?libnext], ax
   825 00000481 8956FA                  	mov word [bp + ?libnext + 2], dx
   826                                  
   827                                  .libname:
   828 00000484 8D76EC                  	lea si, [bp + ?libentry + 4]
   829 00000487 BF[5E02]                	mov di, namebuffer
   830                                  internaldatarelocation
   831 0000048A B90800                  	mov cx, 8
   832                                  @@:
   833 0000048D AC                      	lodsb
   834 0000048E E8D703                  	extcallcall uppercase
   835 00000491 AE                      	scasb
   836 00000492 7502                    	jne @F
   837 00000494 E2F7                    	loop @B
   838                                  @@:
   839 00000496 7508                    	jne .libskip
   840 00000498 89EC5D                  	lleave code
   841 0000049B E82A04                  	extcallcall close_ext
   842 0000049E EB1C                    	jmp insertlib
   843                                  
   844                                  .libskip:
   845 000004A0 8B56F8                  	mov dx, word [bp + ?libnext]
   846 000004A3 8B4EFA                  	mov cx, word [bp + ?libnext + 2]
   847 000004A6 B80042                  	mov ax, 4200h
   848 000004A9 E8CC00                  	call seek_compressed_or_dos_or_boot_io
   849 000004AC 7205                    	jc .io_error
   850 000004AE FF4EF6                  	dec word [bp + ?libamount]
   851 000004B1 75AE                    	jnz .looplib
   852                                  
   853                                  .io_error:
   854                                  .invalid_instance:
   855                                  .invalid:
   856                                  .invalid_check_sld:
   857                                  .ret:
   858                                  .lib_done:
   859                                  .nolib:
   860 000004B3 89EC5D                  	lleave , forcerestoresp
   861 000004B6 E80F04                  	extcallcall close_ext
   862 000004B9 E9FEFC                  	jmp detect_extension.done
   863                                  
   864                                  
   865                                  insertlib:
   866                                  .finish:
   867 000004BC BA[5E01]                	mov dx, nothinglib
   868                                  internaldatarelocation
   869 000004BF 89D7                    	mov di, dx
   870 000004C1 B9FFFF                  	mov cx, -1
   871 000004C4 31C0                    	xor ax, ax
   872 000004C6 F2AE                    	repne scasb
   873 000004C8 F7D1                    	not cx
   874 000004CA 49                      	dec cx
   875                                  
   876 000004CB A2[7302]                	mov byte [escape], al
   877                                  internaldatarelocation
   878 000004CE 51                      	push cx
   879 000004CF 89D7                    	mov di, dx
   880 000004D1 B02C                    	mov al, ','
   881 000004D3 F2AE                    	repne scasb
   882 000004D5 59                      	pop cx
   883 000004D6 741E                    	je .escape
   884 000004D8 51                      	push cx
   885 000004D9 89D7                    	mov di, dx
   886 000004DB B03B                    	mov al, ';'
   887 000004DD F2AE                    	repne scasb
   888 000004DF 59                      	pop cx
   889 000004E0 7414                    	je .escape
   890 000004E2 51                      	push cx
   891 000004E3 89D7                    	mov di, dx
   892 000004E5 B020                    	mov al, 32
   893 000004E7 F2AE                    	repne scasb
   894 000004E9 59                      	pop cx
   895 000004EA 740A                    	je .escape
   896 000004EC 51                      	push cx
   897 000004ED 89D7                    	mov di, dx
   898 000004EF B009                    	mov al, 9
   899 000004F1 F2AE                    	repne scasb
   900 000004F3 59                      	pop cx
   901 000004F4 7506                    	jne .noescape
   902                                  .escape:
   903 000004F6 F616[7302]              	not byte [escape]
   904                                  internaldatarelocation
   905 000004FA 41                      	inc cx			; opening quote
   906 000004FB 41                      	inc cx			; closing quote
   907                                  .noescape:
   908 000004FC 41                      	inc cx			; blank
   909                                  
   910 000004FD E8A003                  	extcallcall yy_reset_buf
   911                                  
   912 00000500 84ED                    	test ch, ch
   913 00000502 7403E9B3FC              	jnz .done
   914                                  
   915 00000507 BE[0100]                	mov si, relocateddata + 1
   916                                  linkdatarelocation line_in
   917 0000050A B400                    	mov ah, 0
   918 0000050C 8A04                    	mov al, byte [si]
   919 0000050E BBFE00                  	mov bx, 254
   920 00000511 29CB                    	sub bx, cx
   921 00000513 39D8                    	cmp ax, bx		; has space ?
   922 00000515 7603E9A0FC              	ja .done
   923 0000051A 000C                    	add byte [si], cl	; add length of extension
   924                                  
   925 0000051C 46                      	inc si			; -> text
   926 0000051D 01C6                    	add si, ax		; -> CR
   927 0000051F 89F7                    	mov di, si
   928 00000521 01CF                    	add di, cx		; -> destination for CR (extension length)
   929 00000523 51                          push cx
   930 00000524 8B0E[6E02]              	mov cx, word [header]
   931                                  internaldatarelocation
   932 00000528 51                      	push cx			; -> header
   933 00000529 F7D9                    	neg cx			; minus -> header
   934 0000052B 01F1                    	add cx, si		; -> CR minus -> header
   935 0000052D 41                      	inc cx			; include CR to be moved
   936 0000052E 51                      	 push cx
   937 0000052F E8B4FC                  	call moveup
   938 00000532 59                      	 pop cx
   939 00000533 5F                      	pop di			; -> trailer source (4 bytes of space)
   940 00000534 89D6                    	mov si, dx		; -> library
   941 00000536 89C3                    	mov bx, ax
   942 00000538 59                          pop cx
   943 00000539 51                      	push cx
   944 0000053A 50                      	push ax
   945 0000053B 49                      	dec cx
   946 0000053C D006[7302]              	rol byte [escape], 1
   947                                  internaldatarelocation
   948 00000540 7204                    	jc .escaped
   949 00000542 F3A4                    	rep movsb
   950 00000544 EB08                    	jmp @F
   951                                  .escaped:
   952 00000546 B022                    	mov al, '"'
   953 00000548 AA                      	stosb
   954 00000549 49                      	dec cx
   955 0000054A 49                      	dec cx
   956 0000054B F3A4                    	rep movsb
   957 0000054D AA                      	stosb
   958                                  @@:
   959 0000054E B020                    	mov al, 32
   960 00000550 AA                      	stosb
   961 00000551 58                      	pop ax
   962 00000552 59                      	pop cx
   963                                  
   964 00000553 BE[0000]                	mov si, relocateddata
   965                                  linkdatarelocation indirect_array_errfix, -2, optional
   966 00000556 85F6                    	test si, si		; not supported ?
   967 00000558 7402                    	jz @F
   968 0000055A 8B34                    	mov si, [si]		; -> errfix.eld array, or 0
   969                                  @@:
   970 0000055C 85F6                    	test si, si
   971 0000055E 7415                    	jz .transfer
   972                                  
   973 00000560 01C6                    	add si, ax		; -> array entry for CR
   974 00000562 46                      	inc si			; -> entry for byte after CR
   975 00000563 89F7                    	mov di, si
   976 00000565 01CF                    	add di, cx		; -> destination for byte after CR
   977                                  				;  (calculated from extension length)
   978 00000567 51                      	push cx
   979 00000568 8D4F01                  	lea cx, [bx + 1]	; count byte after CD
   980 0000056B E878FC                  	call moveup
   981 0000056E 59                      	pop cx
   982 0000056F FD                      	std
   983 00000570 8A04                    	mov al, [si]
   984 00000572 F3AA                    	rep stosb
   985 00000574 FC                      	cld
   986                                  
   987                                  .transfer:
   988 00000575 E942FC                  	jmp detect_extension.transfer
   989                                  
   990                                  .done equ detect_extension.done
   991                                  
   992                                  
   993                                   seek_compressed_or_dos_or_boot_io equ dos_or_boot_io
   994                                   read_compressed_or_dos_or_boot_io equ dos_or_boot_io
   995                                  
   996                                  
   997                                  dos_or_boot_io:
   998                                  %if _BOOTLDR
   999 00000578 F606[0100]40            reloc	testopt [relocateddata], nodosloaded
  1000                                  linkdatarelocation internalflags, -3
  1001 0000057D 7508                    	jnz .boot
  1002                                  %endif
  1003                                  .dos:
  1004 0000057F E8[0000]EB020000        	extcall _doscall
  1005 00000586 C3                      	retn
  1006                                  
  1007                                  %if _BOOTLDR
  1008                                  .boot:
  1009 00000587 80FC3F                  	cmp ah, 3Fh
  1010 0000058A 7508                    	jne @F
  1011 0000058C E8[0000]EB020000        	extcall yy_boot_read.bx
  1012 00000593 C3                      	retn
  1013                                  
  1014                                  @@:
  1015 00000594 3D0042                  	cmp ax, 4200h
  1016 00000597 7517                    	jne @F
  1017                                  .boot_seek_absolute:
  1018 00000599 2B16[FCFF]              reloc	sub dx, word [relocateddata - LOADDATA2 + ldCurrentSeek]
  1019                                  linkdatarelocation load_data
  1020 0000059D 1B0E[FEFF]              reloc	sbb cx, word [relocateddata - LOADDATA2 + ldCurrentSeek + 2]
  1021                                  linkdatarelocation load_data
  1022                                  
  1023                                  .boot_seek_current:
  1024 000005A1 E8[0000]EB020000        	extcall yy_boot_seek_current.bx
  1025 000005A8 A1[FCFF]                reloc	mov ax, word [relocateddata - LOADDATA2 + ldCurrentSeek]
  1026                                  linkdatarelocation load_data
  1027 000005AB 8B16[FEFF]              reloc	mov dx, word [relocateddata - LOADDATA2 + ldCurrentSeek + 2]
  1028                                  linkdatarelocation load_data
  1029 000005AF C3                      	retn
  1030                                  
  1031                                  @@:
  1032 000005B0 3D0142                  	cmp ax, 4201h
  1033 000005B3 74EC                    	je .boot_seek_current
  1034                                   %if _ELDTRAILER
  1035 000005B5 3D0242                  	cmp ax, 4202h
  1036 000005B8 750A                    	jne @F
  1037                                  .boot_seek_eof:
  1038 000005BA 0316[F4FF]              reloc	add dx, word [relocateddata - LOADDATA2 + ldFileSize]
  1039                                  linkdatarelocation load_data
  1040 000005BE 130E[F6FF]              reloc	adc cx, word [relocateddata - LOADDATA2 + ldFileSize + 2]
  1041                                  linkdatarelocation load_data
  1042 000005C2 EBD5                    	jmp .boot_seek_absolute
  1043                                   %endif
  1044                                  @@:
  1045 000005C4 E92CFC                  	jmp notfound_invalid
  1046                                  %endif
  1047                                  %endif	; _LIBSCAN
  1048                                  
  1049                                  
  1050                                  		; INP:	bx -> name to try, cx = length
  1051                                  		;	dl = zero if to attempt filename extensions
  1052                                  		;	while_buffer -> prefix, di -> after
  1053                                  		; OUT:	NC if file found,
  1054                                  		;	 while_buffer = name, di -> after NUL
  1055                                  		;	 ZR if no extension appended
  1056                                  		;	 NZ if extension appended
  1057                                  		;	CY if file not found
  1058                                  		; STT:	es = ds = ss
  1059                                  		; CHG:	si, ax
  1060                                  check_filename:
  1061 000005C7 51                      	push cx
  1062                                  
  1063 000005C8 89DE                    	mov si, bx		; ds:si -> name
  1064 000005CA F3A4                    	rep movsb		; append the name
  1065 000005CC 57                      	push di			; on stack: at initial terminator
  1066 000005CD BE[0400]                	mov si, msg.extensions_eld
  1067                                  internaldatarelocation
  1068 000005D0 D006[0000]              	rol byte [relocateddata], 1
  1069                                  linkdatarelocation yy_is_script
  1070 000005D4 7303                    	jnc @F
  1071 000005D6 BE[0F00]                	mov si, msg.extensions_sld
  1072                                  internaldatarelocation		; si -> extensions to try
  1073                                  @@:
  1074 000005D9 B000                    	mov al, 0
  1075 000005DB AA                      	stosb
  1076                                  			; cx = 0
  1077                                  .loop:
  1078 000005DC B80043                  	mov ax, 4300h		; get attributes
  1079 000005DF 52                      	push dx
  1080 000005E0 51                      	push cx
  1081 000005E1 BA[0000]                	mov dx, relocateddata	; ds:dx -> pathname to try
  1082                                  linkdatarelocation while_buffer
  1083                                  %if _BOOTLDR
  1084 000005E4 D006[7202]              	rol byte [isbootloaded], 1
  1085                                  internaldatarelocation
  1086 000005E8 7305                    	jnc @F
  1087 000005EA E83100                  	call boot_does_file_exist
  1088 000005ED EB0C                    	jmp @FF
  1089                                  @@:
  1090                                  %endif
  1091 000005EF F9                      	stc
  1092 000005F0 E8DD02                  	extcallcall _doscall	; try to get attributes
  1093 000005F3 7206                    	jc @F			; not found --> CY
  1094 000005F5 F6C110                  	test cl, 10h		; directory ?
  1095 000005F8 7401                    	jz @F			; no --> NC
  1096 000005FA F9                      	stc			; yes, handle as not found: CY
  1097                                  @@:
  1098 000005FB 59                      	pop cx
  1099 000005FC 5A                      	pop dx
  1100 000005FD 7317                    	jnc .ret_NC_cx_ZF	; --> (NC)
  1101                                  
  1102 000005FF 84D2                    	test dl, dl		; had an extension originally ?
  1103 00000601 7517                    	jnz .ret_CY		; yes, do not try to append one -->
  1104 00000603 D006[0000]              	rol byte [guessextension], 1
  1105                                  internaldatarelocation
  1106 00000607 7311                    	jnc .ret_CY		; if no guessing extension -->
  1107                                  
  1108 00000609 5F                      	pop di
  1109 0000060A 57                      	push di
  1110 0000060B 803C00                  	cmp byte [si], 0	; last attempt done ?
  1111 0000060E 740A                    	je .ret_CY		; yes -->
  1112 00000610 A5                      	movsw			; ".x"
  1113 00000611 A5                      	movsw			; "LD"
  1114 00000612 A4                      	movsb			; NUL
  1115 00000613 41                      	inc cx		; cx = nonzero
  1116 00000614 EBC6                    	jmp .loop
  1117                                  
  1118                                  .ret_NC_cx_ZF:
  1119 00000616 85C9                    	test cx, cx
  1120 00000618 EB01                    	jmp @F
  1121                                  .ret_CY:
  1122 0000061A F9                      	stc			; CY
  1123                                  @@:
  1124 0000061B 58                      	pop ax			; (discard)
  1125 0000061C 59                      	pop cx
  1126 0000061D C3                      	retn
  1127                                  
  1128                                  
  1129                                  %if _BOOTLDR
  1130                                  		; INP:	ds:dx -> pathname
  1131                                  		; OUT:	CY if file does not exist
  1132                                  		;	NC if file exists
  1133                                  		; CHG:	ax, cx, dx
  1134                                  		; STT:	es = ds = ss
  1135                                  boot_does_file_exist:
  1136 0000061E 56                      	push si
  1137 0000061F 57                      	push di
  1138 00000620 53                      	push bx
  1139                                  
  1140 00000621 89D3                    	mov bx, dx
  1141                                  
  1142 00000623 E8[0000]EB020000        	extcall yy_boot_init_dir2
  1143 0000062A C606[0000]00            reloc	mov byte [relocateddata], 0
  1144                                  linkdatarelocation load_check_dir_attr, -3
  1145 0000062F 8B36[0000]              reloc	mov si, word [relocateddata]
  1146                                  linkdatarelocation load_yyname_input
  1147 00000633 803C2F                  	cmp byte [si], '/'
  1148 00000636 7501                    	jne @F
  1149 00000638 46                      	inc si
  1150                                  @@:
  1151 00000639 803C00                  	cmp byte [si], 0
  1152 0000063C 7507                    	jne @F
  1153 0000063E E8[0000]EB020000        	extcall ..@yy_filename_empty
  1154                                  @@:
  1155 00000645 16                      	 push ss
  1156 00000646 07                      	 pop es
  1157 00000647 E87C00                  	call boot_parse_name
  1158 0000064A 3C2F                    	cmp al, '/'
  1159 0000064C 7509                    	jne @F
  1160 0000064E C606[0000]10            reloc	mov byte [relocateddata], ATTR_DIRECTORY
  1161                                  linkdatarelocation load_check_dir_attr, -3
  1162 00000653 8936[0000]              reloc	mov word [relocateddata], si
  1163                                  linkdatarelocation load_yyname_next
  1164                                  @@:
  1165                                  
  1166 00000657 BFFFFF                  	mov di, -1
  1167 0000065A 89FE                    	mov si, di
  1168 0000065C 897EF4                  	mov [bp + lsvFATSector], di
  1169 0000065F 8976F6                  	mov [bp + lsvFATSector + 2], si
  1170                                  
  1171 00000662 31C0                    	xor ax, ax
  1172 00000664 31D2                    	xor dx, dx
  1173                                  
  1174                                  scan_dir_yyname_loop:
  1175 00000666 8946EC                  	mov word [bp + ldDirCluster], ax
  1176 00000669 8956EE                  	mov word [bp + ldDirCluster + 2], dx
  1177                                  
  1178 0000066C 16                      	push ss
  1179 0000066D 07                      	pop es
  1180 0000066E BB[0000]                reloc	mov bx, relocateddata
  1181                                  linkdatarelocation load_yy_direntry
  1182                                  
  1183 00000671 C706[0000][0000]        reloc2	mov word [relocateddata], relocateddata
  1184                                  linkdatarelocation handle_scan_dir_not_found, -4
  1185                                  ;linkdatarelocation near_transfer_ext_entry
  1186                                  linkdatarelocation dmycmd
  1187 00000677 E8[0000]EB020000        	extcall scan_dir_aux
  1188 0000067E 7251                    	jc boot_does_file_exist_NO
  1189                                  
  1190 00000680 803E[0000]10            reloc	cmp byte [relocateddata], ATTR_DIRECTORY
  1191                                  linkdatarelocation load_check_dir_attr, -3
  1192                                  	;jne got_single_yyentry
  1193 00000685 7549                    	jne boot_does_file_exist_YES
  1194                                  
  1195 00000687 56                      	push si
  1196 00000688 57                      	push di
  1197 00000689 C606[0000]00            reloc	mov byte [relocateddata], 0
  1198                                  linkdatarelocation load_check_dir_attr, -3
  1199 0000068E 8B36[0000]              reloc	mov si, word [relocateddata]
  1200                                  linkdatarelocation load_yyname_next
  1201 00000692 803C00                  	cmp byte [si], 0
  1202 00000695 7507                    	jne @F
  1203 00000697 E8[0000]EB020000        	extcall ..@yy_filename_empty
  1204                                  @@:
  1205 0000069E 06                      	push es
  1206 0000069F 16                      	 push ss
  1207 000006A0 07                      	 pop es
  1208 000006A1 E82200                  	call boot_parse_name
  1209 000006A4 07                      	pop es
  1210 000006A5 3C2F                    	cmp al, '/'
  1211 000006A7 7509                    	jne @F
  1212 000006A9 C606[0000]10            reloc	mov byte [relocateddata], ATTR_DIRECTORY
  1213                                  linkdatarelocation load_check_dir_attr, -3
  1214 000006AE 8936[0000]              reloc	mov word [relocateddata], si
  1215                                  linkdatarelocation load_yyname_next
  1216                                  @@:
  1217 000006B2 5F                      	pop di
  1218 000006B3 5E                      	pop si
  1219                                  
  1220 000006B4 31D2                    	xor dx, dx
  1221 000006B6 268B471A                	mov ax, [es:bx + deClusterLow]
  1222                                  				; = first cluster (not FAT32)
  1223 000006BA 807EE620                	cmp byte [bp + ldFATType], 32
  1224 000006BE 7504                    	jne @F
  1225 000006C0 268B5714                	mov dx, [es:bx + deClusterHigh]
  1226                                  				; dx:ax = first cluster (FAT32)
  1227                                  @@:
  1228                                  
  1229 000006C4 EBA0                    	jmp scan_dir_yyname_loop
  1230                                  
  1231                                  boot_parse_name:
  1232 000006C6 E80F02                  	extcallcall boot_parse_fn	; get next pathname
  1233                                  
  1234 000006C9 C706[0000][0000]        reloc2	mov word [relocateddata], relocateddata
  1235                                  linkdatarelocation handle_scan_dir_entry, -4
  1236                                  linkdatarelocation scan_dir_entry
  1237                                  
  1238 000006CF C3                      	retn
  1239                                  
  1240                                  
  1241                                  boot_does_file_exist_YES:
  1242 000006D0 A8                      	db __TEST_IMM8		; NC, skip stc
  1243                                  boot_does_file_exist_NO:
  1244 000006D1 F9                      	stc
  1245                                  
  1246 000006D2 9C                      	pushf
  1247 000006D3 8026[0300]EF            reloc	clropt [relocateddata], dif3_auxbuff_guarded_1
  1248                                  linkdatarelocation internalflags3, -3
  1249 000006D8 9D                      	popf
  1250                                  
  1251 000006D9 5B                      	pop bx
  1252 000006DA 5F                      	pop di
  1253 000006DB 5E                      	pop si
  1254 000006DC C3                      	retn
  1255                                  %endif
  1256                                  
  1257                                  
  1258                                  %if _LIBSCAN
  1259                                  libcontrol:
  1260 000006DD E87801                  	extcallcall skipcomma
  1261 000006E0 E8FD01                  	extcallcall iseol?
  1262 000006E3 740C                    	je .display
  1263 000006E5 4E                      	dec si
  1264 000006E6 BA[9800]                	mov dx, msg.set
  1265                                  internaldatarelocation
  1266 000006E9 E87401                  	extcallcall isstring?
  1267 000006EC 7412                    	je .set
  1268 000006EE E9FF01                  	jmp error
  1269                                  
  1270                                  .display:
  1271 000006F1 BA[5E01]                	mov dx, nothinglib
  1272                                  internaldatarelocation
  1273 000006F4 E8A101                  	extcallcall putsz
  1274 000006F7 BA[7700]                	mov dx, msg.linebreak
  1275                                  internaldatarelocation
  1276 000006FA E89B01                  	extcallcall putsz
  1277 000006FD E87801                  	extcallcall cmd3
  1278                                  
  1279                                  .set:
  1280 00000700 E85501                  	extcallcall skipcomma
  1281 00000703 E8DA01                  	extcallcall iseol?
  1282 00000706 7508                    	jne @F
  1283 00000708 31C0                    	xor ax, ax
  1284 0000070A A2[5E01]                	mov byte [nothinglib], al
  1285                                  internaldatarelocation
  1286 0000070D E86801                  	extcallcall cmd3
  1287                                  @@:
  1288                                  
  1289 00000710 BB[0000]                	mov bx, relocateddata
  1290                                  linkdatarelocation line_out
  1291                                  
  1292                                  		; INP:	si - 1 -> text
  1293                                  		;	bx -> buffer to store to, 256 Bytes
  1294                                  		; OUT:	al = first text byte of trailer
  1295                                  		;	si - 1 -> trailer
  1296                                  		;	byte [si - 1] may be NUL written there
  1297                                  		;	 in case that INP:bx == INP:si - 1
  1298                                  		;	bx -> pathname, NUL-terminated
  1299                                  		;	di -> terminator NUL
  1300                                  		;	bx may point into a config path buffer
  1301 00000713 E87A01                  	extcallcall yy_common_parse_name_bx_buffer
  1302                                  				; si + 1 -> trailer, bx -> NUL-terminated pathname
  1303 00000716 E8CF01                  	extcallcall skipwh0
  1304 00000719 E85401                  	extcallcall chkeol
  1305                                  
  1306 0000071C 89F9                    	mov cx, di
  1307 0000071E 41                      	inc cx
  1308 0000071F 29D9                    	sub cx, bx
  1309 00000721 81F90001                	cmp cx, nothinglib.end - nothinglib
  1310 00000725 7603E9C601              	ja error
  1311                                  
  1312 0000072A BF[5E01]                	mov di, nothinglib
  1313                                  internaldatarelocation
  1314 0000072D 89DE                    	mov si, bx
  1315 0000072F F3A4                    	rep movsb
  1316 00000731 E84401                  	extcallcall cmd3
  1317                                  %endif
  1318                                  
  1319                                  
  1320                                  		; INP:	si -> separator
  1321                                  		;	bx -> option byte to modify
  1322                                  		;	cx -> message for display
  1323                                  option:
  1324 00000734 E82101                  	extcallcall skipcomma
  1325 00000737 E8A601                  	extcallcall iseol?
  1326 0000073A 741C                    	je .display
  1327 0000073C 4E                      	dec si
  1328 0000073D BA[8600]                	mov dx, msg.on
  1329                                  internaldatarelocation
  1330 00000740 E81D01                  	extcallcall isstring?
  1331 00000743 7428                    	je .on
  1332 00000745 BA[8900]                	mov dx, msg.off
  1333                                  internaldatarelocation
  1334 00000748 E81501                  	extcallcall isstring?
  1335 0000074B 7429                    	je .off
  1336 0000074D BA[8D00]                	mov dx, msg.toggle
  1337                                  internaldatarelocation
  1338 00000750 E80D01                  	extcallcall isstring?
  1339 00000753 742A                    	je .toggle
  1340                                  .error:
  1341 00000755 E89801                  	extcallcall error
  1342                                  
  1343                                  .display:
  1344 00000758 89CA                    	mov dx, cx
  1345 0000075A E83B01                  	extcallcall putsz
  1346 0000075D BA[B600]                	mov dx, msg.optionon
  1347                                  internaldatarelocation
  1348 00000760 D007                    	rol byte [bx], 1
  1349 00000762 7203                    	jc @F
  1350 00000764 BA[C000]                	mov dx, msg.optionoff
  1351                                  internaldatarelocation
  1352                                  @@:
  1353 00000767 E82E01                  	extcallcall putsz
  1354                                  .cmd3:
  1355 0000076A E80B01                  	extcallcall cmd3
  1356                                  
  1357                                  .on:
  1358 0000076D AC                      	lodsb
  1359 0000076E E8FF00                  	extcallcall chkeol
  1360 00000771 C607FF                  	mov byte [bx], 0FFh
  1361 00000774 EBF4                    	jmp .cmd3
  1362                                  
  1363                                  .off:
  1364 00000776 AC                      	lodsb
  1365 00000777 E8F600                  	extcallcall chkeol
  1366 0000077A C60700                  	mov byte [bx], 0
  1367 0000077D EBEB                    	jmp .cmd3
  1368                                  
  1369                                  .toggle:
  1370 0000077F AC                      	lodsb
  1371 00000780 E8ED00                  	extcallcall chkeol
  1372 00000783 F617                    	not byte [bx]
  1373 00000785 EBE3                    	jmp .cmd3
  1374                                  
  1375                                  
  1376                                  %if _LIBSCAN
  1377                                  		; INP:	ds:bx -> filename
  1378                                  		; OUT:	NC if file opened,
  1379                                  		;	 ax = file handle
  1380                                  		;	CY if open failed
  1381                                  		; STT:	ds = es = ss = debugger data selector/segment
  1382                                  open_file:
  1383 00000787 89DF                    	mov di, bx
  1384 00000789 E84000                  	call .setup_opencreate			; ds:si -> pathname
  1385 0000078C B86C71                  	mov ax, 716Ch				; LFN open-create
  1386 0000078F 57                      	push di
  1387 00000790 31FF                    	xor di, di				; alias hint
  1388 00000792 F9                      	stc
  1389 00000793 E83A01                  	extcallcall _doscall
  1390 00000796 5F                      	pop di
  1391 00000797 7332                    	jnc .got		; LFN call succeeded -->
  1392                                  
  1393                                  		; Early case for no-LFN-interface available.
  1394                                  	; cmp ax, 1
  1395                                  	; je .try_sfn
  1396 00000799 3D0071                  	cmp ax, 7100h
  1397 0000079C 7405                    	je .try_sfn
  1398                                  
  1399 0000079E E85701                  	extcallcall yy_check_lfn
  1400 000007A1 7322                    	jnc .error		; if LFN interface is available, actual error
  1401                                  				; if LFN interface is not available, try SFN
  1402                                  
  1403                                  .try_sfn:
  1404 000007A3 E82600                  	call .setup_opencreate
  1405 000007A6 B8006C                  	mov ax, 6C00h				; Open-create
  1406 000007A9 F9                      	stc
  1407 000007AA E82301                  	extcallcall _doscall
  1408 000007AD 731C                    	jnc .got
  1409                                  
  1410 000007AF 83F801                  	cmp ax, 1
  1411 000007B2 7405                    	je .try_old_open
  1412 000007B4 3D006C                  	cmp ax, 6C00h
  1413 000007B7 750C                    	jne .error
  1414                                  
  1415                                  .try_old_open:
  1416 000007B9 88D8                    	mov al, bl				; access and sharing modes
  1417 000007BB B43D                    	mov ah, 3Dh				; Open
  1418 000007BD 89F2                    	mov dx, si				; -> filename
  1419 000007BF F9                      	stc
  1420 000007C0 E80D01                  	extcallcall _doscall
  1421 000007C3 7306                    	jnc .got
  1422                                  
  1423                                  .error:
  1424 000007C5 E8E800                  	extcallcall retry_open_scriptspath
  1425 000007C8 74BD                    	je open_file
  1426 000007CA F9                      	stc
  1427                                  .got:
  1428 000007CB C3                      	retn
  1429                                  
  1430                                  .setup_opencreate:
  1431 000007CC 89FE                    	mov si, di				; -> filename
  1432 000007CE BBA060                  	mov bx, 0110_0000_1010_0000b		; Auto-commit, no int 24h
  1433                                  						; No inherit
  1434                                  						; DENY WRITE, Read-only
  1435 000007D1 31C9                    	xor cx, cx				; create attribute
  1436 000007D3 BA0100                  	mov dx, 0000_0000_0000_0001b		; no create / open, no truncate
  1437 000007D6 C3                      	retn
  1438                                  %endif
  1439                                  
  1440                                  
  1441                                  get_es_ext:
  1442 000007D7 8E06[0000]              	mov es, word [relocateddata]
  1443                                  linkdatarelocation extdssel
  1444 000007DB E82201                  	extcallcall ispm
  1445 000007DE 7404                    	jz @F
  1446 000007E0 8E06[0000]              	mov es, word [relocateddata]
  1447                                  linkdatarelocation extseg
  1448                                  @@:
  1449 000007E4 C3                      	retn
  1450                                  
  1451                                  
  1452                                  uninstall:
  1453 000007E5 AC                      	lodsb
  1454 000007E6 E88700                  	extcallcall chkeol
  1455                                  
  1456 000007E9 E8EBFF                  	call get_es_ext
  1457                                  
  1458 000007EC 06                      	push es
  1459 000007ED 1F                      	pop ds
  1460 000007EE 31DB                    	xor bx, bx		; = 0 (no prior, modify ext_command_handler)
  1461 000007F0 BF[2C00]                	mov di, command		; di -> us
  1462                                  internalcoderelocation
  1463 000007F3 368B36[0000]            	mov si, word [ss:relocateddata]
  1464                                  linkdatarelocation ext_command_handler
  1465                                  				; si -> first
  1466 000007F8 85F6                    	test si, si		; none installed ?
  1467 000007FA 7450                    	jz .error		; error -->
  1468                                  
  1469                                  .loop:
  1470 000007FC 39F7                    	cmp di, si		; found ?
  1471 000007FE 740D                    	je .bx			; yes, use bx -->
  1472 00000800 89F3                    	mov bx, si		; bx -> prior handler
  1473 00000802 AD                      	lodsw			; skip entrypoint jmp strict short
  1474 00000803 AC                      	lodsb			; get first byte of chainer
  1475 00000804 3CE9                    	cmp al, 0E9h		; expecting jmp near ?
  1476 00000806 7544                    	jne .error		; no, error -->
  1477 00000808 AD                      	lodsw			; get rel16 displacement
  1478 00000809 01C6                    	add si, ax		; -> next handler
  1479 0000080B EBEF                    	jmp .loop
  1480                                  
  1481                                  .bx:
  1482 0000080D 85DB                    	test bx, bx		; any prior ?
  1483 0000080F 751A                    	jnz .bxnz		; yes -->
  1484 00000811 AF                      	scasw			; skip entrypoint jmp strict short
  1485 00000812 803DE8                  	cmp byte [di], 0E8h	; is it a call to cmd3_not_ext ?
  1486 00000815 7507                    	jne @F			; no -->
  1487                                  				; yes, reset ext_command_handler to zero
  1488                                  .setbx:
  1489 00000817 36891E[0000]            	mov word [ss:relocateddata], bx
  1490                                  linkdatarelocation ext_command_handler
  1491 0000081C EB1E                    	jmp .done
  1492                                  
  1493                                  @@:
  1494 0000081E 803DE9                  	cmp byte [di], 0E9h	; validate
  1495 00000821 7529                    	jne .error		; failure -->
  1496 00000823 47                      	inc di			; -> rel16 displacement
  1497 00000824 8B1D                    	mov bx, word [di]	; get displacement
  1498 00000826 AF                      	scasw			; -> after jmp near
  1499 00000827 01FB                    	add bx, di		; -> next handler
  1500 00000829 EBEC                    	jmp .setbx		; set ext_command_handler to next
  1501                                  
  1502                                  .bxnz:
  1503 0000082B 89DE                    	mov si, bx		; -> prior handler with us as downlink
  1504 0000082D 87FE                    	xchg di, si		; si -> ours, di -> prior
  1505 0000082F A7                      	cmpsw			; skip entrypoint jmp strict short
  1506 00000830 A4                      	movsb			; copy 0E8h/0E9h
  1507 00000831 AD                      	lodsw			; ax = near rel16 displacement
  1508 00000832 01F0                    	add ax, si		; add in our base (= absolute offset)
  1509 00000834 29F8                    	sub ax, di
  1510 00000836 48                      	dec ax
  1511 00000837 48                      	dec ax			; subtract new base (= relative displacement)
  1512 00000838 AB                      	stosw			; store new rel16 displacement
  1513 00000839 A5                      	movsw			; jmp strict short
  1514 0000083A A5                      	movsw			; linkcall target
  1515 0000083B A4                      	movsb			; trailer
  1516                                  .done:
  1517 0000083C 8026[1000]FE            	clropt [code + eldiFlags], eldifResident
  1518                                  internalcoderelocation -3	; mark block as free
  1519 00000841 BA[2801]                	mov dx, msg.uninstall_done
  1520                                  internaldatarelocation
  1521                                  @@:
  1522 00000844 16                      	push ss
  1523 00000845 1F                      	pop ds
  1524 00000846 E84F00                  	extcallcall putsz
  1525 00000849 E82C00                  	extcallcall cmd3	; return
  1526                                  
  1527                                  .error:
  1528 0000084C B8010E                  	mov ax, 0E01h
  1529 0000084F E8B600                  	extcallcall setrc
  1530 00000852 BA[3F01]                	mov dx, msg.uninstall_error
  1531                                  internaldatarelocation
  1532 00000855 EBED                    	jmp @B
  1533                                  
  1534                                  
  1535 00000857 90E8[0000]EB020000-     	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
  1535 0000085F C3E8[0000]EB020000-
  1535 00000867 C3E8[0000]EB020000-
  1535 0000086F C3E8[0000]EB020000-
  1535 00000877 C3E8[0000]EB020000-
  1535 0000087F C3E8[0000]EB020000-
  1535 00000887 C3E8[0000]EB020000-
  1535 0000088F C3E8[0000]EB020000-
  1535 00000897 C3E8[0000]EB020000-
  1535 0000089F C3E8[0000]EB020000-
  1535 000008A7 C3E8[0000]EB020000-
  1535 000008AF C3E8[0000]EB020000-
  1535 000008B7 C3E8[0000]EB020000-
  1535 000008BF C3E8[0000]EB020000-
  1535 000008C7 C3E8[0000]EB020000-
  1535 000008CF C3E8[0000]EB020000-
  1535 000008D7 C3E8[0000]EB020000-
  1535 000008DF C3E8[0000]EB020000-
  1535 000008E7 C3E8[0000]EB020000-
  1535 000008EF C3E8[0000]EB020000-
  1535 000008F7 C3E8[0000]EB020000-
  1535 000008FF C3E8[0000]EB020000-
  1535 00000907 C3E8[0000]EB020000-
  1535 0000090F C3                 
  1536                                  
  1537                                  endinstalled equ ($ + CODEFIXUP + 15) & ~15
  1538                                  
  1539                                  
  1540                                  start:
  1541 00000910 8CC3                    	mov bx, es
  1542 00000912 16                      	 push ss
  1543 00000913 07                      	 pop es
  1544                                  
  1545 00000914 E841FF                  	call skipcomma
  1546 00000917 4E                      	dec si
  1547 00000918 BA[0000]                	mov dx, relocateddata
  1548                                  linkdatarelocation msg.install
  1549 0000091B E842FF                  	call isstring?
  1550 0000091E 742F                    	je install
  1551 00000920 BA[7301]                	mov dx, msg.help
  1552                                  internaldatarelocation
  1553 00000923 E872FF                  	call putsz
  1554 00000926 E80300                  	call uninstall_oneshot
  1555 00000929 31C0                    	xor ax, ax
  1556 0000092B CB                      	retf
  1557                                  
  1558                                  
  1559                                  uninstall_oneshot:
  1560 0000092C 36F606[0000]01          	testopt [ss:relocateddata], 1
  1561                                  linkdatarelocation options7, -3
  1562 00000932 751A                    	jnz @F
  1563                                  
  1564 00000934 2EA1[0200]              	mov ax, word [cs:code + eldiEndCode]
  1565                                  internalcoderelocation
  1566 00000938 2E2B06[0000]            	sub ax, word [cs:code + eldiStartCode]
  1567                                  internalcoderelocation
  1568 0000093D 2906[0000]              	sub word [relocateddata], ax
  1569                                  linkdatarelocation extseg_used
  1570                                  
  1571 00000941 2EA1[0600]              	mov ax, word [cs:code + eldiEndData]
  1572                                  internalcoderelocation
  1573 00000945 2E2B06[0400]            	sub ax, word [cs:code + eldiStartData]
  1574                                  internalcoderelocation
  1575 0000094A 2906[0000]              	sub word [relocateddata], ax
  1576                                  linkdatarelocation extdata_used
  1577                                  @@:
  1578 0000094E C3                      	retn
  1579                                  
  1580                                  
  1581                                  	usesection DATA
  1582                                  
  1583 00000000 FF                      guessextension:		db 0FFh
  1584 00000001 FF                      warnextension:		db 0FFh
  1585                                  %if _LIBSCAN
  1586 00000002 00                      debuglib:		db 0
  1587                                  %endif
  1588                                  
  1589                                  msg:
  1590 00000003 00                      	align 2, db 0
  1591                                  .extensions_eld:
  1592 00000004 2E454C4400              		asciz ".ELD"
  1593 00000009 2E584C4400              		asciz ".XLD"
  1594 0000000E 00                      		db 0
  1595                                  .extensions_sld:
  1596 0000000F 2E534C4400              		asciz ".SLD"
  1597 00000014 00                      		db 0
  1598                                  .extension_warning:
  1599 00000015 5761726E696E672C20-     		asciz "Warning, unknown filename extension specified!",13,10
  1599 0000001E 756E6B6E6F776E2066-
  1599 00000027 696C656E616D652065-
  1599 00000030 7874656E73696F6E20-
  1599 00000039 737065636966696564-
  1599 00000042 210D0A00           
  1600                                  %if _LIBSCAN
  1601 00000046 4E6F7468696E672066-     .nothingfound.1:	asciz "Nothing found in extname ",'"'
  1601 0000004F 6F756E6420696E2065-
  1601 00000058 78746E616D65202200 
  1602 00000061 222C20747279696E67-     .nothingfound.2:	asciz '", trying with lib "'
  1602 0000006A 2077697468206C6962-
  1602 00000073 202200             
  1603 00000076 22                      .nothingfound.3:	db '"'
  1604 00000077 0D0A00                  .linebreak:		asciz 13,10
  1605                                  %endif
  1606 0000007A 45585400                .ext:			asciz "EXT"
  1607 0000007E 4558544E414D4500        .extname:		asciz "EXTNAME"
  1608 00000086 4F4E00                  .on:			asciz "ON"
  1609 00000089 4F464600                .off:			asciz "OFF"
  1610 0000008D 544F47474C4500          .toggle:		asciz "TOGGLE"
  1611                                  %if _LIBSCAN
  1612 00000094 4C494200                .lib:			asciz "LIB"
  1613 00000098 53455400                .set:			asciz "SET"
  1614                                  %endif
  1615 0000009C 475545535345585400      .guessext:		asciz "GUESSEXT"
  1616 000000A5 5741524E45585400        .warnext:		asciz "WARNEXT"
  1617                                  %if _LIBSCAN
  1618 000000AD 44454255474C494200      .debuglib:		asciz "DEBUGLIB"
  1619                                  %endif
  1620 000000B6 206973204F4E2E0D0A-     .optionon:		asciz " is ON.",13,10
  1620 000000BF 00                 
  1621 000000C0 206973204F46462E0D-     .optionoff:		asciz " is OFF.",13,10
  1621 000000C9 0A00               
  1622 000000CB 4775657373696E6720-     .guessextoption:	asciz "Guessing EXT/Y filename extension"
  1622 000000D4 4558542F592066696C-
  1622 000000DD 656E616D6520657874-
  1622 000000E6 656E73696F6E00     
  1623 000000ED 5761726E696E67206F-     .warnextoption:		asciz "Warning on unknown EXT/Y filename extension"
  1623 000000F6 6E20756E6B6E6F776E-
  1623 000000FF 204558542F59206669-
  1623 00000108 6C656E616D65206578-
  1623 00000111 74656E73696F6E00   
  1624                                  %if _LIBSCAN
  1625 00000119 4465627567204C4942-     .debugliboption:	asciz "Debug LIB scan"
  1625 00000122 207363616E00       
  1626                                  %endif
  1627 00000128 4558544E414D452075-     .uninstall_done:	db "EXTNAME uninstalled."
  1627 00000131 6E696E7374616C6C65-
  1627 0000013A 642E               
  1628                                  %if _ELD_RECLAIM_HINT
  1629                                  			db " (Don't forget to use reclaim.eld)"
  1630                                  %endif
  1631 0000013C 0D0A00                  			asciz 13,10
  1632 0000013F 4558544E414D452075-     .uninstall_error:	asciz "EXTNAME unable to uninstall!",13,10
  1632 00000148 6E61626C6520746F20-
  1632 00000151 756E696E7374616C6C-
  1632 0000015A 210D0A00           
  1633                                  
  1634                                  uinit_data: equ $
  1635                                  
  1636 0000015E 4558544E414D452069-     .installed:	asciz "EXTNAME installed.",13,10
  1636 00000167 6E7374616C6C65642E-
  1636 00000170 0D0A00             
  1637 00000173 496E7374616C6C2074-     .help:		db "Install this ELD using the INSTALL keyword parameter.",13,10
  1637 0000017C 68697320454C442075-
  1637 00000185 73696E672074686520-
  1637 0000018E 494E5354414C4C206B-
  1637 00000197 6579776F7264207061-
  1637 000001A0 72616D657465722E0D-
  1637 000001A9 0A                 
  1638 000001AA 0D0A                    		db 13,10
  1639 000001AC 52756E6E696E672045-     		db "Running EXT or Y command will invoke filename extension guessing.",13,10
  1639 000001B5 5854206F7220592063-
  1639 000001BE 6F6D6D616E64207769-
  1639 000001C7 6C6C20696E766F6B65-
  1639 000001D0 2066696C656E616D65-
  1639 000001D9 20657874656E73696F-
  1639 000001E2 6E206775657373696E-
  1639 000001EB 672E0D0A           
  1640 000001EF 52756E206173204558-     		db "Run as EXTNAME keyword [ON|OFF|TOGGLE] to configure this ELD,",13,10
  1640 000001F8 544E414D45206B6579-
  1640 00000201 776F7264205B4F4E7C-
  1640 0000020A 4F46467C544F47474C-
  1640 00000213 455D20746F20636F6E-
  1640 0000021C 666967757265207468-
  1640 00000225 697320454C442C0D0A 
  1641 0000022E 207768657265206B65-     		db " where keyword is one of WARNEXT, GUESSEXT.",13,10
  1641 00000237 79776F726420697320-
  1641 00000240 6F6E65206F66205741-
  1641 00000249 524E4558542C204755-
  1641 00000252 4553534558542E0D0A 
  1642 0000025B 52756E206173204558-     		db "Run as EXTNAME UNINSTALL to uninstall this ELD.",13,10
  1642 00000264 544E414D4520554E49-
  1642 0000026D 4E5354414C4C20746F-
  1642 00000276 20756E696E7374616C-
  1642 0000027F 6C207468697320454C-
  1642 00000288 442E0D0A           
  1643 0000028C 00                      		asciz
  1644                                  
  1645 0000028D 00<rep 3h>              	align 16, db 0
  1646                                  init_data_end:
  1647                                  data_size equ $ - datastart
  1648                                  transient_data_size equ data_size
  1649                                  
  1650                                  	absolute uinit_data
  1651                                  
  1652                                  	alignb 2
  1653                                  %if _LIBSCAN
  1654 0000015E <res 100h>              nothinglib:			resb 256
  1655                                  .end:
  1656 0000025E ????????????????        namebuffer:			resb 8
  1657 00000266 ????????                libtab_compressed_length:	resd 1
  1658 0000026A ????                    nothingsp:			resw 1
  1659 0000026C ????                    nothingoffset:			resw 1
  1660                                  
  1661 0000026E ????                    header:			resw 1
  1662                                  %endif
  1663 00000270 ????                    trailer:		resw 1
  1664 00000272 ??                      isbootloaded:		resb 1
  1665                                  %if _LIBSCAN
  1666 00000273 ??                      escape:			resb 1
  1667                                  
  1668                                  %if _DATABUFFER
  1669 00000274 <res Ch>                	alignb 16
  1670                                  databuffer:
  1671 00000280 <res 200h>              	resb 512
  1672                                  %endif
  1673                                  %endif
  1674                                  
  1675                                  	alignb 16
  1676                                  resident_data_end:
  1677                                  uinit_data_end:
  1678                                  resident_data_size equ resident_data_end - datastart
  1679                                  
  1680                                  %if uinit_data_end >= init_data_end
  1681                                   total_data_size equ $ - datastart
  1682                                  %else
  1683                                   total_data_size equ init_data_end - datastart
  1684                                  %endif
  1685                                  %assign _DATA_SIZE total_data_size
  1686                                  
  1687                                  
  1688                                  	usesection CODE
  1689                                  
  1690                                  install:
  1691 0000094F AC                      	lodsb
  1692 00000950 E8[0000]EB020000        	extcall chkeol
  1693                                  
  1694                                  	houdini
  1695 00000957 8EC3                    	mov es, bx		; => ext seg (writable)
  1696                                  
  1697 00000959 B89000                  	mov ax, endresident - endinstalled
  1698 0000095C 262906[0200]            	sub word [es:code + eldiEndCode], ax
  1699                                  internalcoderelocation		; adjust size
  1700 00000961 2906[0000]              	sub word [relocateddata], ax
  1701                                  linkdatarelocation extseg_used	; adjust size
  1702                                  
  1703                                  %if (transient_data_size - resident_data_size) > 0
  1704                                  	mov ax, transient_data_size - resident_data_size
  1705                                  	sub word [es:code + eldiEndData], ax
  1706                                  internalcoderelocation		; adjust size
  1707                                  	sub word [relocateddata], ax
  1708                                  linkdatarelocation extdata_used	; adjust size
  1709                                  %endif
  1710                                  
  1711 00000965 8B1E[0000]              	mov bx, word [relocateddata]
  1712                                  linkdatarelocation ext_command_handler
  1713                                  				; -> prior
  1714 00000969 BF[2C00]                	mov di, command		; -> our handler
  1715                                  internalcoderelocation
  1716 0000096C 85DB                    	test bx, bx		; installing as first ?
  1717 0000096E 740A                    	jz .only_first		; yes, simple --> (leave as extcall cmd3_not_ext)
  1718 00000970 AF                      	scasw			; skip entrypoint jmp strict short
  1719 00000971 B0E9                    	mov al, 0E9h		; = jmp near opcode
  1720 00000973 AA                      	stosb			; store
  1721 00000974 93                      	xchg ax, bx		; ax -> next handler
  1722 00000975 29F8                    	sub ax, di
  1723 00000977 48                      	dec ax
  1724 00000978 48                      	dec ax			; ax = ax - (di + 2)
  1725 00000979 AB                      	stosw			; store our downlink as rel16 displacement
  1726                                  
  1727                                  .only_first:
  1728 0000097A 26800E[1000]01          	setopt [es:code + eldiFlags], eldifResident
  1729                                  internalcoderelocation -3	; mark block as resident
  1730 00000980 C706[0000][2C00]        	mov word [relocateddata], command
  1731                                  linkdatarelocation ext_command_handler, -4
  1732                                  internalcoderelocation		; -> our entrypoint
  1733                                  
  1734 00000986 F606[0000]04            	testopt [relocateddata], 4
  1735                                  linkdatarelocation options7, -3
  1736 0000098B 7506                    	jnz @F
  1737 0000098D BA[5E01]                	mov dx, msg.installed
  1738                                  internaldatarelocation
  1739 00000990 E805FF                  	call putsz
  1740                                  @@:
  1741 00000993 31C0                    	xor ax, ax
  1742                                  %if _LIBSCAN
  1743 00000995 A2[5E01]                	mov byte [nothinglib], al
  1744                                  internaldatarelocation
  1745                                  %endif
  1746 00000998 CB                      	retf
  1747                                  
  1748                                  
  1749                                  %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 00000999 5589E5              <1> 	lenter
    93                              <1> 	lvar dword, instance
    94 0000099C 06                  <1> 	 push es
    95 0000099D 52                  <1> 	 push dx		; -> start of where we're loaded in ELD cs
    96                              <1> 	lvar word, targetsection_low_optional_high
    97 0000099E 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 0000099F 1E                  <1> 	 push ds
   102 000009A0 57                  <1> 	 push di		; -> link info (in debugger ss or message seg)
   103                              <1> 	lvar dword, nextreloc
   104 000009A1 06                  <1> 	 push es		; => ELD cs
   105 000009A2 52                  <1> 	 push dx		; placeholder
   106                              <1> 	lvar dword, entry
   107 000009A3 06                  <1> 	 push es		; => ELD cs
   108 000009A4 50                  <1> 	 push ax		; placeholder
   109 000009A5 31C0                <1> 	xor ax, ax
   110 000009A7 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 000009AB 7403                <1> 	je @F
   115                              <1> .error_j1:
   116 000009AD E91403              <1> 	jmp .error		; signature mismatch -->
   117                              <1> @@:
   118 000009B0 837D0601            <1> 	cmp word [di + eldlUseLinkHash], 1
   119 000009B4 77F7                <1> 	ja .error_j1		; unknown use link hash number -->
   120 000009B6 7201                <1> 	jb @F
   121                              <1> %if _ELDDATA_NEXT || _ELDCALL_NEXT
   122                              <1> 	dec al			; = -1 if hash used
   123                              <1> %else
   124 000009B8 48                  <1> 	dec ax
   125                              <1> %endif
   126                              <1> @@:
   127                              <1> 	lvar word, use_hash_low_skip_last_high
   128 000009B9 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 000009BA 31C0                <1> 	xor ax, ax
   138                              <1>  %if _ELD_LINKER_PASSES
   139                              <1> 	lvar word, pass
   140 000009BC 50                  <1> 	 push ax		; = 0 for linker itself, = 2 for application
   141                              <1> 	lvar word, amounterrors
   142 000009BD 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 000009BE 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 000009BF 50                  <1> 	 push ax
   155                              <1>  %endif
   156                              <1> %endif
   157 000009C0 56                  <1> 	push si			; -> command line tail
   158 000009C1 53                  <1> 	push bx			; -> data block in ELD data area (segment ss)
   159                              <1> 
   160                              <1> 			; simple: add instance base (dx) to code
   161 000009C2 06                  <1> 	push es
   162 000009C3 1F                  <1> 	pop ds			; ds = es => ELD cs
   163                              <1> %if _ELD_LINKER_PASSES
   164                              <1> .pass:
   165 000009C4 8B5EEA              <1> 	mov bx, word [bp + ?pass]	; 0 or 2
   166 000009C7 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 000009C9 8BB7B00D            <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 000009CD 01D6                <1> 	add si, dx		; relocate the table pointer itself
   177                              <1> @@:
   178 000009CF AD                  <1> 	lodsw
   179 000009D0 85C0                <1> 	test ax, ax		; was last ?
   180 000009D2 740B                <1> 	jz @F			; yes -->
   181 000009D4 93                  <1> 	xchg bx, ax		; bx = entry
   182 000009D5 01D3                <1> 	add bx, dx		; relocate the entry itself
   183                              <1> %if _ELD_CODE_VSTART
   184 000009D7 812F[0000]          <1> 	sub word [bx], code	; undo adjustment
   185                              <1> %endif
   186 000009DB 0117                <1> 	add word [bx], dx	; relocate word referenced by entry
   187 000009DD 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 000009DF 8B5EEA              <1> 	mov bx, word [bp + ?pass]	; 0 or 2
   193 000009E2 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 000009E4 8BB7B40D            <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 000009E8 01D6                <1> 	add si, dx		; relocate the table pointer itself
   204                              <1> @@:
   205 000009EA AD                  <1> 	lodsw
   206 000009EB 85C0                <1> 	test ax, ax		; was last ?
   207 000009ED 740C                <1> 	jz @F			; yes -->
   208 000009EF 93                  <1> 	xchg bx, ax		; bx = entry
   209 000009F0 01D3                <1> 	add bx, dx		; relocate the entry itself
   210                              <1> 		; ! access the offset of the data area block, topmost on stack
   211 000009F2 58                  <1> 	pop ax			; ax -> heap data
   212 000009F3 50                  <1> 	push ax
   213                              <1> %if _ELD_DATA_VSTART
   214 000009F4 2D[0000]            <1> 	sub ax, datastart	; undo adjustment
   215                              <1> %endif
   216 000009F7 0107                <1> 	add word [bx], ax	; relocate word referenced by entry
   217 000009F9 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 000009FB 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   224 000009FE 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 00000A00 8BB7B80D            <1> 	mov si, word [linktable - code + ltDataToCode + bx]
   230                              <1>  %endif
   231                              <1> %else
   232                              <1> 	mov si, internaldatatocoderelocations - code
   233                              <1> %endif
   234 00000A04 01D6                <1> 	add si, dx
   235                              <1> @@:
   236 00000A06 AD                  <1> 	lodsw
   237 00000A07 83F8FF              <1> 	cmp ax, -1		; was last ?
   238 00000A0A 740F                <1> 	je @F			; yes -->
   239 00000A0C 93                  <1> 	xchg bx, ax		; bx = entry
   240                              <1> 		; ! access the offset of the data area block, topmost on stack
   241 00000A0D 58                  <1> 	pop ax
   242 00000A0E 50                  <1> 	push ax
   243 00000A0F 01C3                <1> 	add bx, ax		; relocate the entry itself
   244                              <1> %if _ELD_CODE_VSTART
   245 00000A11 36812F[0000]        <1> 	sub word [ss:bx], code	; undo adjustment
   246                              <1> %endif
   247 00000A16 360117              <1> 	add word [ss:bx], dx	; relocate word referenced by entry
   248 00000A19 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 00000A1B 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   254 00000A1E 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 00000A20 8BB7BC0D            <1> 	mov si, word [linktable - code + ltDataToData + bx]
   260                              <1>  %endif
   261                              <1> %else
   262                              <1> 	mov si, internaldatatodatarelocations - code
   263                              <1> %endif
   264 00000A24 01D6                <1> 	add si, dx
   265                              <1> @@:
   266 00000A26 AD                  <1> 	lodsw
   267 00000A27 83F8FF              <1> 	cmp ax, -1		; was last ?
   268 00000A2A 740D                <1> 	je @F			; yes -->
   269 00000A2C 93                  <1> 	xchg bx, ax		; bx = entry
   270                              <1> 		; ! access the offset of the data area block, topmost on stack
   271 00000A2D 58                  <1> 	pop ax			; ax -> heap data
   272 00000A2E 50                  <1> 	push ax
   273 00000A2F 01C3                <1> 	add bx, ax		; relocate the entry itself
   274                              <1> %if _ELD_DATA_VSTART
   275 00000A31 2D[0000]            <1> 	sub ax, datastart	; undo adjustment
   276                              <1> %endif
   277 00000A34 360107              <1> 	add word [ss:bx], ax	; relocate word referenced by entry
   278 00000A37 EBED                <1> 	jmp @B
   279                              <1> 
   280                              <1> @@:
   281 00000A39 8B56FC              <1> 	mov dx, word [bp + ?instance]
   282                              <1> 				; reset (why??) -> ELD instance in ELD cs
   283                              <1> %if _ELD_LINKER_PASSES
   284 00000A3C 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   285 00000A3F 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 00000A41 0397C00D            <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 00000A45 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 00000A48 C576F2              <1> 	lds si, [bp + ?nextreloc]
   301 00000A4B AD                  <1> 	lodsw			; ax = section indicator
   302 00000A4C 85C0                <1> 	test ax, ax		; end of table ?
   303 00000A4E 7503E95101          <1> 	jz .donedatareloc
   304 00000A53 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 00000A54 5B                  <1> 	pop bx
   307 00000A55 53                  <1> 	push bx			; bx -> ELD data block
   308 00000A56 8946FA              <1> 	mov word [bp + ?targetsection_low_optional_high], ax
   309 00000A59 84C0                <1> 	test al, al		; data ?
   310 00000A5B AD                  <1> 	lodsw
   311 00000A5C 7504                <1> 	jnz @F			; yes -->
   312 00000A5E 0346FC              <1> 	add ax, word [bp + ?instance]
   313                              <1> 				; relocate entry into code
   314 00000A61 A9                  <1> 	db __TEST_IMM16		; (skip add)
   315                              <1> @@:
   316 00000A62 01D8                <1> 	add ax, bx		; relocate entry into data
   317 00000A64 8946EE              <1> 	mov word [bp + ?entry], ax
   318                              <1> 				; save away -> where to patch
   319 00000A67 AD                  <1> 	lodsw			; get unrelocated -> name
   320 00000A68 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 00000A6B E8FB00              <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 00000A6E 73D8                <1> 	jnc .datarelocloop	; if duplicate of a not found symbol -->
   337                              <1> %endif
   338 00000A70 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 00000A73 268B4F08            <1> 	mov cx, word [es:bx + eldlDataAmount]	; amount data link info
   346 00000A77 268B7F0A            <1> 	mov di, word [es:bx + eldlDataPrefixes]	; -> prefixes or hashes
   347                              <1> .datarelocfind:
   348 00000A7B 83F901              <1> 	cmp cx, 1			; NZ if cx == 0
   349 00000A7E F2AF                <1> 	repne scasw			; scan initial
   350                              <1> %if _ELDDATA_OPTIONAL
   351 00000A80 7541                <1> 	jne .datanotfound_may_be_optional
   352                              <1> %else
   353                              <1> 	jne .datanotfound
   354                              <1> %endif
   355 00000A82 57                  <1> 	push di
   356 00000A83 51                  <1> 	push cx
   357 00000A84 56                  <1> 	push si
   358 00000A85 262B7F0A            <1> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   359 00000A89 4F                  <1> 	dec di
   360 00000A8A 4F                  <1> 	dec di				; 0-based
   361 00000A8B 26037F0C            <1> 	add di, word [es:bx + eldlDataEntries]	; -> entry
   362 00000A8F 268B3D              <1> 	mov di, [es:di]			; -> counted suffix/string
   363 00000A92 B500                <1> 	mov ch, 0
   364 00000A94 8A0C                <1> 	mov cl, byte [si]		; cx = length
   365 00000A96 41                  <1> 	inc cx
   366                              <1> 	; cmp al, al			; ZR if length is zero
   367 00000A97 F3A6                <1> 	repe cmpsb			; match ?
   368 00000A99 5E                  <1> 	pop si
   369 00000A9A 59                  <1> 	pop cx
   370 00000A9B 5F                  <1> 	pop di
   371 00000A9C 75DD                <1> 	jne .datarelocfind		; if not found this time,
   372                              <1> 					;  scan for next initial -->
   373 00000A9E 8814                <1> 	mov byte [si], dl		; restore the original byte at counter
   374 00000AA0 262B7F0A            <1> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   375 00000AA4 4F                  <1> 	dec di
   376 00000AA5 4F                  <1> 	dec di				; 0-based
   377 00000AA6 26037F0E            <1> 	add di, word [es:bx + eldlDataAddresses]	; -> address (offset)
   378 00000AAA 268B05              <1> 	mov ax, word [es:di]		; get link data from the table
   379 00000AAD E80700              <1> 	call .address_data_reloc
   380                              <1> %if _ELD_RELOC_VSTART
   381 00000AB0 2D[0000]            <1> 	sub ax, relocateddata		; *not* a relocation
   382                              <1> %endif
   383 00000AB3 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 00000AB5 EB91                <1> 	jmp .datarelocloop
   390                              <1> 
   391                              <1> .address_data_reloc:
   392 00000AB7 C576EE              <1> 	lds si, [bp + ?entry]		; -> entry if in ELD code instance
   393 00000ABA 807EFA00            <1> 	cmp byte [bp + ?targetsection], 0
   394                              <1> 					; relocation in code ?
   395 00000ABE 7402                <1> 	je @F				; yes -->
   396 00000AC0 16                  <1> 	push ss
   397 00000AC1 1F                  <1> 	pop ds				; => our ELD data block
   398                              <1> @@:
   399 00000AC2 C3                  <1> 	retn
   400                              <1> 
   401                              <1> %if _ELDDATA_OPTIONAL
   402                              <1> .datanotfound_may_be_optional:
   403 00000AC3 8814                <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 00000AC5 807EFB00            <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 00000AC9 742E                <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 00000ACB D046E4              <1> 	rol byte [bp + ?optionalmissing], 1
   444 00000ACE 730B                <1> 	jnc .optionaldatamissingmsg
   445 00000AD0 8B76E6              <1> 	mov si, [bp + ?name]
   446 00000AD3 800C80              <1> 	or byte [si], 80h
   447 00000AD6 F656E4              <1> 	not byte [bp + ?optionalmissing]
   448 00000AD9 EB15                <1> 	jmp @F
   449                              <1> .optionaldatamissingmsg:
   450                              <1> %endif
   451 00000ADB 36F606[0000]02      <1> 	testopt [ss:relocateddata], 2	; debug optional link ?
   452                              <1> linkdatarelocation options7, -3
   453 00000AE1 740D                <1> 	jz @F				; no -->
   454                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   455 00000AE3 C646E5FF            <1> 	mov byte [bp + ?optionalmissing + 1], -1
   456                              <1> %endif
   457 00000AE7 BE[A514]            <1> 	mov si, lmsg.warning_data_optional
   458                              <1> internalcoderelocation
   459 00000AEA E82B00              <1> 	call .notfound			; display a warning
   460                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   461 00000AED F656E5              <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 00000AF0 E8C4FF              <1> 	call .address_data_reloc
   470 00000AF3 832400              <1> 	and word [si], 0		; indicate optional data link failed
   471 00000AF6 E94FFF              <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 00000AF9 BE[C714]            <1> 	mov si, lmsg.error_data
   560                              <1> internalcoderelocation
   561 00000AFC E81900              <1> 	call .notfound			; display error
   562 00000AFF 7306                <1> 	jnc .error_j3			; NC if in pass 0, error out now -->
   563 00000B01 FF46E8              <1> 	inc word [bp + ?amounterrors]	; count the amount of errors
   564 00000B04 E941FF              <1> 	jmp .datarelocloop		; go to next relocation entry -->
   565                              <1> 
   566                              <1> .error_j3:
   567 00000B07 E9BA01              <1> 	jmp .error
   568                              <1> 
   569                              <1> .codenotfound:
   570 00000B0A BE[E014]            <1> 	mov si, lmsg.error_code
   571                              <1> internalcoderelocation
   572 00000B0D E80800              <1> 	call .notfound			; display error
   573 00000B10 73F5                <1> 	jnc .error_j3			; NC if in pass 0 -->
   574 00000B12 FF46E8              <1> 	inc word [bp + ?amounterrors]	; count the amount of errors
   575 00000B15 E99B00              <1> 	jmp .coderelocloop		; go to next -->
   576                              <1> 
   577                              <1> .notfound:
   578 00000B18 807EEA00            <1> 	cmp byte [bp + ?pass], 0	; pass 0 ?
   579 00000B1C 7442                <1> 	je .notfound.retn		; yes, do not try displaying --> (NC)
   580 00000B1E 16                  <1> 	 push ss
   581 00000B1F 07                  <1> 	 pop es
   582 00000B20 BF[0000]            <1> 	mov di, relocateddata
   583                              <1> linkdatarelocation line_out		; es:di -> line_out buffer
   584 00000B23 E83B00              <1> 	call .copy			; copy prefix message
   585 00000B26 8B76E6              <1> 	mov si, word [bp + ?name]
   586 00000B29 AD                  <1> 	lodsw				; = hash
   587 00000B2A E8[0000]EB020000    <1> 	extcall hexword			; display the hash in hex
   588 00000B31 56                  <1> 	push si
   589 00000B32 BE[F914]            <1> 	mov si, lmsg.error.2
   590                              <1> internalcoderelocation
   591 00000B35 E82900              <1> 	call .copy			; display message fragment
   592 00000B38 5E                  <1> 	pop si
   593                              <1> %if _ELD_LINKER_PASSES
   594 00000B39 56                  <1> 	push si
   595 00000B3A E82400              <1> 	call .copy			; copy over the full name
   596 00000B3D 5E                  <1> 	pop si
   597                              <1>  %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   598 00000B3E 800C80              <1> 	or byte [si], 80h		; mark as failed optional link
   599 00000B41 D046E5              <1> 	rol byte [bp + ?optionalmissing + 1], 1
   600                              <1> 					; was it optional ?
   601 00000B44 7203                <1> 	jc @F				; yes -->
   602                              <1>  %endif
   603 00000B46 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 00000B49 B022                <1> 	mov al, '"'
   609 00000B4B AA                  <1> 	stosb				; end message with a closing quote mark
   610 00000B4C 16                  <1> 	 push ss
   611 00000B4D 1F                  <1> 	 pop ds
   612 00000B4E E8[0000]EB020000    <1> 	extcall putsline_crlf		; display diagnostic line
   613 00000B55 B8350E              <1> 	mov ax, 0E35h
   614 00000B58 E8[0000]EB020000    <1> 	extcall setrc
   615 00000B5F F9                  <1> 	stc				; CY, diagnostic displayed
   616                              <1> .notfound.retn:
   617 00000B60 C3                  <1> 	retn
   618                              <1> 
   619                              <1> .copy:		; (cannot use extcallcall here)
   620 00000B61 E8[0000]EB020000    <1> 	extcall copy_single_counted_string
   621 00000B68 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 00000B69 C646E400            <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 00000B6D 2D[0000]            <1> 	sub ax, code			; revert adjustment (= displacement)
   638                              <1> %endif
   639 00000B70 0346FC              <1> 	add ax, word [bp + ?instance]	; make displacement into -> name string
   640 00000B73 96                  <1> 	xchg si, ax			; si -> hash word, counted name string
   641                              <1> %if _ELD_LINKER_PASSES || _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   642 00000B74 8976E6              <1> 	mov word [bp + ?name], si	; save away for diagnostics
   643                              <1> %endif
   644 00000B77 AD                  <1> 	lodsw			; = hash, si -> counted string
   645 00000B78 8A14                <1> 	mov dl, byte [si]	; dl = original start byte of match
   646                              <1> %if _ELD_LINKER_PASSES
   647 00000B7A 84D2                <1> 	test dl, dl		; marked as already failed ?
   648                              <1> 				;  (80h = optional, 0 = required)
   649 00000B7C 750A                <1> 	jnz @F			; no -->
   650 00000B7E 837EE800            <1> 	cmp word [bp + ?amounterrors], 0
   651                              <1> 				; validate error status
   652 00000B82 7503E9B000          <1> 	je .error_j		; no error known ?! cancel quickly -->
   653 00000B87 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 00000B88 7909                <1> 	jns @F
   661 00000B8A 80E27F              <1> 	and dl, 7Fh
   662 00000B8D 8814                <1> 	mov byte [si], dl
   663 00000B8F C646E4FF            <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 00000B93 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 00000B96 720A                <1> 	jc @F			; if to use hash, return now -->
   679 00000B98 AC                  <1> 	lodsb			; al = length
   680 00000B99 91                  <1> 	xchg cx, ax		; cl = length
   681 00000B9A AD                  <1> 	lodsw			; ax = prefix
   682 00000B9B 49                  <1> 	dec cx
   683 00000B9C 49                  <1> 	dec cx			; cl = adjusted length
   684 00000B9D 4E                  <1> 	dec si			; -> second byte of prefix
   685 00000B9E 8A14                <1> 	mov dl, byte [si]	; dl = original start byte of match
   686 00000BA0 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 00000BA2 F9                  <1> 	stc			; CY
   695                              <1> %endif
   696 00000BA3 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 00000BA4 8B56FC              <1> 	mov dx, word [bp + ?instance]
   707                              <1> %if _ELD_LINKER_PASSES
   708 00000BA7 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   709 00000BAA 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 00000BAC 0397C40D            <1> 	add dx, word [linktable - code + ltLinkCode + bx]
   715                              <1>  %endif
   716                              <1> %else
   717                              <1> 	add dx, linkercoderelocations - code
   718                              <1> %endif
   719 00000BB0 8956F2              <1> 	mov word [bp + ?nextreloc], dx
   720                              <1> 
   721                              <1> .coderelocloop:
   722 00000BB3 C576F2              <1> 	lds si, [bp + ?nextreloc]
   723 00000BB6 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 00000BB7 0346FC              <1> 	add ax, word [bp + ?instance]
   731 00000BBA 8946EE              <1> 	mov word [bp + ?entry], ax
   732 00000BBD AD                  <1> 	lodsw
   733 00000BBE 8976F2              <1> 	mov word [bp + ?nextreloc], si
   734                              <1> %ifn _ELDCALL_OPTIONAL || _ELDCALL_NEXT
   735 00000BC1 85C0                <1> 	test ax, ax			; if no optional word, check -> match
   736 00000BC3 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 00000BC8 E89EFF              <1> 	call .build_match
   748                              <1> %if _ELD_LINKER_PASSES
   749 00000BCB 73E6                <1> 	jnc .coderelocloop
   750                              <1> %endif
   751 00000BCD C45EF6              <1> 	les bx, [bp + ?linkinfo]
   752 00000BD0 268B4F10            <1> 	mov cx, word [es:bx + eldlCodeAmount]	; amount code link info
   753 00000BD4 268B7F12            <1> 	mov di, word [es:bx + eldlCodePrefixes]	; -> prefixes or hashes
   754                              <1> .coderelocfind:
   755 00000BD8 83F901              <1> 	cmp cx, 1			; NZ if cx == 0
   756 00000BDB 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 00000BDD 7403E928FF          <1> 	jne .codenotfound
   767                              <1>  %endif
   768                              <1> %endif
   769 00000BE2 57                  <1> 	push di
   770 00000BE3 51                  <1> 	push cx
   771 00000BE4 56                  <1> 	push si
   772 00000BE5 262B7F12            <1> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   773 00000BE9 4F                  <1> 	dec di
   774 00000BEA 4F                  <1> 	dec di				; 0-based
   775 00000BEB 26037F14            <1> 	add di, word [es:bx + eldlCodeEntries]	; -> entry
   776 00000BEF 268B3D              <1> 	mov di, [es:di]			; -> counted suffix/string
   777 00000BF2 B500                <1> 	mov ch, 0
   778 00000BF4 8A0C                <1> 	mov cl, byte [si]		; cx = length
   779 00000BF6 41                  <1> 	inc cx
   780                              <1> 	; cmp al, al			; ZR if length is zero
   781 00000BF7 F3A6                <1> 	repe cmpsb			; match ?
   782 00000BF9 5E                  <1> 	pop si
   783 00000BFA 59                  <1> 	pop cx
   784 00000BFB 5F                  <1> 	pop di
   785 00000BFC 75DA                <1> 	jne .coderelocfind
   786 00000BFE 8814                <1> 	mov byte [si], dl
   787 00000C00 262B7F12            <1> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   788 00000C04 4F                  <1> 	dec di
   789 00000C05 4F                  <1> 	dec di				; 0-based
   790 00000C06 01FF                <1> 	add di, di			; quadruple index
   791 00000C08 26037F16            <1> 	add di, word [es:bx + eldlCodeAddresses]	; -> address (offset, segment)
   792 00000C0C 26FF35              <1> 	push word [es:di]
   793 00000C0F C576EE              <1> 	lds si, [bp + ?entry]
   794 00000C12 8F4405              <1> 	pop word [si + 3 + 2]		; call near imm (3), jmp short (2)
   795                              <1> 					;  patch the destination address
   796 00000C15 803CE8              <1> 	cmp byte [si], 0E8h		; is it as expected ?
   797 00000C18 751D                <1> 	jne .error_j
   798 00000C1A 268B7D02            <1> 	mov di, word [es:di + 2]
   799 00000C1E BB[0000]            <1> 	mov bx, relocateddata
   800                              <1> linkdatarelocation linkcall_table	; ss:bx -> link call table
   801 00000C21 36833F01            <1> 	cmp word [ss:bx], 1		; is it initialised to format 1 ?
   802 00000C25 7510                <1> 	jne .error_j			; no -->
   803 00000C27 368B4F02            <1> 	mov cx, word [ss:bx + 2]	; get amount of segments
   804 00000C2B E30A                <1> 	jcxz .error_j			; none -->
   805                              <1> @@:
   806 00000C2D 83C304              <1> 	add bx, 4			; -> next segment
   807 00000C30 36393F              <1> 	cmp word [ss:bx], di		; value matches ?
   808 00000C33 7405                <1> 	je @F				; yes, found -->
   809 00000C35 E2F6                <1> 	loop @B				; try remaining segments
   810                              <1> .error_j:
   811 00000C37 E98A00              <1> 	jmp .error
   812                              <1> 
   813                              <1> @@:
   814 00000C3A 368B5F02            <1> 	mov bx, word [ss:bx + 2]	; -> call destination offset
   815                              <1> 		; si + 3 + delta = bx
   816                              <1> 		; delta = bx - si - 3
   817 00000C3E 29F3                <1> 	sub bx, si
   818 00000C40 83EB03              <1> 	sub bx, 3
   819 00000C43 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 00000C46 E96AFF              <1> 	jmp .coderelocloop
   826                              <1> 
   827                              <1> .donecodereloc:
   828                              <1> %if _ELD_LINKER_PASSES
   829 00000C49 8B46E8              <1> 	mov ax, word [bp + ?amounterrors]
   830 00000C4C 85C0                <1> 	test ax, ax
   831 00000C4E 75E7                <1> 	jnz .error_j
   832 00000C50 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   833 00000C53 85DB                <1> 	test bx, bx
   834 00000C55 750B                <1> 	jnz @F
   835 00000C57 43                  <1> 	inc bx
   836 00000C58 43                  <1> 	inc bx
   837 00000C59 895EEA              <1> 	mov word [bp + ?pass], bx
   838 00000C5C 8B56FC              <1> 	mov dx, word [bp + ?instance]
   839 00000C5F E962FD              <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 00000C62 16                  <1> 	push ss
   848 00000C63 1F                  <1> 	pop ds
   849 00000C64 B02D                <1> 	mov al, 2Dh
   850 00000C66 E8[0000]EB020000    <1> 	extcall intchk			; ZR if offset = -1 or segment = 0
   851                              <1> 					; CHG: ax, dx, bx
   852 00000C6D 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 00000C6F 8A26[0000]          <1> 	mov ah, byte [relocateddata]
   860                              <1> linkdatarelocation try_debugger_amis_multiplex_number
   861 00000C73 E85500              <1> 	call plex_check
   862 00000C76 7305                <1> 	jnc @F
   863                              <1> 
   864 00000C78 B4FF                <1> 	mov ah, 0FFh		; start with multiplex number 0FFh
   865                              <1> .loop_hint:
   866 00000C7A E84E00              <1> 	call plex_check
   867                              <1> @@:
   868 00000C7D 7307                <1> 	jnc .end_hint		; if found --> (NC)
   869 00000C7F 80EC01              <1> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   870 00000C82 73F6                <1> 	jnc .loop_hint		; try next if we didn't check all yet -->
   871 00000C84 EB20                <1> 	jmp .no_hint
   872                              <1> 
   873                              <1> .end_hint:
   874 00000C86 50                  <1> 	push ax
   875 00000C87 C446FC              <1> 	les ax, [bp + ?instance]
   876 00000C8A BF[6710]            <1> 	mov di, listmsg.hint.offset
   877                              <1> internalcoderelocation
   878 00000C8D E8[0000]EB020000    <1> 	extcall hexword
   879 00000C94 BB[4610]            <1> 	mov bx, listmsg.hint
   880                              <1> internalcoderelocation
   881 00000C97 368B16[0000]        <1> 	mov dx, [ss:relocateddata]
   882                              <1> linkdatarelocation extseg	; must be 86 Mode segment even in PM
   883 00000C9C 58                  <1> 	pop ax
   884 00000C9D B040                <1> 	mov al, 40h		; AMIS message display service
   885 00000C9F 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 00000CA6 5B                  <1> 	pop bx				; -> our heap data
  1005 00000CA7 5E                  <1> 	pop si				; -> our command line tail
  1006 00000CA8 16                  <1> 	 push ss
  1007 00000CA9 1F                  <1> 	 pop ds
  1008 00000CAA C47EFC              <1> 	les di, [bp + ?instance]
  1009 00000CAD 268B4502            <1> 	mov ax, word [es:di + eldiEndCode]
  1010                              <1> houdini
  1011 00000CB1 2D[A009]            <1> 	sub ax, strict word endresident + code
  1012                              <1> internalcoderelocation
  1013 00000CB4 26C74502[A009]      <1> 	mov word [es:di + eldiEndCode], endresident + code
  1014                              <1> internalcoderelocation
  1015 00000CBA 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 00000CBE 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 00000CC1 E94CFC              <1> 	jmp start
  1029                              <1> 
  1030                              <1> .error:
  1031 00000CC4 89EC5D              <1> 	lleave
  1032 00000CC7 B8FFFF              <1> 	mov ax, -1
  1033 00000CCA 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 00000CCB 16                  <1> 	push ss
  1055 00000CCC 1F                  <1> 	pop ds
  1056 00000CCD F606[0000]08        <1> 	testopt [relocateddata], 8
  1057                              <1> linkdatarelocation internalflags4, -3
  1058 00000CD2 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 00000CD4 BE[0000]            <1> 	mov si, relocateddata
  1068                              <1> linkdatarelocation amis_multiplex_number, -2, optional
  1069 00000CD7 85F6                <1> 	test si, si
  1070 00000CD9 7404                <1> 	jz @F
  1071 00000CDB 3A24                <1> 	cmp ah, byte [si]
  1072 00000CDD 7420                <1> 	je .notfound		; do not use our own multiplexer -->
  1073                              <1> %endif
  1074                              <1> @@:
  1075 00000CDF B000                <1> 	mov al, 00h		; AMIS installation check
  1076 00000CE1 E8[0000]EB020000    <1> 	extcall call_int2D	; AMIS (or "DOS reserved" = iret if no AMIS present)
  1077 00000CE8 3CFF                <1> 	cmp al, 0FFh
  1078 00000CEA 7513                <1> 	jne .notfound
  1079 00000CEC 0E                  <1> 	push cs
  1080 00000CED 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 00000CEE BE[3610]            <1> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
  1089                              <1> internalcoderelocation
  1090 00000CF1 E8[0000]EB020000    <1> 	extcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
  1091 00000CF8 B90800              <1> 	mov cx, 8		; Ignore description, only compare vendor and program name
  1092 00000CFB F3A7                <1> 	repe cmpsw
  1093                              <1> %endif
  1094 00000CFD 7401                <1> 	je .checkret		; ZR, NC = match -->
  1095                              <1> .notfound:
  1096 00000CFF F9                  <1> 	stc			; CY no match
  1097                              <1> .checkret:
  1098 00000D00 C3                  <1> 	retn
  1099                              <1> %endif
  1100                              <1> 
  1101                              <1> 
  1102 00000D01 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 00000D04 2E00[6F10]7F05-     <1> 	dw ELDCALL_CODE_RELOCATIONS, 0, 0
  1107 00000D0A [7E10]8C05[8910]A1- <1>
  1107 00000D11 05[9B10]2306[B510]- <1>
  1107 00000D18 3E06[C910]7706-     <1>
  1107 00000D1E [E010]9706[C910]58- <1>
  1107 00000D25 08[EF10]6008[FB10]- <1>
  1107 00000D2C 6808[0711]7008-     <1>
  1107 00000D32 [1311]7808[1C11]80- <1>
  1107 00000D39 08[2311]8808[2B11]- <1>
  1107 00000D40 9008[4A11]9808-     <1>
  1107 00000D46 [6B11]A008[7311]A8- <1>
  1107 00000D4D 08[8211]B008[8E11]- <1>
  1107 00000D54 B808[A711]C008-     <1>
  1107 00000D5A [B611]C808[CB11]D0- <1>
  1107 00000D61 08[7E10]D808[D711]- <1>
  1107 00000D68 E008[E711]E808-     <1>
  1107 00000D6E [F011]F008[FA11]F8- <1>
  1107 00000D75 08[0212]0009[1112]- <1>
  1107 00000D7C 0809[1812]5009-     <1>
  1107 00000D82 [1311]660C[5712]8D- <1>
  1107 00000D89 0C[2012]9F0C[6012]- <1>
  1107 00000D90 E10C[6012]F10C-     <1>
  1107 00000D96 [6D12]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 00000D9C 2A0B[2012]4E0B-     <1> 	dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
  1115 00000DA2 [2A12]580B[1812]61- <1>
  1115 00000DA9 0B[3A12]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 00000DB0 2610                <1> 	dw internallinkercodetocoderelocations - code
  1123 00000DB2 6E0F                <1> 	dw internalcodetocoderelocations - code
  1124                              <1> at ltCodeToData
  1125 00000DB4 3010                <1> 	dw internallinkercodetodatarelocations - code
  1126 00000DB6 8E0F                <1> 	dw internalcodetodatarelocations - code
  1127                              <1> at ltDataToCode
  1128 00000DB8 3210                <1> 	dw internallinkerdatatocoderelocations - code
  1129 00000DBA 0E10                <1> 	dw internaldatatocoderelocations - code
  1130                              <1> at ltDataToData
  1131 00000DBC 3410                <1> 	dw internallinkerdatatodatarelocations - code
  1132 00000DBE 1010                <1> 	dw internaldatatodatarelocations - code
  1133                              <1> at ltLinkData
  1134 00000DC0 1210                <1> 	dw linkerlinkerdatarelocations - code
  1135 00000DC2 C80D                <1> 	dw linkerdatarelocations - code
  1136                              <1> at ltLinkCode
  1137 00000DC4 9C0D                <1> 	dw linkerlinkercoderelocations - code
  1138 00000DC6 040D                <1> 	dw linkercoderelocations - code
  1139                              <1> 	iend
  1140                              <1> %endif
  1141                              <1> 
  1142                              <1> 	align 2, db 0
  1143                              <1> linkerdatarelocations:
  1144 00000DC8 01006600[7812]0100- <1> 	dw LINK_DATA_RELOCATIONS, 0
  1144 00000DD0 6800[8212]01006B00- <1>
  1144 00000DD8 [8B12]0100B600-     <1>
  1144 00000DDE [9B12]0100C300-     <1>
  1144 00000DE4 [7812]0100C500-     <1>
  1144 00000DEA [8212]0100D000-     <1>
  1144 00000DF0 [AA12]0100D800-     <1>
  1144 00000DF6 [BA12]0100E600-     <1>
  1144 00000DFC [CB12]0100F000-     <1>
  1144 00000E02 [E912]01004401-     <1>
  1144 00000E08 [9B12]01006201-     <1>
  1144 00000E0E [F412]01007201-     <1>
  1144 00000E14 [0313]01019A01-     <1>
  1144 00000E1A [0D13]0100BB01-     <1>
  1144 00000E20 [0313]0100DB01-     <1>
  1144 00000E26 [F412]0100FF01-     <1>
  1144 00000E2C [9B12]01009602-     <1>
  1144 00000E32 [AA12]0100A302-     <1>
  1144 00000E38 [BA12]0100A802-     <1>
  1144 00000E3E [AA12]0100BE02-     <1>
  1144 00000E44 [2513]0100C302-     <1>
  1144 00000E4A [2513]0100C602-     <1>
  1144 00000E50 [2513]0100CA02-     <1>
  1144 00000E56 [2513]0100CE02-     <1>
  1144 00000E5C [3113]0100E302-     <1>
  1144 00000E62 [4413]01000805-     <1>
  1144 00000E68 [0313]01015405-     <1>
  1144 00000E6E [0D13]01007A05-     <1>
  1144 00000E74 [AA12]01009B05-     <1>
  1144 00000E7A [2513]01009F05-     <1>
  1144 00000E80 [2513]0100A905-     <1>
  1144 00000E86 [2513]0100AD05-     <1>
  1144 00000E8C [2513]0100BC05-     <1>
  1144 00000E92 [2513]0100C005-     <1>
  1144 00000E98 [2513]0100D205-     <1>
  1144 00000E9E [9B12]0100E205-     <1>
  1144 00000EA4 [F412]01002C06-     <1>
  1144 00000EAA [5113]01003106-     <1>
  1144 00000EB0 [6713]01005006-     <1>
  1144 00000EB6 [5113]01005506-     <1>
  1144 00000EBC [7B13]01006F06-     <1>
  1144 00000EC2 [8E13]01007306-     <1>
  1144 00000EC8 [A113]01007506-     <1>
  1144 00000ECE [8212]01008206-     <1>
  1144 00000ED4 [5113]01008B06-     <1>
  1144 00000EDA [5113]01009006-     <1>
  1144 00000EE0 [7B13]0100AB06-     <1>
  1144 00000EE6 [5113]0100B006-     <1>
  1144 00000EEC [7B13]0100CB06-     <1>
  1144 00000EF2 [BD13]0100CD06-     <1>
  1144 00000EF8 [D513]0100D506-     <1>
  1144 00000EFE [BA12]01001107-     <1>
  1144 00000F04 [E912]0100D907-     <1>
  1144 00000F0A [E613]0100E207-     <1>
  1144 00000F10 [F113]0100F607-     <1>
  1144 00000F16 [FA13]01001A08-     <1>
  1144 00000F1C [FA13]01001909-     <1>
  1144 00000F22 [1014]01002F09-     <1>
  1144 00000F28 [1E14]01003F09-     <1>
  1144 00000F2E [2914]01004C09-     <1>
  1144 00000F34 [3714]01006309-     <1>
  1144 00000F3A [2914]01006709-     <1>
  1144 00000F40 [FA13]01008209-     <1>
  1144 00000F46 [FA13]01008809-     <1>
  1144 00000F4C [1E14]0100710C-     <1>
  1144 00000F52 [5714]01009A0C-     <1>
  1144 00000F58 [F113]0100BC0C-     <1>
  1144 00000F5E [2914]0100CF0C-     <1>
  1144 00000F64 [7C14]0101D50C-     <1>
  1144 00000F6A [8D14]0000          <1>
  1145                              <1> 
  1146                              <1> 	align 2, db 0
  1147                              <1> internalcodetocoderelocations:
  1148 00000F6E F1073E0836093B0943- <1> 	dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
  1148 00000F77 0948095F096A097D09- <1>
  1148 00000F80 84098B0C950CB20CB8- <1>
  1148 00000F89 0CEF0C0000          <1>
  1149                              <1> 
  1150                              <1> 	align 2, db 0
  1151                              <1> internalcodetodatarelocations:
  1152 00000F8E 28002A0040004A0076- <1> 	dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
  1152 00000F97 0079007C0084008700- <1>
  1152 00000FA0 8A00920095009800A3- <1>
  1152 00000FA9 00BE00E200F4000301- <1>
  1152 00000FB2 3301400149015B0187- <1>
  1152 00000FBB 01C501F501FB010902- <1>
  1152 00000FC4 0E0215021B02210227- <1>
  1152 00000FCD 02300239027B029202- <1>
  1152 00000FD6 B2022E048804BD04CC- <1>
  1152 00000FDF 04F80426053E05CE05- <1>
  1152 00000FE8 D705E6050506E706F2- <1>
  1152 00000FF1 06F8060B072B073E07- <1>
  1152 00000FFA 46074E075E07650742- <1>
  1152 00001003 08530821098E099609- <1>
  1152 0000100C 0000                <1>
  1153                              <1> 
  1154                              <1> 	align 2, db 0
  1155                              <1> internaldatatocoderelocations:
  1156 0000100E FFFF                <1> 	dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
  1157                              <1> 
  1158                              <1> 	align 2, db 0
  1159                              <1> internaldatatodatarelocations:
  1160 00001010 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 00001012 0100DE0A[1E14]0100- <1> 	dw LINK_LINKER_DATA_RELOCATIONS, 0
  1165 0000101A 210B[E912]01001F0C- <1>
  1165 00001022 [4614]0000          <1>
  1166                              <1> 
  1167                              <1> 	align 2, db 0
  1168                              <1> internallinkercodetocoderelocations:
  1169 00001026 E80AFA0A0B0B330B00- <1> 	dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
  1169 0000102F 00                  <1>
  1170                              <1> 
  1171                              <1> 	align 2, db 0
  1172                              <1> internallinkercodetodatarelocations:
  1173 00001030 0000                <1> 	dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
  1174                              <1> 
  1175                              <1> 	align 2, db 0
  1176                              <1> internallinkerdatatocoderelocations:
  1177 00001032 FFFF                <1> 	dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
  1178                              <1> 
  1179                              <1> 	align 2, db 0
  1180                              <1> internallinkerdatatodatarelocations:
  1181 00001034 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 00001036 65636D20<rep 5h>    <1> 		fill 8, 32, db "ecm"
  1198 0000103E 6C446562756720-     <1> 		fill 8, 32, db "lDebug"
  1198 0000103E <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 00001046 547261634C6973742D- <1> .hint:		db "TracList-add-offset=",_LISTING,"::"
  1210 0000104F 6164642D6F66667365- <1>
  1210 00001058 743D6578746E616D65- <1>
  1210 00001061 2E6C73743A3A        <1>
  1211 00001067 2D2D2D2D680D0A00    <1> .hint.offset:	asciz "----h",13,10
  1212                              <1> %endif
  1213                              <1> 
  1214 0000106F 30CD0C636D64335F6E- <1> 	eldcall_dump_names ELDCALL_CODE_NAMES
  1214 00001078 6F745F657874683108- <1>
  1214 00001081 5F646F7363616C6CFF- <1>
  1214 0000108A 8B0F79795F626F6F74- <1>
  1214 00001093 5F726561642E627863- <1>
  1214 0000109C E41779795F626F6F74- <1>
  1214 000010A5 5F7365656B5F637572- <1>
  1214 000010AE 72656E742E627825D7- <1>
  1214 000010B7 1179795F626F6F745F- <1>
  1214 000010C0 696E69745F64697232- <1>
  1214 000010C9 1527142E2E4079795F- <1>
  1214 000010D2 66696C656E616D655F- <1>
  1214 000010DB 656D707479D1C60C73- <1>
  1214 000010E4 63616E5F6469725F61- <1>
  1214 000010ED 7578D55509736B6970- <1>
  1214 000010F6 636F6D6D6103C30969- <1>
  1214 000010FF 73737472696E673FF1- <1>
  1214 00001108 230975707065726361- <1>
  1214 00001111 7365DDB90663686B65- <1>
  1214 0000111A 6F6CBABD04636D6433- <1>
  1214 00001123 629605496E444F53F0- <1>
  1214 0000112C 011C79795F626F6F74- <1>
  1214 00001135 5F70617273655F6E61- <1>
  1214 0000113E 6D655F62785F627566- <1>
  1214 00001147 66657217D81E79795F- <1>
  1214 00001150 636F6D6D6F6E5F7061- <1>
  1214 00001159 7273655F6E616D655F- <1>
  1214 00001162 62785F627566666572- <1>
  1214 0000116B 551205707574737AA5- <1>
  1214 00001174 330C79795F72657365- <1>
  1214 0000117D 745F62756629EF0973- <1>
  1214 00001186 6B69707768697465B0- <1>
  1214 0000118F CC1672657472795F6F- <1>
  1214 00001198 70656E5F7363726970- <1>
  1214 000011A1 7473706174685A0B0C- <1>
  1214 000011AA 696E69745F626F6F74- <1>
  1214 000011B3 636D64109A1279795F- <1>
  1214 000011BC 626F6F745F6F70656E- <1>
  1214 000011C5 5F66696C6532794C09- <1>
  1214 000011CE 636C6F73655F657874- <1>
  1214 000011D7 20660D626F6F745F70- <1>
  1214 000011E0 617273655F666EE83A- <1>
  1214 000011E9 066973656F6C3F7FAE- <1>
  1214 000011F2 07736B6970776830A7- <1>
  1214 000011FB AA056572726F729F9A- <1>
  1214 00001204 0C79795F636865636B- <1>
  1214 0000120D 5F6C666E2890046973- <1>
  1214 00001216 706DB2120573657472- <1>
  1214 0000121F 63848107686578776F- <1>
  1214 00001228 72646FA20D70757473- <1>
  1214 00001231 6C696E655F63726C66- <1>
  1214 0000123A D0BB1A636F70795F73- <1>
  1214 00001243 696E676C655F636F75- <1>
  1214 0000124C 6E7465645F73747269- <1>
  1214 00001255 6E67986906696E7463- <1>
  1214 0000125E 686B21300A63616C6C- <1>
  1214 00001267 5F696E743244B77408- <1>
  1214 00001270 7365746573326478    <1>
  1215 00001278 C30B076C617374636D- <1> 	link_data_dump_names LINK_DATA_NAMES
  1215 00001281 646B5D06646D79636D- <1>
  1215 0000128A 6454400D6D73672E75- <1>
  1215 00001293 6E696E7374616C6CA2- <1>
  1215 0000129C 250C79795F69735F73- <1>
  1215 000012A5 6372697074899F0D69- <1>
  1215 000012AE 6E7465726E616C666C- <1>
  1215 000012B7 616773CA510E696E74- <1>
  1215 000012C0 65726E616C666C6167- <1>
  1215 000012C9 7333D5691B696E7465- <1>
  1215 000012D2 726E616C666C616773- <1>
  1215 000012DB 5F776974685F74745F- <1>
  1215 000012E4 7768696C6584E3086C- <1>
  1215 000012ED 696E655F6F75748F03- <1>
  1215 000012F6 0C7768696C655F6275- <1>
  1215 000012FF 666665722F7A076C69- <1>
  1215 00001308 6E655F696E26EB1569- <1>
  1215 00001311 6E6469726563745F61- <1>
  1215 0000131A 727261795F65727266- <1>
  1215 00001323 69788274096C6F6164- <1>
  1215 0000132C 5F646174610F08106C- <1>
  1215 00001335 6F61645F646174615F- <1>
  1215 0000133E 6C6F77657374C71C0A- <1>
  1215 00001347 6578745F68616E646C- <1>
  1215 00001350 6592AA136C6F61645F- <1>
  1215 00001359 636865636B5F646972- <1>
  1215 00001362 5F617474720EB5116C- <1>
  1215 0000136B 6F61645F79796E616D- <1>
  1215 00001374 655F696E7075742F75- <1>
  1215 0000137D 106C6F61645F79796E- <1>
  1215 00001386 616D655F6E6578746C- <1>
  1215 0000138F 52106C6F61645F7979- <1>
  1215 00001398 5F646972656E747279- <1>
  1215 000013A1 38D21968616E646C65- <1>
  1215 000013AA 5F7363616E5F646972- <1>
  1215 000013B3 5F6E6F745F666F756E- <1>
  1215 000013BC 6494C01568616E646C- <1>
  1215 000013C5 655F7363616E5F6469- <1>
  1215 000013CE 725F656E7472793F85- <1>
  1215 000013D7 0E7363616E5F646972- <1>
  1215 000013E0 5F656E747279EB4208- <1>
  1215 000013E9 657874647373656CD5- <1>
  1215 000013F2 2D0665787473656797- <1>
  1215 000013FB B6136578745F636F6D- <1>
  1215 00001404 6D616E645F68616E64- <1>
  1215 0000140D 6C65728D710B6D7367- <1>
  1215 00001416 2E696E7374616C6C5A- <1>
  1215 0000141F BC086F7074696F6E73- <1>
  1215 00001428 37E7D30B6578747365- <1>
  1215 00001431 675F75736564B2400C- <1>
  1215 0000143A 657874646174615F75- <1>
  1215 00001443 73656468440E6C696E- <1>
  1215 0000144C 6B63616C6C5F746162- <1>
  1215 00001455 6C65F09E227472795F- <1>
  1215 0000145E 64656275676765725F- <1>
  1215 00001467 616D69735F6D756C74- <1>
  1215 00001470 69706C65785F6E756D- <1>
  1215 00001479 626572CB510E696E74- <1>
  1215 00001482 65726E616C666C6167- <1>
  1215 0000148B 7334688C15616D6973- <1>
  1215 00001494 5F6D756C7469706C65- <1>
  1215 0000149D 785F6E756D626572    <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 000014A5 214F7074696F6E616C- <1> .warning_data_optional:		counted "Optional data link missing, hash="
  1226 000014AE 2064617461206C696E- <1>
  1226 000014B7 6B206D697373696E67- <1>
  1226 000014C0 2C20686173683D      <1>
  1227                              <1> %endif
  1228 000014C7 1844617461206C696E- <1> .error_data:			counted "Data link missing, hash="
  1228 000014D0 6B206D697373696E67- <1>
  1228 000014D9 2C20686173683D      <1>
  1229 000014E0 18436F6465206C696E- <1> .error_code:			counted "Code link missing, hash="
  1229 000014E9 6B206D697373696E67- <1>
  1229 000014F2 2C20686173683D      <1>
  1230 000014F9 0A682C206C6162656C- <1> .error.2:			counted "h, label ",'"'
  1230 00001502 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 00001504 00<rep Ch>          <1> 	align 16, db 0
  1750                                  
  1751                                  	align 16
  1752                                  code_size equ $ - code
