     1                                  
     2                                  ; Public Domain
     3                                  
     4                                  ; test run command: ; .; .
     5                                  
     6                                  %include "lmacros3.mac"
     1                              <1> [list -]
    14                              <2> [list -]
    14                              <1> [list -]
     7                                  %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
     8                                  %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
     9                                  %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
    10                                  
    11                                  	numdef MCP, 0
    12                                  	numdef COMPRESSED, 0
    13                                  	numdef COMPRESSLIB, 0
    14                                  %assign _ELDCOMPRESSED _COMPRESSED
    15                                  	numdef ALIGNPAGE, 1
    16                                  	excdef !_COMPRESSED, ALIGNPAGE
    17                                  	numdef DATABUFFER, 1
    18                                  	numdef ELD_TEST_LIB, 0
    19                                  	numdef ELD_TEST_DESCRIBEX, 0
    20                                   	numdef ELD_ZERO_OFFSETS, 0
    21                                  
    22                                  %assign _DEBUG 1
    23                                  %assign _CATCHINT0C 0
    24                                  %assign _CATCHINT0D 0
    25                                  %assign _CATCHINTFAULTCOND 0
    26                                  %assign _LOADER 0
    27                                  %assign _DEBUG_COND 1
    28                                  %assign _DELAY_BEFORE_BP 0
    29                                  %assign _DHIGHLIGHT 0
    30                                  %assign _GETLINEHIGHLIGHT 0
    31                                  %assign _IMMASM 0
    32                                  %assign _INPUT_FILE_BOOT 0
    33                                  %assign _INPUT_FILE_HANDLES 0
    34                                  %assign _MS_0RANGE_COMPAT 0
    35                                  %assign _PM 0
    36                                  %assign _RH 0
    37                                  %assign _SYMBOLIC 0
    38                                  %assign _VXCHG 0
    39                                  %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
    40                                  
    41                                  %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
    42                                  
    43                                  	numdef XLD
    44                                  
    45                                  %ifn _COMPRESSLIB
    46                                  	cpu 8086
    47                                  
    48                                  	addsection RELOCATEDDATA, nobits vstart=_ELD_RELOC_VSTART
    49                                  relocateddata:
    50                                  
    51                                  	addsection HEADER, start=0
    52                                  
    53                                  	istruc ELD_HEADERX
    54                                  at eldhxHeader
    55                                  		; ELD executable header
    56                                  	istruc ELD_HEADER
    57 00000000 454C4431                at eldhSignature,	db "ELD1"
    58 00000004 000000                  			db 0,0,0
    59 00000007 1A                      			db 26
    60 00000008 50000000                at eldhCodeOffset,	dd CODEOFFSET
    61 0000000C B00E                    at eldhCodeImageLength,	dw code_size
    62 0000000E 0000                    at eldhCodeAllocLength,	dw 0
    63 00000010 000F0000                at eldhDataOffset,	dd DATAOFFSET
    64 00000014 A005                    at eldhDataImageLength,	dw data_size
    65 00000016 1002                    at eldhDataAllocLength,	dw total_data_size - data_size
    66 00000018 3806                    at eldhCodeEntrypoint,	dw linker - code
    67                                  at eldhReserved
    68 0000001A 00<rep 4h>2C00          at eldhExtensionSize,	dw header_extension_end - $$
    69                                  	iend
    70 00000020 [30000000]              at eldhxDescriptionOffset,	dd description
    71 00000024 A7130000                at eldhxHelpOffset,		dd DATAOFFSET + msg.help - datastart
    72 00000028 000F0000                at eldhxLibTable,		dd DATAOFFSET + libtable - datastart
    73                                  PUT_ELDHX_DATETIME_OFFSET
    74                                  header_extension_end:
    75 0000002C 00<rep 4h>              	iend
    76                                  
    77                                  description:
    78                                  %if _MCP
    79                                  	db "MCP "
    80                                  %endif
    81 00000030 455854204C49423A20-     	asciz "EXT LIB: library of ELDs."
    81 00000039 6C696272617279206F-
    81 00000042 6620454C44732E00   
    82                                  
    83                                  
    84 0000004A 00<rep 6h>              	align 16, db 0
    85                                  
    86                                  CODEOFFSET equ $ - $$
    87                                  	addsection CODE, follows=HEADER vstart=_ELD_CODE_VSTART
    88                                  %define CODEFIXUP - code + 0
    89                                  code:
    90                                  		; ELD instance header
    91                                  	istruc ELD_INSTANCE
    92                                  at eldiStartCode
    93 00000000 00<rep 2h>              at eldiEndCode
    94 00000002 00<rep 2h>              at eldiStartData
    95 00000004 00<rep 2h>              at eldiEndData
    96 00000006 00<rep 2h>4558544C-     at eldiIdentifier,	fill 8, 32, db "EXTLIB"
    96 0000000C 494220<rep 2h>     
    97 00000010 00<rep 2h>6578746C-     at eldiListing,		asciz _ELD_LISTING
    97 00000016 69622E6C737400     
    98 0000001D 00<rep 3h>              	iend
    99                                  
   100                                  
   101                                  load:
   102 00000020 E85502                  	call get_es_ext
   103 00000023 BF[0000]                	mov di, code
   104                                  internalcoderelocation
   105 00000026 268B4502                	mov ax, word [es:di + eldiEndCode]
   106 0000002A 2D[E002]                	sub ax, strict word endload + code
   107                                  internalcoderelocation
   108 0000002D 26C74502[E002]          	mov word [es:di + eldiEndCode], endload + code
   109                                  internalcoderelocation
   110 00000033 2906[0000]              	sub word [relocateddata], ax
   111                                  linkdatarelocation extseg_used
   112 00000037 16                      	push ss
   113 00000038 07                      	pop es
   114                                  
   115                                  %assign _BOOTLDR 1
   116                                  %assign _APPLICATION 1
   117                                  %assign _DEVICE 1
   118                                  %assign _PM 1
   119                                  %define relocated(address) relocateddata
   120                                  %define doscall extcallcall _doscall
   121                                  %assign ELD 1
   122                                  %assign _DOSORBOOTIO 1
   123                                  
   124                                  %include "loadeld.asm"
     1                              <1> 
     2                              <1> %if 0
     3                              <1> 
     4                              <1> lDebug load Extensions for lDebug
     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> %if ELD
    17                              <1> %assign _ELDTRAILER 0
    18                              <1> 		numdef DOSORBOOTIO, 0
    19                              <1> 		numdef ELDCOMPRESSED, 0
    20                              <1> %else
    21                              <1> %assign _DOSORBOOTIO 0
    22                              <1> %assign _ELDCOMPRESSED 0
    23                              <1> 	push bp
    24                              <1> %endif
    25                              <1> 
    26                              <1> %if _ELDTRAILER
    27                              <1> 	xor ax, ax
    28                              <1> 	mov word [eldheader], ax
    29                              <1> internaldatarelocation
    30                              <1> 	mov word [eldheader + 2], ax
    31                              <1> internaldatarelocation
    32                              <1> 
    33                              <1> 	xchg cx, ax
    34                              <1> 	mov ax, 4202h
    35                              <1> 	xor dx, dx
    36                              <1> %if _BOOTLDR
    37                              <1>  %if _APPLICATION || _DEVICE
    38                              <1> 	testopt [relocated(internalflags)], nodosloaded
    39                              <1> linkdatarelocation internalflags, -3
    40                              <1> 	jz @F
    41                              <1>  %endif
    42                              <1> 	extcallcall yy_boot_seek_start.bx
    43                              <1> 	mov cx, word [load_data - LOADDATA2 + ldFileSize + 2]
    44                              <1> internaldatarelocation
    45                              <1> 	mov dx, word [load_data - LOADDATA2 + ldFileSize]
    46                              <1> internaldatarelocation
    47                              <1> 	extcallcall yy_boot_seek_current.bx
    48                              <1> 	mov dx, word [load_data - LOADDATA2 + ldCurrentSeek + 2]
    49                              <1> internaldatarelocation
    50                              <1> 	mov ax, word [load_data - LOADDATA2 + ldCurrentSeek]
    51                              <1> internaldatarelocation
    52                              <1>  %if _APPLICATION || _DEVICE
    53                              <1> 	jmp @FF
    54                              <1>  %endif
    55                              <1> %endif
    56                              <1> 
    57                              <1> @@:
    58                              <1> %if _APPLICATION || _DEVICE
    59                              <1> 	doscall
    60                              <1> %endif
    61                              <1> @@:
    62                              <1> 	jc .io_error
    63                              <1> 
    64                              <1> 	test dx, dx
    65                              <1> 	jnz @F
    66                              <1> 	cmp ax, ELD_HEADER_size + ELD_TRAILER_HEADER_size
    67                              <1> 	jb .no_trailer
    68                              <1> @@:
    69                              <1> 
    70                              <1> 	mov ax, 4201h
    71                              <1> 	mov cx, -1
    72                              <1> 	mov dx, - ELD_TRAILER_HEADER_size
    73                              <1> %if _BOOTLDR
    74                              <1>  %if _APPLICATION || _DEVICE
    75                              <1> 	testopt [relocated(internalflags)], nodosloaded
    76                              <1> linkdatarelocation internalflags, -3
    77                              <1> 	jz @F
    78                              <1>  %endif
    79                              <1> 	extcallcall yy_boot_seek_current.bx
    80                              <1> 	mov dx, word [load_data - LOADDATA2 + ldCurrentSeek + 2]
    81                              <1> internaldatarelocation
    82                              <1> 	mov ax, word [load_data - LOADDATA2 + ldCurrentSeek]
    83                              <1> internaldatarelocation
    84                              <1>  %if _APPLICATION || _DEVICE
    85                              <1> 	jmp @FF
    86                              <1>  %endif
    87                              <1> %endif
    88                              <1> 
    89                              <1> @@:
    90                              <1> %if _APPLICATION || _DEVICE
    91                              <1> 	doscall
    92                              <1> %endif
    93                              <1> @@:
    94                              <1> 	jc .io_error
    95                              <1> 
    96                              <1> 	push dx
    97                              <1> 	push ax
    98                              <1> 
    99                              <1> 	mov cx, fromwords(ELD_TRAILER_HEADER_size_w)
   100                              <1> 	sub sp, cx
   101                              <1> 	mov dx, sp
   102                              <1> 
   103                              <1> 	mov ah, 3Fh
   104                              <1> %if _BOOTLDR
   105                              <1>  %if _APPLICATION || _DEVICE
   106                              <1> 	testopt [relocated(internalflags)], nodosloaded
   107                              <1> linkdatarelocation internalflags, -3
   108                              <1> 	jz @F
   109                              <1>  %endif
   110                              <1> 	extcallcall yy_boot_read.bx
   111                              <1>  %if _APPLICATION || _DEVICE
   112                              <1> 	jmp @FF
   113                              <1>  %endif
   114                              <1> %endif
   115                              <1> 
   116                              <1> @@:
   117                              <1> %if _APPLICATION || _DEVICE
   118                              <1> 	doscall
   119                              <1> %endif
   120                              <1> @@:
   121                              <1> 	jc .io_error
   122                              <1> 	mov di, sp
   123                              <1> 	mov si, sp
   124                              <1> 
   125                              <1> 	cmp ax, cx
   126                              <1> 	jne .no_trailer_pop
   127                              <1> 
   128                              <1> 	xor dx, dx
   129                              <1> 	shr cx, 1
   130                              <1> @@:
   131                              <1> 	lodsw
   132                              <1> 	add dx, ax
   133                              <1> 	loop @B
   134                              <1> 	jnz .no_trailer_pop
   135                              <1> 
   136                              <1> 	pop ax
   137                              <1> 	cmp ax, "EL"
   138                              <1> 	jne .no_trailer_pop
   139                              <1> 	pop ax
   140                              <1> 	cmp ax, "D1"
   141                              <1> 	jne .no_trailer_pop
   142                              <1> 	pop ax
   143                              <1> 	cmp ax, "TA"
   144                              <1> 	jne .no_trailer_pop
   145                              <1> 	pop ax
   146                              <1> 	cmp ax, "IL"
   147                              <1> 	jne .no_trailer_pop
   148                              <1> 
   149                              <1> 	pop si
   150                              <1> 	pop cx			; cx:si = displacement to subtract
   151                              <1> 	pop ax			; reserved
   152                              <1> 	pop ax			; checksum
   153                              <1> 
   154                              <1> 	pop ax
   155                              <1> 	pop dx			; dx:ax = offset of trailer header
   156                              <1> 	add ax, si
   157                              <1> 	adc dx, cx		; dx:ax = offset of header
   158                              <1> 	jnc .io_error
   159                              <1> 
   160                              <1> 	mov word [eldheader], ax
   161                              <1> internaldatarelocation
   162                              <1> 	mov word [eldheader + 2], dx
   163                              <1> internaldatarelocation
   164                              <1> 
   165                              <1> .no_trailer_pop:
   166                              <1> 	lea sp, [di + fromwords(ELD_TRAILER_HEADER_size_w) + 4]
   167                              <1> 
   168                              <1> .no_trailer:
   169                              <1> 	mov ax, 4200h
   170                              <1> 	mov dx, word [eldheader]
   171                              <1> internaldatarelocation
   172                              <1> 	mov cx, word [eldheader + 2]
   173                              <1> internaldatarelocation
   174                              <1> 
   175                              <1> %if _BOOTLDR
   176                              <1>  %if _APPLICATION || _DEVICE
   177                              <1> 	testopt [relocated(internalflags)], nodosloaded
   178                              <1> linkdatarelocation internalflags, -3
   179                              <1> 	jz @F
   180                              <1>  %endif
   181                              <1> 	extcallcall yy_boot_seek_start.bx
   182                              <1> 	extcallcall yy_boot_seek_current.bx
   183                              <1>  %if _APPLICATION || _DEVICE
   184                              <1> 	jmp @FF
   185                              <1>  %endif
   186                              <1> %endif
   187                              <1> 
   188                              <1> @@:
   189                              <1> %if _APPLICATION || _DEVICE
   190                              <1> 	doscall
   191                              <1> %endif
   192                              <1> @@:
   193                              <1> 	jc .io_error
   194                              <1> %endif
   195                              <1> 
   196 00000039 B92000              <1> 	mov cx, fromwords(ELD_HEADER_size_w)
   197 0000003C 29CC                <1> 	sub sp, cx
   198 0000003E 89E2                <1> 	mov dx, sp		; es:dx and ds:dx
   199                              <1> %if _ELDCOMPRESSED
   200                              <1> 	push word [eldheader + 2]
   201                              <1> internaldatarelocation
   202                              <1> 	push word [eldheader]
   203                              <1> internaldatarelocation
   204                              <1> 	pop word [depackskip]
   205                              <1> internaldatarelocation
   206                              <1> 	pop word [depackskip + 2]
   207                              <1> internaldatarelocation
   208                              <1> 
   209                              <1> 	call read_and_depack
   210                              <1> %elif _DOSORBOOTIO
   211 00000040 B8003F              <1> 	mov ax, 3F00h
   212 00000043 E8DA01              <1> 	call dos_or_boot_io
   213                              <1> %else
   214                              <1> 	mov ah, 3Fh
   215                              <1> %if _BOOTLDR
   216                              <1>  %if _APPLICATION || _DEVICE
   217                              <1> 	testopt [relocated(internalflags)], nodosloaded
   218                              <1> linkdatarelocation internalflags, -3
   219                              <1> 	jz @F
   220                              <1>  %endif
   221                              <1> 	extcallcall yy_boot_read.bx
   222                              <1>  %if _APPLICATION || _DEVICE
   223                              <1> 	jmp @FF
   224                              <1>  %endif
   225                              <1> %endif
   226                              <1> 
   227                              <1> @@:
   228                              <1> %if _APPLICATION || _DEVICE
   229                              <1> 	doscall
   230                              <1> %endif
   231                              <1> @@:
   232                              <1> %endif
   233 00000046 7303E9B201          <1> 	jc .io_error
   234 0000004B 39C8                <1> 	cmp ax, cx
   235 0000004D 7403E9B001          <1> 	jne .invalid
   236                              <1> 
   237 00000052 89E7                <1> 	mov di, sp
   238                              <1> 
   239 00000054 58                  <1> 	pop ax
   240 00000055 3D454C              <1> 	cmp ax, "EL"
   241 00000058 7403E9A501          <1> 	jne .invalid
   242 0000005D 58                  <1> 	pop ax
   243 0000005E 3D4431              <1> 	cmp ax, "D1"
   244 00000061 7403E99C01          <1> 	jne .invalid
   245 00000066 58                  <1> 	pop ax
   246 00000067 58                  <1> 	pop ax
   247 00000068 80FC1A              <1> 	cmp ah, 26
   248 0000006B 7403E99201          <1> 	jne .invalid
   249                              <1> 
   250                              <1> %ifn ELD
   251                              <1> 	testopt [internalflags3], dif3_in_if
   252                              <1> 	jnz if_exists_found_ext_open
   253                              <1> %endif
   254                              <1> 
   255 00000070 A1[0000]            <1> 	mov ax, word [relocated(extseg_size)]
   256                              <1> linkdatarelocation extseg_size
   257 00000073 2B06[0000]          <1> 	sub ax, word [relocated(extseg_used)]
   258                              <1> linkdatarelocation extseg_used
   259 00000077 7303E97C01          <1> 	jc .error_internal
   260                              <1> %if ELD
   261 0000007C 83E840              <1> 	sub ax, fromparas(relocator_size_p)
   262 0000007F 7303E97401          <1> 	jc .error_internal
   263                              <1> %endif
   264                              <1> 
   265 00000084 8B4D0C              <1> 	mov cx, word [di + eldhCodeImageLength]
   266                              <1> %if ELD
   267 00000087 39C8                <1> 	cmp ax, cx
   268 00000089 7303E97901          <1> 	jb .oom
   269                              <1> %endif
   270 0000008E 034D0E              <1> 	add cx, word [di + eldhCodeAllocLength]
   271 00000091 7238                <1> 	jc .invalid_CY
   272 00000093 83C10F              <1> 	add cx, 15
   273 00000096 7233                <1> 	jc .invalid_CY
   274 00000098 80E1F0              <1> 	and cl, ~ 15
   275                              <1> 
   276                              <1> %if ELD
   277 0000009B 2E0306[0200]        <1> 	add ax, word [cs:code + eldiEndCode]
   278                              <1> internalcoderelocation
   279 000000A0 2E2B06[0000]        <1> 	sub ax, word [cs:code + eldiStartCode]
   280                              <1> internalcoderelocation
   281                              <1> %endif
   282 000000A5 39C8                <1> 	cmp ax, cx
   283 000000A7 7303E95B01          <1> 	jb .oom
   284                              <1> 
   285 000000AC 8B16[0000]          <1> 	mov dx, word [relocated(extdata_size)]
   286                              <1> linkdatarelocation extdata_size
   287 000000B0 2B16[0000]          <1> 	sub dx, word [relocated(extdata_used)]
   288                              <1> linkdatarelocation extdata_used
   289 000000B4 7303E93F01          <1> 	jc .error_internal
   290                              <1> 
   291 000000B9 8B7514              <1> 	mov si, word [di + eldhDataImageLength]
   292                              <1> %if ELD
   293 000000BC 39F2                <1> 	cmp dx, si
   294 000000BE 7303E94401          <1> 	jb .oom
   295                              <1> %endif
   296 000000C3 037516              <1> 	add si, word [di + eldhDataAllocLength]
   297 000000C6 7203                <1> 	jc .invalid_CY
   298 000000C8 83C60F              <1> 	add si, 15
   299                              <1> .invalid_CY:
   300 000000CB 7303E93201          <1> 	jc .invalid
   301 000000D0 83E6F0              <1> 	and si, ~ 15
   302                              <1> 
   303                              <1> %if ELD
   304 000000D3 2E0316[0600]        <1> 	add dx, word [cs:code + eldiEndData]
   305                              <1> internalcoderelocation
   306 000000D8 2E2B16[0400]        <1> 	sub dx, word [cs:code + eldiStartData]
   307                              <1> internalcoderelocation
   308                              <1> %endif
   309 000000DD 39F2                <1> 	cmp dx, si
   310 000000DF 7303E92301          <1> 	jb .oom
   311                              <1> 
   312 000000E4 56                  <1> 	push si
   313 000000E5 51                  <1> 	push cx
   314                              <1> 
   315 000000E6 B80042              <1> 	mov ax, 4200h
   316 000000E9 8B4D0A              <1> 	mov cx, word [di + eldhCodeOffset + 2]
   317 000000EC 8B5508              <1> 	mov dx, word [di + eldhCodeOffset]
   318                              <1> %if ELD || _ELDTRAILER
   319 000000EF 0316[A205]          <1> 	add dx, word [eldheader]
   320                              <1> internaldatarelocation
   321 000000F3 130E[A405]          <1> 	adc cx, word [eldheader + 2]
   322                              <1> internaldatarelocation
   323                              <1> %else
   324                              <1> 		; ELD header is at seek 0
   325                              <1> %endif
   326                              <1> %if _ELDCOMPRESSED
   327                              <1> 	mov word [depackskip], dx
   328                              <1> internaldatarelocation
   329                              <1> 	mov word [depackskip + 2], cx
   330                              <1> internaldatarelocation
   331                              <1> %elif _DOSORBOOTIO
   332 000000F7 E82601              <1> 	call dos_or_boot_io
   333                              <1> %else
   334                              <1> %if _BOOTLDR
   335                              <1>  %if _APPLICATION || _DEVICE
   336                              <1> 	testopt [relocated(internalflags)], nodosloaded
   337                              <1> linkdatarelocation internalflags, -3
   338                              <1> 	jz @F
   339                              <1>  %endif
   340                              <1> 	extcallcall yy_boot_seek_start.bx
   341                              <1> 	extcallcall yy_boot_seek_current.bx
   342                              <1>  %if _APPLICATION || _DEVICE
   343                              <1> 	jmp @FF
   344                              <1>  %endif
   345                              <1> %endif
   346                              <1> 
   347                              <1> @@:
   348                              <1> %if _APPLICATION || _DEVICE
   349                              <1> 	doscall
   350                              <1> %endif
   351                              <1> @@:
   352                              <1> %endif
   353 000000FA 7303E9FE00          <1> 	jc .io_error
   354                              <1> 
   355 000000FF 8B16[0000]          <1> 	mov dx, word [relocated(extseg_used)]
   356                              <1> linkdatarelocation extseg_used
   357                              <1> %if _PM
   358 00000103 E8BA01              <1> 	extcallcall ispm
   359 00000106 7506                <1> 	jnz @F
   360 00000108 8E1E[0000]          <1> 	mov ds, word [relocated(extdssel)]
   361                              <1> linkdatarelocation extdssel
   362 0000010C EB04                <1> 	jmp @FF
   363                              <1> 
   364                              <1> @@:
   365                              <1> %endif
   366 0000010E 8E1E[0000]          <1> 	mov ds, word [relocated(extseg)]
   367                              <1> linkdatarelocation extseg
   368                              <1> @@:
   369 00000112 368B4D0C            <1> 	mov cx, word [ss:di + eldhCodeImageLength]
   370                              <1> %if _ELDCOMPRESSED
   371                              <1> 	push ds
   372                              <1> 	pop es
   373                              <1> 	push ss
   374                              <1> 	pop ds
   375                              <1> 	call read_and_depack
   376                              <1> 	push ss
   377                              <1> 	pop es
   378                              <1> %elif _DOSORBOOTIO
   379 00000116 B8FF3F              <1> 	mov ax, 3FFFh
   380 00000119 E80401              <1> 	call dos_or_boot_io
   381                              <1> %else
   382                              <1> 	mov ah, 3Fh
   383                              <1> %if _BOOTLDR
   384                              <1>  %if _APPLICATION || _DEVICE
   385                              <1> 	testopt [ss:relocated(internalflags)], nodosloaded
   386                              <1> linkdatarelocation internalflags, -3
   387                              <1> 	jz @F
   388                              <1>  %endif
   389                              <1> 	push ds
   390                              <1> 	pop es
   391                              <1> 	push ss
   392                              <1> 	pop ds
   393                              <1> 	extcallcall yy_boot_read.bx
   394                              <1> 	push ss
   395                              <1> 	pop es
   396                              <1>  %if _APPLICATION || _DEVICE
   397                              <1> 	jmp @FF
   398                              <1>  %endif
   399                              <1> %endif
   400                              <1> 
   401                              <1> @@:
   402                              <1> %if _APPLICATION || _DEVICE
   403                              <1> %if _PM
   404                              <1> 	extcallcall doscall_extseg
   405                              <1> %else
   406                              <1> 	doscall
   407                              <1> %endif
   408                              <1> %endif
   409                              <1> @@:
   410                              <1> %endif
   411 0000011C 16                  <1> 	 push ss
   412 0000011D 1F                  <1> 	 pop ds
   413 0000011E 7303E9DA00          <1> 	jc .io_error
   414 00000123 39C1                <1> 	cmp cx, ax
   415 00000125 7403E9D300          <1> 	jne .io_error
   416                              <1> 
   417 0000012A B80042              <1> 	mov ax, 4200h
   418 0000012D 8B4D12              <1> 	mov cx, word [di + eldhDataOffset + 2]
   419 00000130 8B5510              <1> 	mov dx, word [di + eldhDataOffset]
   420                              <1> %if ELD || _ELDTRAILER
   421 00000133 0316[A205]          <1> 	add dx, word [eldheader]
   422                              <1> internaldatarelocation
   423 00000137 130E[A405]          <1> 	adc cx, word [eldheader + 2]
   424                              <1> internaldatarelocation
   425                              <1> %else
   426                              <1> 		; ELD header is at seek 0
   427                              <1> %endif
   428                              <1> 
   429                              <1> %if _ELDCOMPRESSED
   430                              <1> 	mov word [depackskip], dx
   431                              <1> internaldatarelocation
   432                              <1> 	mov word [depackskip + 2], cx
   433                              <1> internaldatarelocation
   434                              <1> %elif _DOSORBOOTIO
   435 0000013B E8E200              <1> 	call dos_or_boot_io
   436                              <1> %else
   437                              <1> %if _BOOTLDR
   438                              <1>  %if _APPLICATION || _DEVICE
   439                              <1> 	testopt [relocated(internalflags)], nodosloaded
   440                              <1> linkdatarelocation internalflags, -3
   441                              <1> 	jz @F
   442                              <1>  %endif
   443                              <1> 	extcallcall yy_boot_seek_start.bx
   444                              <1> 	extcallcall yy_boot_seek_current.bx
   445                              <1>  %if _APPLICATION || _DEVICE
   446                              <1> 	jmp @FF
   447                              <1>  %endif
   448                              <1> %endif
   449                              <1> 
   450                              <1> @@:
   451                              <1> %if _APPLICATION || _DEVICE
   452                              <1> 	doscall
   453                              <1> %endif
   454                              <1> @@:
   455                              <1> %endif
   456 0000013E 7303E9BA00          <1> 	jc .io_error
   457                              <1> 
   458                              <1> %if ELD
   459 00000143 8B16[0000]          <1> 	mov dx, word [relocateddata]
   460                              <1> linkdatarelocation extdata
   461                              <1> %else
   462                              <1> 	mov dx, ext_data_area
   463                              <1> %endif
   464 00000147 0316[0000]          <1> 	add dx, word [relocated(extdata_used)]
   465                              <1> linkdatarelocation extdata_used
   466 0000014B 8B4D14              <1> 	mov cx, word [di + eldhDataImageLength]
   467                              <1> %if _ELDCOMPRESSED
   468                              <1> 	call read_and_depack
   469                              <1> %elif _DOSORBOOTIO
   470 0000014E B8003F              <1> 	mov ax, 3F00h
   471 00000151 E8CC00              <1> 	call dos_or_boot_io
   472                              <1> %else
   473                              <1> 	mov ah, 3Fh
   474                              <1> %if _BOOTLDR
   475                              <1>  %if _APPLICATION || _DEVICE
   476                              <1> 	testopt [relocated(internalflags)], nodosloaded
   477                              <1> linkdatarelocation internalflags, -3
   478                              <1> 	jz @F
   479                              <1>  %endif
   480                              <1> 	extcallcall yy_boot_read.bx
   481                              <1>  %if _APPLICATION || _DEVICE
   482                              <1> 	jmp @FF
   483                              <1>  %endif
   484                              <1> %endif
   485                              <1> 
   486                              <1> @@:
   487                              <1> %if _APPLICATION || _DEVICE
   488                              <1> 	doscall
   489                              <1> %endif
   490                              <1> @@:
   491                              <1> %endif
   492 00000154 7303E9A400          <1> 	jc .io_error
   493 00000159 39C1                <1> 	cmp cx, ax
   494 0000015B 7403E99D00          <1> 	jne .io_error
   495                              <1> 		; seek now -> behind data image.
   496                              <1> 		; this is expected by library ELDs to find their
   497                              <1> 		;  library images within the file, even if the
   498                              <1> 		;  library ELD was appended using eldapend.
   499                              <1> 
   500                              <1> %if _PM
   501 00000160 E81501              <1> 	call get_es_ext
   502                              <1> %else
   503                              <1> 	mov es, word [extseg]
   504                              <1> %endif
   505                              <1> 
   506                              <1> %if ELD
   507 00000163 8B1E[0000]          <1> 	mov bx, word [relocateddata]
   508                              <1> linkdatarelocation extseg_used		; es:bx -> where we loaded code
   509                              <1> 
   510 00000167 8B4518              <1> 	mov ax, [di + eldhCodeEntrypoint]
   511 0000016A 05[0000]            <1> 	add ax, strict word code	; -> entry destination
   512                              <1> internalcoderelocation
   513 0000016D 26A3[B402]          <1> 	mov word [es:relocator.entry], ax
   514                              <1> internalcoderelocation
   515                              <1> 
   516 00000171 8B450C              <1> 	mov ax, word [di + eldhCodeImageLength]
   517 00000174 26A3[8D02]          <1> 	mov word [es:relocator.codelength], ax
   518                              <1> internalcoderelocation
   519                              <1> 
   520 00000178 8B4514              <1> 	mov ax, word [di + eldhDataImageLength]
   521 0000017B 26A3[9C02]          <1> 	mov word [es:relocator.datalength], ax
   522                              <1> internalcoderelocation
   523                              <1> 
   524 0000017F 58                  <1> 	pop ax
   525                              <1> 
   526 00000180 26C707[0000]        <1> 	mov word [es:bx + eldiStartCode], code
   527                              <1> internalcoderelocation			; fix its start
   528                              <1> 
   529 00000185 89C7                <1> 	mov di, ax
   530 00000187 033E[0000]          <1> 	add di, word [relocateddata]
   531                              <1> linkdatarelocation extseg_used		; di -> relocator destination
   532 0000018B 50                  <1> 	push ax
   533 0000018C 83C040              <1> 	add ax, fromparas(relocator_size_p)
   534 0000018F 260106[0200]        <1> 	add word [es:code + eldiEndCode], ax
   535                              <1> internalcoderelocation			; grow our allocation
   536 00000194 0106[0000]          <1> 	add word [relocateddata], ax
   537                              <1> linkdatarelocation extseg_used		; ditto
   538 00000198 58                  <1> 	pop ax
   539                              <1> 
   540 00000199 26891E[9002]        <1> 	mov word [es:relocator.codesource], bx
   541                              <1> internalcoderelocation			; -> start
   542 0000019E 05[0000]            <1> 	add ax, strict word code
   543                              <1> internalcoderelocation
   544 000001A1 26894702            <1> 	mov word [es:bx + eldiEndCode], ax
   545                              <1> 					; -> past destination
   546 000001A5 26A3[AB02]          <1> 	mov word [es:relocator.extseg_used], ax
   547                              <1> internalcoderelocation			; new extseg_used
   548                              <1> 
   549 000001A9 58                  <1> 	pop ax
   550                              <1> 
   551 000001AA 8B16[0000]          <1> 	mov dx, word [relocateddata]
   552                              <1> linkdatarelocation extdata_used
   553 000001AE 0316[0000]          <1> 	add dx, word [relocateddata]
   554                              <1> linkdatarelocation extdata
   555                              <1> 
   556 000001B2 268916[9F02]        <1> 	mov word [es:relocator.datasource], dx
   557                              <1> internalcoderelocation
   558                              <1> 
   559                              <1> 	houdini
   560 000001B7 BA[0000]            <1> 	mov dx, datastart
   561                              <1> internaldatarelocation
   562 000001BA 26895704            <1> 	mov word [es:bx + eldiStartData], dx
   563 000001BE 01D0                <1> 	add ax, dx
   564 000001C0 26894706            <1> 	mov word [es:bx + eldiEndData], ax
   565                              <1> 
   566 000001C4 2B06[0000]          <1> 	sub ax, word [relocateddata]
   567                              <1> linkdatarelocation extdata
   568 000001C8 26A3[B102]          <1> 	mov word [es:relocator.extdata_used], ax
   569                              <1> internalcoderelocation			; new extdata_used
   570                              <1> 
   571 000001CC BA[0000]            <1> 	mov dx, code
   572                              <1> internalcoderelocation			; es:dx -> ELD code instance (dest)
   573 000001CF BB[0000]            <1> 	mov bx, datastart
   574                              <1> internaldatarelocation
   575                              <1> 
   576 000001D2 BE[8602]            <1> 	mov si, relocator
   577                              <1> internalcoderelocation
   578 000001D5 B91B00              <1> 	mov cx, relocator_size_w
   579 000001D8 06                  <1> 	 push es
   580 000001D9 1F                  <1> 	 pop ds
   581 000001DA 57                  <1> 	push di
   582 000001DB F3A5                <1> 	rep movsw
   583 000001DD 59                  <1> 	pop cx				; -> relocator entry
   584 000001DE 16                  <1> 	push ss
   585 000001DF 1F                  <1> 	pop ds
   586                              <1> %else
   587                              <1> 	pop ax				; allocated code size
   588                              <1> 	mov dx, word [extseg_used]
   589                              <1> 	mov bp, dx
   590                              <1> 	mov word [es:bp+eldiStartCode], dx
   591                              <1> 					; -> loaded code
   592                              <1> 	add ax, word [extseg_used]
   593                              <1> 	mov word [extseg_used], ax	; -> behind
   594                              <1> 	mov word [es:bp+eldiEndCode], ax; -> behind
   595                              <1> 
   596                              <1> 	pop ax				; allocated data size
   597                              <1> 	mov bx, word [extdata_used]
   598                              <1> 	add bx, ext_data_area		; -> loaded data
   599                              <1> 	mov word [es:bp+eldiStartData], bx
   600                              <1> 	add word [extdata_used], ax	; = amount new used
   601                              <1> 	add ax, bx			; -> behind
   602                              <1> 	mov word [es:bp+eldiEndData], ax
   603                              <1> 
   604                              <1> 	mov cx, [di + eldhCodeEntrypoint]
   605                              <1> 	add cx, dx
   606                              <1> %endif
   607 000001E0 83C418              <1> 	add sp, ELD_HEADER_size - 8
   608                              <1> 
   609                              <1> %if ELD
   610 000001E3 5E                  <1> 	pop si
   611 000001E4 A1[0000]            <1> 	mov ax, word [relocateddata]
   612                              <1> linkdatarelocation linksel
   613 000001E7 E8D600              <1> 	extcallcall ispm
   614 000001EA 7403                <1> 	jz @F
   615 000001EC A1[0000]            <1> 	mov ax, word [relocateddata]
   616                              <1> linkdatarelocation linkseg
   617                              <1> @@:
   618                              <1> 
   619 000001EF BF[0000]            <1> 	mov di, relocateddata
   620                              <1> linkdatarelocation linkinfoaddress
   621 000001F2 8B3D                <1> 	mov di, [di]
   622 000001F4 8ED8                <1> 	mov ds, ax
   623                              <1> 
   624 000001F6 FFE1                <1> 	jmp cx
   625                              <1> 		; INP:	es:dx -> loaded initial ELD image
   626                              <1> 		;	 ELD instance structure filled
   627                              <1> 		;	es => ELD code area
   628                              <1> 		;	ds:di -> link info
   629                              <1> 		;	ss:bx -> loaded initial data
   630                              <1> 		;	ss:si -> command line tail
   631                              <1> 		;	cs:ip -> entrypoint
   632                              <1> 		;	ss:sp -> far return address for current mode
   633                              <1> 		; STT:	UP, EI
   634                              <1> 		; REM:	if loaded as an ELD by an uncompressed library ELD,
   635                              <1> 		;	 file seek -> behind data image just loaded
   636                              <1> 		;	file seek is not meaningful when loaded as an ELD
   637                              <1> 		;	 by a compressed library ELD
   638                              <1> %else
   639                              <1> ext_finish.bp_is_set equ $
   640                              <1> 	pop bp
   641                              <1> 
   642                              <1> 	mov si, word [ext_cmdline]
   643                              <1> 
   644                              <1> %if _MESSAGESEGMENT
   645                              <1>  %if _PM
   646                              <1> 	call get_messagesegsel
   647                              <1>  %else
   648                              <1>  	mov ds, word [ss:messageseg]
   649                              <1>  %endif
   650                              <1> %endif
   651                              <1> 	mov di, linkinfo
   652                              <1> 
   653                              <1> 	push cs
   654                              <1> 	call .transfer
   655                              <1> 		; INP:	es:dx -> loaded initial ELD image
   656                              <1> 		;	 ELD instance structure filled
   657                              <1> 		;	es => ELD code area
   658                              <1> 		;	ds:di -> link info
   659                              <1> 		;	ss:bx -> loaded initial data
   660                              <1> 		;	ss:si -> command line tail
   661                              <1> 		;	cs:ip -> entrypoint
   662                              <1> 		;	ss:sp -> far return address for current mode
   663                              <1> 		; STT:	UP, EI
   664                              <1> 		; REM:	file seek -> behind data image just loaded
   665                              <1> %endif
   125                                  
   126                                  .error_internal:
   127 000001F8 BE[0903]                	mov si, msg.ext_error_internal
   128                                  internaldatarelocation
   129 000001FB EB0D                    	jmp specificerror
   130                                  
   131                                  .io_error:
   132 000001FD BE[2F03]                	mov si, msg.ext_error_io
   133                                  internaldatarelocation
   134 00000200 EB08                    	jmp specificerror
   135                                  
   136                                  .invalid:
   137 00000202 BE[5103]                	mov si, msg.ext_error_invalid
   138                                  internaldatarelocation
   139 00000205 EB03                    	jmp specificerror
   140                                  
   141                                  .oom:
   142 00000207 BE[8803]                	mov si, msg.ext_error_oom
   143                                  internaldatarelocation
   144                                  	; jmp specificerror
   145                                  
   146                                  specificerror:
   147 0000020A 16                      	push ss
   148 0000020B 1F                      	pop ds
   149 0000020C 16                      	push ss
   150 0000020D 07                      	pop es
   151 0000020E B40E                    	mov ah, 0Eh
   152 00000210 AC                      	lodsb
   153 00000211 E8[0000]EB020000        	extcall setrc
   154 00000218 89F2                    	mov dx, si
   155 0000021A E8AB00                  	extcallcall putsz
   156                                  zero_and_cmd3:
   157                                  %if _ELD_ZERO_OFFSETS
   158                                  	call zerooffsets
   159                                  %endif
   160 0000021D E8B000                  	extcallcall cmd3
   161                                  
   162                                  
   163                                  
   164                                  dos_or_boot_io:
   165                                  %if _BOOTLDR
   166 00000220 36F606[0100]40          reloc	testopt [ss:relocateddata], nodosloaded
   167                                  linkdatarelocation internalflags, -3
   168 00000226 7515                    	jnz .boot
   169                                  %endif
   170                                  .dos:
   171 00000228 3DFF3F                  	cmp ax, 3FFFh
   172 0000022B 7408                    	je @F
   173 0000022D E8[0000]EB020000        	extcall _doscall
   174 00000234 C3                      	retn
   175                                  
   176                                  @@:
   177 00000235 E8[0000]EB020000        	extcall doscall_extseg
   178 0000023C C3                      	retn
   179                                  
   180                                  %if _BOOTLDR
   181                                  .boot:
   182 0000023D 80FC3F                  	cmp ah, 3Fh
   183 00000240 7512                    	jne @F
   184 00000242 3CFF                    	cmp al, 0FFh
   185 00000244 7504                    	jne .bootread
   186                                  .bootread_ext:
   187 00000246 1E                      	push ds
   188 00000247 07                      	pop es
   189 00000248 16                      	push ss
   190 00000249 1F                      	pop ds
   191                                  .bootread:
   192 0000024A E8[0000]EB020000        	extcall yy_boot_read.bx
   193 00000251 16                      	push ss
   194 00000252 07                      	pop es
   195 00000253 C3                      	retn
   196                                  
   197                                  @@:
   198 00000254 3D0042                  	cmp ax, 4200h
   199 00000257 7517                    	jne @F
   200 00000259 2B16[FCFF]              	sub dx, word [relocateddata - LOADDATA2 + ldCurrentSeek]
   201                                  linkdatarelocation load_data
   202 0000025D 1B0E[FEFF]              	sbb cx, word [relocateddata - LOADDATA2 + ldCurrentSeek + 2]
   203                                  linkdatarelocation load_data
   204                                  
   205                                  .boot_seek_current:
   206 00000261 E8[0000]EB020000        	extcall yy_boot_seek_current.bx
   207 00000268 A1[FCFF]                	mov ax, word [relocateddata - LOADDATA2 + ldCurrentSeek]
   208                                  linkdatarelocation load_data
   209 0000026B 8B16[FEFF]              	mov dx, word [relocateddata - LOADDATA2 + ldCurrentSeek + 2]
   210                                  linkdatarelocation load_data
   211 0000026F C3                      	retn
   212                                  
   213                                  @@:
   214 00000270 3D0142                  	cmp ax, 4201h
   215 00000273 74EC                    	je .boot_seek_current
   216 00000275 E86000                  	extcallcall error
   217                                  %endif
   218                                  
   219                                  
   220                                  %if _COMPRESSED
   221                                  %assign _STANDALONE 0
   222                                   %ifn _ELD_TEST_DESCRIBEX
   223                                    %define ELD_OMIT_PARTIALDEPACK
   224                                   %endif
   225                                   %include "depack.asm"
   226                                  %endif
   227                                  
   228                                  
   229                                  get_es_ext:
   230 00000278 8E06[0000]              reloc	mov es, word [relocateddata]
   231                                  linkdatarelocation extdssel
   232 0000027C E84100                  	extcallcall ispm
   233 0000027F 7404                    	jz @F
   234 00000281 8E06[0000]              reloc	mov es, word [relocateddata]
   235                                  linkdatarelocation extseg
   236                                  @@:
   237 00000285 C3                      	retn
   238                                  
   239                                  
   240                                  	align 2
   241                                  relocator:
   242 00000286 56                      	push si
   243 00000287 57                      	push di
   244 00000288 1E                      	push ds
   245 00000289 06                      	push es
   246                                  
   247 0000028A 06                      	 push es
   248 0000028B 1F                      	 pop ds
   249 0000028C B90000                  	mov cx, 0
   250                                  .codelength equ $ - 2
   251 0000028F BE0000                  	mov si, 0
   252                                  .codesource equ $ - 2
   253 00000292 BF[0000]                	mov di, code
   254                                  .codedestination equ $ - 2
   255                                  internalcoderelocation
   256 00000295 F3A4                    	rep movsb
   257                                  
   258 00000297 16                      	 push ss
   259 00000298 07                      	 pop es
   260 00000299 16                      	 push ss
   261 0000029A 1F                      	 pop ds
   262 0000029B B90000                  	mov cx, 0
   263                                  .datalength equ $ - 2
   264 0000029E BE0000                  	mov si, 0
   265                                  .datasource equ $ - 2
   266 000002A1 BF[0000]                	mov di, datastart
   267                                  .datadestination equ $ - 2
   268                                  internaldatarelocation
   269 000002A4 F3A4                    	rep movsb
   270                                  
   271 000002A6 07                      	pop es
   272 000002A7 C706[0000]0000          	mov word [relocateddata], 0
   273                                  linkdatarelocation extseg_used, -4
   274                                  .extseg_used equ $ - 2
   275 000002AD C706[0000]0000          	mov word [relocateddata], 0
   276                                  linkdatarelocation extdata_used, -4
   277                                  .extdata_used equ $ - 2
   278                                  
   279 000002B3 B90000                  	mov cx, 0
   280                                  .entry equ $ - 2
   281 000002B6 1F                      	pop ds
   282 000002B7 5F                      	pop di
   283 000002B8 5E                      	pop si
   284 000002B9 FFE1                    	jmp cx
   285                                  
   286 000002BB 90                      	align 2
   287                                  	endarea relocator
   288                                  
   289 000002BC 90<rep 4h>E8[0000]-     	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   289 000002C3 EB020000C3E8[0000]-
   289 000002CB EB020000C3E8[0000]-
   289 000002D3 EB020000C3E8[0000]-
   289 000002DB EB020000C3         
   290                                  	eldcall_new_callcall
   291                                  
   292                                  endload: equ ($ + _CURRENT_SECTION %+ FIXUP + 15) & ~15
   293                                  
   294                                  
   295                                  start:
   296 000002E0 16                      	push ss
   297 000002E1 07                      	pop es
   298                                  %if _DATABUFFER
   299 000002E2 F606[0100]40            reloc	testopt [relocateddata], nodosloaded
   300                                  linkdatarelocation internalflags, -3
   301 000002E7 7420                    	jz .skipdatabuffer
   302 000002E9 B104                    	mov cl, 4
   303 000002EB 8CD0                    	mov ax, ss
   304 000002ED BB[B005]                reloc	mov bx, databuffer
   305                                  internaldatarelocation
   306 000002F0 F6C30F                  	test bl, 15
   307 000002F3 7514                    	jnz .skipdatabuffer
   308 000002F5 D3EB                    	shr bx, cl
   309 000002F7 01D8                    	add ax, bx
   310 000002F9 A3[0600]                reloc	mov word [relocateddata - LOADDATA2 + ldDataSegment], ax
   311                                  linkdatarelocation load_data
   312 000002FC 31C0                    	xor ax, ax
   313 000002FE A3[0A00]                reloc	mov word [relocateddata - LOADDATA2 + ldDataSector + 2], ax
   314                                  linkdatarelocation load_data
   315 00000301 A3[0800]                reloc	mov word [relocateddata - LOADDATA2 + ldDataSector], ax
   316                                  linkdatarelocation load_data
   317 00000304 800E[1700]08            reloc	setopt [relocateddata - LOADDATA2 + ldFlags], ldfDataBuffered
   318                                  linkdatarelocation load_data, -3
   319                                  .skipdatabuffer:
   320                                  %endif
   321 00000309 E8E402                  	extcallcall skipcomma
   322 0000030C 8D5CFF                  	lea bx, [si - 1]
   323 0000030F E8E602                  	extcallcall iseol?
   324 00000312 740D                    	je help_dec
   325 00000314 4E                      	dec si
   326 00000315 BA[9404]                	mov dx, msg.help_keyword
   327                                  internaldatarelocation
   328 00000318 E8E502                  	extcallcall isstring?
   329 0000031B 7405                    	je help
   330                                  %if _COMPRESSED && _ELD_TEST_LIB
   331                                  	mov dx, msg.test_keyword
   332                                  internaldatarelocation
   333                                  	extcallcall isstring?
   334                                  	je test
   335                                  %endif
   336 0000031D AC                      	lodsb
   337 0000031E E93401                  	jmp getname
   338                                  
   339                                  %if _COMPRESSED && _ELD_TEST_LIB
   340                                  test:
   341                                  	call get_dxax_seek_lib_zero
   342                                  	jc .io_error
   343                                  	mov word [libseek], ax
   344                                  internaldatarelocation
   345                                  	mov word [libseek + 2], dx
   346                                  internaldatarelocation
   347                                  
   348                                  	mov cx, ELD_HEADERX_size
   349                                  	sub sp, cx
   350                                  
   351                                  	xor ax, ax
   352                                  	mov word [depackskip], ax
   353                                  internaldatarelocation
   354                                  	mov word [depackskip + 2], ax
   355                                  internaldatarelocation
   356                                  
   357                                  	mov dx, sp
   358                                  	call read_and_depack
   359                                  	houdini
   360                                  
   361                                  	mov ax, (library_end_skip - library_start_skip - 16) & 0FFFFh
   362                                  	mov dx, (library_end_skip - library_start_skip - 16) >> 16
   363                                  
   364                                  	mov word [depackskip], ax
   365                                  internaldatarelocation
   366                                  	mov word [depackskip + 2], dx
   367                                  internaldatarelocation
   368                                  
   369                                  	mov cx, ELD_HEADERX_size
   370                                  	mov dx, sp
   371                                  	call read_and_depack
   372                                  	houdini
   373                                  	jc .io_error
   374                                  	cmp cx, ax
   375                                  	jne .io_error
   376                                  .io_error:
   377                                  	mov word [depackskip], 30h
   378                                  internaldatarelocation -4
   379                                  	mov word [depackskip + 2], 0
   380                                  internaldatarelocation -4
   381                                  
   382                                  	mov cx, 32
   383                                  	mov dx, sp
   384                                  	call read_and_depack
   385                                  	houdini
   386                                  
   387                                  	extcallcall cmd3
   388                                  %endif
   389                                  
   390                                  help_dec:
   391 00000321 4E                      	dec si
   392                                  help:
   393 00000322 31C9                    	xor cx, cx
   394 00000324 E8C902                  	extcallcall skipcomma
   395 00000327 E8CE02                  	extcallcall iseol?
   396 0000032A 7419                    	je .dispatch_eol
   397 0000032C 4E                      	dec si
   398 0000032D 41                      	inc cx
   399 0000032E BA[9904]                	mov dx, msg.describe_keyword
   400                                  internaldatarelocation
   401 00000331 E8CC02                  	extcallcall isstring?
   402 00000334 740B                    	je .dispatch
   403                                  %if _ELD_TEST_DESCRIBEX
   404                                  %if _COMPRESSED
   405                                  	not byte [partialdepack]
   406                                  internaldatarelocation
   407                                  %endif
   408                                  	mov dx, msg.describex_keyword
   409                                  internaldatarelocation
   410                                  	extcallcall isstring?
   411                                  	je .dispatch
   412                                  %endif
   413 00000336 41                      	inc cx
   414 00000337 BA[A204]                	mov dx, msg.wide_keyword
   415                                  internaldatarelocation
   416 0000033A E8C302                  	extcallcall isstring?
   417 0000033D 7402                    	je .dispatch
   418 0000033F EB97                    	jmp error
   419                                  
   420                                  .dispatch:
   421 00000341 AC                      	lodsb
   422 00000342 E8C302                  	extcallcall chkeol
   423                                  .dispatch_eol:
   424 00000345 BA[A704]                	mov dx, msg.help
   425                                  internaldatarelocation
   426 00000348 E87DFF                  	extcallcall putsz
   427                                  
   428 0000034B 49                      	dec cx
   429 0000034C 7903E9CCFE              	js zero_and_cmd3
   430 00000351 742D                    	jz describe
   431                                  
   432                                  wide:
   433 00000353 BA[8205]                	mov dx, msg.list
   434                                  internaldatarelocation
   435 00000356 E86FFF                  	extcallcall putsz
   436                                  
   437 00000359 BE[0800]                	mov si, lib
   438                                  internaldatarelocation
   439 0000035C EB09                    	jmp @F
   440                                  .loop:
   441 0000035E 81FF[4800]              	cmp di, relocateddata + 9 * 8
   442                                  linkdatarelocation line_out
   443 00000362 7206                    	jb @FF
   444 00000364 E8A902                  	extcallcall trimputs
   445                                  @@:
   446 00000367 BF[0000]                reloc	mov di, relocateddata
   447                                  linkdatarelocation line_out
   448                                  @@:
   449 0000036A AD                      	lodsw
   450 0000036B AD                      	lodsw			; si += 4
   451 0000036C B90800                  	mov cx, 8
   452 0000036F F3A4                    	rep movsb
   453 00000371 B020                    	mov al, 32
   454 00000373 AA                      	stosb
   455                                  
   456 00000374 81FE[0803]              	cmp si, strict word lib_end
   457                                  internaldatarelocation
   458 00000378 72E4                    	jb .loop
   459 0000037A E89302                  	extcallcall trimputs
   460                                  %if _ELD_ZERO_OFFSETS
   461                                  	call zerooffsets
   462                                  %endif
   463 0000037D E850FF                  	extcallcall cmd3
   464                                  
   465                                  
   466                                  describe:
   467 00000380 BA[8205]                	mov dx, msg.list
   468                                  internaldatarelocation
   469 00000383 E842FF                  	extcallcall putsz
   470                                  
   471 00000386 E83102                  	call get_dxax_seek_lib_zero
   472 00000389 7303E96FFE              	jc .io_error
   473 0000038E A3[9E05]                	mov word [libseek], ax
   474                                  internaldatarelocation
   475 00000391 8916[A005]              	mov word [libseek + 2], dx
   476                                  internaldatarelocation
   477                                  
   478 00000395 BE[0800]                	mov si, lib
   479                                  internaldatarelocation
   480                                  .loop:
   481 00000398 8D5404                  	lea dx, [si + 4]
   482 0000039B B90800                  	mov cx, 8
   483 0000039E 53                      	push bx
   484 0000039F E87602                  	extcallcall puts
   485 000003A2 5B                      	pop bx
   486 000003A3 BA[3E04]                	mov dx, msg.between
   487                                  internaldatarelocation
   488 000003A6 E81FFF                  	extcallcall putsz
   489                                  
   490                                  %if _COMPRESSED
   491                                  	mov ax, word [si]
   492                                  	mov dx, word [si + 2]
   493                                  
   494                                  	mov word [eldheader], ax
   495                                  internaldatarelocation
   496                                  	mov word [eldheader + 2], dx
   497                                  internaldatarelocation
   498                                  
   499                                  	mov word [depackskip], ax
   500                                  internaldatarelocation
   501                                  	mov word [depackskip + 2], dx
   502                                  internaldatarelocation
   503                                  %else
   504 000003A9 8B16[9E05]              	mov dx, word [libseek]
   505                                  internaldatarelocation
   506 000003AD 8B0E[A005]              	mov cx, word [libseek + 2]
   507                                  internaldatarelocation
   508                                  
   509 000003B1 0314                    	add dx, word [si]
   510 000003B3 134C02                  	adc cx, word [si + 2]
   511                                  
   512 000003B6 B80042                  	mov ax, 4200h
   513 000003B9 E864FE                  	call dos_or_boot_io
   514 000003BC 7303E93CFE              	jc .io_error
   515 000003C1 A3[A205]                	mov word [eldheader], ax
   516                                  internaldatarelocation
   517 000003C4 8916[A405]              	mov word [eldheader + 2], dx
   518                                  internaldatarelocation
   519                                  %endif
   520                                  
   521 000003C8 B93000                  	mov cx, ELD_HEADERX_size
   522 000003CB 29CC                    	sub sp, cx
   523 000003CD 89E2                    	mov dx, sp
   524                                  %if _COMPRESSED
   525                                  	call read_and_depack
   526                                  %else
   527 000003CF B8003F                  	mov ax, 3F00h
   528 000003D2 E84BFE                  	call dos_or_boot_io
   529                                  %endif
   530 000003D5 7303E923FE              	jc .io_error
   531 000003DA 39C1                    	cmp cx, ax
   532 000003DC 7403E91CFE              	jne .io_error
   533                                  
   534 000003E1 89E7                    	mov di, sp
   535 000003E3 837D1E24                	cmp word [di + eldhExtensionSize], eldhxDescriptionOffset + 4
   536 000003E7 7240                    	jb .nodesc
   537 000003E9 8B4D22                  	mov cx, word [di + eldhxDescriptionOffset + 2]
   538 000003EC 8B5520                  	mov dx, word [di + eldhxDescriptionOffset]
   539 000003EF 89C8                    	mov ax, cx
   540 000003F1 09D0                    	or ax, dx
   541 000003F3 7434                    	jz .nodesc
   542                                  
   543 000003F5 B80042                  	mov ax, 4200h
   544 000003F8 0316[A205]              	add dx, word [eldheader]
   545                                  internaldatarelocation
   546 000003FC 130E[A405]              	adc cx, word [eldheader + 2]
   547                                  internaldatarelocation
   548                                  %if _COMPRESSED
   549                                  	mov word [depackskip], dx
   550                                  internaldatarelocation
   551                                  	mov word [depackskip + 2], cx
   552                                  internaldatarelocation
   553                                  %else
   554 00000400 E81DFE                  	call dos_or_boot_io
   555 00000403 7303E9F5FD              	jc .io_error
   556                                  %endif
   557                                  
   558 00000408 BF[0000]                	mov di, relocateddata
   559                                  linkdatarelocation line_out
   560 0000040B 89FA                    	mov dx, di
   561 0000040D 31C0                    	xor ax, ax
   562 0000040F B94000                  	mov cx, words(128)
   563 00000412 F3AB                    	rep stosw
   564 00000414 B17F                    	mov cl, 127
   565                                  %if _COMPRESSED
   566                                  	call read_and_depack
   567                                  %else
   568 00000416 B8003F                  	mov ax, 3F00h
   569 00000419 E804FE                  	call dos_or_boot_io
   570                                  %endif
   571 0000041C 7303E9DCFD              	jc .io_error
   572                                  	; cmp cx, ax
   573                                  	; jne .io_error
   574                                  
   575 00000421 E8A4FE                  	extcallcall putsz
   576 00000424 BA[5004]                	mov dx, msg.linebreak
   577                                  internaldatarelocation
   578 00000427 EB03                    	jmp @F
   579                                  .nodesc:
   580 00000429 BA[4104]                	mov dx, msg.nodesc
   581                                  internaldatarelocation
   582                                  @@:
   583 0000042C E899FE                  	extcallcall putsz
   584 0000042F 83C430                  	add sp, ELD_HEADERX_size
   585 00000432 83C60C                  	add si, 4 + 8
   586 00000435 81FE[0803]              	cmp si, strict word lib_end
   587                                  internaldatarelocation
   588 00000439 7303E95AFF              	jb .loop
   589                                  
   590                                  .io_error equ found.io_error
   591                                  %if _ELD_ZERO_OFFSETS
   592                                  	call zerooffsets
   593                                  %endif
   594 0000043E E88FFE                  	extcallcall cmd3
   595                                  
   596                                  
   597                                  %if _ELD_ZERO_OFFSETS
   598                                  zerooffsets:
   599                                  		; for debugging with eldcomp, zero the offsets
   600                                  	xor ax, ax
   601                                  	mov di, ..@eldltOffset
   602                                  internaldatarelocation
   603                                  	stosw
   604                                  	stosw			; clear eldltOffset
   605                                   %if _COMPRESSED
   606                                  	stosw
   607                                  	stosw			; clear libtab_compressed_length
   608                                   %endif
   609                                  .loop:
   610                                  	stosw
   611                                  	stosw
   612                                  	add di, 8
   613                                  	cmp di, strict word lib_end
   614                                  internaldatarelocation
   615                                  	jb .loop
   616                                  	retn
   617                                  %endif
   618                                  
   619                                  
   620                                  unquoted:
   621                                  .loop:
   622 00000441 AC                      	lodsb
   623                                  .first:
   624 00000442 3C20                    	cmp al, 32
   625 00000444 7430                    	je end
   626 00000446 3C09                    	cmp al, 9
   627 00000448 742C                    	je end
   628 0000044A 3C2C                    	cmp al, ','
   629 0000044C 7428                    	je end
   630 0000044E E8CF01                  	extcallcall iseol?.notsemicolon
   631 00000451 75EE                    	jne .loop
   632 00000453 EB21                    	jmp end
   633                                  
   634                                  getname:
   635 00000455 3C22                    	cmp al, '"'
   636 00000457 7404                    	je quoted
   637 00000459 3C27                    	cmp al, "'"
   638 0000045B 75E5                    	jne unquoted.first
   639                                  quoted:
   640 0000045D 43                      	inc bx
   641 0000045E 88C4                    	mov ah, al
   642                                  .loop:
   643 00000460 AC                      	lodsb
   644 00000461 38E0                    	cmp al, ah
   645 00000463 740B                    	je end_quoted
   646 00000465 E8B801                  	extcallcall iseol?.notsemicolon
   647 00000468 75F6                    	jne .loop
   648                                  unexpected_eol:
   649 0000046A BE[5304]                	mov si, msg.unexpected_eol
   650                                  internaldatarelocation
   651 0000046D E99AFD                  	jmp specificerror
   652                                  
   653                                  end_quoted:
   654 00000470 8D4CFF                  	lea cx, [si - 1]
   655 00000473 AC                      	lodsb
   656 00000474 EB03                    	jmp @F
   657                                  
   658                                  end:
   659 00000476 8D4CFF                  	lea cx, [si - 1]
   660                                  @@:
   661 00000479 E8AC01                  	extcallcall skipcomm0
   662 0000047C 4E                      	dec si
   663                                  
   664 0000047D 56                      	push si
   665 0000047E 29D9                    	sub cx, bx
   666 00000480 7503E91901              	jz notfound_invalid
   667                                  
   668 00000485 80F904                  	cmp cl, 4
   669 00000488 7226                    	jb .notext
   670 0000048A 8D77FC                  	lea si, [bx - 4]
   671 0000048D 01CE                    	add si, cx
   672 0000048F AC                      	lodsb
   673 00000490 3C2E                    	cmp al, '.'
   674 00000492 751C                    	jne .notext
   675 00000494 AC                      	lodsb
   676 00000495 24DF                    	and al, ~20h
   677 00000497 3C45                    	cmp al, 'E'
   678 00000499 7404                    	je @F
   679 0000049B 3C58                    	cmp al, 'X'
   680 0000049D 7511                    	jne .notext
   681                                  @@:
   682 0000049F AD                      	lodsw
   683 000004A0 25DFDF                  	and ax, ~2020h
   684 000004A3 3D4C44                  	cmp ax, "LD"
   685 000004A6 7508                    	jne .notext
   686                                  .ext:
   687 000004A8 80E904                  	sub cl, 4
   688 000004AB 7503E9EE00              	jz notfound_invalid
   689                                  .notext:
   690                                  
   691 000004B0 80F908                  	cmp cl, 8
   692 000004B3 7603E9E600              	ja notfound_invalid
   693 000004B8 89DE                    	mov si, bx
   694 000004BA BF[0904]                	mov di, msg.namebuffer
   695                                  internaldatarelocation
   696                                  @@:
   697 000004BD AC                      	lodsb
   698 000004BE E86F01                  	extcallcall uppercase
   699 000004C1 AA                      	stosb
   700 000004C2 E2F9                    	loop @B
   701                                  
   702                                  search_filename:
   703 000004C4 BE[0C00]                	mov si, lib + 4
   704                                  internaldatarelocation
   705                                  .loop:
   706 000004C7 E8DA00                  	call comparenamebuffer
   707 000004CA 7503E9B700              	je found
   708 000004CF 83C60C                  	add si, 8 + 4
   709 000004D2 81FE[0803]              	cmp si, strict word lib_end
   710                                  internaldatarelocation
   711 000004D6 72EF                    	jb .loop
   712                                  
   713                                  search_instancename:
   714 000004D8 E8DF00                  	call get_dxax_seek_lib_zero
   715 000004DB 7303E91DFD              	jc .io_error
   716 000004E0 A3[9E05]                	mov word [libseek], ax
   717                                  internaldatarelocation
   718 000004E3 8916[A005]              	mov word [libseek + 2], dx
   719                                  internaldatarelocation
   720                                  
   721 000004E7 BE[0C00]                	mov si, lib + 4
   722                                  internaldatarelocation
   723                                  
   724                                  .loop:
   725                                  %if _COMPRESSED
   726                                  	mov ax, word [si - 4]
   727                                  	mov dx, word [si - 4 + 2]
   728                                  
   729                                  	mov word [depackskip], ax
   730                                  internaldatarelocation
   731                                  	mov word [depackskip + 2], dx
   732                                  internaldatarelocation
   733                                  %else
   734 000004EA 8B4CFE                  	mov cx, word [si - 4 + 2]
   735 000004ED 8B54FC                  	mov dx, word [si - 4]		; cx:dx = offset within lib section
   736 000004F0 0316[9E05]              	add dx, word [libseek]
   737                                  internaldatarelocation
   738 000004F4 130E[A005]              	adc cx, word [libseek + 2]
   739                                  internaldatarelocation
   740 000004F8 B80042                  	mov ax, 4200h
   741 000004FB E822FD                  	call dos_or_boot_io
   742 000004FE 7303E9FAFC              	jc .io_error
   743                                  %endif
   744                                  
   745 00000503 A3[A205]                	mov word [eldheader], ax
   746                                  internaldatarelocation
   747 00000506 8916[A405]              	mov word [eldheader + 2], dx
   748                                  internaldatarelocation
   749                                  
   750 0000050A B92000                  	mov cx, ELD_HEADER_size
   751 0000050D 29CC                    	sub sp, cx
   752 0000050F 89E2                    	mov dx, sp
   753                                  %if _COMPRESSED
   754                                  	call read_and_depack
   755                                  %else
   756 00000511 B8003F                  	mov ax, 3F00h
   757 00000514 E809FD                  	call dos_or_boot_io
   758                                  %endif
   759 00000517 7303E9E1FC              	jc .io_error
   760 0000051C 39C1                    	cmp cx, ax
   761 0000051E 7403E9DAFC              	jne .io_error
   762                                  
   763 00000523 89E7                    	mov di, sp
   764 00000525 8B4D0A                  	mov cx, word [di + eldhCodeOffset + 2]
   765 00000528 8B5508                  	mov dx, word [di + eldhCodeOffset] ; cx:dx = offset within ELD
   766 0000052B 0316[A205]              	add dx, word [eldheader]
   767                                  internaldatarelocation
   768 0000052F 130E[A405]              	adc cx, word [eldheader + 2]
   769                                  internaldatarelocation
   770                                  %if _COMPRESSED
   771                                  	mov word [depackskip], dx
   772                                  internaldatarelocation
   773                                  	mov word [depackskip + 2], cx
   774                                  internaldatarelocation
   775                                  %else
   776 00000533 B80042                  	mov ax, 4200h
   777 00000536 E8E7FC                  	call dos_or_boot_io
   778 00000539 7303E9BFFC              	jc .io_error
   779                                  %endif
   780                                  
   781 0000053E 89E2                    	mov dx, sp
   782 00000540 B91000                  	mov cx, eldiIdentifier + 8
   783                                  %if (eldiIdentifier + 8) > ELD_HEADER_size
   784                                   %error Expected shorter instance header
   785                                  %endif
   786                                  %if _COMPRESSED
   787                                  	call read_and_depack
   788                                  %else
   789 00000543 B8003F                  	mov ax, 3F00h
   790 00000546 E8D7FC                  	call dos_or_boot_io
   791                                  %endif
   792 00000549 7303E9AFFC              	jc .io_error
   793 0000054E 39C1                    	cmp cx, ax
   794 00000550 7403E9A8FC              	jne .io_error
   795                                  
   796 00000555 8D4D08                  	lea cx, [di + eldiIdentifier]
   797 00000558 E84B00                  	call comparenamebuffer.cx
   798 0000055B 7411                    	je .found
   799 0000055D 83C420                  	add sp, ELD_HEADER_size
   800                                  
   801 00000560 83C60C                  	add si, 8 + 4
   802 00000563 81FE[0803]              	cmp si, strict word lib_end
   803                                  internaldatarelocation
   804 00000567 7281                    	jb .loop
   805                                  	; jmp notfound
   806 00000569 BE[E503]                	mov si, msg.notfound
   807                                  internaldatarelocation
   808 0000056C EB33                    	jmp specificerror_j
   809                                  
   810                                  .found:
   811 0000056E 83C420                  	add sp, ELD_HEADER_size
   812                                  
   813                                  %ifn _COMPRESSED
   814 00000571 8B16[A205]              	mov dx, word [eldheader]
   815                                  internaldatarelocation
   816 00000575 8B0E[A405]              	mov cx, word [eldheader + 2]
   817                                  internaldatarelocation
   818 00000579 B80042                  	mov ax, 4200h
   819 0000057C E8A1FC                  	call dos_or_boot_io
   820 0000057F 7303E979FC              	jc .io_error
   821                                  %endif
   822                                  		; get_dxax_seek_lib_* already called
   823 00000584 EB15                    	jmp found.header_variable
   824                                  
   825                                  .io_error equ found.io_error
   826                                  
   827                                  
   828                                  found:
   829                                  		; get_dxax_seek_lib_* not yet called
   830                                  %if 0
   831                                  	xor ax, ax
   832                                  	retf
   833                                  %endif
   834                                  
   835                                  %if _COMPRESSED
   836                                  	call get_dxax_seek_lib_zero
   837                                  	jc .io_error
   838                                  	mov word [libseek], ax
   839                                  internaldatarelocation
   840                                  	mov word [libseek + 2], dx
   841                                  internaldatarelocation
   842                                  
   843                                  	mov dx, word [si - 4 + 2]
   844                                  	mov ax, word [si - 4]		; dx:ax = offset within lib section
   845                                  %else
   846 00000586 8B4CFE                  	mov cx, word [si - 4 + 2]
   847 00000589 8B54FC                  	mov dx, word [si - 4]		; cx:dx = offset within lib section
   848                                  
   849 0000058C E82F00                  	call get_dxax_seek_lib_plus_cxdx
   850 0000058F 7303E969FC              	jc .io_error
   851                                  %endif
   852 00000594 A3[A205]                	mov word [eldheader], ax
   853                                  internaldatarelocation
   854 00000597 8916[A405]              	mov word [eldheader + 2], dx
   855                                  internaldatarelocation
   856                                  		; get_dxax_seek_lib_* already called
   857                                  .header_variable:
   858 0000059B E982FA                  	jmp load
   859                                  
   860                                  .io_error equ load.io_error
   861                                  
   862                                  
   863                                  notfound_invalid:
   864 0000059E BE[1604]                	mov si, msg.notfound.invalid
   865                                  internaldatarelocation
   866                                  specificerror_j:
   867 000005A1 E966FC                  	jmp specificerror
   868                                  
   869                                  
   870                                  comparenamebuffer:
   871 000005A4 89F1                    	mov cx, si
   872                                  .cx:
   873 000005A6 56                      	push si
   874 000005A7 89CE                    	mov si, cx
   875 000005A9 BF[0904]                	mov di, msg.namebuffer
   876                                  internaldatarelocation
   877 000005AC B90800                  	mov cx, 8
   878                                  @@:
   879 000005AF AC                      	lodsb
   880 000005B0 E87D00                  	extcallcall uppercase
   881 000005B3 AE                      	scasb
   882 000005B4 E1F9                    	loope @B
   883 000005B6 5E                      	pop si
   884 000005B7 C3                      	retn
   885                                  
   886 000005B8 [0000]                  	dw relocateddata		; link only for checking support
   887                                  linkdatarelocation ext_finish.bp_is_set
   888                                  
   889                                  		; This must be called exactly once, if at all.
   890                                  		;  It expects that the current file seek is as
   891                                  		;  left over from our ELD instance having been
   892                                  		;  loaded, ie it -> behind our data section.
   893                                  		; This seeks once to the library image plus the
   894                                  		;  displacement given by cxdx.
   895                                  get_dxax_seek_lib_zero:
   896 000005BA 31C9                    	xor cx, cx
   897 000005BC 31D2                    	xor dx, dx
   898                                  get_dxax_seek_lib_plus_cxdx:
   899 000005BE BB[0000]                	mov bx, relocateddata
   900                                  linkdatarelocation load_data_lowest	; make yy_boot_get and yy_boot_update no-ops
   901 000005C1 F606[0100]40            	testopt [relocateddata], nodosloaded
   902                                  linkdatarelocation internalflags, -3
   903 000005C6 7510                    	jnz @F
   904 000005C8 8B1E[0000]              	mov bx, [relocateddata]
   905                                  linkdatarelocation ext_handle
   906 000005CC E8[0000]EB020000        	extcall InDOS
   907 000005D3 7403                    	jz @F
   908 000005D5 E800FD                  	extcallcall error
   909                                  @@:
   910 000005D8 B80142                  	mov ax, 4201h
   911                                  lib_displacement equ LIBOFFSET - (DATAOFFSET + data_size)
   912                                  %if lib_displacement
   913                                  	add dx, lib_displacement & 0FFFFh
   914                                  	adc cx, (lib_displacement >> 16) & 0FFFFh
   915                                  %endif
   916 000005DB D006[0803]              	rol byte [got_seek_lib], 1
   917                                  internaldatarelocation
   918 000005DF 7306                    	jnc @F
   919 000005E1 BE[AD03]                	mov si, msg.error_seek_lib
   920                                  internaldatarelocation
   921 000005E4 E923FC                  	jmp specificerror
   922                                  @@:
   923 000005E7 F616[0803]              	not byte [got_seek_lib]
   924                                  internaldatarelocation
   925 000005EB E932FC                  	jmp dos_or_boot_io
   926                                  
   927                                  
   928                                  DATAOFFSET equ CODEOFFSET + code_size
   929                                  	addsection DATA, follows=CODE vstart=_ELD_DATA_VSTART
   930                                  datastart:
   931                                  PUT_ELD_DATETIME
   932                                  
   933                                  %define INCBINLIST db ""
   934                                  
   935                                  	%imacro libeld 1-2.nolist
   936                                  %strcat %%label "lib_", %1
   937                                  %deftok %%token %%label
   938                                  %if _XLD
   939                                   %strcat %%filename %1,".xld"
   940                                  %else
   941                                   %strcat %%filename %1,".eld"
   942                                  %endif
   943                                  %xdefine INCBINLIST INCBINLIST, {align 16, db 0}, %%token:, incbin %%filename
   944                                  	dd %%token
   945                                  	fill 8, 32, db %1
   946                                  	%endmacro
   947                                  
   948                                  	%imacro dump_incbin 1-*.nolist
   949                                  %rep %0
   950                                  	%1
   951                                   %rotate 1
   952                                  %endrep
   953                                  	%endmacro
   954                                  
   955                                  %ifn _COMPRESSED
   956                                  	overridedef LZEXEDAT, 0
   957                                  %endif
   958                                  %ifn _LZEXEDAT
   959                                  	overridedef LONGLITERAL, 0
   960                                  %endif
   961                                  
   962                                  	align 4, db 0
   963                                  libtable:
   964                                   istruc ELD_LIBTABLE
   965 00000000 0000                    at eldltFormat,		dw 2 * !!_COMPRESSED + !!_LZEXEDAT + !!_LONGLITERAL
   966                                  	; 0 = uncompressed
   967                                  	; 1 = legacy heatshrink format (no libtab compressed length)
   968                                  	; 2 = heatshrink format (prepended with -w and -l bytes)
   969                                  	; 3 = lzexedat -4 format (current revision starts with a 1 bit)
   970                                  	; 4 = lzexedat -4 -l format (current revision starts with a 1 bit)
   971 00000002 4000                    at eldltAmount,		dw (lib_end - lib) / 12
   972                                  at eldltOffset
   973 00000004 A0140000                ..@eldltOffset:		dd LIBOFFSET
   974                                   iend
   975                                   %if _COMPRESSED
   976                                  libtab_compressed_length:
   977                                  			dd (lib_compressed_end - lib_start)
   978                                   %endif
   979                                  %else
   980                                  		; Collect the binaries and compress them solidly.
   981                                  	%imacro libeld 1-2.nolist
   982                                  %strcat %%label "lib_", %1
   983                                  %deftok %%token %%label
   984                                  %if _XLD
   985                                   %strcat %%filename %1,".xld"
   986                                  %else
   987                                   %strcat %%filename %1,".eld"
   988                                  %endif
   989                                  	align 16, db 0
   990                                  %%token:
   991                                  	incbin %%filename
   992                                  	%endmacro
   993                                  %endif
   994                                  
   995                                  	numdef ELD_DEBUG_LIB, 0
   996                                  lib:
   997                                  %if _ELD_DEBUG_LIB
   998                                  libeld "eldteste"
   999                                  libeld "eldtestf"
  1000                                  %else
  1001 00000008 [00000000]61666F72-     libeld "aformat"
  1001 00000010 6D617420           
  1002 00000014 [A00C0000]616C6961-     libeld "alias"
  1002 0000001C 7320<rep 3h>       
  1003 00000020 [201D0000]616D6973-     libeld "amiscmd"
  1003 00000028 636D6420           
  1004 0000002C [70290000]616D6973-     libeld "amismsg"
  1004 00000034 6D736720           
  1005 00000038 [60350000]616D6973-     libeld "amisoth"
  1005 00000040 6F746820           
  1006 00000044 [10400000]616D6974-     libeld "amitsrs"
  1006 0000004C 73727320           
  1007 00000050 [D0580000]616D6F75-     libeld "amount"
  1007 00000058 6E7420<rep 2h>     
  1008 0000005C [20640000]62617365-     libeld "bases"
  1008 00000064 7320<rep 3h>       
  1009 00000068 [20710000]626F6F74-     libeld "bootdir"
  1009 00000070 64697220           
  1010 00000074 [40880000]63686563-     libeld "checksum"
  1010 0000007C 6B73756D           
  1011 00000080 [80940000]63687374-     libeld "chstool"
  1011 00000088 6F6F6C20           
  1012 0000008C [D0AE0000]636F20-       libeld "co"
  1012 0000008C <rep 6h>           
  1013 00000098 [70C20000]636F6E66-     libeld "config"
  1013 000000A0 696720<rep 2h>     
  1014 000000A4 [30CC0000]64626974-     libeld "dbitmap"
  1014 000000AC 6D617020           
  1015 000000B0 [30DF0000]64657669-     libeld "devices"
  1015 000000B8 63657320           
  1016 000000BC [30ED0000]64686D20-     libeld "dhm"
  1016 000000BC <rep 5h>           
  1017 000000C8 [30FB0000]646920-       libeld "di"
  1017 000000C8 <rep 6h>           
  1018 000000D4 [C00E0100]646D20-       libeld "dm"
  1018 000000D4 <rep 6h>           
  1019 000000E0 [F01F0100]646F7363-     libeld "doscd"
  1019 000000E8 6420<rep 3h>       
  1020 000000EC [F0270100]646F7364-     libeld "dosdir"
  1020 000000F4 697220<rep 2h>     
  1021 000000F8 [C03E0100]646F7364-     libeld "dosdrive"
  1021 00000100 72697665           
  1022 00000104 [C0460100]646F7370-     libeld "dospwd"
  1022 0000010C 776420<rep 2h>     
  1023 00000110 [604E0100]646F7373-     libeld "dosseek"
  1023 00000118 65656B20           
  1024 0000011C [C05A0100]646F7373-     libeld "dosspace"
  1024 00000124 70616365           
  1025 00000128 [006D0100]646F7373-     libeld "dosstrat"
  1025 00000130 74726174           
  1026 00000134 [A0770100]64706220-     libeld "dpb"
  1026 00000134 <rep 5h>           
  1027 00000140 [008E0100]64746164-     libeld "dtadisp"
  1027 00000148 69737020           
  1028 0000014C [70950100]647820-       libeld "dx"
  1028 0000014C <rep 6h>           
  1029 00000158 [E0A30100]656E616D-     libeld "enamelib"
  1029 00000160 656C6962           
  1030 00000164 [50B30100]65727266-     libeld "errfix"
  1030 0000016C 697820<rep 2h>     
  1031 00000170 [50C10100]6578746E-     libeld "extname"
  1031 00000178 616D6520           
  1032                                  %if _MCP
  1033                                  libeld "fdbplace"
  1034                                  %endif
  1035 0000017C [60D90100]68696E74-     libeld "hint"
  1035 00000184 20<rep 4h>         
  1036 00000188 [50E60100]68696E74-     libeld "hintoth"
  1036 00000190 6F746820           
  1037 00000194 [70F30100]68697374-     libeld "history"
  1037 0000019C 6F727920           
  1038 000001A0 [70FF0100]69666578-     libeld "ifext"
  1038 000001A8 7420<rep 3h>       
  1039 000001AC [000D0200]696E6A65-     libeld "inject"
  1039 000001B4 637420<rep 2h>     
  1040 000001B8 [20190200]696E7374-     libeld "instnoth"
  1040 000001C0 6E6F7468           
  1041 000001C4 [90270200]696E7374-     libeld "instnoun"
  1041 000001CC 6E6F756E           
  1042 000001D0 [10340200]6B636D64-     libeld "kcmdline"
  1042 000001D8 6C696E65           
  1043 000001DC [F03F0200]6B646973-     libeld "kdisplay"
  1043 000001E4 706C6179           
  1044 000001E8 [F0480200]6C646D65-     libeld "ldmem"
  1044 000001F0 6D20<rep 3h>       
  1045 000001F4 [70730200]6C646D65-     libeld "ldmemoth"
  1045 000001FC 6D6F7468           
  1046 00000200 [40A10200]6C696E66-     libeld "linfo"
  1046 00000208 6F20<rep 3h>       
  1047 0000020C [F0B10200]6C697374-     libeld "list"
  1047 00000214 20<rep 4h>         
  1048                                  %if _MCP
  1049                                  libeld "nreserve"
  1050                                  %endif
  1051 00000218 [A0D50200]70617463-     libeld "patchqry"
  1051 00000220 68717279           
  1052 00000224 [80E70200]70617468-     libeld "path"
  1052 0000022C 20<rep 4h>         
  1053 00000230 [10F90200]7072696E-     libeld "printf"
  1053 00000238 746620<rep 2h>     
  1054 0000023C [A00C0300]71756965-     libeld "quiet"
  1054 00000244 7420<rep 3h>       
  1055 00000248 [B0170300]71756974-     libeld "quit"
  1055 00000250 20<rep 4h>         
  1056 00000254 [B0230300]72636578-     libeld "rcexec"
  1056 0000025C 656320<rep 2h>     
  1057 00000260 [A02E0300]7264756D-     libeld "rdumpidx"
  1057 00000268 70696478           
  1058 0000026C [E03A0300]7264756D-     libeld "rdumpstr"
  1058 00000274 70737472           
  1059 00000278 [00470300]7265636C-     libeld "reclaim"
  1059 00000280 61696D20           
  1060 00000284 [F04D0300]72657365-     libeld "reserve"
  1060 0000028C 72766520           
  1061 00000290 [E0630300]726D20-       libeld "rm"
  1061 00000290 <rep 6h>           
  1062 0000029C [F06D0300]726E20-       libeld "rn"
  1062 0000029C <rep 6h>           
  1063 000002A8 [007D0300]7320-         libeld "s"
  1063 000002A8 <rep 7h>           
  1064 000002B4 [90920300]73627261-     libeld "sbranch"
  1064 000002BC 6E636820           
  1065 000002C0 [909E0300]73657420-     libeld "set"
  1065 000002C0 <rep 5h>           
  1066 000002CC [20B10300]74736320-     libeld "tsc"
  1066 000002CC <rep 5h>           
  1067 000002D8 [E0C00300]75736570-     libeld "useparat"
  1067 000002E0 61726174           
  1068 000002E4 [90CF0300]76617269-     libeld "variable"
  1068 000002EC 61626C65           
  1069 000002F0 [40DF0300]77697468-     libeld "withhdr"
  1069 000002F8 68647220           
  1070 000002FC [70EC0300]7820-         libeld "x"
  1070 000002FC <rep 7h>           
  1071                                  %endif
  1072                                  lib_end:
  1073                                  
  1074                                  %ifn _COMPRESSLIB
  1075                                  %if _COMPRESSED
  1076                                  	align 2, db 0
  1077                                  depack_saved_sp:	dw 0FFFFh
  1078                                   %if _ELD_TEST_DESCRIBEX
  1079                                  partialdepack:		db 0FFh
  1080                                   %endif
  1081                                  %endif
  1082                                  
  1083 00000308 00                      got_seek_lib:		db 0
  1084                                  
  1085                                  msg:
  1086 00000309 39496E7465726E616C-     .ext_error_internal:	asciz 39h,"Internal error in EXT LIB command.",13,10
  1086 00000312 206572726F7220696E-
  1086 0000031B 20455854204C494220-
  1086 00000324 636F6D6D616E642E0D-
  1086 0000032D 0A00               
  1087 0000032F 3A455854204C494220-     .ext_error_io:		asciz 3Ah,"EXT LIB command got I/O error.",13,10
  1087 00000338 636F6D6D616E642067-
  1087 00000341 6F7420492F4F206572-
  1087 0000034A 726F722E0D0A00     
  1088 00000351 3B455854204C49423A-     .ext_error_invalid:	asciz 3Bh,"EXT LIB: No or invalid Extension for lDebug header.",13,10
  1088 0000035A 204E6F206F7220696E-
  1088 00000363 76616C696420457874-
  1088 0000036C 656E73696F6E20666F-
  1088 00000375 72206C446562756720-
  1088 0000037E 6865616465722E0D0A-
  1088 00000387 00                 
  1089 00000388 3C4F7574206F66206D-     .ext_error_oom:		asciz 3Ch,"Out of memory in EXT LIB command.",13,10
  1089 00000391 656D6F727920696E20-
  1089 0000039A 455854204C49422063-
  1089 000003A3 6F6D6D616E642E0D0A-
  1089 000003AC 00                 
  1090 000003AD 7F496E7465726E616C-     .error_seek_lib:	asciz 7Fh,"Internal error in EXT LIB, multiple seek to library.",13,10
  1090 000003B6 206572726F7220696E-
  1090 000003BF 20455854204C49422C-
  1090 000003C8 206D756C7469706C65-
  1090 000003D1 207365656B20746F20-
  1090 000003DA 6C6962726172792E0D-
  1090 000003E3 0A00               
  1091 000003E5 37455854204C49423A-     .notfound:		db 37h,'EXT LIB: No ELD found by the name "'
  1091 000003EE 204E6F20454C442066-
  1091 000003F7 6F756E642062792074-
  1091 00000400 6865206E616D652022 
  1092 00000409 20<rep 8h>              .namebuffer:		times 8 db 32
  1093 00000411 22210D0A00              			asciz '"!',13,10
  1094 00000416 38455854204C49423A-     .notfound.invalid:	asciz 38h,"EXT LIB: No ELD found, invalid name!",13,10
  1094 0000041F 204E6F20454C442066-
  1094 00000428 6F756E642C20696E76-
  1094 00000431 616C6964206E616D65-
  1094 0000043A 210D0A00           
  1095 0000043E 202000                  .between:		asciz "  "
  1096 00000441 4E6F20646573637269-     .nodesc:		db "No description."
  1096 0000044A 7074696F6E2E       
  1097 00000450 0D0A00                  .linebreak:		asciz 13,10
  1098                                  
  1099                                  depack_stack: equ $
  1100                                  
  1101 00000453 36455854204C49423A-     .unexpected_eol:	asciz 36h,"EXT LIB: Unexpected End Of Line, expected closing quote mark!",13,10
  1101 0000045C 20556E657870656374-
  1101 00000465 656420456E64204F66-
  1101 0000046E 204C696E652C206578-
  1101 00000477 70656374656420636C-
  1101 00000480 6F73696E672071756F-
  1101 00000489 7465206D61726B210D-
  1101 00000492 0A00               
  1102 00000494 48454C5000              .help_keyword:		asciz "HELP"
  1103 00000499 444553435249424500      .describe_keyword:	asciz "DESCRIBE"
  1104                                  %if _ELD_TEST_DESCRIBEX
  1105                                  .describex_keyword:	asciz "DESCRIBEX"
  1106                                  %endif
  1107                                  %if _COMPRESSED && _ELD_TEST_LIB
  1108                                  .test_keyword:		asciz "TEST"
  1109                                  %endif
  1110 000004A2 5749444500              .wide_keyword:		asciz "WIDE"
  1111                                  .help:
  1112                                  %if _MCP
  1113                                  			db "MCP "
  1114                                  %endif
  1115 000004A7 455854204C49422063-     			db "EXT LIB command. This ELD is a library of other ELDs.",13,10
  1115 000004B0 6F6D6D616E642E2054-
  1115 000004B9 68697320454C442069-
  1115 000004C2 732061206C69627261-
  1115 000004CB 7279206F66206F7468-
  1115 000004D4 657220454C44732E0D-
  1115 000004DD 0A                 
  1116 000004DE 52756E207769746820-     			db "Run with an ELD instance name to run another ELD.",13,10
  1116 000004E7 616E20454C4420696E-
  1116 000004F0 7374616E6365206E61-
  1116 000004F9 6D6520746F2072756E-
  1116 00000502 20616E6F7468657220-
  1116 0000050B 454C442E0D0A       
  1117 00000511 52756E207769746820-     			db "Run with HELP DESCRIBE to dump descriptions (slow)",13,10
  1117 0000051A 48454C502044455343-
  1117 00000523 5249424520746F2064-
  1117 0000052C 756D70206465736372-
  1117 00000535 697074696F6E732028-
  1117 0000053E 736C6F77290D0A     
  1118 00000545 206F72207769746820-     			db " or with HELP WIDE to display only known ELD names (fast).",13,10
  1118 0000054E 48454C502057494445-
  1118 00000557 20746F20646973706C-
  1118 00000560 6179206F6E6C79206B-
  1118 00000569 6E6F776E20454C4420-
  1118 00000572 6E616D657320286661-
  1118 0000057B 7374292E0D0A       
  1119 00000581 00                      			asciz
  1120 00000582 0D0A                    .list:			db 13,10
  1121 00000584 4C697374206F662063-     			asciz "List of contained ELDs:",13,10
  1121 0000058D 6F6E7461696E656420-
  1121 00000596 454C44733A0D0A00   
  1122                                  
  1123                                  uinit_data: equ $
  1124                                  
  1125 0000059E 00<rep 2h>              	align 16, db 0
  1126                                  init_data_end:
  1127                                  data_size equ $ - datastart
  1128                                  transient_data_size equ data_size
  1129                                  
  1130                                  %if _COMPRESSED
  1131                                  	absolute depack_stack
  1132                                  	alignb 2
  1133                                  		resb 256
  1134                                  depack_stack.top:
  1135                                  
  1136                                   %if uinit_data > depack_stack.top
  1137                                  	absolute uinit_data
  1138                                   %endif
  1139                                  %else
  1140                                  	absolute uinit_data
  1141                                  %endif
  1142                                  
  1143                                  	alignb 2
  1144 0000059E ????????                libseek:	resd 1
  1145 000005A2 ????????                eldheader:	resd 1
  1146                                  
  1147                                  %if _COMPRESSED
  1148                                  depackskip:	resd 1
  1149                                  depackseek:	resd 1
  1150                                  depacked_buffer:resd 1
  1151                                  depack_left_length:	resw 1
  1152                                  depack_left_address:	resw 1
  1153                                  depacked_length:resw 1
  1154                                  depack_prior_sp:resw 1
  1155                                  	alignb 2
  1156                                  filebuffer:
  1157                                  %if _ALIGNPAGE
  1158                                  	resb 512
  1159                                  %else
  1160                                  	resb 256
  1161                                  %endif
  1162                                  .end:
  1163                                  	alignb 2
  1164                                  .next:		resw 1
  1165                                  .tail:		resw 1
  1166                                  handle:		resw 1
  1167                                  
  1168                                  	alignb 16
  1169                                  resultbuffer:
  1170                                  .size equ 4096
  1171                                  		resb .size
  1172                                  .end:
  1173                                  %endif
  1174                                  
  1175                                  %if _DATABUFFER
  1176 000005A6 <res Ah>                	alignb 16
  1177                                  databuffer:
  1178 000005B0 <res 200h>              	resb 512
  1179                                  %endif
  1180                                  
  1181                                  	alignb 16
  1182                                  uinit_data_end:
  1183                                  
  1184                                  %if uinit_data_end >= init_data_end
  1185                                   total_data_size equ $ - datastart
  1186                                  %else
  1187                                   total_data_size equ init_data_end - datastart
  1188                                  %endif
  1189                                  %assign _DATA_SIZE total_data_size
  1190                                  
  1191                                  	usesection CODE
  1192                                  
  1193                                  %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 000005EE 90<rep 2h>E8[0000]- <1> 	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
    28 000005F3 EB020000C3E8[0000]- <1>
    28 000005FB EB020000C3E8[0000]- <1>
    28 00000603 EB020000C3E8[0000]- <1>
    28 0000060B EB020000C3E8[0000]- <1>
    28 00000613 EB020000C3E8[0000]- <1>
    28 0000061B EB020000C3E8[0000]- <1>
    28 00000623 EB020000C3E8[0000]- <1>
    28 0000062B EB020000C3E8[0000]- <1>
    28 00000633 EB020000C3          <1>
    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 00000638 5589E5              <1> 	lenter
    93                              <1> 	lvar dword, instance
    94 0000063B 06                  <1> 	 push es
    95 0000063C 52                  <1> 	 push dx		; -> start of where we're loaded in ELD cs
    96                              <1> 	lvar word, targetsection_low_optional_high
    97 0000063D 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 0000063E 1E                  <1> 	 push ds
   102 0000063F 57                  <1> 	 push di		; -> link info (in debugger ss or message seg)
   103                              <1> 	lvar dword, nextreloc
   104 00000640 06                  <1> 	 push es		; => ELD cs
   105 00000641 52                  <1> 	 push dx		; placeholder
   106                              <1> 	lvar dword, entry
   107 00000642 06                  <1> 	 push es		; => ELD cs
   108 00000643 50                  <1> 	 push ax		; placeholder
   109 00000644 31C0                <1> 	xor ax, ax
   110 00000646 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 0000064A 7403                <1> 	je @F
   115                              <1> .error_j1:
   116 0000064C E9C602              <1> 	jmp .error		; signature mismatch -->
   117                              <1> @@:
   118 0000064F 837D0601            <1> 	cmp word [di + eldlUseLinkHash], 1
   119 00000653 77F7                <1> 	ja .error_j1		; unknown use link hash number -->
   120 00000655 7201                <1> 	jb @F
   121                              <1> %if _ELDDATA_NEXT || _ELDCALL_NEXT
   122                              <1> 	dec al			; = -1 if hash used
   123                              <1> %else
   124 00000657 48                  <1> 	dec ax
   125                              <1> %endif
   126                              <1> @@:
   127                              <1> 	lvar word, use_hash_low_skip_last_high
   128 00000658 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 00000659 31C0                <1> 	xor ax, ax
   138                              <1>  %if _ELD_LINKER_PASSES
   139                              <1> 	lvar word, pass
   140 0000065B 50                  <1> 	 push ax		; = 0 for linker itself, = 2 for application
   141                              <1> 	lvar word, amounterrors
   142 0000065C 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 0000065D 50                  <1> 	 push ax		; -> name currently being sought (in our table)
   147                              <1>  %endif
   148                              <1>  %if ELDOTHER
   149                              <1> 	lvar word, other
   150                              <1> 	 push ax		; byte: 0 = own data links, -1 = other data links
   151                              <1>  %endif
   152                              <1>  %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   153                              <1> 	lvar word, optionalmissing
   154                              <1> 	 push ax
   155                              <1>  %endif
   156                              <1> %endif
   157 0000065E 56                  <1> 	push si			; -> command line tail
   158 0000065F 53                  <1> 	push bx			; -> data block in ELD data area (segment ss)
   159                              <1> 
   160                              <1> 			; simple: add instance base (dx) to code
   161 00000660 06                  <1> 	push es
   162 00000661 1F                  <1> 	pop ds			; ds = es => ELD cs
   163                              <1> %if _ELD_LINKER_PASSES
   164                              <1> .pass:
   165 00000662 8B5EEA              <1> 	mov bx, word [bp + ?pass]	; 0 or 2
   166 00000665 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 00000667 8BB7CC09            <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 0000066B 01D6                <1> 	add si, dx		; relocate the table pointer itself
   177                              <1> @@:
   178 0000066D AD                  <1> 	lodsw
   179 0000066E 85C0                <1> 	test ax, ax		; was last ?
   180 00000670 740B                <1> 	jz @F			; yes -->
   181 00000672 93                  <1> 	xchg bx, ax		; bx = entry
   182 00000673 01D3                <1> 	add bx, dx		; relocate the entry itself
   183                              <1> %if _ELD_CODE_VSTART
   184 00000675 812F[0000]          <1> 	sub word [bx], code	; undo adjustment
   185                              <1> %endif
   186 00000679 0117                <1> 	add word [bx], dx	; relocate word referenced by entry
   187 0000067B 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 0000067D 8B5EEA              <1> 	mov bx, word [bp + ?pass]	; 0 or 2
   193 00000680 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 00000682 8BB7D009            <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 00000686 01D6                <1> 	add si, dx		; relocate the table pointer itself
   204                              <1> @@:
   205 00000688 AD                  <1> 	lodsw
   206 00000689 85C0                <1> 	test ax, ax		; was last ?
   207 0000068B 740C                <1> 	jz @F			; yes -->
   208 0000068D 93                  <1> 	xchg bx, ax		; bx = entry
   209 0000068E 01D3                <1> 	add bx, dx		; relocate the entry itself
   210                              <1> 		; ! access the offset of the data area block, topmost on stack
   211 00000690 58                  <1> 	pop ax			; ax -> heap data
   212 00000691 50                  <1> 	push ax
   213                              <1> %if _ELD_DATA_VSTART
   214 00000692 2D[0000]            <1> 	sub ax, datastart	; undo adjustment
   215                              <1> %endif
   216 00000695 0107                <1> 	add word [bx], ax	; relocate word referenced by entry
   217 00000697 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 00000699 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   224 0000069C 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 0000069E 8BB7D409            <1> 	mov si, word [linktable - code + ltDataToCode + bx]
   230                              <1>  %endif
   231                              <1> %else
   232                              <1> 	mov si, internaldatatocoderelocations - code
   233                              <1> %endif
   234 000006A2 01D6                <1> 	add si, dx
   235                              <1> @@:
   236 000006A4 AD                  <1> 	lodsw
   237 000006A5 83F8FF              <1> 	cmp ax, -1		; was last ?
   238 000006A8 740F                <1> 	je @F			; yes -->
   239 000006AA 93                  <1> 	xchg bx, ax		; bx = entry
   240                              <1> 		; ! access the offset of the data area block, topmost on stack
   241 000006AB 58                  <1> 	pop ax
   242 000006AC 50                  <1> 	push ax
   243 000006AD 01C3                <1> 	add bx, ax		; relocate the entry itself
   244                              <1> %if _ELD_CODE_VSTART
   245 000006AF 36812F[0000]        <1> 	sub word [ss:bx], code	; undo adjustment
   246                              <1> %endif
   247 000006B4 360117              <1> 	add word [ss:bx], dx	; relocate word referenced by entry
   248 000006B7 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 000006B9 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   254 000006BC 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 000006BE 8BB7D809            <1> 	mov si, word [linktable - code + ltDataToData + bx]
   260                              <1>  %endif
   261                              <1> %else
   262                              <1> 	mov si, internaldatatodatarelocations - code
   263                              <1> %endif
   264 000006C2 01D6                <1> 	add si, dx
   265                              <1> @@:
   266 000006C4 AD                  <1> 	lodsw
   267 000006C5 83F8FF              <1> 	cmp ax, -1		; was last ?
   268 000006C8 740D                <1> 	je @F			; yes -->
   269 000006CA 93                  <1> 	xchg bx, ax		; bx = entry
   270                              <1> 		; ! access the offset of the data area block, topmost on stack
   271 000006CB 58                  <1> 	pop ax			; ax -> heap data
   272 000006CC 50                  <1> 	push ax
   273 000006CD 01C3                <1> 	add bx, ax		; relocate the entry itself
   274                              <1> %if _ELD_DATA_VSTART
   275 000006CF 2D[0000]            <1> 	sub ax, datastart	; undo adjustment
   276                              <1> %endif
   277 000006D2 360107              <1> 	add word [ss:bx], ax	; relocate word referenced by entry
   278 000006D5 EBED                <1> 	jmp @B
   279                              <1> 
   280                              <1> @@:
   281 000006D7 8B56FC              <1> 	mov dx, word [bp + ?instance]
   282                              <1> 				; reset (why??) -> ELD instance in ELD cs
   283                              <1> %if _ELD_LINKER_PASSES
   284 000006DA 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   285 000006DD 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 000006DF 0397DC09            <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 000006E3 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 000006E6 C576F2              <1> 	lds si, [bp + ?nextreloc]
   301 000006E9 AD                  <1> 	lodsw			; ax = section indicator
   302 000006EA 85C0                <1> 	test ax, ax		; end of table ?
   303 000006EC 7503E90401          <1> 	jz .donedatareloc
   304 000006F1 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 000006F2 5B                  <1> 	pop bx
   307 000006F3 53                  <1> 	push bx			; bx -> ELD data block
   308 000006F4 8946FA              <1> 	mov word [bp + ?targetsection_low_optional_high], ax
   309 000006F7 84C0                <1> 	test al, al		; data ?
   310 000006F9 AD                  <1> 	lodsw
   311 000006FA 7504                <1> 	jnz @F			; yes -->
   312 000006FC 0346FC              <1> 	add ax, word [bp + ?instance]
   313                              <1> 				; relocate entry into code
   314 000006FF A9                  <1> 	db __TEST_IMM16		; (skip add)
   315                              <1> @@:
   316 00000700 01D8                <1> 	add ax, bx		; relocate entry into data
   317 00000702 8946EE              <1> 	mov word [bp + ?entry], ax
   318                              <1> 				; save away -> where to patch
   319 00000705 AD                  <1> 	lodsw			; get unrelocated -> name
   320 00000706 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 00000709 E8BD00              <1> 	call .build_match	; get ax = scan value, si -> counted string,
   332                              <1> 				;  dl = original value at byte [si]
   333                              <1> 				; NC if symbol already not found before
   334                              <1> 				; CY if to search for the symbol
   335                              <1> %if _ELD_LINKER_PASSES
   336 0000070C 73D8                <1> 	jnc .datarelocloop	; if duplicate of a not found symbol -->
   337                              <1> %endif
   338 0000070E 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 00000711 268B4F08            <1> 	mov cx, word [es:bx + eldlDataAmount]	; amount data link info
   346 00000715 268B7F0A            <1> 	mov di, word [es:bx + eldlDataPrefixes]	; -> prefixes or hashes
   347                              <1> .datarelocfind:
   348 00000719 83F901              <1> 	cmp cx, 1			; NZ if cx == 0
   349 0000071C F2AF                <1> 	repne scasw			; scan initial
   350                              <1> %if _ELDDATA_OPTIONAL
   351                              <1> 	jne .datanotfound_may_be_optional
   352                              <1> %else
   353 0000071E 7541                <1> 	jne .datanotfound
   354                              <1> %endif
   355 00000720 57                  <1> 	push di
   356 00000721 51                  <1> 	push cx
   357 00000722 56                  <1> 	push si
   358 00000723 262B7F0A            <1> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   359 00000727 4F                  <1> 	dec di
   360 00000728 4F                  <1> 	dec di				; 0-based
   361 00000729 26037F0C            <1> 	add di, word [es:bx + eldlDataEntries]	; -> entry
   362 0000072D 268B3D              <1> 	mov di, [es:di]			; -> counted suffix/string
   363 00000730 B500                <1> 	mov ch, 0
   364 00000732 8A0C                <1> 	mov cl, byte [si]		; cx = length
   365 00000734 41                  <1> 	inc cx
   366                              <1> 	; cmp al, al			; ZR if length is zero
   367 00000735 F3A6                <1> 	repe cmpsb			; match ?
   368 00000737 5E                  <1> 	pop si
   369 00000738 59                  <1> 	pop cx
   370 00000739 5F                  <1> 	pop di
   371 0000073A 75DD                <1> 	jne .datarelocfind		; if not found this time,
   372                              <1> 					;  scan for next initial -->
   373 0000073C 8814                <1> 	mov byte [si], dl		; restore the original byte at counter
   374 0000073E 262B7F0A            <1> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   375 00000742 4F                  <1> 	dec di
   376 00000743 4F                  <1> 	dec di				; 0-based
   377 00000744 26037F0E            <1> 	add di, word [es:bx + eldlDataAddresses]	; -> address (offset)
   378 00000748 268B05              <1> 	mov ax, word [es:di]		; get link data from the table
   379 0000074B E80700              <1> 	call .address_data_reloc
   380                              <1> %if _ELD_RELOC_VSTART
   381 0000074E 2D[0000]            <1> 	sub ax, relocateddata		; *not* a relocation
   382                              <1> %endif
   383 00000751 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 00000753 EB91                <1> 	jmp .datarelocloop
   390                              <1> 
   391                              <1> .address_data_reloc:
   392 00000755 C576EE              <1> 	lds si, [bp + ?entry]		; -> entry if in ELD code instance
   393 00000758 807EFA00            <1> 	cmp byte [bp + ?targetsection], 0
   394                              <1> 					; relocation in code ?
   395 0000075C 7402                <1> 	je @F				; yes -->
   396 0000075E 16                  <1> 	push ss
   397 0000075F 1F                  <1> 	pop ds				; => our ELD data block
   398                              <1> @@:
   399 00000760 C3                  <1> 	retn
   400                              <1> 
   401                              <1> %if _ELDDATA_OPTIONAL
   402                              <1> .datanotfound_may_be_optional:
   403                              <1> 	mov byte [si], dl		; restore the original byte at counter
   404                              <1> %if _ELDDATA_NEXT
   405                              <1> 	test byte [bp + ?optional], 3	; is it an optional relocation ?
   406                              <1> %else
   407                              <1> 	cmp byte [bp + ?optional], 0	; is it an optional relocation ?
   408                              <1> %endif
   409                              <1> %if _ELD_DEBUG
   410                              <1> 	jnz @F
   411                              <1>  %ifn _ELD_LINKER_PASSES
   412                              <1> 	mov si, 0			; (invalid link)
   413                              <1> linkdatarelocation internalflags6
   414                              <1> 	test si, si
   415                              <1> 	jz .datanotfound
   416                              <1> 	mov si, 0			; (invalid link)
   417                              <1> linkdatarelocation options7
   418                              <1> 	test si, si
   419                              <1> 	jz .datanotfound
   420                              <1>  %else
   421                              <1> 	cmp byte [bp + ?pass], 0
   422                              <1> 	je .datanotfound
   423                              <1>  %endif
   424                              <1> 	houdini				; (the above conditions are for this)
   425                              <1> 	jmp .datanotfound
   426                              <1> @@:
   427                              <1> %else
   428                              <1> 	jz .datanotfound		; no, handle as an error -->
   429                              <1> %endif
   430                              <1> 
   431                              <1> %if ELDDATA_PMREQUIRED_STATUS
   432                              <1> 	mov si, relocateddata
   433                              <1> linkdatarelocation build_option_PM
   434                              <1> 	test si, si			; is it a PM build ?
   435                              <1> 	jz @F				; no --> (treat PM required as optional)
   436                              <1> 	test byte [bp + ?optional], 2	; optional status is PM required ?
   437                              <1> 	jnz .datanotfound		; yes, handle as an error -->
   438                              <1> @@:
   439                              <1> %endif
   440                              <1> 
   441                              <1> %if _ELD_LINKER_PASSES
   442                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   443                              <1> 	rol byte [bp + ?optionalmissing], 1
   444                              <1> 	jnc .optionaldatamissingmsg
   445                              <1> 	mov si, [bp + ?name]
   446                              <1> 	or byte [si], 80h
   447                              <1> 	not byte [bp + ?optionalmissing]
   448                              <1> 	jmp @F
   449                              <1> .optionaldatamissingmsg:
   450                              <1> %endif
   451                              <1> 	testopt [ss:relocateddata], 2	; debug optional link ?
   452                              <1> linkdatarelocation options7, -3
   453                              <1> 	jz @F				; no -->
   454                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   455                              <1> 	mov byte [bp + ?optionalmissing + 1], -1
   456                              <1> %endif
   457                              <1> 	mov si, lmsg.warning_data_optional
   458                              <1> internalcoderelocation
   459                              <1> 	call .notfound			; display a warning
   460                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   461                              <1> 	not byte [bp + ?optionalmissing + 1]
   462                              <1> %endif
   463                              <1> @@:
   464                              <1> %endif
   465                              <1> %if _ELDDATA_NEXT
   466                              <1> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   467                              <1> 	jnz .datarelocloop
   468                              <1> %endif
   469                              <1> 	call .address_data_reloc
   470                              <1> 	and word [si], 0		; indicate optional data link failed
   471                              <1> 	jmp .datarelocloop
   472                              <1> %endif
   473                              <1> 
   474                              <1> 
   475                              <1> %if _ELDCALL_OPTIONAL
   476                              <1> .codenotfound_may_be_optional:
   477                              <1> 	mov byte [si], dl		; restore the original byte at counter
   478                              <1> %if _ELDCALL_NEXT
   479                              <1> 	test byte [bp + ?optional], 3	; is it an optional relocation ?
   480                              <1> %else
   481                              <1> 	cmp byte [bp + ?optional], 0	; is it an optional relocation ?
   482                              <1> %endif
   483                              <1> %if _ELD_DEBUG
   484                              <1> 	jnz @F
   485                              <1>  %ifn _ELD_LINKER_PASSES
   486                              <1> 	mov si, 0			; (invalid link)
   487                              <1> linkdatarelocation internalflags6
   488                              <1> 	test si, si
   489                              <1> 	jz .codenotfound
   490                              <1> 	mov si, 0			; (invalid link)
   491                              <1> linkdatarelocation options7
   492                              <1> 	test si, si
   493                              <1> 	jz .codenotfound
   494                              <1>  %else
   495                              <1> 	cmp byte [bp + ?pass], 0
   496                              <1> 	je .codenotfound
   497                              <1>  %endif
   498                              <1> 	houdini				; (the above conditions are for this)
   499                              <1> 	jmp .codenotfound
   500                              <1> @@:
   501                              <1> %else
   502                              <1> 	jz .codenotfound		; no, handle as an error -->
   503                              <1> %endif
   504                              <1> 
   505                              <1> %if ELDCALL_PMREQUIRED_STATUS
   506                              <1>  %if _ELD_LINKER_PASSES
   507                              <1>   %assign ELDLINKER 0
   508                              <1>  %endif
   509                              <1> 	mov si, relocateddata
   510                              <1> linkdatarelocation build_option_PM
   511                              <1>  %if _ELD_LINKER_PASSES
   512                              <1>   %assign ELDLINKER 1
   513                              <1>  %endif
   514                              <1> 	test si, si			; is it a PM build ?
   515                              <1> 	jz @F				; no --> (treat PM required as optional)
   516                              <1> 	test byte [bp + ?optional], 2	; optional status is PM required ?
   517                              <1> 	jnz .codenotfound		; yes, handle as an error -->
   518                              <1> @@:
   519                              <1> %endif
   520                              <1> 
   521                              <1> %if _ELD_LINKER_PASSES
   522                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   523                              <1> 	rol byte [bp + ?optionalmissing], 1
   524                              <1> 	jnc .optionalcodemissingmsg
   525                              <1> 	mov si, [bp + ?name]
   526                              <1> 	or byte [si], 80h
   527                              <1> 	not byte [bp + ?optionalmissing]
   528                              <1> 	jmp @F
   529                              <1> .optionalcodemissingmsg:
   530                              <1> %endif
   531                              <1> 	testopt [ss:relocateddata], 2	; debug optional link ?
   532                              <1> linkdatarelocation options7, -3
   533                              <1> 	jz @F				; no -->
   534                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   535                              <1> 	mov byte [bp + ?optionalmissing + 1], -1
   536                              <1> %endif
   537                              <1> 	mov si, lmsg.warning_code_optional
   538                              <1> internalcoderelocation
   539                              <1> 	call .notfound			; display a warning
   540                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   541                              <1> 	not byte [bp + ?optionalmissing + 1]
   542                              <1> %endif
   543                              <1> @@:
   544                              <1> %endif
   545                              <1> %if _ELDCALL_NEXT
   546                              <1> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   547                              <1> 	jnz .coderelocloop
   548                              <1> %endif
   549                              <1> 	lds si, [bp + ?entry]		; -> code site (must be in ELD cs)
   550                              <1> 	mov word [si], 9090h
   551                              <1> 	mov byte [si + 2], 90h		; indicate optional code link failed
   552                              <1> 					;  (NOP out the 3-byte call near imm)
   553                              <1> 	jmp .coderelocloop
   554                              <1> %endif
   555                              <1> 
   556                              <1> 
   557                              <1> %if _ELD_LINKER_PASSES
   558                              <1> .datanotfound:
   559 00000761 BE[690E]            <1> 	mov si, lmsg.error_data
   560                              <1> internalcoderelocation
   561 00000764 E81900              <1> 	call .notfound			; display error
   562 00000767 7306                <1> 	jnc .error_j3			; NC if in pass 0, error out now -->
   563 00000769 FF46E8              <1> 	inc word [bp + ?amounterrors]	; count the amount of errors
   564 0000076C E977FF              <1> 	jmp .datarelocloop		; go to next relocation entry -->
   565                              <1> 
   566                              <1> .error_j3:
   567 0000076F E9A301              <1> 	jmp .error
   568                              <1> 
   569                              <1> .codenotfound:
   570 00000772 BE[820E]            <1> 	mov si, lmsg.error_code
   571                              <1> internalcoderelocation
   572 00000775 E80800              <1> 	call .notfound			; display error
   573 00000778 73F5                <1> 	jnc .error_j3			; NC if in pass 0 -->
   574 0000077A FF46E8              <1> 	inc word [bp + ?amounterrors]	; count the amount of errors
   575 0000077D E98400              <1> 	jmp .coderelocloop		; go to next -->
   576                              <1> 
   577                              <1> .notfound:
   578 00000780 807EEA00            <1> 	cmp byte [bp + ?pass], 0	; pass 0 ?
   579 00000784 743A                <1> 	je .notfound.retn		; yes, do not try displaying --> (NC)
   580 00000786 16                  <1> 	 push ss
   581 00000787 07                  <1> 	 pop es
   582 00000788 BF[0000]            <1> 	mov di, relocateddata
   583                              <1> linkdatarelocation line_out		; es:di -> line_out buffer
   584 0000078B E83300              <1> 	call .copy			; copy prefix message
   585 0000078E 8B76E6              <1> 	mov si, word [bp + ?name]
   586 00000791 AD                  <1> 	lodsw				; = hash
   587 00000792 E8[0000]EB020000    <1> 	extcall hexword			; display the hash in hex
   588 00000799 56                  <1> 	push si
   589 0000079A BE[9B0E]            <1> 	mov si, lmsg.error.2
   590                              <1> internalcoderelocation
   591 0000079D E82100              <1> 	call .copy			; display message fragment
   592 000007A0 5E                  <1> 	pop si
   593                              <1> %if _ELD_LINKER_PASSES
   594 000007A1 56                  <1> 	push si
   595 000007A2 E81C00              <1> 	call .copy			; copy over the full name
   596 000007A5 5E                  <1> 	pop si
   597                              <1>  %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   598                              <1> 	or byte [si], 80h		; mark as failed optional link
   599                              <1> 	rol byte [bp + ?optionalmissing + 1], 1
   600                              <1> 					; was it optional ?
   601                              <1> 	jc @F				; yes -->
   602                              <1>  %endif
   603 000007A6 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 000007A9 B022                <1> 	mov al, '"'
   609 000007AB AA                  <1> 	stosb				; end message with a closing quote mark
   610 000007AC 16                  <1> 	 push ss
   611 000007AD 1F                  <1> 	 pop ds
   612 000007AE E8[0000]EB020000    <1> 	extcall putsline_crlf		; display diagnostic line
   613 000007B5 B8350E              <1> 	mov ax, 0E35h
   614 000007B8 E8[0000]EB020000    <1> 	extcall setrc
   615 000007BF F9                  <1> 	stc				; CY, diagnostic displayed
   616                              <1> .notfound.retn:
   617 000007C0 C3                  <1> 	retn
   618                              <1> 
   619                              <1> .copy:		; (cannot use extcallcall here)
   620 000007C1 E8[0000]EB020000    <1> 	extcall copy_single_counted_string
   621 000007C8 C3                  <1> 	retn
   622                              <1> %else
   623                              <1> .datanotfound: equ .error
   624                              <1> .codenotfound: equ .error
   625                              <1> %endif
   626                              <1> 
   627                              <1> .build_match:
   628                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   629                              <1> 	mov byte [bp + ?optionalmissing], 0
   630                              <1> 		; This is needed for eldtestj.asm with debugoptlink.
   631                              <1> 		;  The optional data link sets flag 80h, then the
   632                              <1> 		;  required data link to the same symbol sets this
   633                              <1> 		;  flag but doesn't reset it. So the first optional
   634                              <1> 		;  code link still had this set. Reset here to fix.
   635                              <1> %endif
   636                              <1> %if _ELD_CODE_VSTART
   637 000007C9 2D[0000]            <1> 	sub ax, code			; revert adjustment (= displacement)
   638                              <1> %endif
   639 000007CC 0346FC              <1> 	add ax, word [bp + ?instance]	; make displacement into -> name string
   640 000007CF 96                  <1> 	xchg si, ax			; si -> hash word, counted name string
   641                              <1> %if _ELD_LINKER_PASSES || _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   642 000007D0 8976E6              <1> 	mov word [bp + ?name], si	; save away for diagnostics
   643                              <1> %endif
   644 000007D3 AD                  <1> 	lodsw			; = hash, si -> counted string
   645 000007D4 8A14                <1> 	mov dl, byte [si]	; dl = original start byte of match
   646                              <1> %if _ELD_LINKER_PASSES
   647 000007D6 84D2                <1> 	test dl, dl		; marked as already failed ?
   648                              <1> 				;  (80h = optional, 0 = required)
   649 000007D8 750A                <1> 	jnz @F			; no -->
   650 000007DA 837EE800            <1> 	cmp word [bp + ?amounterrors], 0
   651                              <1> 				; validate error status
   652 000007DE 7503E9A500          <1> 	je .error_j		; no error known ?! cancel quickly -->
   653 000007E3 C3                  <1> 	retn			; (NC)
   654                              <1> 
   655                              <1> @@:
   656                              <1> %else
   657                              <1> 	test dl, dl
   658                              <1> %endif
   659                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   660                              <1> 	jns @F
   661                              <1> 	and dl, 7Fh
   662                              <1> 	mov byte [si], dl
   663                              <1> 	mov byte [bp + ?optionalmissing], -1
   664                              <1> @@:
   665                              <1> %endif
   666                              <1> %if ELDOTHER
   667                              <1> 	rol byte [bp + ?other], 1
   668                              <1> 	jnc @F
   669                              <1> 	rol byte [bp + ?use_hash_other], 1
   670                              <1> 	jmp @FF
   671                              <1> 
   672                              <1> @@:
   673                              <1> %endif
   674 000007E4 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 000007E7 720A                <1> 	jc @F			; if to use hash, return now -->
   679 000007E9 AC                  <1> 	lodsb			; al = length
   680 000007EA 91                  <1> 	xchg cx, ax		; cl = length
   681 000007EB AD                  <1> 	lodsw			; ax = prefix
   682 000007EC 49                  <1> 	dec cx
   683 000007ED 49                  <1> 	dec cx			; cl = adjusted length
   684 000007EE 4E                  <1> 	dec si			; -> second byte of prefix
   685 000007EF 8A14                <1> 	mov dl, byte [si]	; dl = original start byte of match
   686 000007F1 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 000007F3 F9                  <1> 	stc			; CY
   695                              <1> %endif
   696 000007F4 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 000007F5 8B56FC              <1> 	mov dx, word [bp + ?instance]
   707                              <1> %if _ELD_LINKER_PASSES
   708 000007F8 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   709 000007FB 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 000007FD 0397E009            <1> 	add dx, word [linktable - code + ltLinkCode + bx]
   715                              <1>  %endif
   716                              <1> %else
   717                              <1> 	add dx, linkercoderelocations - code
   718                              <1> %endif
   719 00000801 8956F2              <1> 	mov word [bp + ?nextreloc], dx
   720                              <1> 
   721                              <1> .coderelocloop:
   722 00000804 C576F2              <1> 	lds si, [bp + ?nextreloc]
   723 00000807 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 00000808 0346FC              <1> 	add ax, word [bp + ?instance]
   731 0000080B 8946EE              <1> 	mov word [bp + ?entry], ax
   732 0000080E AD                  <1> 	lodsw
   733 0000080F 8976F2              <1> 	mov word [bp + ?nextreloc], si
   734                              <1> %ifn _ELDCALL_OPTIONAL || _ELDCALL_NEXT
   735 00000812 85C0                <1> 	test ax, ax			; if no optional word, check -> match
   736 00000814 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 00000819 E8ADFF              <1> 	call .build_match
   748                              <1> %if _ELD_LINKER_PASSES
   749 0000081C 73E6                <1> 	jnc .coderelocloop
   750                              <1> %endif
   751 0000081E C45EF6              <1> 	les bx, [bp + ?linkinfo]
   752 00000821 268B4F10            <1> 	mov cx, word [es:bx + eldlCodeAmount]	; amount code link info
   753 00000825 268B7F12            <1> 	mov di, word [es:bx + eldlCodePrefixes]	; -> prefixes or hashes
   754                              <1> .coderelocfind:
   755 00000829 83F901              <1> 	cmp cx, 1			; NZ if cx == 0
   756 0000082C 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 0000082E 7403E93FFF          <1> 	jne .codenotfound
   767                              <1>  %endif
   768                              <1> %endif
   769 00000833 57                  <1> 	push di
   770 00000834 51                  <1> 	push cx
   771 00000835 56                  <1> 	push si
   772 00000836 262B7F12            <1> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   773 0000083A 4F                  <1> 	dec di
   774 0000083B 4F                  <1> 	dec di				; 0-based
   775 0000083C 26037F14            <1> 	add di, word [es:bx + eldlCodeEntries]	; -> entry
   776 00000840 268B3D              <1> 	mov di, [es:di]			; -> counted suffix/string
   777 00000843 B500                <1> 	mov ch, 0
   778 00000845 8A0C                <1> 	mov cl, byte [si]		; cx = length
   779 00000847 41                  <1> 	inc cx
   780                              <1> 	; cmp al, al			; ZR if length is zero
   781 00000848 F3A6                <1> 	repe cmpsb			; match ?
   782 0000084A 5E                  <1> 	pop si
   783 0000084B 59                  <1> 	pop cx
   784 0000084C 5F                  <1> 	pop di
   785 0000084D 75DA                <1> 	jne .coderelocfind
   786 0000084F 8814                <1> 	mov byte [si], dl
   787 00000851 262B7F12            <1> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   788 00000855 4F                  <1> 	dec di
   789 00000856 4F                  <1> 	dec di				; 0-based
   790 00000857 01FF                <1> 	add di, di			; quadruple index
   791 00000859 26037F16            <1> 	add di, word [es:bx + eldlCodeAddresses]	; -> address (offset, segment)
   792 0000085D 26FF35              <1> 	push word [es:di]
   793 00000860 C576EE              <1> 	lds si, [bp + ?entry]
   794 00000863 8F4405              <1> 	pop word [si + 3 + 2]		; call near imm (3), jmp short (2)
   795                              <1> 					;  patch the destination address
   796 00000866 803CE8              <1> 	cmp byte [si], 0E8h		; is it as expected ?
   797 00000869 751D                <1> 	jne .error_j
   798 0000086B 268B7D02            <1> 	mov di, word [es:di + 2]
   799 0000086F BB[0000]            <1> 	mov bx, relocateddata
   800                              <1> linkdatarelocation linkcall_table	; ss:bx -> link call table
   801 00000872 36833F01            <1> 	cmp word [ss:bx], 1		; is it initialised to format 1 ?
   802 00000876 7510                <1> 	jne .error_j			; no -->
   803 00000878 368B4F02            <1> 	mov cx, word [ss:bx + 2]	; get amount of segments
   804 0000087C E30A                <1> 	jcxz .error_j			; none -->
   805                              <1> @@:
   806 0000087E 83C304              <1> 	add bx, 4			; -> next segment
   807 00000881 36393F              <1> 	cmp word [ss:bx], di		; value matches ?
   808 00000884 7405                <1> 	je @F				; yes, found -->
   809 00000886 E2F6                <1> 	loop @B				; try remaining segments
   810                              <1> .error_j:
   811 00000888 E98A00              <1> 	jmp .error
   812                              <1> 
   813                              <1> @@:
   814 0000088B 368B5F02            <1> 	mov bx, word [ss:bx + 2]	; -> call destination offset
   815                              <1> 		; si + 3 + delta = bx
   816                              <1> 		; delta = bx - si - 3
   817 0000088F 29F3                <1> 	sub bx, si
   818 00000891 83EB03              <1> 	sub bx, 3
   819 00000894 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 00000897 E96AFF              <1> 	jmp .coderelocloop
   826                              <1> 
   827                              <1> .donecodereloc:
   828                              <1> %if _ELD_LINKER_PASSES
   829 0000089A 8B46E8              <1> 	mov ax, word [bp + ?amounterrors]
   830 0000089D 85C0                <1> 	test ax, ax
   831 0000089F 75E7                <1> 	jnz .error_j
   832 000008A1 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   833 000008A4 85DB                <1> 	test bx, bx
   834 000008A6 750B                <1> 	jnz @F
   835 000008A8 43                  <1> 	inc bx
   836 000008A9 43                  <1> 	inc bx
   837 000008AA 895EEA              <1> 	mov word [bp + ?pass], bx
   838 000008AD 8B56FC              <1> 	mov dx, word [bp + ?instance]
   839 000008B0 E9AFFD              <1> 	jmp .pass
   840                              <1> 
   841                              <1> @@:
   842                              <1> %endif
   843                              <1> 
   844                              <1> %ifnidni _LISTING, ""
   845                              <1> %assign ELDLINKER 0
   846                              <1> .hint:
   847 000008B3 16                  <1> 	push ss
   848 000008B4 1F                  <1> 	pop ds
   849 000008B5 B02D                <1> 	mov al, 2Dh
   850 000008B7 E8[0000]EB020000    <1> 	extcall intchk			; ZR if offset = -1 or segment = 0
   851                              <1> 					; CHG: ax, dx, bx
   852 000008BE 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 000008C0 8A26[0000]          <1> 	mov ah, byte [relocateddata]
   860                              <1> linkdatarelocation try_debugger_amis_multiplex_number
   861 000008C4 E85500              <1> 	call plex_check
   862 000008C7 7305                <1> 	jnc @F
   863                              <1> 
   864 000008C9 B4FF                <1> 	mov ah, 0FFh		; start with multiplex number 0FFh
   865                              <1> .loop_hint:
   866 000008CB E84E00              <1> 	call plex_check
   867                              <1> @@:
   868 000008CE 7307                <1> 	jnc .end_hint		; if found --> (NC)
   869 000008D0 80EC01              <1> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   870 000008D3 73F6                <1> 	jnc .loop_hint		; try next if we didn't check all yet -->
   871 000008D5 EB20                <1> 	jmp .no_hint
   872                              <1> 
   873                              <1> .end_hint:
   874 000008D7 50                  <1> 	push ax
   875 000008D8 C446FC              <1> 	les ax, [bp + ?instance]
   876 000008DB BF[EE0B]            <1> 	mov di, listmsg.hint.offset
   877                              <1> internalcoderelocation
   878 000008DE E8[0000]EB020000    <1> 	extcall hexword
   879 000008E5 BB[CE0B]            <1> 	mov bx, listmsg.hint
   880                              <1> internalcoderelocation
   881 000008E8 368B16[0000]        <1> 	mov dx, [ss:relocateddata]
   882                              <1> linkdatarelocation extseg	; must be 86 Mode segment even in PM
   883 000008ED 58                  <1> 	pop ax
   884 000008EE B040                <1> 	mov al, 40h		; AMIS message display service
   885 000008F0 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 000008F7 5B                  <1> 	pop bx				; -> our heap data
  1005 000008F8 5E                  <1> 	pop si				; -> our command line tail
  1006 000008F9 16                  <1> 	 push ss
  1007 000008FA 1F                  <1> 	 pop ds
  1008 000008FB C47EFC              <1> 	les di, [bp + ?instance]
  1009 000008FE 268B4502            <1> 	mov ax, word [es:di + eldiEndCode]
  1010                              <1> houdini
  1011 00000902 2D[4006]            <1> 	sub ax, strict word endresident + code
  1012                              <1> internalcoderelocation
  1013 00000905 26C74502[4006]      <1> 	mov word [es:di + eldiEndCode], endresident + code
  1014                              <1> internalcoderelocation
  1015 0000090B 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 0000090F 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 00000912 E9CBF9              <1> 	jmp start
  1029                              <1> 
  1030                              <1> .error:
  1031 00000915 89EC5D              <1> 	lleave
  1032 00000918 B8FFFF              <1> 	mov ax, -1
  1033 0000091B 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 0000091C 16                  <1> 	push ss
  1055 0000091D 1F                  <1> 	pop ds
  1056 0000091E F606[0000]08        <1> 	testopt [relocateddata], 8
  1057                              <1> linkdatarelocation internalflags4, -3
  1058 00000923 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 00000925 BE[0000]            <1> 	mov si, relocateddata
  1068                              <1> linkdatarelocation amis_multiplex_number, -2, optional
  1069 00000928 85F6                <1> 	test si, si
  1070 0000092A 7404                <1> 	jz @F
  1071 0000092C 3A24                <1> 	cmp ah, byte [si]
  1072 0000092E 7420                <1> 	je .notfound		; do not use our own multiplexer -->
  1073                              <1> %endif
  1074                              <1> @@:
  1075 00000930 B000                <1> 	mov al, 00h		; AMIS installation check
  1076 00000932 E8[0000]EB020000    <1> 	extcall call_int2D	; AMIS (or "DOS reserved" = iret if no AMIS present)
  1077 00000939 3CFF                <1> 	cmp al, 0FFh
  1078 0000093B 7513                <1> 	jne .notfound
  1079 0000093D 0E                  <1> 	push cs
  1080 0000093E 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 0000093F BE[BE0B]            <1> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
  1089                              <1> internalcoderelocation
  1090 00000942 E8[0000]EB020000    <1> 	extcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
  1091 00000949 B90800              <1> 	mov cx, 8		; Ignore description, only compare vendor and program name
  1092 0000094C F3A7                <1> 	repe cmpsw
  1093                              <1> %endif
  1094 0000094E 7401                <1> 	je .checkret		; ZR, NC = match -->
  1095                              <1> .notfound:
  1096 00000950 F9                  <1> 	stc			; CY no match
  1097                              <1> .checkret:
  1098 00000951 C3                  <1> 	retn
  1099                              <1> %endif
  1100                              <1> 
  1101                              <1> 
  1102 00000952 00<rep 2h>          <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 00000954 1102[F60B]2D02-     <1> 	dw ELDCALL_CODE_RELOCATIONS, 0, 0
  1107 0000095A [FE0B]3502[090C]4A- <1>
  1107 00000961 02[1A0C]6102[2C0C]- <1>
  1107 00000968 C002[460C]C802-     <1>
  1107 0000096E [4D0C]D002[550C]D8- <1>
  1107 00000975 02[5C0C]CC05[640C]- <1>
  1107 0000097C F005[6C0C]F805-     <1>
  1107 00000982 [780C]0006[810C]08- <1>
  1107 00000989 06[8D0C]1006[960C]- <1>
  1107 00000990 1806[A10C]2006-     <1>
  1107 00000996 [A80C]2806[BE0C]30- <1>
  1107 0000099D 06[CA0C]B708[0D0D]- <1>
  1107 000009A4 DE08[D60C]F008-     <1>
  1107 000009AA [160D]3209[160D]42- <1>
  1107 000009B1 09[230D]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 000009B8 9207[D60C]AE07-     <1> 	dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
  1115 000009BE [E00C]B807[F60B]C1- <1>
  1115 000009C5 07[F00C]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 000009CC B00B                <1> 	dw internallinkercodetocoderelocations - code
  1123 000009CE F40A                <1> 	dw internalcodetocoderelocations - code
  1124                              <1> at ltCodeToData
  1125 000009D0 B80B                <1> 	dw internallinkercodetodatarelocations - code
  1126 000009D2 2A0B                <1> 	dw internalcodetodatarelocations - code
  1127                              <1> at ltDataToCode
  1128 000009D4 BA0B                <1> 	dw internallinkerdatatocoderelocations - code
  1129 000009D6 9E0B                <1> 	dw internaldatatocoderelocations - code
  1130                              <1> at ltDataToData
  1131 000009D8 BC0B                <1> 	dw internallinkerdatatodatarelocations - code
  1132 000009DA A00B                <1> 	dw internaldatatodatarelocations - code
  1133                              <1> at ltLinkData
  1134 000009DC A20B                <1> 	dw linkerlinkerdatarelocations - code
  1135 000009DE E409                <1> 	dw linkerdatarelocations - code
  1136                              <1> at ltLinkCode
  1137 000009E0 B809                <1> 	dw linkerlinkercoderelocations - code
  1138 000009E2 5409                <1> 	dw linkercoderelocations - code
  1139                              <1> 	iend
  1140                              <1> %endif
  1141                              <1> 
  1142                              <1> 	align 2, db 0
  1143                              <1> linkerdatarelocations:
  1144 000009E4 01003500[2E0D]0100- <1> 	dw LINK_DATA_RELOCATIONS, 0
  1144 000009EC 7100[3C0D]01007500- <1>
  1144 000009F4 [2E0D]0100AE00-     <1>
  1144 000009FA [4A0D]0100B200-     <1>
  1144 00000A00 [590D]01000101-     <1>
  1144 00000A06 [2E0D]01000A01-     <1>
  1144 00000A0C [680D]01001001-     <1>
  1144 00000A12 [730D]01004501-     <1>
  1144 00000A18 [7C0D]01004901-     <1>
  1144 00000A1E [590D]01006501-     <1>
  1144 00000A24 [2E0D]01008901-     <1>
  1144 00000A2A [2E0D]01009601-     <1>
  1144 00000A30 [2E0D]0100AC01-     <1>
  1144 00000A36 [590D]0100B001-     <1>
  1144 00000A3C [7C0D]0100C601-     <1>
  1144 00000A42 [7C0D]0100E501-     <1>
  1144 00000A48 [860D]0100ED01-     <1>
  1144 00000A4E [900D]0100F001-     <1>
  1144 00000A54 [9A0D]01002302-     <1>
  1144 00000A5A [AC0D]01005B02-     <1>
  1144 00000A60 [BC0D]01005F02-     <1>
  1144 00000A66 [BC0D]01006902-     <1>
  1144 00000A6C [BC0D]01006D02-     <1>
  1144 00000A72 [BC0D]01007A02-     <1>
  1144 00000A78 [680D]01008302-     <1>
  1144 00000A7E [730D]0100A902-     <1>
  1144 00000A84 [2E0D]0100AF02-     <1>
  1144 00000A8A [590D]0100E402-     <1>
  1144 00000A90 [AC0D]0100FA02-     <1>
  1144 00000A96 [BC0D]0100FF02-     <1>
  1144 00000A9C [BC0D]01000203-     <1>
  1144 00000AA2 [BC0D]01000603-     <1>
  1144 00000AA8 [BC0D]01006003-     <1>
  1144 00000AAE [C80D]01006803-     <1>
  1144 00000AB4 [C80D]01000904-     <1>
  1144 00000ABA [C80D]0100B805-     <1>
  1144 00000AC0 [D30D]0100BF05-     <1>
  1144 00000AC6 [EA0D]0100C305-     <1>
  1144 00000ACC [AC0D]0100CA05-     <1>
  1144 00000AD2 [FD0D]0100C208-     <1>
  1144 00000AD8 [1B0E]0100EB08-     <1>
  1144 00000ADE [730D]01000D09-     <1>
  1144 00000AE4 [2E0D]01002009-     <1>
  1144 00000AEA [400E]01012609-     <1>
  1144 00000AF0 [510E]0000          <1>
  1145                              <1> 
  1146                              <1> 	align 2, db 0
  1147                              <1> internalcodetocoderelocations:
  1148 00000AF4 24002B0031009E00A3- <1> 	dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
  1148 00000AFD 00D600DB006B016F01- <1>
  1148 00000B06 76017D01830192019C- <1>
  1148 00000B0F 019F01A701B501CA01- <1>
  1148 00000B18 CD01D3019302DC08E6- <1>
  1148 00000B21 080309090940090000  <1>
  1149                              <1> 
  1150                              <1> 	align 2, db 0
  1151                              <1> internalcodetodatarelocations:
  1152 00000B2A F100F50035013901B8- <1> 	dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
  1152 00000B33 01D001F901FE010302- <1>
  1152 00000B3C 0802A202EE0216032F- <1>
  1152 00000B45 033803460354035A03- <1>
  1152 00000B4E 760381038F03930396- <1>
  1152 00000B57 03A403AB03AF03C203- <1>
  1152 00000B60 C603FA03FE0325042A- <1>
  1152 00000B69 0437046B04BB04C504- <1>
  1152 00000B72 D404E104E504E804F2- <1>
  1152 00000B7B 04F604040508052D05- <1>
  1152 00000B84 310565056A05730577- <1>
  1152 00000B8D 05950599059F05AA05- <1>
  1152 00000B96 DD05E205E9050000    <1>
  1153                              <1> 
  1154                              <1> 	align 2, db 0
  1155                              <1> internaldatatocoderelocations:
  1156 00000B9E FFFF                <1> 	dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
  1157                              <1> 
  1158                              <1> 	align 2, db 0
  1159                              <1> internaldatatodatarelocations:
  1160 00000BA0 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 00000BA2 01008907[C80D]0100- <1> 	dw LINK_LINKER_DATA_RELOCATIONS, 0
  1165 00000BAA 7008[0A0E]0000      <1>
  1166                              <1> 
  1167                              <1> 	align 2, db 0
  1168                              <1> internallinkercodetocoderelocations:
  1169 00000BB0 620773079B070000    <1> 	dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
  1170                              <1> 
  1171                              <1> 	align 2, db 0
  1172                              <1> internallinkercodetodatarelocations:
  1173 00000BB8 0000                <1> 	dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
  1174                              <1> 
  1175                              <1> 	align 2, db 0
  1176                              <1> internallinkerdatatocoderelocations:
  1177 00000BBA FFFF                <1> 	dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
  1178                              <1> 
  1179                              <1> 	align 2, db 0
  1180                              <1> internallinkerdatatodatarelocations:
  1181 00000BBC 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 00000BBE 65636D20<rep 5h>    <1> 		fill 8, 32, db "ecm"
  1198 00000BC6 6C446562756720-     <1> 		fill 8, 32, db "lDebug"
  1198 00000BC6 <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 00000BCE 547261634C6973742D- <1> .hint:		db "TracList-add-offset=",_LISTING,"::"
  1210 00000BD7 6164642D6F66667365- <1>
  1210 00000BE0 743D6578746C69622E- <1>
  1210 00000BE9 6C73743A3A          <1>
  1211 00000BEE 2D2D2D2D680D0A00    <1> .hint.offset:	asciz "----h",13,10
  1212                              <1> %endif
  1213                              <1> 
  1214 00000BF6 B21205736574726368- <1> 	eldcall_dump_names ELDCALL_CODE_NAMES
  1214 00000BFF 31085F646F7363616C- <1>
  1214 00000C08 6C8EF70E646F736361- <1>
  1214 00000C11 6C6C5F657874736567- <1>
  1214 00000C1A FF8B0F79795F626F6F- <1>
  1214 00000C23 745F726561642E6278- <1>
  1214 00000C2C 63E41779795F626F6F- <1>
  1214 00000C35 745F7365656B5F6375- <1>
  1214 00000C3E 7272656E742E627828- <1>
  1214 00000C47 90046973706D551205- <1>
  1214 00000C50 707574737ABABD0463- <1>
  1214 00000C59 6D6433A7AA05657272- <1>
  1214 00000C62 6F72629605496E444F- <1>
  1214 00000C6B 53D55509736B697063- <1>
  1214 00000C74 6F6D6D61E83A066973- <1>
  1214 00000C7D 656F6C3F03C3096973- <1>
  1214 00000C86 737472696E673FDDB9- <1>
  1214 00000C8F 0663686B656F6C67B1- <1>
  1214 00000C98 087472696D70757473- <1>
  1214 00000CA1 C5C604707574738490- <1>
  1214 00000CAA 136973656F6C3F2E6E- <1>
  1214 00000CB3 6F7473656D69636F6C- <1>
  1214 00000CBC 6F6EA45509736B6970- <1>
  1214 00000CC5 636F6D6D30F1230975- <1>
  1214 00000CCE 707065726361736584- <1>
  1214 00000CD7 8107686578776F7264- <1>
  1214 00000CE0 6FA20D707574736C69- <1>
  1214 00000CE9 6E655F63726C66D0BB- <1>
  1214 00000CF2 1A636F70795F73696E- <1>
  1214 00000CFB 676C655F636F756E74- <1>
  1214 00000D04 65645F737472696E67- <1>
  1214 00000D0D 986906696E7463686B- <1>
  1214 00000D16 21300A63616C6C5F69- <1>
  1214 00000D1F 6E743244B774087365- <1>
  1214 00000D28 746573326478        <1>
  1215 00000D2E E7D30B657874736567- <1> 	link_data_dump_names LINK_DATA_NAMES
  1215 00000D37 5F757365642BC80B65- <1>
  1215 00000D40 78747365675F73697A- <1>
  1215 00000D49 65F6340C6578746461- <1>
  1215 00000D52 74615F73697A65B240- <1>
  1215 00000D5B 0C657874646174615F- <1>
  1215 00000D64 75736564EB42086578- <1>
  1215 00000D6D 74647373656CD52D06- <1>
  1215 00000D76 6578747365672AAE07- <1>
  1215 00000D7F 65787464617461FF7E- <1>
  1215 00000D88 076C696E6B73656CFA- <1>
  1215 00000D91 7E076C696E6B736567- <1>
  1215 00000D9A 2B850F6C696E6B696E- <1>
  1215 00000DA3 666F61646472657373- <1>
  1215 00000DAC 899F0D696E7465726E- <1>
  1215 00000DB5 616C666C6167738274- <1>
  1215 00000DBE 096C6F61645F646174- <1>
  1215 00000DC7 6184E3086C696E655F- <1>
  1215 00000DD0 6F7574222914657874- <1>
  1215 00000DD9 5F66696E6973682E62- <1>
  1215 00000DE2 705F69735F7365740F- <1>
  1215 00000DEB 08106C6F61645F6461- <1>
  1215 00000DF4 74615F6C6F77657374- <1>
  1215 00000DFD C71C0A6578745F6861- <1>
  1215 00000E06 6E646C6568440E6C69- <1>
  1215 00000E0F 6E6B63616C6C5F7461- <1>
  1215 00000E18 626C65F09E22747279- <1>
  1215 00000E21 5F6465627567676572- <1>
  1215 00000E2A 5F616D69735F6D756C- <1>
  1215 00000E33 7469706C65785F6E75- <1>
  1215 00000E3C 6D626572CB510E696E- <1>
  1215 00000E45 7465726E616C666C61- <1>
  1215 00000E4E 677334688C15616D69- <1>
  1215 00000E57 735F6D756C7469706C- <1>
  1215 00000E60 65785F6E756D626572  <1>
  1216                              <1> %if ELDOTHER
  1217                              <1> 	link_data_dump_names LINK_OTHER_DATA_NAMES
  1218                              <1> %endif
  1219                              <1> 
  1220                              <1> lmsg:
  1221                              <1> %if _ELD_LINKER_PASSES
  1222                              <1> %if _ELDCALL_OPTIONAL
  1223                              <1> .warning_code_optional:		counted "Optional code link missing, hash="
  1224                              <1> %endif
  1225                              <1> %if _ELDDATA_OPTIONAL
  1226                              <1> .warning_data_optional:		counted "Optional data link missing, hash="
  1227                              <1> %endif
  1228 00000E69 1844617461206C696E- <1> .error_data:			counted "Data link missing, hash="
  1228 00000E72 6B206D697373696E67- <1>
  1228 00000E7B 2C20686173683D      <1>
  1229 00000E82 18436F6465206C696E- <1> .error_code:			counted "Code link missing, hash="
  1229 00000E8B 6B206D697373696E67- <1>
  1229 00000E94 2C20686173683D      <1>
  1230 00000E9B 0A682C206C6162656C- <1> .error.2:			counted "h, label ",'"'
  1230 00000EA4 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 00000EA6 00<rep Ah>          <1> 	align 16, db 0
  1194                                  
  1195                                  	align 16
  1196                                  code_size equ $ - code
  1197                                  
  1198                                  %if _ALIGNPAGE
  1199                                  LIBOFFSETUNALIGNED equ DATAOFFSET + data_size
  1200                                  	addsection ALIGNED, follows=DATA vstart=0
  1201                                  aligned:
  1202                                  	times (((512) - ((LIBOFFSETUNALIGNED) % (512))) % (512)) db 0
  1203                                  	endarea aligned
  1204                                  
  1205                                  LIBOFFSET equ LIBOFFSETUNALIGNED + aligned_size
  1206                                  	addsection LIB, follows=ALIGNED vstart=0
  1207                                  %else
  1208                                  LIBOFFSET equ DATAOFFSET + data_size
  1209                                  	addsection LIB, follows=DATA vstart=0
  1210                                  %endif
  1211                                  lib_start:
  1212                                  
  1213                                   %if _COMPRESSED
  1214                                    %if _XLD
  1215                                     %if _LZEXEDAT
  1216                                  	incbin "packlibx.lz"
  1217                                     %else
  1218                                  	incbin "packlibx.hs"
  1219                                     %endif
  1220                                    %else
  1221                                     %if _LZEXEDAT
  1222                                  	incbin "packlibe.lz"
  1223                                     %else
  1224                                  	incbin "packlibe.hs"
  1225                                     %endif
  1226                                    %endif
  1227                                  lib_compressed_end:
  1228                                  
  1229                                  	align 16, db 0
  1230                                  length_to_truncate equ $ - lib_start + LIBOFFSET
  1231                                  
  1232                                  	addsection LIBDEPACKED, follows=LIB vstart=0
  1233                                  library_start_skip:
  1234                                   %endif
  1235                                  
  1236 00000CA0 <bin CA0h>-             dump_incbin INCBINLIST
  1236 00001D20 <bin 1080h>-       
  1236 00002970 <bin C50h>-        
  1236 00003560 <bin BF0h>-        
  1236 00004010 <bin AB0h>-        
  1236 000058D0 <bin 18C0h>-       
  1236 00006420 <bin B50h>-        
  1236 00007120 <bin D00h>-        
  1236 00008840 <bin 1720h>-       
  1236 00009480 <bin C40h>-        
  1236 0000AED0 <bin 1A50h>-       
  1236 0000C270 <bin 13A0h>-       
  1236 0000CC30 <bin 9C0h>-        
  1236 0000DF30 <bin 1300h>-       
  1236 0000ED30 <bin E00h>-        
  1236 0000FB30 <bin E00h>-        
  1236 00010EC0 <bin 1390h>-       
  1236 00011FF0 <bin 1130h>-       
  1236 000127F0 <bin 800h>-        
  1236 00013EC0 <bin 16D0h>-       
  1236 000146C0 <bin 800h>-        
  1236 00014E60 <bin 7A0h>-        
  1236 00015AC0 <bin C60h>-        
  1236 00016D00 <bin 1240h>-       
  1236 000177A0 <bin AA0h>-        
  1236 00018E00 <bin 1660h>-       
  1236 00019570 <bin 770h>-        
  1236 0001A3E0 <bin E70h>-        
  1236 0001B350 <bin F70h>-        
  1236 0001C150 <bin E00h>-        
  1236 0001D960 <bin 1810h>-       
  1236 0001E650 <bin CF0h>-        
  1236 0001F370 <bin D20h>-        
  1236 0001FF70 <bin C00h>-        
  1236 00020D00 <bin D90h>-        
  1236 00021920 <bin C20h>-        
  1236 00022790 <bin E70h>-        
  1236 00023410 <bin C80h>-        
  1236 00023FF0 <bin BE0h>-        
  1236 000248F0 <bin 900h>-        
  1236 00027370 <bin 2A80h>-       
  1236 0002A140 <bin 2DD0h>-       
  1236 0002B1F0 <bin 10B0h>-       
  1236 0002D5A0 <bin 23B0h>-       
  1236 0002E780 <bin 11E0h>-       
  1236 0002F910 <bin 1190h>-       
  1236 00030CA0 <bin 1390h>-       
  1236 000317B0 <bin B10h>-        
  1236 000323B0 <bin C00h>-        
  1236 00032EA0 <bin AF0h>-        
  1236 00033AE0 <bin C40h>-        
  1236 00034700 <bin C20h>-        
  1236 00034DF0 <bin 6F0h>-        
  1236 000363E0 <bin 15F0h>-       
  1236 00036DF0 <bin A10h>-        
  1236 00037D00 <bin F10h>-        
  1236 00039290 <bin 1590h>-       
  1236 00039E90 <bin C00h>-        
  1236 0003B120 <bin 1290h>-       
  1236 0003C0E0 <bin FC0h>-        
  1236 0003CF90 <bin EB0h>-        
  1236 0003DF40 <bin FB0h>-        
  1236 0003EC70 <bin D30h>-        
  1236 0003EC70 <bin 12A0h>        
  1237                                  library_end_skip:
  1238                                  
  1239                                   %if _COMPRESSED
  1240                                  	dd length_to_truncate
  1241                                   %endif
  1242                                  %endif
