     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> 
    36                              <2> 	%imacro internalcoderelocation 0-1.nolist -2
    37                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    38                              <2> %if ELDLINKER
    39                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    40                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    41                              <2>  %else
    42                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    43                              <2>  %endif
    44                              <2> %else
    45                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    46                              <2>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    47                              <2>  %else
    48                              <2>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    49                              <2>  %endif
    50                              <2> %endif
    51                              <2> 	eldstrictcheck
    52                              <2> 	%endmacro
    53                              <2> 
    54                              <2> 	%imacro internaldatarelocation 0-1.nolist -2
    55                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    56                              <2> %if ELDLINKER
    57                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    58                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    59                              <2>  %else
    60                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    61                              <2>  %endif
    62                              <2> %else
    63                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    64                              <2>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    65                              <2>  %else
    66                              <2>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    67                              <2>  %endif
    68                              <2> %endif
    69                              <2> 	eldstrictcheck
    70                              <2> 	%endmacro
    71                              <2> 
    72                              <2> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    73                              <2> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    74                              <2> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    75                              <2> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    76                              <2> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    77                              <2> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    78                              <2> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    79                              <2> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    80                              <2> 
    81                              <2> 
    82                              <2> %define LINK_DATA_RELOCATIONS ""
    83                              <2> %define LINK_LINKER_DATA_RELOCATIONS ""
    84                              <2> %define LINK_DATA_NAMES db ""
    85                              <2> %define LINK_DATA_DETECTION none, none
    86                              <2> 
    87                              <2> %define LINK_OTHER_DATA_RELOCATIONS ""
    88                              <2> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    89                              <2> %define LINK_OTHER_DATA_NAMES db ""
    90                              <2> %define LINK_OTHER_DATA_DETECTION none, none
    91                              <2> 
    92                              <2> %ifndef ELDOTHER
    93                              <2>  %assign ELDOTHER 0
    94                              <2> %endif
    95                              <2> %assign ELDOTHERLINK 0
    96                              <2> 
    97                              <2> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
    98                              <2> %if ELDOTHER
    99                              <2>  %assign ELDOTHERLINK 1
   100                              <2> %endif
   101                              <2> 	linkdatarelocation %1, %2, %3
   102                              <2> %assign ELDOTHERLINK 0
   103                              <2> 	%endmacro
   104                              <2> 
   105                              <2> 	%imacro linkdatarelocation 1-3.nolist -2, required
   106                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   107                              <2> %ifidni %3, required
   108                              <2>  %assign %%optional 0
   109                              <2> %elifidni %3, optional
   110                              <2>  %assign %%optional 100h
   111                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   112                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   113                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   114                              <2>  %else
   115                              <2>   %error Optional data link not allowed here
   116                              <2>  %endif
   117                              <2> %elifidni %3, PM required
   118                              <2>  %assign %%optional 300h
   119                              <2>  %assign ELDDATA_PMREQUIRED_STATUS 1
   120                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   121                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   122                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   123                              <2>  %else
   124                              <2>   %error Optional data link not allowed here
   125                              <2>  %endif
   126                              <2> %else
   127                              <2>  %fatal Unknown optional keyword
   128                              <2> %endif
   129                              <2> %ifidni _CURRENT_SECTION_TYPE, DATA
   130                              <2>  %assign %%DATASECTION 1
   131                              <2> %else
   132                              <2>  %assign %%DATASECTION 0
   133                              <2> %endif
   134                              <2> 	%if ELDOTHERLINK
   135                              <2> %if ELDLINKER
   136                              <2>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   137                              <2> %else
   138                              <2>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   139                              <2> %endif
   140                              <2> 	%else
   141                              <2> %if ELDLINKER
   142                              <2>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   143                              <2> %else
   144                              <2>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   145                              <2> %endif
   146                              <2> 	%endif
   147                              <2> %defstr %%string %1
   148                              <2> %strlen %%length %%string
   149                              <2> %if %%length > 64
   150                              <2>  %error Too long link name: %1
   151                              <2> %endif
   152                              <2> %define LINK_DATA_CHECK %1
   153                              <2> 	%if ELDOTHERLINK
   154                              <2> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   155                              <2> %if LINK_DATA_NEW
   156                              <2>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   157                              <2> 	hashdef HASH, %%string
   158                              <2>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   160                              <2> %else
   161                              <2>  %%name equ LINK_DATA_DUPLICATE
   162                              <2> %endif
   163                              <2> 	%else
   164                              <2> 	linkdata_detect LINK_DATA_DETECTION
   165                              <2> %if LINK_DATA_NEW
   166                              <2>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   167                              <2> 	hashdef HASH, %%string
   168                              <2>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   170                              <2> %else
   171                              <2>  %%name equ LINK_DATA_DUPLICATE
   172                              <2> %endif
   173                              <2> 	%endif
   174                              <2> 	eldstrictcheck
   175                              <2> 	%endmacro
   176                              <2> 
   177                              <2> 	%imacro linkdata_detect 2-*.nolist
   178                              <2> %assign LINK_DATA_NEW 1
   179                              <2> %rep (%0 - 2) / 2
   180                              <2>  %rotate 2
   181                              <2>  %ifidni %1, LINK_DATA_CHECK
   182                              <2>   %assign LINK_DATA_NEW 0
   183                              <2>   %xdefine LINK_DATA_DUPLICATE %2
   184                              <2>   %exitrep
   185                              <2>  %endif
   186                              <2> %endrep
   187                              <2> 	%endmacro
   188                              <2> 
   189                              <2> 	%imacro link_data_dump_names 1-*.nolist
   190                              <2> %rep %0
   191                              <2> 	%1
   192                              <2>  %rotate 1
   193                              <2> %endrep
   194                              <2> 	%endmacro
   195                              <2> 
   196                              <2> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   197                              <2> ; dw LINK_DATA_RELOCATIONS, 0, 0
   198                              <2> ; link_data_dump_names ELDCALL_CODE_NAMES
   199                              <2> 
   200                              <2> %endif
    21                              <1> 
    22                              <1> %assign ELDLINKER 0
    23                              <1> 
    24                              <1> [section relocatedzero nobits vstart=0]
    25                              <1> relocatedzero:
    26                              <1> __SECT__
    27                              <1> 
    28                              <1> 	numdef HOUDINI, 1
    29                              <1> 	numdef HOUDINI_CONDITIONAL, 1
    30                              <1> 
    31                              <1> %imacro houdini 0.nolist
    32                              <1> %if _HOUDINI
    33                              <1>  %if _HOUDINI_CONDITIONAL
    34                              <1> reloc	testopt [ss:relocateddata], 100h
    35                              <1> linkdatarelocation options7, -3
    36                              <1> 	jz %%skip
    37                              <1>  %endif
    38                              <1> reloc	testopt [ss:relocateddata], 100h
    39                              <1> linkdatarelocation internalflags6, -3
    40                              <1> 	jz %%skip
    41                              <1> 	int3
    42                              <1> %%skip:
    43                              <1> %endif
    44                              <1> %endmacro
    45                              <1> 
    46                              <1> %define ELDCALL_CODE_RELOCATIONS ""
    47                              <1> %define ELDCALL_LINKER_CODE_RELOCATIONS ""
    48                              <1> %define ELDCALL_CODE_RELOCATIONS_OPTIONAL ""
    49                              <1> %define ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ""
    50                              <1> %define ELDCALL_CODE_NAMES db ""
    51                              <1> %define ELDCALL_CODE_DETECTION none, none
    52                              <1> %assign ELDCALL_OPTIONAL_STATUS 0		; not any seen yet
    53                              <1> %assign ELDCALL_PMREQUIRED_STATUS 0		; not any seen yet
    54                              <1> 
    55                              <1> 	%imacro extcall 1-2.nolist required
    56                              <1> %ifidni _CURRENT_SECTION_TYPE, DATA
    57                              <1>  %error "ELD call cannot be used in ELD data block"
    58                              <1> %endif
    59                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP
    60                              <1> %ifidni %2, required
    61                              <1>  %assign %%optional 0
    62                              <1> %elifidni %2, optional
    63                              <1>  %assign %%optional 100h
    64                              <1>  %if ELDCALL_OPTIONAL_STATUS == 0
    65                              <1>   %assign ELDCALL_OPTIONAL_STATUS 1
    66                              <1>  %elif ELDCALL_OPTIONAL_STATUS == 1
    67                              <1>  %else
    68                              <1>   %error Optional code link not allowed here
    69                              <1>  %endif
    70                              <1> %elifidni %2, PM required
    71                              <1>  %assign %%optional 300h
    72                              <1>  %assign ELDCALL_PMREQUIRED_STATUS 1
    73                              <1>  %if ELDCALL_OPTIONAL_STATUS == 0
    74                              <1>   %assign ELDCALL_OPTIONAL_STATUS 1
    75                              <1>  %elif ELDCALL_OPTIONAL_STATUS == 1
    76                              <1>  %else
    77                              <1>   %error Optional code link not allowed here
    78                              <1>  %endif
    79                              <1> %else
    80                              <1>  %fatal Unknown optional keyword
    81                              <1> %endif
    82                              <1> %if 0
    83                              <1> [warning -reloc-rel-word]
    84                              <1> 	call near relocatedzero
    85                              <1> [warning +reloc-rel-word]
    86                              <1> %else
    87                              <1> 	db 0E8h
    88                              <1> reloc	dw relocatedzero
    89                              <1> 	eldstrictcheck
    90                              <1> %endif
    91                              <1> 	jmp strict short %%skipparameter
    92                              <1> 	dw 0
    93                              <1> %%skipparameter:
    94                              <1> %if ELDLINKER
    95                              <1>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS ELDCALL_LINKER_CODE_RELOCATIONS, %%entry, %%name
    96                              <1>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional, %%entry, %%name
    97                              <1> %else
    98                              <1>  %xdefine ELDCALL_CODE_RELOCATIONS ELDCALL_CODE_RELOCATIONS, %%entry, %%name
    99                              <1>  %xdefine ELDCALL_CODE_RELOCATIONS_OPTIONAL ELDCALL_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional, %%entry, %%name
   100                              <1> %endif
   101                              <1> %defstr %%string %1
   102                              <1> %strlen %%length %%string
   103                              <1> %if %%length > 64
   104                              <1>  %error Too long link name: %1
   105                              <1> %endif
   106                              <1> %define ELDCALL_CODE_CHECK %1
   107                              <1> 	linkcode_detect ELDCALL_CODE_DETECTION
   108                              <1> %if ELDCALL_CODE_NEW
   109                              <1>  %xdefine ELDCALL_CODE_DETECTION ELDCALL_CODE_DETECTION, %1, %%name
   110                              <1> 	hashdef HASH, %%string
   111                              <1> %xdefine ELDCALL_CODE_NAMES 	ELDCALL_CODE_NAMES, %%name:, dw _HASH, {counted %%string}
   113                              <1> %else
   114                              <1>  %%name equ ELDCALL_CODE_DUPLICATE
   115                              <1> %endif
   116                              <1> 	%endmacro
   117                              <1> 
   118                              <1> 	%imacro linkcode_detect 2-*.nolist
   119                              <1> %assign ELDCALL_CODE_NEW 1
   120                              <1> %rep (%0 - 2) / 2
   121                              <1>  %rotate 2
   122                              <1>  %ifidni %1, ELDCALL_CODE_CHECK
   123                              <1>   %assign ELDCALL_CODE_NEW 0
   124                              <1>   %xdefine ELDCALL_CODE_DUPLICATE %2
   125                              <1>   %exitrep
   126                              <1>  %endif
   127                              <1> %endrep
   128                              <1> 	%endmacro
   129                              <1> 
   130                              <1> 
   131                              <1> %define ELDCALL_CALLCALL_LIST none
   132                              <1> 
   133                              <1> 	%imacro extcallcall 1.nolist
   134                              <1> 	call %1
   135                              <1> %xdefine ELDCALL_CALLCALL_LIST ELDCALL_CALLCALL_LIST, %1
   136                              <1> 	%endmacro
   137                              <1> 
   138                              <1> %assign ELDCALLCALL_DUMPED 0
   139                              <1> 
   140                              <1> 	%imacro eldcall_dump_callcall 1-*.nolist
   141                              <1> %define ELDCALL_CALLCALL_PROCESSED none
   142                              <1>  %rep %0 - 1
   143                              <1>   %rotate 1
   144                              <1>   %define ELDCALL_CHECK %1
   145                              <1> 	eldcall_callcall_detect ELDCALL_CALLCALL_PROCESSED
   146                              <1>   %if ELDCALL_NEW
   147                              <1>    %xdefine ELDCALL_CALLCALL_PROCESSED ELDCALL_CALLCALL_PROCESSED, %1
   148                              <1> 	align 8, nop
   149                              <1> %1:
   150                              <1> 	extcall %1
   151                              <1> 	retn
   152                              <1>   %endif
   153                              <1>  %endrep
   154                              <1> %unimacro extcallcall 1.nolist
   155                              <1> %assign ELDCALLCALL_DUMPED 1
   156                              <1> %define ELDCALL_CALLCALL_LIST none
   157                              <1> 	%endmacro
   158                              <1> 
   159                              <1> 	%imacro eldcall_callcall_detect 1-*.nolist
   160                              <1> %assign ELDCALL_NEW 1
   161                              <1> %rep %0 - 1
   162                              <1>  %rotate 1
   163                              <1>  %ifidni %1, ELDCALL_CHECK
   164                              <1>   %assign ELDCALL_NEW 0
   165                              <1>   %exitrep
   166                              <1>  %endif
   167                              <1> %endrep
   168                              <1> 	%endmacro
   169                              <1> 
   170                              <1> 	%imacro eldcall_dump_names 1-*.nolist
   171                              <1> %rep %0
   172                              <1> 	%1
   173                              <1>  %rotate 1
   174                              <1> %endrep
   175                              <1> 	%endmacro
   176                              <1> 
   177                              <1> ; eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   178                              <1> ; if using optional code links:
   179                              <1> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
   180                              <1> ;  dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
   181                              <1> ; if not using optional code links:
   182                              <1> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
   183                              <1> ;  dw ELDCALL_CODE_RELOCATIONS, 0, 0
   184                              <1> ; eldcall_dump_names ELDCALL_CODE_NAMES
   185                              <1> 
   186                              <1> %endif
     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> 
    36                              <1> 	%imacro internalcoderelocation 0-1.nolist -2
    37                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    38                              <1> %if ELDLINKER
    39                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    40                              <1>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    41                              <1>  %else
    42                              <1>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    43                              <1>  %endif
    44                              <1> %else
    45                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    46                              <1>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    47                              <1>  %else
    48                              <1>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    49                              <1>  %endif
    50                              <1> %endif
    51                              <1> 	eldstrictcheck
    52                              <1> 	%endmacro
    53                              <1> 
    54                              <1> 	%imacro internaldatarelocation 0-1.nolist -2
    55                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    56                              <1> %if ELDLINKER
    57                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    58                              <1>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    59                              <1>  %else
    60                              <1>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    61                              <1>  %endif
    62                              <1> %else
    63                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    64                              <1>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    65                              <1>  %else
    66                              <1>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    67                              <1>  %endif
    68                              <1> %endif
    69                              <1> 	eldstrictcheck
    70                              <1> 	%endmacro
    71                              <1> 
    72                              <1> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    73                              <1> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    74                              <1> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    75                              <1> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    76                              <1> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    77                              <1> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    78                              <1> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    79                              <1> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    80                              <1> 
    81                              <1> 
    82                              <1> %define LINK_DATA_RELOCATIONS ""
    83                              <1> %define LINK_LINKER_DATA_RELOCATIONS ""
    84                              <1> %define LINK_DATA_NAMES db ""
    85                              <1> %define LINK_DATA_DETECTION none, none
    86                              <1> 
    87                              <1> %define LINK_OTHER_DATA_RELOCATIONS ""
    88                              <1> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    89                              <1> %define LINK_OTHER_DATA_NAMES db ""
    90                              <1> %define LINK_OTHER_DATA_DETECTION none, none
    91                              <1> 
    92                              <1> %ifndef ELDOTHER
    93                              <1>  %assign ELDOTHER 0
    94                              <1> %endif
    95                              <1> %assign ELDOTHERLINK 0
    96                              <1> 
    97                              <1> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
    98                              <1> %if ELDOTHER
    99                              <1>  %assign ELDOTHERLINK 1
   100                              <1> %endif
   101                              <1> 	linkdatarelocation %1, %2, %3
   102                              <1> %assign ELDOTHERLINK 0
   103                              <1> 	%endmacro
   104                              <1> 
   105                              <1> 	%imacro linkdatarelocation 1-3.nolist -2, required
   106                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   107                              <1> %ifidni %3, required
   108                              <1>  %assign %%optional 0
   109                              <1> %elifidni %3, optional
   110                              <1>  %assign %%optional 100h
   111                              <1>  %if ELDDATA_OPTIONAL_STATUS == 0
   112                              <1>   %assign ELDDATA_OPTIONAL_STATUS 1
   113                              <1>  %elif ELDDATA_OPTIONAL_STATUS == 1
   114                              <1>  %else
   115                              <1>   %error Optional data link not allowed here
   116                              <1>  %endif
   117                              <1> %elifidni %3, PM required
   118                              <1>  %assign %%optional 300h
   119                              <1>  %assign ELDDATA_PMREQUIRED_STATUS 1
   120                              <1>  %if ELDDATA_OPTIONAL_STATUS == 0
   121                              <1>   %assign ELDDATA_OPTIONAL_STATUS 1
   122                              <1>  %elif ELDDATA_OPTIONAL_STATUS == 1
   123                              <1>  %else
   124                              <1>   %error Optional data link not allowed here
   125                              <1>  %endif
   126                              <1> %else
   127                              <1>  %fatal Unknown optional keyword
   128                              <1> %endif
   129                              <1> %ifidni _CURRENT_SECTION_TYPE, DATA
   130                              <1>  %assign %%DATASECTION 1
   131                              <1> %else
   132                              <1>  %assign %%DATASECTION 0
   133                              <1> %endif
   134                              <1> 	%if ELDOTHERLINK
   135                              <1> %if ELDLINKER
   136                              <1>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   137                              <1> %else
   138                              <1>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   139                              <1> %endif
   140                              <1> 	%else
   141                              <1> %if ELDLINKER
   142                              <1>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   143                              <1> %else
   144                              <1>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   145                              <1> %endif
   146                              <1> 	%endif
   147                              <1> %defstr %%string %1
   148                              <1> %strlen %%length %%string
   149                              <1> %if %%length > 64
   150                              <1>  %error Too long link name: %1
   151                              <1> %endif
   152                              <1> %define LINK_DATA_CHECK %1
   153                              <1> 	%if ELDOTHERLINK
   154                              <1> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   155                              <1> %if LINK_DATA_NEW
   156                              <1>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   157                              <1> 	hashdef HASH, %%string
   158                              <1>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   160                              <1> %else
   161                              <1>  %%name equ LINK_DATA_DUPLICATE
   162                              <1> %endif
   163                              <1> 	%else
   164                              <1> 	linkdata_detect LINK_DATA_DETECTION
   165                              <1> %if LINK_DATA_NEW
   166                              <1>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   167                              <1> 	hashdef HASH, %%string
   168                              <1>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   170                              <1> %else
   171                              <1>  %%name equ LINK_DATA_DUPLICATE
   172                              <1> %endif
   173                              <1> 	%endif
   174                              <1> 	eldstrictcheck
   175                              <1> 	%endmacro
   176                              <1> 
   177                              <1> 	%imacro linkdata_detect 2-*.nolist
   178                              <1> %assign LINK_DATA_NEW 1
   179                              <1> %rep (%0 - 2) / 2
   180                              <1>  %rotate 2
   181                              <1>  %ifidni %1, LINK_DATA_CHECK
   182                              <1>   %assign LINK_DATA_NEW 0
   183                              <1>   %xdefine LINK_DATA_DUPLICATE %2
   184                              <1>   %exitrep
   185                              <1>  %endif
   186                              <1> %endrep
   187                              <1> 	%endmacro
   188                              <1> 
   189                              <1> 	%imacro link_data_dump_names 1-*.nolist
   190                              <1> %rep %0
   191                              <1> 	%1
   192                              <1>  %rotate 1
   193                              <1> %endrep
   194                              <1> 	%endmacro
   195                              <1> 
   196                              <1> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   197                              <1> ; dw LINK_DATA_RELOCATIONS, 0, 0
   198                              <1> ; link_data_dump_names ELDCALL_CODE_NAMES
   199                              <1> 
   200                              <1> %endif
    10                                  
    11                                  	numdef COMPRESSED, 0
    12                                  	numdef COMPRESSLIB, 0
    13                                  %assign _ELDCOMPRESSED _COMPRESSED
    14                                  	numdef ALIGNPAGE, 1
    15                                  	excdef !_COMPRESSED, ALIGNPAGE
    16                                  	numdef ELD_TEST_LIB, 0
    17                                   	numdef ELD_ZERO_OFFSETS, 1
    18                                  
    19                                  %assign _DEBUG 1
    20                                  %assign _CATCHINT0C 0
    21                                  %assign _CATCHINT0D 0
    22                                  %assign _CATCHINTFAULTCOND 0
    23                                  %assign _DEBUG_COND 1
    24                                  %assign _DELAY_BEFORE_BP 0
    25                                  %assign _DHIGHLIGHT 0
    26                                  %assign _GETLINEHIGHLIGHT 0
    27                                  %assign _IMMASM 0
    28                                  %assign _INPUT_FILE_BOOT 0
    29                                  %assign _INPUT_FILE_HANDLES 0
    30                                  %assign _MS_0RANGE_COMPAT 0
    31                                  %assign _PM 0
    32                                  %assign _RH 0
    33                                  %assign _SYMBOLIC 0
    34                                  %assign _VXCHG 0
    35                                  %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-2023 E. C. Masloch
     7                              <1> 
     8                              <1> Usage of the works is permitted provided that this
     9                              <1> instrument is retained with the works, so that any entity
    10                              <1> that uses the works is notified of this instrument.
    11                              <1> 
    12                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                              <1> 
    14                              <1> %endif
    15                              <1> 
    16                              <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_no_ensure:			equ 1000h
   203                              <1> opt7_no_tsr_ll:			equ 2000h
   204                              <1> 
   205                              <1> 
   206                              <1> oldpacket	equ	  1	; Int25/Int26 packet method available (L, W)
   207                              <1> newpacket	equ	  2	; Int21.7305 packet method available (L, W)
   208                              <1> ntpacket	equ	  4	; VDD registered and usable (L, W)
   209                              <1> pagedcommand	equ	  8	; allows paging in puts
   210                              <1> notstdinput	equ	 10h	; DEBUG's StdIn isn't a device with StdIn bit (is file or other device)
   211                              <1> inputfile	equ	 20h	; DEBUG's StdIn is a file, notstdinput also set
   212                              <1> notstdoutput	equ	 40h	; DEBUG's StdOut isn't a device with StdOut bit (is file or other device)
   213                              <1> outputfile	equ	  80h	; DEBUG's StdOut is a file, notstdoutput also set
   214                              <1> hooked2F	equ	 100h	; Int2F hooked
   215                              <1> nohook2F	equ	 200h	; don't hook Int2F.1687 (required for Win9x, DosEmu?)
   216                              <1> unused_dif1_dpminohlt equ 400h	; DPMI doesn't like hlt
   217                              <1> protectedmode	equ	 800h	; in (DPMI) protected mode
   218                              <1> debuggeeA20	equ	1000h	; state of debuggee's A20
   219                              <1> debuggerA20	equ	2000h	; state of debugger's A20 (will be on if possible)
   220                              <1> nodosloaded	equ	4000h	; No DOS loaded currently (Boot loader mode)
   221                              <1> has386		equ	8000h	; CPU is a 386
   222                              <1> usecharcounter	equ    1_0000h	; don't reset charcounter between calls to puts
   223                              <1> runningnt	equ    2_0000h	; running in NTVDM
   224                              <1> canswitchmode	equ    4_0000h	; can switch modes (auxbuff large enough, DPMI mode switch set up)
   225                              <1> modeswitched	equ    8_0000h	; switched mode (now in the mode that we weren't entered in)
   226                              <1> promptwaiting	equ   10_0000h	; puts: any more output needs to display a prompt first
   227                              <1> switchbuffer	equ   20_0000h	; mode switch needs a buffer (auxbuff)
   228                              <1> tsrmode		equ   40_0000h	; in TSR mode; DPI and DPP not valid
   229                              <1> attachedterm	equ   80_0000h	; the attached process terminated
   230                              <1> runningdosemu	equ  100_0000h	; running in dosemu
   231                              <1> ; load_is_ldp	equ  200_0000h	; boot load: partition specified as "ldp"
   232                              <1> tt_while:	equ  400_0000h	; tt: while condition specified
   233                              <1> tt_p:		equ  800_0000h	; tt: proceed past repeated string instructions
   234                              <1> tt_silent_mode:	equ 1000_0000h	; tt: run should be silent (dump at end)
   235                              <1> tt_silence:	equ 2000_0000h	; tt: silent writing (write to auxbuff instead)
   236                              <1> tt_no_bb:	equ 4000_0000h	; tt: do not use bb breakpoints
   237                              <1> tt_no_bb_first:	equ 8000_0000h	; tt: do not use bb breakpoints at first
   238                              <1> 
   239                              <1> 
   240                              <1> dif2_gg_is_first:	equ   1
   241                              <1> dif2_gg_skip_non_cseip:	equ   2
   242                              <1> dif2_gg_skip_cseip:	equ   4
   243                              <1> dif2_gg_is_gg:		equ   8
   244                              <1> dif2_gg_first_detected:	equ  10h
   245                              <1> dif2_gg_again:		equ  20h
   246                              <1> dif2_tpg_proceed_bp_set:equ  40h
   247                              <1> dif2_tpg_keep_proceed_bp: equ 80h
   248                              <1> dif2_tpg_have_bp:	equ 100h
   249                              <1> dif2_tpg_adjusted_cseip:equ 200h
   250                              <1> dif2_tpg_do_not_adjust:	equ 400h
   251                              <1> dif2_bp_failure:	equ 800h
   252                              <1> dif2_is_pp:		equ 1000h
   253                              <1> %if _SYMBOLIC
   254                              <1> dif2_createdprocess:	equ 800_0000h	; created empty debuggee process
   255                              <1> dif2_sym_req_xms:	equ 2000h
   256                              <1> dif2_sym_req_86mm:	equ 4000h
   257                              <1> dif2_sym_req_mask equ dif2_sym_req_86mm | dif2_sym_req_xms
   258                              <1> dif2_no_pm_xms:		equ 1_0000h
   259                              <1> dif2_xms_detection_done:equ 2_0000h
   260                              <1> %endif
   261                              <1> %if _INPUT_FILE_HANDLES
   262                              <1> dif2_input_file:	equ 10_0000h
   263                              <1> dif2_closed_input_file:	equ 20_0000h
   264                              <1> %endif
   265                              <1> dif2_did_getline_file:	equ 40_0000h
   266                              <1> %if _SYMBOLIC
   267                              <1> dif2_poison:		equ 80_0000h
   268                              <1> %endif
   269                              <1> dif2_boot_loaded_kernel:equ 100_0000h
   270                              <1> %if _INPUT_FILE_BOOT
   271                              <1> dif2_input_file_boot:	equ 200_0000h
   272                              <1> dif2_closed_input_file_boot:	equ 400_0000h
   273                              <1> %endif
   274                              <1> dif2_in_silence_dump:	equ 1000_0000h
   275                              <1> dif2_int31_segment:	equ 2000_0000h
   276                              <1> dif2_nn_compat:		equ 4000_0000h
   277                              <1> dif2_nn_capitalise:	equ 8000_0000h
   278                              <1> 
   279                              <1> 
   280                              <1> dif3_load_is_ldp:	equ 1	; boot load: partition specified as "ldp"
   281                              <1> dif3_load_is_sdp:	equ 2	; boot load: partition specified as "sdp"
   282                              <1> dif3_load_is_ydp:	equ 4	; boot load: partition specified as "ydp"
   283                              <1> dif3_load_is_dp:	equ dif3_load_is_ldp 				| dif3_load_is_sdp 				| dif3_load_is_ydp
   286                              <1> dif3_load_dir_dir:	equ 8
   287                              <1> dif3_input_terminal_override:	equ 10h
   288                              <1> dif3_input_serial_override:	equ 20h
   289                              <1> dif3_if_not:		equ 40h
   290                              <1> dif3_partition_changed:	equ 80h
   291                              <1> ;
   292                              <1> dif3_input_cmdline:	equ 100h; input reading from cmdline_buffer
   293                              <1> dif3_input_cmdline_closed: equ 200h
   294                              <1> dif3_at_line_end:	equ 400h
   295                              <1> dif3_quiet_input_single:equ 800h
   296                              <1> dif3_quiet_output:	equ 1000h
   297                              <1> dif3_unquiet_error:	equ 2000h
   298                              <1> dif3_unquiet_prompt:	equ 4000h
   299                              <1> dif3_unquiet:		equ dif3_unquiet_error | dif3_unquiet_prompt
   300                              <1> dif3_return_eof:	equ 8000h
   301                              <1> dif3_highlighting:	equ 1_0000h
   302                              <1> dif3_do_not_highlight:	equ 2_0000h
   303                              <1> dif3_int10_highlight:	equ 2_0000h
   304                              <1> dif3_nosymbols_1:	equ 4_0000h
   305                              <1> dif3_nosymbols_2:	equ 8_0000h
   306                              <1> %if _PM
   307                              <1> dif3_ss_b_bit_set:	equ  10_0000h
   308                              <1> %endif
   309                              <1> dif3_gotint19:		equ  20_0000h
   310                              <1> dif3_prior_pm:		equ  40_0000h
   311                              <1> %if _DELAY_BEFORE_BP
   312                              <1> dif3_delayed		equ  80_0000h
   313                              <1> %endif
   314                              <1> dif3_input_re:		equ 100_0000h	; input reading from re_buffer
   315                              <1> dif3_input_re_closed:	equ 200_0000h
   316                              <1> dif3_accept_getrange_0:	equ 400_0000h
   317                              <1> %if _INPUT_FILE_HANDLES || _INPUT_FILE_BOOT
   318                              <1> dif3_in_if:		equ 800_0000h
   319                              <1> %endif
   320                              <1> dif3_auxbuff_guarded_1:	equ 1000_0000h
   321                              <1> dif3_auxbuff_guarded_2:	equ 2000_0000h
   322                              <1> dif3_auxbuff_guarded_3:	equ 4000_0000h
   323                              <1> dif3_sss_is_reverse:	equ 8000_0000h
   324                              <1> 
   325                              <1> 
   326                              <1> dif4_int_serial_hooked:	equ 1
   327                              <1> dif4_int_2F_hooked:	equ 2
   328                              <1> dif4_int_08_hooked:	equ 4
   329                              <1> dif4_int_2D_hooked:	equ 8
   330                              <1> %if _CATCHINTFAULTCOND && _CATCHINT0D
   331                              <1> dif4_int_0D_hooked:	equ 10h
   332                              <1> %endif
   333                              <1> %if _CATCHINTFAULTCOND && _CATCHINT0C
   334                              <1> dif4_int_0C_hooked:	equ 20h
   335                              <1> %endif
   336                              <1> 
   337                              <1> 
   338                              <1> %if _VXCHG
   339                              <1> dif6_vv_mode:		equ 1
   340                              <1> %endif
   341                              <1> dif6_in_hook2F:		equ 2
   342                              <1> dif6_in_amis_hook2F:	equ 4
   343                              <1> dif6_debug_mode:	equ 100h
   344                              <1> dif6_locked:		equ 200h
   345                              <1> %if _RH
   346                              <1> dif6_rh_mode_was:	equ  8_0000h
   347                              <1> dif6_rh_mode:		equ 10_0000h
   348                              <1> dif6_rh_mode_2:		equ 20_0000h
   349                              <1> %endif
   350                              <1> dif6_device_mode:	equ 40_0000h
   351                              <1> dif6_cpdepchars:	equ 80_0000h
   352                              <1> %if _IMMASM
   353                              <1> dif6_immasm_no_output:	equ 100_0000h
   354                              <1> dif6_immasm:		equ 200_0000h
   355                              <1> dif6_immasm_rel8:	equ 400_0000h
   356                              <1> %endif
   357                              <1> 
   358                              <1> 
   359                              <1> disasm_lowercase	equ 1
   360                              <1> disasm_commablank	equ 2
   361                              <1> disasm_nasm		equ 4
   362                              <1> disasm_lowercase_refmem:equ 8
   363                              <1> disasm_show_short:	equ 10h
   364                              <1> disasm_show_near:	equ 20h
   365                              <1> disasm_show_far:	equ 40h
   366                              <1> disasm_nec:		equ 80h
   367                              <1> disasm_40_columns:	equ 100h
   368                              <1> disasm_no_indent:	equ 200h
   369                              <1> disasm_msdebug_mnemonofs: equ 400h
   370                              <1> disasm_a16_memref:	equ 1000h
   371                              <1> disasm_a32_memref:	equ 2000h
   372                              <1> disasm_a16_string:	equ 4000h
   373                              <1> disasm_a32_string:	equ 8000h
   374                              <1> disasm_hide_modrm:	equ 10000h
   375                              <1> disasm_asize_loop_nasm:	equ 20000h
   376                              <1> disasm_modrm_always:	equ 40000h
   377                              <1> DEFAULTASMOPTIONS equ disasm_lowercase|disasm_commablank|disasm_nasm 	| disasm_a16_memref | disasm_a32_memref 	| disasm_a16_string | disasm_a32_string
    36                                  
    37                                  %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-2023 E. C. Masloch
     6                              <1> 
     7                              <1> Usage of the works is permitted provided that this
     8                              <1> instrument is retained with the works, so that any entity
     9                              <1> that uses the works is notified of this instrument.
    10                              <1> 
    11                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <1> 
    13                              <1> %endif
    14                              <1> 
    15                              <1> 
    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> lsvefNoDataStart	equ 1
   109                              <1> lsvefPartitionNumber	equ 2
   110                              <1> 
   111                              <1> 	struc LOADCMDLINE, LOADDATA - lsvclBufferLength
   112                              <1> ldCommandLine:
   113 FFFFFEE0 <res 100h>          <1> .start:		resb lsvclBufferLength
   114                              <1> 	endstruc
   115                              <1> 
   116                              <1> ldfHasLBA:	equ 1
   117                              <1> ldfFATInvalid:	equ 2
   118                              <1> ldfFATBuffered:	equ 4
   119                              <1> 
   120                              <1> 	struc LOADDATA2, LOADDATA - 10h
   121 FFFFFFD0 ????????            <1> ldRootSector:		resd 1
   122 FFFFFFD4 ????                <1> ldEntriesPerSector:	resw 1
   123 FFFFFFD6 ????                <1> ldLastAvailableSector:	resw 1
   124 FFFFFFD8 ????                <1> ldParasLeft:		resw 1
   125 FFFFFFDA ????                <1> ldParasDone:		resw 1
   126                              <1> 	endstruc
   127                              <1> 
   128                              <1> 	struc LOADDATA3, LOADDATA2 - 10h
   129 FFFFFFC0 ????????            <1> ldMaxCluster:		resd 1
   130 FFFFFFC4 ????????            <1> ldFileSize:		resd 1
   131 FFFFFFC8 ????????            <1> ldCurrentCluster:	resd 1
   132 FFFFFFCC ????????            <1> ldCurrentSeek:		resd 1
   133                              <1> 	endstruc
   134                              <1> 
   135                              <1> 	struc LBAPACKET
   136 00000000 ????                <1> lpSize:		resw 1
   137 00000002 ????                <1> lpCount:	resw 1
   138 00000004 ????????            <1> lpBuffer:	resd 1
   139 00000008 ????????????????    <1> lpSector:	resq 1
   140                              <1> 	endstruc
   141                              <1> 
   142                              <1> 	struc PARTINFO
   143 00000000 ??                  <1> piBoot:		resb 1
   144 00000001 ??????              <1> piStartCHS:	resb 3
   145 00000004 ??                  <1> piType:		resb 1
   146 00000005 ??????              <1> piEndCHS:	resb 3
   147 00000008 ????????            <1> piStart:	resd 1
   148 0000000C ????????            <1> piLength:	resd 1
   149                              <1> 	endstruc
   150                              <1> 
   151                              <1> ptEmpty:		equ 0
   152                              <1> ptFAT12:		equ 1
   153                              <1> ptFAT16_16BIT_CHS:	equ 4
   154                              <1> ptExtendedCHS:		equ 5
   155                              <1> ptFAT16_CHS:		equ 6
   156                              <1> ptFAT32_CHS:		equ 0Bh
   157                              <1> ptFAT32:		equ 0Ch
   158                              <1> ptFAT16:		equ 0Eh
   159                              <1> ptExtended:		equ 0Fh
   160                              <1> ptLinux:		equ 83h
   161                              <1> ptExtendedLinux:	equ 85h
   162                              <1> 
   163                              <1> 
   164                              <1> 		; Flags of load_unit_flags
   165                              <1> lufForceCHS:		equ 1
   166                              <1> lufForceLBA:		equ 2
   167                              <1> lufForceGeometry:	equ 4
   168                              <1> luf_mask_writable equ lufForceCHS | lufForceLBA | lufForceGeometry
    38                                  
    39                                  	numdef XLD
    40                                  
    41                                  %ifn _COMPRESSLIB
    42                                  	cpu 8086
    43                                  
    44                                  	addsection RELOCATEDDATA, nobits vstart=_ELD_RELOC_VSTART
    45                                  relocateddata:
    46                                  
    47                                  	addsection HEADER, start=0
    48                                  
    49                                  	istruc ELD_HEADERX
    50                                  at eldhxHeader
    51                                  		; ELD executable header
    52                                  	istruc ELD_HEADER
    53 00000000 454C4431                at eldhSignature,	db "ELD1"
    54 00000004 000000                  			db 0,0,0
    55 00000007 1A                      			db 26
    56 00000008 50000000                at eldhCodeOffset,	dd CODEOFFSET
    57 0000000C 100F                    at eldhCodeImageLength,	dw code_size
    58 0000000E 0000                    at eldhCodeAllocLength,	dw 0
    59 00000010 600F0000                at eldhDataOffset,	dd DATAOFFSET
    60 00000014 5005                    at eldhDataImageLength,	dw data_size
    61 00000016 1000                    at eldhDataAllocLength,	dw total_data_size - data_size
    62 00000018 7806                    at eldhCodeEntrypoint,	dw linker - code
    63                                  at eldhReserved
    64 0000001A 00<rep 4h>2C00          at eldhExtensionSize,	dw header_extension_end - $$
    65                                  	iend
    66 00000020 [30000000]              at eldhxDescriptionOffset,	dd description
    67 00000024 B2130000                at eldhxHelpOffset,		dd DATAOFFSET + msg.help - datastart
    68 00000028 600F0000                at eldhxLibTable,		dd DATAOFFSET + libtable - datastart
    69                                  PUT_ELDHX_DATETIME_OFFSET
    70                                  header_extension_end:
    71 0000002C 00<rep 4h>              	iend
    72                                  
    73 00000030 455854204C49423A20-     description:		asciz "EXT LIB: library of ELDs."
    73 00000039 6C696272617279206F-
    73 00000042 6620454C44732E00   
    74                                  
    75                                  
    76 0000004A 00<rep 6h>              	align 16, db 0
    77                                  
    78                                  CODEOFFSET equ $ - $$
    79                                  	addsection CODE, follows=HEADER vstart=_ELD_CODE_VSTART
    80                                  %define CODEFIXUP - code + 0
    81                                  code:
    82                                  		; ELD instance header
    83                                  	istruc ELD_INSTANCE
    84                                  at eldiStartCode
    85 00000000 00<rep 2h>              at eldiEndCode
    86 00000002 00<rep 2h>              at eldiStartData
    87 00000004 00<rep 2h>              at eldiEndData
    88 00000006 00<rep 2h>4558544C-     at eldiIdentifier,	fill 8, 32, db "EXTLIB"
    88 0000000C 494220<rep 2h>     
    89 00000010 00<rep 2h>6578746C-     at eldiListing,		asciz _ELD_LISTING
    89 00000016 69622E6C737400     
    90 0000001D 00<rep 3h>              	iend
    91                                  
    92                                  start:
    93 00000020 16                      	push ss
    94 00000021 07                      	pop es
    95 00000022 E8DB05                  	extcallcall skipcomma
    96 00000025 4E                      	dec si
    97 00000026 89F3                    	mov bx, si
    98 00000028 AC                      	lodsb
    99 00000029 E8DC05                  	extcallcall iseol?
   100 0000002C 8D74FF                  	lea si, [si - 1]
   101 0000002F 740C                    	je help
   102 00000031 BA[3504]                	mov dx, msg.help_keyword
   103                                  internaldatarelocation
   104 00000034 E8D905                  	extcallcall isstring?
   105 00000037 7404                    	je help
   106                                  %if _COMPRESSED && _ELD_TEST_LIB
   107                                  	mov dx, msg.test_keyword
   108                                  internaldatarelocation
   109                                  	extcallcall isstring?
   110                                  	je test
   111                                  %endif
   112 00000039 AC                      	lodsb
   113 0000003A E94C01                  	jmp getname
   114                                  
   115                                  %if _COMPRESSED && _ELD_TEST_LIB
   116                                  test:
   117                                  	xor cx, cx
   118                                  	xor dx, dx
   119                                  	call get_dxax_seek_lib_plus_cxdx
   120                                  	jc .io_error
   121                                  	mov word [libseek], ax
   122                                  internaldatarelocation
   123                                  	mov word [libseek + 2], dx
   124                                  internaldatarelocation
   125                                  
   126                                  	mov cx, ELD_HEADERX_size
   127                                  	sub sp, cx
   128                                  
   129                                  	xor ax, ax
   130                                  	mov word [depackskip], ax
   131                                  internaldatarelocation
   132                                  	mov word [depackskip + 2], ax
   133                                  internaldatarelocation
   134                                  
   135                                  	mov dx, sp
   136                                  	call read_and_depack
   137                                  	houdini
   138                                  
   139                                  	mov ax, (library_end_skip - library_start_skip - 16) & 0FFFFh
   140                                  	mov dx, (library_end_skip - library_start_skip - 16) >> 16
   141                                  
   142                                  	mov word [depackskip], ax
   143                                  internaldatarelocation
   144                                  	mov word [depackskip + 2], dx
   145                                  internaldatarelocation
   146                                  
   147                                  	mov cx, ELD_HEADERX_size
   148                                  	mov dx, sp
   149                                  	call read_and_depack
   150                                  	houdini
   151                                  	jc .io_error
   152                                  	cmp cx, ax
   153                                  	jne .io_error
   154                                  .io_error:
   155                                  	mov word [depackskip], 30h
   156                                  internaldatarelocation -4
   157                                  	mov word [depackskip + 2], 0
   158                                  internaldatarelocation -4
   159                                  
   160                                  	mov cx, 32
   161                                  	mov dx, sp
   162                                  	call read_and_depack
   163                                  	houdini
   164                                  
   165                                  	extcallcall cmd3
   166                                  %endif
   167                                  
   168                                  help:
   169 0000003D B90200                  	mov cx, 2
   170 00000040 E8BD05                  	extcallcall skipcomma
   171 00000043 E8C205                  	extcallcall iseol?
   172 00000046 7422                    	je .dispatch_eol
   173 00000048 4E                      	dec si
   174 00000049 49                      	dec cx
   175 0000004A BA[3A04]                	mov dx, msg.describe_keyword
   176                                  internaldatarelocation
   177 0000004D E8C005                  	extcallcall isstring?
   178 00000050 7414                    	je .dispatch
   179                                  %if _COMPRESSED
   180                                  	not byte [partialdepack]
   181                                  internaldatarelocation
   182                                  %endif
   183 00000052 BA[4304]                	mov dx, msg.describex_keyword
   184                                  internaldatarelocation
   185 00000055 E8B805                  	extcallcall isstring?
   186 00000058 740C                    	je .dispatch
   187 0000005A 49                      	dec cx
   188 0000005B BA[4D04]                	mov dx, msg.wide_keyword
   189                                  internaldatarelocation
   190 0000005E E8AF05                  	extcallcall isstring?
   191 00000061 7403                    	je .dispatch
   192 00000063 E90A06                  	jmp error
   193                                  
   194                                  .dispatch:
   195 00000066 AC                      	lodsb
   196 00000067 E8AE05                  	extcallcall chkeol
   197                                  .dispatch_eol:
   198 0000006A BA[5204]                	mov dx, msg.help
   199                                  internaldatarelocation
   200 0000006D E8B005                  	extcallcall putsz
   201                                  
   202 00000070 80F901                  	cmp cl, 1
   203 00000073 7606                    	jbe @F
   204 00000075 E8FE00                  	call zerooffsets
   205 00000078 E8AD05                  	extcallcall cmd3
   206                                  
   207                                  @@:
   208 0000007B 7431                    	je describe
   209                                  
   210                                  wide:
   211 0000007D BA[2D05]                	mov dx, msg.list
   212                                  internaldatarelocation
   213 00000080 E89D05                  	extcallcall putsz
   214                                  
   215 00000083 BE[0800]                	mov si, lib
   216                                  internaldatarelocation
   217 00000086 EB09                    	jmp @F
   218                                  .loop:
   219 00000088 81FF[4800]              	cmp di, relocateddata + 9 * 8
   220                                  linkdatarelocation line_out
   221 0000008C 7206                    	jb @FF
   222 0000008E E89F05                  	extcallcall trimputs
   223                                  @@:
   224 00000091 BF[0000]                reloc	mov di, relocateddata
   225                                  linkdatarelocation line_out
   226                                  @@:
   227 00000094 8D7404                  	lea si, [si + 4]
   228 00000097 B90800                  	mov cx, 8
   229 0000009A F3A4                    	rep movsb
   230 0000009C B020                    	mov al, 32
   231 0000009E AA                      	stosb
   232                                  
   233 0000009F 81FE[F002]              	cmp si, strict word lib_end
   234                                  internaldatarelocation
   235 000000A3 72E3                    	jb .loop
   236 000000A5 E88805                  	extcallcall trimputs
   237 000000A8 E8CB00                  	call zerooffsets
   238 000000AB E87A05                  	extcallcall cmd3
   239                                  
   240                                  
   241                                  describe:
   242 000000AE BA[2D05]                	mov dx, msg.list
   243                                  internaldatarelocation
   244 000000B1 E86C05                  	extcallcall putsz
   245                                  
   246 000000B4 31C9                    	xor cx, cx
   247 000000B6 31D2                    	xor dx, dx
   248 000000B8 E87B04                  	call get_dxax_seek_lib_plus_cxdx
   249 000000BB 7303E95504              	jc .io_error
   250 000000C0 A3[5205]                	mov word [libseek], ax
   251                                  internaldatarelocation
   252 000000C3 8916[5405]              	mov word [libseek + 2], dx
   253                                  internaldatarelocation
   254                                  
   255 000000C7 BE[0800]                	mov si, lib
   256                                  internaldatarelocation
   257                                  .loop:
   258 000000CA 8D5404                  	lea dx, [si + 4]
   259 000000CD B90800                  	mov cx, 8
   260 000000D0 53                      	push bx
   261 000000D1 E86405                  	extcallcall puts
   262 000000D4 5B                      	pop bx
   263 000000D5 BA[E003]                	mov dx, msg.between
   264                                  internaldatarelocation
   265 000000D8 E84505                  	extcallcall putsz
   266                                  
   267                                  %if _COMPRESSED
   268                                  	mov ax, word [si]
   269                                  	mov dx, word [si + 2]
   270                                  
   271                                  	mov word [eldheader], ax
   272                                  internaldatarelocation
   273                                  	mov word [eldheader + 2], dx
   274                                  internaldatarelocation
   275                                  
   276                                  	mov word [depackskip], ax
   277                                  internaldatarelocation
   278                                  	mov word [depackskip + 2], dx
   279                                  internaldatarelocation
   280                                  %else
   281 000000DB 8B16[5205]              	mov dx, word [libseek]
   282                                  internaldatarelocation
   283 000000DF 8B0E[5405]              	mov cx, word [libseek + 2]
   284                                  internaldatarelocation
   285                                  
   286 000000E3 0314                    	add dx, word [si]
   287 000000E5 134C02                  	adc cx, word [si + 2]
   288                                  
   289 000000E8 B80042                  	mov ax, 4200h
   290 000000EB E86A04                  	call dos_or_boot_io
   291 000000EE 7303E92204              	jc .io_error
   292 000000F3 A3[5605]                	mov word [eldheader], ax
   293                                  internaldatarelocation
   294 000000F6 8916[5805]              	mov word [eldheader + 2], dx
   295                                  internaldatarelocation
   296                                  %endif
   297                                  
   298 000000FA B93000                  	mov cx, ELD_HEADERX_size
   299 000000FD 29CC                    	sub sp, cx
   300 000000FF 89E2                    	mov dx, sp
   301                                  %if _COMPRESSED
   302                                  	call read_and_depack
   303                                  %else
   304 00000101 B8003F                  	mov ax, 3F00h
   305 00000104 E85104                  	call dos_or_boot_io
   306                                  %endif
   307 00000107 7303E90904              	jc .io_error
   308 0000010C 39C1                    	cmp cx, ax
   309 0000010E 7403E90204              	jne .io_error
   310                                  
   311 00000113 89E7                    	mov di, sp
   312 00000115 837D1E24                	cmp word [di + eldhExtensionSize], eldhxDescriptionOffset + 4
   313 00000119 7240                    	jb .nodesc
   314 0000011B 8B4D22                  	mov cx, word [di + eldhxDescriptionOffset + 2]
   315 0000011E 8B5520                  	mov dx, word [di + eldhxDescriptionOffset]
   316 00000121 89C8                    	mov ax, cx
   317 00000123 09D0                    	or ax, dx
   318 00000125 7434                    	jz .nodesc
   319                                  
   320 00000127 B80042                  	mov ax, 4200h
   321 0000012A 0316[5605]              	add dx, word [eldheader]
   322                                  internaldatarelocation
   323 0000012E 130E[5805]              	adc cx, word [eldheader + 2]
   324                                  internaldatarelocation
   325                                  %if _COMPRESSED
   326                                  	mov word [depackskip], dx
   327                                  internaldatarelocation
   328                                  	mov word [depackskip + 2], cx
   329                                  internaldatarelocation
   330                                  %else
   331 00000132 E82304                  	call dos_or_boot_io
   332 00000135 7303E9DB03              	jc .io_error
   333                                  %endif
   334                                  
   335 0000013A BF[0000]                	mov di, relocateddata
   336                                  linkdatarelocation line_out
   337 0000013D 89FA                    	mov dx, di
   338 0000013F 31C0                    	xor ax, ax
   339 00000141 B94000                  	mov cx, words(128)
   340 00000144 F3AB                    	rep stosw
   341 00000146 B17F                    	mov cl, 127
   342                                  %if _COMPRESSED
   343                                  	call read_and_depack
   344                                  %else
   345 00000148 B8003F                  	mov ax, 3F00h
   346 0000014B E80A04                  	call dos_or_boot_io
   347                                  %endif
   348 0000014E 7303E9C203              	jc .io_error
   349                                  	; cmp cx, ax
   350                                  	; jne .io_error
   351                                  
   352 00000153 E8CA04                  	extcallcall putsz
   353 00000156 BA[F203]                	mov dx, msg.linebreak
   354                                  internaldatarelocation
   355 00000159 EB03                    	jmp @F
   356                                  .nodesc:
   357 0000015B BA[E303]                	mov dx, msg.nodesc
   358                                  internaldatarelocation
   359                                  @@:
   360 0000015E E8BF04                  	extcallcall putsz
   361 00000161 83C430                  	add sp, ELD_HEADERX_size
   362 00000164 83C60C                  	add si, 4 + 8
   363 00000167 81FE[F002]              	cmp si, strict word lib_end
   364                                  internaldatarelocation
   365 0000016B 7303E95AFF              	jb .loop
   366                                  
   367                                  .io_error equ found.io_error
   368 00000170 E80300                  	call zerooffsets
   369 00000173 E8B204                  	extcallcall cmd3
   370                                  
   371                                  
   372                                  zerooffsets:
   373                                  %if _ELD_ZERO_OFFSETS
   374                                  		; for debugging with eldcomp, zero the offsets
   375 00000176 31C0                    	xor ax, ax
   376 00000178 BF[0400]                	mov di, ..@eldltOffset
   377                                  internaldatarelocation
   378 0000017B AB                      	stosw
   379 0000017C AB                      	stosw			; clear eldltOffset
   380                                   %if _COMPRESSED
   381                                  	stosw
   382                                  	stosw			; clear libtab_compressed_length
   383                                   %endif
   384                                  .loop:
   385 0000017D AB                      	stosw
   386 0000017E AB                      	stosw
   387 0000017F 83C708                  	add di, 8
   388 00000182 81FF[F002]              	cmp di, strict word lib_end
   389                                  internaldatarelocation
   390 00000186 72F5                    	jb .loop
   391                                  %endif
   392 00000188 C3                      	retn
   393                                  
   394                                  
   395                                  getname:
   396 00000189 3C22                    	cmp al, '"'
   397 0000018B 7419                    	je quoted
   398 0000018D 3C27                    	cmp al, "'"
   399 0000018F 7415                    	je quoted
   400                                  unquoted:
   401 00000191 4E                      	dec si
   402                                  .loop:
   403 00000192 AC                      	lodsb
   404 00000193 3C20                    	cmp al, 32
   405 00000195 7431                    	je end
   406 00000197 3C09                    	cmp al, 9
   407 00000199 742D                    	je end
   408 0000019B 3C2C                    	cmp al, ','
   409 0000019D 7429                    	je end
   410 0000019F E89E04                  	extcallcall iseol?.notsemicolon
   411 000001A2 75EE                    	jne .loop
   412 000001A4 EB22                    	jmp end
   413                                  
   414                                  quoted:
   415 000001A6 43                      	inc bx
   416 000001A7 88C4                    	mov ah, al
   417                                  .loop:
   418 000001A9 AC                      	lodsb
   419 000001AA 38E0                    	cmp al, ah
   420 000001AC 7414                    	je end_quoted
   421 000001AE E88F04                  	extcallcall iseol?.notsemicolon
   422 000001B1 75F6                    	jne .loop
   423                                  unexpected_eol:
   424 000001B3 B8360E                  	mov ax, 0E36h
   425 000001B6 E88F04                  	extcallcall setrc
   426 000001B9 BA[F503]                	mov dx, msg.unexpected_eol
   427                                  internaldatarelocation
   428                                  putsz_cmd3:
   429 000001BC E86104                  	extcallcall putsz
   430                                  cmd3_j:
   431 000001BF E86604                  	extcallcall cmd3
   432                                  
   433                                  end_quoted:
   434 000001C2 8D4CFF                  	lea cx, [si - 1]
   435 000001C5 AC                      	lodsb
   436 000001C6 EB03                    	jmp @F
   437                                  
   438                                  end:
   439 000001C8 8D4CFF                  	lea cx, [si - 1]
   440                                  @@:
   441 000001CB E88204                  	extcallcall skipcomm0
   442 000001CE 4E                      	dec si
   443                                  
   444 000001CF 56                      	push si
   445 000001D0 29D9                    	sub cx, bx
   446 000001D2 7503E95301              	jz notfound_invalid
   447                                  
   448 000001D7 83F904                  	cmp cx, 4
   449 000001DA 722A                    	jb .notext
   450 000001DC 8D77FC                  	lea si, [bx - 4]
   451 000001DF 01CE                    	add si, cx
   452 000001E1 803C2E                  	cmp byte [si], '.'
   453 000001E4 7520                    	jne .notext
   454 000001E6 8B4402                  	mov ax, word [si + 2]
   455 000001E9 25DFDF                  	and ax, ~2020h
   456 000001EC 3D4C44                  	cmp ax, "LD"
   457 000001EF 7515                    	jne .notext
   458 000001F1 8A4401                  	mov al, byte [si + 1]
   459 000001F4 24DF                    	and al, ~20h
   460 000001F6 3C45                    	cmp al, 'E'
   461 000001F8 7404                    	je .ext
   462 000001FA 3C58                    	cmp al, 'X'
   463 000001FC 7508                    	jne .notext
   464                                  .ext:
   465 000001FE 83E904                  	sub cx, 4
   466 00000201 7503E92401              	jz notfound_invalid
   467                                  .notext:
   468                                  
   469 00000206 83F908                  	cmp cx, 8
   470 00000209 7603E91C01              	ja notfound_invalid
   471 0000020E 89DE                    	mov si, bx
   472 00000210 BF[4A05]                	mov di, namebuffer
   473                                  internaldatarelocation
   474 00000213 89CA                    	mov dx, cx
   475                                  @@:
   476 00000215 AC                      	lodsb
   477 00000216 E83F04                  	extcallcall uppercase
   478 00000219 AA                      	stosb
   479 0000021A E2F9                    	loop @B
   480 0000021C F7DA                    	neg dx
   481 0000021E 83C208                  	add dx, 8
   482 00000221 87CA                    	xchg cx, dx
   483 00000223 B020                    	mov al, 32
   484 00000225 F3AA                    	rep stosb
   485 00000227 BF[4A05]                	mov di, namebuffer
   486                                  internaldatarelocation
   487                                  
   488                                  search_filename:
   489 0000022A BE[0C00]                	mov si, lib + 4
   490                                  internaldatarelocation
   491                                  .loop:
   492 0000022D 57                      	push di
   493 0000022E 56                      	push si
   494 0000022F B90800                  	mov cx, 8
   495                                  @@:
   496 00000232 AC                      	lodsb
   497 00000233 E82204                  	extcallcall uppercase
   498 00000236 AE                      	scasb
   499 00000237 7502                    	jne @F
   500 00000239 E2F7                    	loop @B
   501                                  @@:
   502 0000023B 5E                      	pop si
   503 0000023C 5F                      	pop di
   504 0000023D 7503E9F700              	je found
   505 00000242 83C60C                  	add si, 8 + 4
   506 00000245 81FE[F002]              	cmp si, strict word lib_end
   507                                  internaldatarelocation
   508 00000249 72E2                    	jb .loop
   509                                  
   510                                  search_instancename:
   511 0000024B 31C9                    	xor cx, cx
   512 0000024D 31D2                    	xor dx, dx
   513 0000024F E8E402                  	call get_dxax_seek_lib_plus_cxdx
   514 00000252 7303E9BE02              	jc .io_error
   515 00000257 A3[5205]                	mov word [libseek], ax
   516                                  internaldatarelocation
   517 0000025A 8916[5405]              	mov word [libseek + 2], dx
   518                                  internaldatarelocation
   519                                  
   520 0000025E BE[0C00]                	mov si, lib + 4
   521                                  internaldatarelocation
   522                                  
   523                                  .loop:
   524                                  %if _COMPRESSED
   525                                  	mov ax, word [si - 4]
   526                                  	mov dx, word [si - 4 + 2]
   527                                  
   528                                  	mov word [depackskip], ax
   529                                  internaldatarelocation
   530                                  	mov word [depackskip + 2], dx
   531                                  internaldatarelocation
   532                                  %else
   533 00000261 8B4CFE                  	mov cx, word [si - 4 + 2]
   534 00000264 8B54FC                  	mov dx, word [si - 4]		; cx:dx = offset within lib section
   535 00000267 0316[5205]              	add dx, word [libseek]
   536                                  internaldatarelocation
   537 0000026B 130E[5405]              	adc cx, word [libseek + 2]
   538                                  internaldatarelocation
   539 0000026F B80042                  	mov ax, 4200h
   540 00000272 E8E302                  	call dos_or_boot_io
   541 00000275 7303E99B02              	jc .io_error
   542                                  %endif
   543                                  
   544 0000027A A3[5605]                	mov word [eldheader], ax
   545                                  internaldatarelocation
   546 0000027D 8916[5805]              	mov word [eldheader + 2], dx
   547                                  internaldatarelocation
   548                                  
   549 00000281 B92000                  	mov cx, ELD_HEADER_size
   550 00000284 29CC                    	sub sp, cx
   551 00000286 89E2                    	mov dx, sp
   552                                  %if _COMPRESSED
   553                                  	call read_and_depack
   554                                  %else
   555 00000288 B8003F                  	mov ax, 3F00h
   556 0000028B E8CA02                  	call dos_or_boot_io
   557                                  %endif
   558 0000028E 7303E98202              	jc .io_error
   559 00000293 39C1                    	cmp cx, ax
   560 00000295 7403E97B02              	jne .io_error
   561                                  
   562 0000029A 89E7                    	mov di, sp
   563 0000029C 8B4D0A                  	mov cx, word [di + eldhCodeOffset + 2]
   564 0000029F 8B5508                  	mov dx, word [di + eldhCodeOffset] ; cx:dx = offset within ELD
   565 000002A2 0316[5605]              	add dx, word [eldheader]
   566                                  internaldatarelocation
   567 000002A6 130E[5805]              	adc cx, word [eldheader + 2]
   568                                  internaldatarelocation
   569                                  %if _COMPRESSED
   570                                  	mov word [depackskip], dx
   571                                  internaldatarelocation
   572                                  	mov word [depackskip + 2], cx
   573                                  internaldatarelocation
   574                                  %else
   575 000002AA B80042                  	mov ax, 4200h
   576 000002AD E8A802                  	call dos_or_boot_io
   577 000002B0 7303E96002              	jc .io_error
   578                                  %endif
   579                                  
   580 000002B5 89E2                    	mov dx, sp
   581 000002B7 B91000                  	mov cx, eldiIdentifier + 8
   582                                  %if (eldiIdentifier + 8) > ELD_HEADER_size
   583                                   %error Expected shorter instance header
   584                                  %endif
   585                                  %if _COMPRESSED
   586                                  	call read_and_depack
   587                                  %else
   588 000002BA B8003F                  	mov ax, 3F00h
   589 000002BD E89802                  	call dos_or_boot_io
   590                                  %endif
   591 000002C0 7303E95002              	jc .io_error
   592 000002C5 39C1                    	cmp cx, ax
   593 000002C7 7403E94902              	jne .io_error
   594                                  
   595 000002CC 56                      	push si
   596 000002CD 8D7508                  	lea si, [di + eldiIdentifier]
   597 000002D0 BF[4A05]                	mov di, namebuffer
   598                                  internaldatarelocation
   599                                  
   600 000002D3 57                      	push di
   601 000002D4 B90800                  	mov cx, 8
   602                                  @@:
   603 000002D7 AC                      	lodsb
   604 000002D8 E87D03                  	extcallcall uppercase
   605 000002DB AE                      	scasb
   606 000002DC 7502                    	jne @F
   607 000002DE E2F7                    	loop @B
   608                                  @@:
   609 000002E0 5F                      	pop di
   610 000002E1 5E                      	pop si
   611 000002E2 7411                    	je .found
   612 000002E4 83C420                  	add sp, ELD_HEADER_size
   613                                  
   614 000002E7 83C60C                  	add si, 8 + 4
   615 000002EA 81FE[F002]              	cmp si, strict word lib_end
   616                                  internaldatarelocation
   617 000002EE 7303E96EFF              	jb .loop
   618 000002F3 EB18                    	jmp notfound
   619                                  
   620                                  .found:
   621 000002F5 83C420                  	add sp, ELD_HEADER_size
   622                                  
   623                                  %ifn _COMPRESSED
   624 000002F8 8B16[5605]              	mov dx, word [eldheader]
   625                                  internaldatarelocation
   626 000002FC 8B0E[5805]              	mov cx, word [eldheader + 2]
   627                                  internaldatarelocation
   628 00000300 B80042                  	mov ax, 4200h
   629 00000303 E85202                  	call dos_or_boot_io
   630 00000306 7303E90A02              	jc .io_error
   631                                  %endif
   632 0000030B EB41                    	jmp found.header_variable
   633                                  
   634                                  .io_error equ found.io_error
   635                                  
   636                                  
   637                                  notfound:
   638 0000030D B8370E                  	mov ax, 0E37h
   639 00000310 E83503                  	extcallcall setrc
   640 00000313 BA[9003]                	mov dx, msg.notfound.1
   641                                  internaldatarelocation
   642 00000316 E80703                  	extcallcall putsz
   643 00000319 89FA                    	mov dx, di
   644 0000031B B90800                  	mov cx, 8
   645 0000031E E81703                  	extcallcall puts
   646 00000321 BA[B403]                	mov dx, msg.notfound.2
   647                                  internaldatarelocation
   648 00000324 E84FFE                  	call zerooffsets
   649 00000327 E992FE                  	jmp putsz_cmd3
   650                                  
   651                                  notfound_invalid:
   652 0000032A B8380E                  	mov ax, 0E38h
   653 0000032D E81803                  	extcallcall setrc
   654 00000330 BA[B903]                	mov dx, msg.notfound.invalid
   655                                  internaldatarelocation
   656 00000333 E840FE                  	call zerooffsets
   657 00000336 E983FE                  	jmp putsz_cmd3
   658                                  
   659                                  found:
   660                                  %if 0
   661                                  	xor ax, ax
   662                                  	retf
   663                                  %endif
   664                                  
   665                                  %if _COMPRESSED
   666                                  	xor cx, cx
   667                                  	xor dx, dx
   668                                  	call get_dxax_seek_lib_plus_cxdx
   669                                  	jc .io_error
   670                                  	mov word [libseek], ax
   671                                  internaldatarelocation
   672                                  	mov word [libseek + 2], dx
   673                                  internaldatarelocation
   674                                  
   675                                  	mov dx, word [si - 4 + 2]
   676                                  	mov ax, word [si - 4]		; dx:ax = offset within lib section
   677                                  %else
   678 00000339 8B4CFE                  	mov cx, word [si - 4 + 2]
   679 0000033C 8B54FC                  	mov dx, word [si - 4]		; cx:dx = offset within lib section
   680                                  
   681 0000033F E8F401                  	call get_dxax_seek_lib_plus_cxdx
   682 00000342 7303E9CE01              	jc .io_error
   683                                  %endif
   684 00000347 A3[5605]                	mov word [eldheader], ax
   685                                  internaldatarelocation
   686 0000034A 8916[5805]              	mov word [eldheader + 2], dx
   687                                  internaldatarelocation
   688                                  .header_variable:
   689                                  
   690                                  %assign _BOOTLDR 1
   691                                  %assign _APPLICATION 1
   692                                  %assign _DEVICE 1
   693                                  %assign _PM 1
   694                                  %define relocated(address) relocateddata
   695                                  %define doscall extcallcall _doscall
   696                                  %assign ELD 1
   697                                  %assign _DOSORBOOTIO 1
   698                                  
   699                                  %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-2024 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 0000034E B92000              <1> 	mov cx, fromwords(ELD_HEADER_size_w)
   197 00000351 29CC                <1> 	sub sp, cx
   198 00000353 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 00000355 B8003F              <1> 	mov ax, 3F00h
   212 00000358 E8FD01              <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 0000035B 7303E9B501          <1> 	jc .io_error
   234 00000360 39C8                <1> 	cmp ax, cx
   235 00000362 7403E9B601          <1> 	jne .invalid
   236                              <1> 
   237 00000367 89E7                <1> 	mov di, sp
   238                              <1> 
   239 00000369 58                  <1> 	pop ax
   240 0000036A 3D454C              <1> 	cmp ax, "EL"
   241 0000036D 7403E9AB01          <1> 	jne .invalid
   242 00000372 58                  <1> 	pop ax
   243 00000373 3D4431              <1> 	cmp ax, "D1"
   244 00000376 7403E9A201          <1> 	jne .invalid
   245 0000037B 58                  <1> 	pop ax
   246 0000037C 58                  <1> 	pop ax
   247 0000037D 80FC1A              <1> 	cmp ah, 26
   248 00000380 7403E99801          <1> 	jne .invalid
   249                              <1> 
   250 00000385 A1[0000]            <1> 	mov ax, word [relocated(extseg_size)]
   251                              <1> linkdatarelocation extseg_size
   252 00000388 2B06[0000]          <1> 	sub ax, word [relocated(extseg_used)]
   253                              <1> linkdatarelocation extseg_used
   254 0000038C 7303E97C01          <1> 	jc .error_internal
   255                              <1> %if ELD
   256 00000391 83E840              <1> 	sub ax, relocator_size
   257 00000394 7303E97401          <1> 	jc .error_internal
   258                              <1> %endif
   259                              <1> 
   260 00000399 8B4D0C              <1> 	mov cx, word [di + eldhCodeImageLength]
   261                              <1> %if ELD
   262 0000039C 39C8                <1> 	cmp ax, cx
   263 0000039E 7303E98201          <1> 	jb .oom
   264                              <1> %endif
   265 000003A3 034D0E              <1> 	add cx, word [di + eldhCodeAllocLength]
   266 000003A6 7238                <1> 	jc .invalid_CY
   267 000003A8 83C10F              <1> 	add cx, 15
   268 000003AB 7233                <1> 	jc .invalid_CY
   269 000003AD 80E1F0              <1> 	and cl, ~ 15
   270                              <1> 
   271                              <1> %if ELD
   272 000003B0 2E0306[0200]        <1> 	add ax, word [cs:code + eldiEndCode]
   273                              <1> internalcoderelocation
   274 000003B5 2E2B06[0000]        <1> 	sub ax, word [cs:code + eldiStartCode]
   275                              <1> internalcoderelocation
   276                              <1> %endif
   277 000003BA 39C8                <1> 	cmp ax, cx
   278 000003BC 7303E96401          <1> 	jb .oom
   279                              <1> 
   280 000003C1 8B16[0000]          <1> 	mov dx, word [relocated(extdata_size)]
   281                              <1> linkdatarelocation extdata_size
   282 000003C5 2B16[0000]          <1> 	sub dx, word [relocated(extdata_used)]
   283                              <1> linkdatarelocation extdata_used
   284 000003C9 7303E93F01          <1> 	jc .error_internal
   285                              <1> 
   286 000003CE 8B7514              <1> 	mov si, word [di + eldhDataImageLength]
   287                              <1> %if ELD
   288 000003D1 39F2                <1> 	cmp dx, si
   289 000003D3 7303E94D01          <1> 	jb .oom
   290                              <1> %endif
   291 000003D8 037516              <1> 	add si, word [di + eldhDataAllocLength]
   292 000003DB 7203                <1> 	jc .invalid_CY
   293 000003DD 83C60F              <1> 	add si, 15
   294                              <1> .invalid_CY:
   295 000003E0 7303E93801          <1> 	jc .invalid
   296 000003E5 83E6F0              <1> 	and si, ~ 15
   297                              <1> 
   298                              <1> %if ELD
   299 000003E8 2E0316[0600]        <1> 	add dx, word [cs:code + eldiEndData]
   300                              <1> internalcoderelocation
   301 000003ED 2E2B16[0400]        <1> 	sub dx, word [cs:code + eldiStartData]
   302                              <1> internalcoderelocation
   303                              <1> %endif
   304 000003F2 39F2                <1> 	cmp dx, si
   305 000003F4 7303E92C01          <1> 	jb .oom
   306                              <1> 
   307 000003F9 56                  <1> 	push si
   308 000003FA 51                  <1> 	push cx
   309                              <1> 
   310 000003FB B80042              <1> 	mov ax, 4200h
   311 000003FE 8B4D0A              <1> 	mov cx, word [di + eldhCodeOffset + 2]
   312 00000401 8B5508              <1> 	mov dx, word [di + eldhCodeOffset]
   313                              <1> %if ELD || _ELDTRAILER
   314 00000404 0316[5605]          <1> 	add dx, word [eldheader]
   315                              <1> internaldatarelocation
   316 00000408 130E[5805]          <1> 	adc cx, word [eldheader + 2]
   317                              <1> internaldatarelocation
   318                              <1> %else
   319                              <1> 		; ELD header is at seek 0
   320                              <1> %endif
   321                              <1> %if _ELDCOMPRESSED
   322                              <1> 	mov word [depackskip], dx
   323                              <1> internaldatarelocation
   324                              <1> 	mov word [depackskip + 2], cx
   325                              <1> internaldatarelocation
   326                              <1> %elif _DOSORBOOTIO
   327 0000040C E84901              <1> 	call dos_or_boot_io
   328                              <1> %else
   329                              <1> %if _BOOTLDR
   330                              <1>  %if _APPLICATION || _DEVICE
   331                              <1> 	testopt [relocated(internalflags)], nodosloaded
   332                              <1> linkdatarelocation internalflags, -3
   333                              <1> 	jz @F
   334                              <1>  %endif
   335                              <1> 	extcallcall yy_boot_seek_start.bx
   336                              <1> 	extcallcall yy_boot_seek_current.bx
   337                              <1>  %if _APPLICATION || _DEVICE
   338                              <1> 	jmp @FF
   339                              <1>  %endif
   340                              <1> %endif
   341                              <1> 
   342                              <1> @@:
   343                              <1> %if _APPLICATION || _DEVICE
   344                              <1> 	doscall
   345                              <1> %endif
   346                              <1> @@:
   347                              <1> %endif
   348 0000040F 7303E90101          <1> 	jc .io_error
   349                              <1> 
   350 00000414 8B16[0000]          <1> 	mov dx, word [relocated(extseg_used)]
   351                              <1> linkdatarelocation extseg_used
   352                              <1> %if _PM
   353 00000418 E84502              <1> 	extcallcall ispm
   354 0000041B 7506                <1> 	jnz @F
   355 0000041D 8E1E[0000]          <1> 	mov ds, word [relocated(extdssel)]
   356                              <1> linkdatarelocation extdssel
   357 00000421 EB04                <1> 	jmp @FF
   358                              <1> 
   359                              <1> @@:
   360                              <1> %endif
   361 00000423 8E1E[0000]          <1> 	mov ds, word [relocated(extseg)]
   362                              <1> linkdatarelocation extseg
   363                              <1> @@:
   364 00000427 368B4D0C            <1> 	mov cx, word [ss:di + eldhCodeImageLength]
   365                              <1> %if _ELDCOMPRESSED
   366                              <1> 	push ds
   367                              <1> 	pop es
   368                              <1> 	push ss
   369                              <1> 	pop ds
   370                              <1> 	call read_and_depack
   371                              <1> 	push ss
   372                              <1> 	pop es
   373                              <1> %elif _DOSORBOOTIO
   374 0000042B B8FF3F              <1> 	mov ax, 3FFFh
   375 0000042E E82701              <1> 	call dos_or_boot_io
   376                              <1> %else
   377                              <1> 	mov ah, 3Fh
   378                              <1> %if _BOOTLDR
   379                              <1>  %if _APPLICATION || _DEVICE
   380                              <1> 	testopt [ss:relocated(internalflags)], nodosloaded
   381                              <1> linkdatarelocation internalflags, -3
   382                              <1> 	jz @F
   383                              <1>  %endif
   384                              <1> 	push ds
   385                              <1> 	pop es
   386                              <1> 	push ss
   387                              <1> 	pop ds
   388                              <1> 	extcallcall yy_boot_read.bx
   389                              <1> 	push ss
   390                              <1> 	pop es
   391                              <1>  %if _APPLICATION || _DEVICE
   392                              <1> 	jmp @FF
   393                              <1>  %endif
   394                              <1> %endif
   395                              <1> 
   396                              <1> @@:
   397                              <1> %if _APPLICATION || _DEVICE
   398                              <1> %if _PM
   399                              <1> 	extcallcall doscall_extseg
   400                              <1> %else
   401                              <1> 	doscall
   402                              <1> %endif
   403                              <1> %endif
   404                              <1> @@:
   405                              <1> %endif
   406 00000431 16                  <1> 	 push ss
   407 00000432 1F                  <1> 	 pop ds
   408 00000433 7303E9DD00          <1> 	jc .io_error
   409 00000438 39C1                <1> 	cmp cx, ax
   410 0000043A 7403E9D600          <1> 	jne .io_error
   411                              <1> 
   412 0000043F B80042              <1> 	mov ax, 4200h
   413 00000442 8B4D12              <1> 	mov cx, word [di + eldhDataOffset + 2]
   414 00000445 8B5510              <1> 	mov dx, word [di + eldhDataOffset]
   415                              <1> %if ELD || _ELDTRAILER
   416 00000448 0316[5605]          <1> 	add dx, word [eldheader]
   417                              <1> internaldatarelocation
   418 0000044C 130E[5805]          <1> 	adc cx, word [eldheader + 2]
   419                              <1> internaldatarelocation
   420                              <1> %else
   421                              <1> 		; ELD header is at seek 0
   422                              <1> %endif
   423                              <1> 
   424                              <1> %if _ELDCOMPRESSED
   425                              <1> 	mov word [depackskip], dx
   426                              <1> internaldatarelocation
   427                              <1> 	mov word [depackskip + 2], cx
   428                              <1> internaldatarelocation
   429                              <1> %elif _DOSORBOOTIO
   430 00000450 E80501              <1> 	call dos_or_boot_io
   431                              <1> %else
   432                              <1> %if _BOOTLDR
   433                              <1>  %if _APPLICATION || _DEVICE
   434                              <1> 	testopt [relocated(internalflags)], nodosloaded
   435                              <1> linkdatarelocation internalflags, -3
   436                              <1> 	jz @F
   437                              <1>  %endif
   438                              <1> 	extcallcall yy_boot_seek_start.bx
   439                              <1> 	extcallcall yy_boot_seek_current.bx
   440                              <1>  %if _APPLICATION || _DEVICE
   441                              <1> 	jmp @FF
   442                              <1>  %endif
   443                              <1> %endif
   444                              <1> 
   445                              <1> @@:
   446                              <1> %if _APPLICATION || _DEVICE
   447                              <1> 	doscall
   448                              <1> %endif
   449                              <1> @@:
   450                              <1> %endif
   451 00000453 7303E9BD00          <1> 	jc .io_error
   452                              <1> 
   453                              <1> %if ELD
   454 00000458 8B16[0000]          <1> 	mov dx, word [relocateddata]
   455                              <1> linkdatarelocation extdata
   456                              <1> %else
   457                              <1> 	mov dx, ext_data_area
   458                              <1> %endif
   459 0000045C 0316[0000]          <1> 	add dx, word [relocated(extdata_used)]
   460                              <1> linkdatarelocation extdata_used
   461 00000460 8B4D14              <1> 	mov cx, word [di + eldhDataImageLength]
   462                              <1> %if _ELDCOMPRESSED
   463                              <1> 	call read_and_depack
   464                              <1> %elif _DOSORBOOTIO
   465 00000463 B8003F              <1> 	mov ax, 3F00h
   466 00000466 E8EF00              <1> 	call dos_or_boot_io
   467                              <1> %else
   468                              <1> 	mov ah, 3Fh
   469                              <1> %if _BOOTLDR
   470                              <1>  %if _APPLICATION || _DEVICE
   471                              <1> 	testopt [relocated(internalflags)], nodosloaded
   472                              <1> linkdatarelocation internalflags, -3
   473                              <1> 	jz @F
   474                              <1>  %endif
   475                              <1> 	extcallcall yy_boot_read.bx
   476                              <1>  %if _APPLICATION || _DEVICE
   477                              <1> 	jmp @FF
   478                              <1>  %endif
   479                              <1> %endif
   480                              <1> 
   481                              <1> @@:
   482                              <1> %if _APPLICATION || _DEVICE
   483                              <1> 	doscall
   484                              <1> %endif
   485                              <1> @@:
   486                              <1> %endif
   487 00000469 7303E9A700          <1> 	jc .io_error
   488 0000046E 39C1                <1> 	cmp cx, ax
   489 00000470 7403E9A000          <1> 	jne .io_error
   490                              <1> 
   491                              <1> %if _PM
   492 00000475 E83801              <1> 	call get_es_ext
   493                              <1> %else
   494                              <1> 	mov es, word [extseg]
   495                              <1> %endif
   496                              <1> 
   497                              <1> %if ELD
   498 00000478 8B1E[0000]          <1> 	mov bx, word [relocateddata]
   499                              <1> linkdatarelocation extseg_used		; es:bx -> where we loaded code
   500                              <1> 
   501 0000047C 8B4518              <1> 	mov ax, [di + eldhCodeEntrypoint]
   502 0000047F 05[0000]            <1> 	add ax, strict word code	; -> entry destination
   503                              <1> internalcoderelocation
   504 00000482 26A3[EE05]          <1> 	mov word [es:relocator.entry], ax
   505                              <1> internalcoderelocation
   506                              <1> 
   507 00000486 8B450C              <1> 	mov ax, word [di + eldhCodeImageLength]
   508 00000489 26A3[C705]          <1> 	mov word [es:relocator.codelength], ax
   509                              <1> internalcoderelocation
   510                              <1> 
   511 0000048D 8B4514              <1> 	mov ax, word [di + eldhDataImageLength]
   512 00000490 26A3[D605]          <1> 	mov word [es:relocator.datalength], ax
   513                              <1> internalcoderelocation
   514                              <1> 
   515 00000494 58                  <1> 	pop ax
   516                              <1> 
   517 00000495 26C707[0000]        <1> 	mov word [es:bx + eldiStartCode], code
   518                              <1> internalcoderelocation			; fix its start
   519                              <1> 
   520 0000049A 89C7                <1> 	mov di, ax
   521 0000049C 033E[0000]          <1> 	add di, word [relocateddata]
   522                              <1> linkdatarelocation extseg_used		; di -> relocator destination
   523 000004A0 50                  <1> 	push ax
   524 000004A1 83C040              <1> 	add ax, relocator_size
   525 000004A4 260106[0200]        <1> 	add word [es:code + eldiEndCode], ax
   526                              <1> internalcoderelocation			; grow our allocation
   527 000004A9 0106[0000]          <1> 	add word [relocateddata], ax
   528                              <1> linkdatarelocation extseg_used		; ditto
   529 000004AD 58                  <1> 	pop ax
   530                              <1> 
   531 000004AE 26891E[CA05]        <1> 	mov word [es:relocator.codesource], bx
   532                              <1> internalcoderelocation			; -> start
   533 000004B3 05[0000]            <1> 	add ax, strict word code
   534                              <1> internalcoderelocation
   535 000004B6 26894702            <1> 	mov word [es:bx + eldiEndCode], ax
   536                              <1> 					; -> past destination
   537 000004BA 26A3[E505]          <1> 	mov word [es:relocator.extseg_used], ax
   538                              <1> internalcoderelocation			; new extseg_used
   539                              <1> 
   540 000004BE 58                  <1> 	pop ax
   541                              <1> 
   542 000004BF 8B16[0000]          <1> 	mov dx, word [relocateddata]
   543                              <1> linkdatarelocation extdata_used
   544 000004C3 0316[0000]          <1> 	add dx, word [relocateddata]
   545                              <1> linkdatarelocation extdata
   546                              <1> 
   547 000004C7 268916[D905]        <1> 	mov word [es:relocator.datasource], dx
   548                              <1> internalcoderelocation
   549                              <1> 
   550                              <1> 	houdini
   551 000004CC BA[0000]            <1> 	mov dx, datastart
   552                              <1> internaldatarelocation
   553 000004CF 26895704            <1> 	mov word [es:bx + eldiStartData], dx
   554 000004D3 01D0                <1> 	add ax, dx
   555 000004D5 26894706            <1> 	mov word [es:bx + eldiEndData], ax
   556                              <1> 
   557 000004D9 2B06[0000]          <1> 	sub ax, word [relocateddata]
   558                              <1> linkdatarelocation extdata
   559 000004DD 26A3[EB05]          <1> 	mov word [es:relocator.extdata_used], ax
   560                              <1> internalcoderelocation			; new extdata_used
   561                              <1> 
   562 000004E1 BA[0000]            <1> 	mov dx, code
   563                              <1> internalcoderelocation			; es:dx -> ELD code instance (dest)
   564 000004E4 BB[0000]            <1> 	mov bx, datastart
   565                              <1> internaldatarelocation
   566                              <1> 
   567 000004E7 BE[C005]            <1> 	mov si, relocator
   568                              <1> internalcoderelocation
   569 000004EA B92000              <1> 	mov cx, words(relocator_size)
   570 000004ED 06                  <1> 	 push es
   571 000004EE 1F                  <1> 	 pop ds
   572 000004EF 57                  <1> 	push di
   573 000004F0 F3A5                <1> 	rep movsw
   574 000004F2 59                  <1> 	pop cx				; -> relocator entry
   575 000004F3 16                  <1> 	push ss
   576 000004F4 1F                  <1> 	pop ds
   577                              <1> %else
   578                              <1> 	pop ax				; allocated code size
   579                              <1> 	mov dx, word [extseg_used]
   580                              <1> 	mov bp, dx
   581                              <1> 	mov word [es:bp+eldiStartCode], dx
   582                              <1> 					; -> loaded code
   583                              <1> 	add ax, word [extseg_used]
   584                              <1> 	mov word [extseg_used], ax	; -> behind
   585                              <1> 	mov word [es:bp+eldiEndCode], ax; -> behind
   586                              <1> 
   587                              <1> 	pop ax				; allocated data size
   588                              <1> 	mov bx, word [extdata_used]
   589                              <1> 	add bx, ext_data_area		; -> loaded data
   590                              <1> 	mov word [es:bp+eldiStartData], bx
   591                              <1> 	add word [extdata_used], ax	; = amount new used
   592                              <1> 	add ax, bx			; -> behind
   593                              <1> 	mov word [es:bp+eldiEndData], ax
   594                              <1> 
   595                              <1> 	mov cx, [di + eldhCodeEntrypoint]
   596                              <1> 	add cx, dx
   597                              <1> %endif
   598 000004F5 83C418              <1> 	add sp, ELD_HEADER_size - 8
   599                              <1> 
   600                              <1> %if ELD
   601 000004F8 5E                  <1> 	pop si
   602 000004F9 A1[0000]            <1> 	mov ax, word [relocateddata]
   603                              <1> linkdatarelocation linksel
   604 000004FC E86101              <1> 	extcallcall ispm
   605 000004FF 7403                <1> 	jz @F
   606 00000501 A1[0000]            <1> 	mov ax, word [relocateddata]
   607                              <1> linkdatarelocation linkseg
   608                              <1> @@:
   609                              <1> 
   610 00000504 BF[0000]            <1> 	mov di, relocateddata
   611                              <1> linkdatarelocation linkinfoaddress
   612 00000507 8B3D                <1> 	mov di, [di]
   613 00000509 8ED8                <1> 	mov ds, ax
   614                              <1> 
   615 0000050B FFE1                <1> 	jmp cx
   616                              <1> 		; INP:	es:dx -> loaded initial ELD image
   617                              <1> 		;	 ELD instance structure filled
   618                              <1> 		;	es => ELD code area
   619                              <1> 		;	ds:di -> link info
   620                              <1> 		;	ss:bx -> loaded initial data
   621                              <1> 		;	ss:si -> command line tail
   622                              <1> 		;	cs:ip -> entrypoint
   623                              <1> 		;	ss:sp -> far return address for current mode
   624                              <1> 		; STT:	UP, EI
   625                              <1> %else
   626                              <1> ext_finish.bp_is_set equ $
   627                              <1> 	pop bp
   628                              <1> 
   629                              <1> 	mov si, word [ext_cmdline]
   630                              <1> 
   631                              <1> %if _MESSAGESEGMENT
   632                              <1>  %if _PM
   633                              <1> 	call get_messagesegsel
   634                              <1>  %else
   635                              <1>  	mov ds, word [ss:messageseg]
   636                              <1>  %endif
   637                              <1> %endif
   638                              <1> 	mov di, linkinfo
   639                              <1> 
   640                              <1> 	push cs
   641                              <1> 	call .transfer
   642                              <1> 		; INP:	es:dx -> loaded initial ELD image
   643                              <1> 		;	 ELD instance structure filled
   644                              <1> 		;	es => ELD code area
   645                              <1> 		;	ds:di -> link info
   646                              <1> 		;	ss:bx -> loaded initial data
   647                              <1> 		;	ss:si -> command line tail
   648                              <1> 		;	cs:ip -> entrypoint
   649                              <1> 		;	ss:sp -> far return address for current mode
   650                              <1> 		; STT:	UP, EI
   651                              <1> %endif
   700                                  
   701                                  .error_internal:
   702 0000050D BA[F002]                	mov dx, msg.ext_error_internal
   703                                  internaldatarelocation
   704 00000510 B8390E                  	mov ax, 0E39h
   705 00000513 EB16                    	jmp @F
   706                                  
   707                                  .io_error:
   708 00000515 BA[1503]                	mov dx, msg.ext_error_io
   709                                  internaldatarelocation
   710 00000518 B83A0E                  	mov ax, 0E3Ah
   711 0000051B EB0E                    	jmp @F
   712                                  
   713                                  .invalid:
   714 0000051D BA[3603]                	mov dx, msg.ext_error_invalid
   715                                  internaldatarelocation
   716 00000520 B83B0E                  	mov ax, 0E3Bh
   717 00000523 EB06                    	jmp @F
   718                                  
   719                                  .oom:
   720 00000525 BA[6C03]                	mov dx, msg.ext_error_oom
   721                                  internaldatarelocation
   722 00000528 B83C0E                  	mov ax, 0E3Ch
   723                                  
   724                                  @@:
   725 0000052B E81A01                  	extcallcall setrc
   726 0000052E 16                      	push ss
   727 0000052F 1F                      	pop ds
   728 00000530 E8ED00                  	extcallcall putsz
   729 00000533 E8F200                  	extcallcall cmd3
   730                                  
   731                                  
   732                                  get_dxax_seek_lib_plus_cxdx:
   733 00000536 BB[0000]                	mov bx, relocateddata
   734                                  linkdatarelocation load_data_lowest	; make yy_boot_get and yy_boot_update no-ops
   735 00000539 F606[0100]40            	testopt [relocateddata], nodosloaded
   736                                  linkdatarelocation internalflags, -3
   737 0000053E 750C                    	jnz @F
   738 00000540 8B1E[0000]              	mov bx, [relocateddata]
   739                                  linkdatarelocation ext_handle
   740 00000544 E82101                  	extcallcall InDOS
   741 00000547 7403                    	jz @F
   742 00000549 E82401                  	extcallcall error
   743                                  @@:
   744 0000054C B8[0000]                	mov ax, relocateddata
   745                                  linkdatarelocation ext_finish.bp_is_set
   746                                  
   747 0000054F B80142                  	mov ax, 4201h
   748                                  lib_displacement equ LIBOFFSET - DATAOFFSET - data_size
   749 00000552 83C200                  	add dx, lib_displacement & 0FFFFh
   750 00000555 83D100                  	adc cx, (lib_displacement >> 16) & 0FFFFh
   751                                  	; jmp dos_or_boot_io
   752                                  
   753                                  
   754                                  dos_or_boot_io:
   755                                  %if _BOOTLDR
   756 00000558 36F606[0100]40          reloc	testopt [ss:relocateddata], nodosloaded
   757                                  linkdatarelocation internalflags, -3
   758 0000055E 7515                    	jnz .boot
   759                                  %endif
   760                                  .dos:
   761 00000560 3DFF3F                  	cmp ax, 3FFFh
   762 00000563 7408                    	je @F
   763 00000565 E8[0000]EB020000        	extcall _doscall
   764 0000056C C3                      	retn
   765                                  
   766                                  @@:
   767 0000056D E8[0000]EB020000        	extcall doscall_extseg
   768 00000574 C3                      	retn
   769                                  
   770                                  %if _BOOTLDR
   771                                  .boot:
   772 00000575 80FC3F                  	cmp ah, 3Fh
   773 00000578 7512                    	jne @F
   774 0000057A 3CFF                    	cmp al, 0FFh
   775 0000057C 7504                    	jne .bootread
   776                                  .bootread_ext:
   777 0000057E 1E                      	push ds
   778 0000057F 07                      	pop es
   779 00000580 16                      	push ss
   780 00000581 1F                      	pop ds
   781                                  .bootread:
   782 00000582 E8[0000]EB020000        	extcall yy_boot_read.bx
   783 00000589 16                      	push ss
   784 0000058A 07                      	pop es
   785 0000058B C3                      	retn
   786                                  
   787                                  @@:
   788 0000058C 3D0042                  	cmp ax, 4200h
   789 0000058F 7517                    	jne @F
   790 00000591 2B16[FCFF]              	sub dx, word [relocateddata - LOADDATA2 + ldCurrentSeek]
   791                                  linkdatarelocation load_data
   792 00000595 1B0E[FEFF]              	sbb cx, word [relocateddata - LOADDATA2 + ldCurrentSeek + 2]
   793                                  linkdatarelocation load_data
   794                                  
   795                                  .boot_seek_current:
   796 00000599 E8[0000]EB020000        	extcall yy_boot_seek_current.bx
   797 000005A0 A1[FCFF]                	mov ax, word [relocateddata - LOADDATA2 + ldCurrentSeek]
   798                                  linkdatarelocation load_data
   799 000005A3 8B16[FEFF]              	mov dx, word [relocateddata - LOADDATA2 + ldCurrentSeek + 2]
   800                                  linkdatarelocation load_data
   801 000005A7 C3                      	retn
   802                                  
   803                                  @@:
   804 000005A8 3D0142                  	cmp ax, 4201h
   805 000005AB 74EC                    	je .boot_seek_current
   806 000005AD E8C000                  	extcallcall error
   807                                  %endif
   808                                  
   809                                  
   810                                  %if _COMPRESSED
   811                                  %assign _STANDALONE 0
   812                                   %include "depack.asm"
   813                                  %endif
   814                                  
   815                                  
   816                                  get_es_ext:
   817 000005B0 8E06[0000]              reloc	mov es, word [relocateddata]
   818                                  linkdatarelocation extdssel
   819 000005B4 E8A900                  	extcallcall ispm
   820 000005B7 7404                    	jz @F
   821 000005B9 8E06[0000]              reloc	mov es, word [relocateddata]
   822                                  linkdatarelocation extseg
   823                                  @@:
   824 000005BD C3                      	retn
   825                                  
   826                                  
   827 000005BE 90<rep 2h>              	align 16
   828                                  relocator:
   829 000005C0 56                      	push si
   830 000005C1 57                      	push di
   831 000005C2 1E                      	push ds
   832 000005C3 06                      	push es
   833                                  
   834 000005C4 06                      	 push es
   835 000005C5 1F                      	 pop ds
   836 000005C6 B90000                  	mov cx, 0
   837                                  .codelength equ $ - 2
   838 000005C9 BE0000                  	mov si, 0
   839                                  .codesource equ $ - 2
   840 000005CC BF[0000]                	mov di, code
   841                                  .codedestination equ $ - 2
   842                                  internalcoderelocation
   843 000005CF F3A4                    	rep movsb
   844                                  
   845 000005D1 16                      	 push ss
   846 000005D2 07                      	 pop es
   847 000005D3 16                      	 push ss
   848 000005D4 1F                      	 pop ds
   849 000005D5 B90000                  	mov cx, 0
   850                                  .datalength equ $ - 2
   851 000005D8 BE0000                  	mov si, 0
   852                                  .datasource equ $ - 2
   853 000005DB BF[0000]                	mov di, datastart
   854                                  .datadestination equ $ - 2
   855                                  internaldatarelocation
   856 000005DE F3A4                    	rep movsb
   857                                  
   858 000005E0 07                      	pop es
   859 000005E1 C706[0000]0000          	mov word [relocateddata], 0
   860                                  linkdatarelocation extseg_used, -4
   861                                  .extseg_used equ $ - 2
   862 000005E7 C706[0000]0000          	mov word [relocateddata], 0
   863                                  linkdatarelocation extdata_used, -4
   864                                  .extdata_used equ $ - 2
   865                                  
   866 000005ED B90000                  	mov cx, 0
   867                                  .entry equ $ - 2
   868 000005F0 1F                      	pop ds
   869 000005F1 5F                      	pop di
   870 000005F2 5E                      	pop si
   871 000005F3 FFE1                    	jmp cx
   872                                  
   873 000005F5 90<rep Bh>              	align 16
   874                                  	endarea relocator
   875                                  
   876                                  
   877                                  DATAOFFSET equ CODEOFFSET + code_size
   878                                  	addsection DATA, follows=CODE vstart=_ELD_DATA_VSTART
   879                                  datastart:
   880                                  PUT_ELD_DATETIME
   881                                  
   882                                  %define INCBINLIST db ""
   883                                  
   884                                  	%imacro libeld 1-2.nolist
   885                                  %strcat %%label "lib_", %1
   886                                  %deftok %%token %%label
   887                                  %if _XLD
   888                                   %strcat %%filename %1,".xld"
   889                                  %else
   890                                   %strcat %%filename %1,".eld"
   891                                  %endif
   892                                  %xdefine INCBINLIST INCBINLIST, {align 16, db 0}, %%token:, incbin %%filename
   893                                  	dd %%token
   894                                  	fill 8, 32, db %1
   895                                  	%endmacro
   896                                  
   897                                  	%imacro dump_incbin 1-*.nolist
   898                                  %rep %0
   899                                  	%1
   900                                   %rotate 1
   901                                  %endrep
   902                                  	%endmacro
   903                                  
   904                                  %ifn _COMPRESSED
   905                                  	overridedef LZEXEDAT, 0
   906                                  %endif
   907                                  %ifn _LZEXEDAT
   908                                  	overridedef LONGLITERAL, 0
   909                                  %endif
   910                                  
   911                                  	align 4, db 0
   912                                  libtable:
   913                                   istruc ELD_LIBTABLE
   914 00000000 0000                    at eldltFormat,		dw 2 * !!_COMPRESSED + !!_LZEXEDAT + !!_LONGLITERAL
   915                                  	; 0 = uncompressed
   916                                  	; 1 = legacy heatshrink format (no libtab compressed length)
   917                                  	; 2 = heatshrink format (prepended with -w and -l bytes)
   918                                  	; 3 = lzexedat -4 format (current revision starts with a 1 bit)
   919                                  	; 4 = lzexedat -4 -l format (current revision starts with a 1 bit)
   920 00000002 3E00                    at eldltAmount,		dw (lib_end - lib) / 12
   921                                  at eldltOffset
   922 00000004 B0140000                ..@eldltOffset:		dd LIBOFFSET
   923                                   iend
   924                                   %if _COMPRESSED
   925                                  libtab_compressed_length:
   926                                  			dd (lib_compressed_end - lib_start)
   927                                   %endif
   928                                  %else
   929                                  		; Collect the binaries and compress them solidly.
   930                                  	%imacro libeld 1-2.nolist
   931                                  %strcat %%label "lib_", %1
   932                                  %deftok %%token %%label
   933                                  %if _XLD
   934                                   %strcat %%filename %1,".xld"
   935                                  %else
   936                                   %strcat %%filename %1,".eld"
   937                                  %endif
   938                                  	align 16, db 0
   939                                  %%token:
   940                                  	incbin %%filename
   941                                  	%endmacro
   942                                  %endif
   943                                  
   944                                  	numdef ELD_DEBUG_LIB, 0
   945                                  lib:
   946                                  %if _ELD_DEBUG_LIB
   947                                  libeld "eldteste"
   948                                  libeld "eldtestf"
   949                                  %else
   950 00000008 [00000000]61666F72-     libeld "aformat"
   950 00000010 6D617420           
   951 00000014 [F00C0000]616C6961-     libeld "alias"
   951 0000001C 7320<rep 3h>       
   952 00000020 [401D0000]616D6973-     libeld "amiscmd"
   952 00000028 636D6420           
   953 0000002C [D0290000]616D6973-     libeld "amismsg"
   953 00000034 6D736720           
   954 00000038 [10360000]616D6973-     libeld "amisoth"
   954 00000040 6F746820           
   955 00000044 [10410000]616D6974-     libeld "amitsrs"
   955 0000004C 73727320           
   956 00000050 [F0590000]616D6F75-     libeld "amount"
   956 00000058 6E7420<rep 2h>     
   957 0000005C [80650000]62617365-     libeld "bases"
   957 00000064 7320<rep 3h>       
   958 00000068 [C0720000]626F6F74-     libeld "bootdir"
   958 00000070 64697220           
   959 00000074 [308A0000]63686563-     libeld "checksum"
   959 0000007C 6B73756D           
   960 00000080 [B0960000]63687374-     libeld "chstool"
   960 00000088 6F6F6C20           
   961 0000008C [40B10000]636F20-       libeld "co"
   961 0000008C <rep 6h>           
   962 00000098 [50C30000]636F6E66-     libeld "config"
   962 000000A0 696720<rep 2h>     
   963 000000A4 [60CD0000]64626974-     libeld "dbitmap"
   963 000000AC 6D617020           
   964 000000B0 [B0E00000]64657669-     libeld "devices"
   964 000000B8 63657320           
   965 000000BC [C0EE0000]64686D20-     libeld "dhm"
   965 000000BC <rep 5h>           
   966 000000C8 [D0FC0000]646920-       libeld "di"
   966 000000C8 <rep 6h>           
   967 000000D4 [90100100]646D20-       libeld "dm"
   967 000000D4 <rep 6h>           
   968 000000E0 [F0210100]646F7363-     libeld "doscd"
   968 000000E8 6420<rep 3h>       
   969 000000EC [302A0100]646F7364-     libeld "dosdir"
   969 000000F4 697220<rep 2h>     
   970 000000F8 [20410100]646F7364-     libeld "dosdrive"
   970 00000100 72697665           
   971 00000104 [60490100]646F7370-     libeld "dospwd"
   971 0000010C 776420<rep 2h>     
   972 00000110 [50510100]646F7373-     libeld "dosseek"
   972 00000118 65656B20           
   973 0000011C [805D0100]646F7373-     libeld "dosspace"
   973 00000124 70616365           
   974 00000128 [00700100]646F7373-     libeld "dosstrat"
   974 00000130 74726174           
   975 00000134 [E07A0100]64706220-     libeld "dpb"
   975 00000134 <rep 5h>           
   976 00000140 [90910100]64746164-     libeld "dtadisp"
   976 00000148 69737020           
   977 0000014C [10990100]647820-       libeld "dx"
   977 0000014C <rep 6h>           
   978 00000158 [A0A70100]65727266-     libeld "errfix"
   978 00000160 697820<rep 2h>     
   979 00000164 [C0B50100]6578746E-     libeld "extname"
   979 0000016C 616D6520           
   980 00000170 [10C70100]68696E74-     libeld "hint"
   980 00000178 20<rep 4h>         
   981 0000017C [D0D30100]68696E74-     libeld "hintoth"
   981 00000184 6F746820           
   982 00000188 [80E00100]68697374-     libeld "history"
   982 00000190 6F727920           
   983 00000194 [50EC0100]69666578-     libeld "ifext"
   983 0000019C 7420<rep 3h>       
   984 000001A0 [90F90100]696E6A65-     libeld "inject"
   984 000001A8 637420<rep 2h>     
   985 000001AC [50050200]696E7374-     libeld "instnoth"
   985 000001B4 6E6F7468           
   986 000001B8 [50130200]696E7374-     libeld "instnoun"
   986 000001C0 6E6F756E           
   987 000001C4 [A01F0200]6B636D64-     libeld "kcmdline"
   987 000001CC 6C696E65           
   988 000001D0 [C02B0200]6B646973-     libeld "kdisplay"
   988 000001D8 706C6179           
   989 000001DC [00350200]6C646D65-     libeld "ldmem"
   989 000001E4 6D20<rep 3h>       
   990 000001E8 [C05B0200]6C646D65-     libeld "ldmemoth"
   990 000001F0 6D6F7468           
   991 000001F4 [50850200]6C696E66-     libeld "linfo"
   991 000001FC 6F20<rep 3h>       
   992 00000200 [40960200]6C697374-     libeld "list"
   992 00000208 20<rep 4h>         
   993 0000020C [C0B90200]70617468-     libeld "path"
   993 00000214 20<rep 4h>         
   994 00000218 [90CB0200]7072696E-     libeld "printf"
   994 00000220 746620<rep 2h>     
   995 00000224 [60DF0200]71756965-     libeld "quiet"
   995 0000022C 7420<rep 3h>       
   996 00000230 [C0EA0200]71756974-     libeld "quit"
   996 00000238 20<rep 4h>         
   997 0000023C [D0F60200]72636578-     libeld "rcexec"
   997 00000244 656320<rep 2h>     
   998 00000248 [00020300]7264756D-     libeld "rdumpidx"
   998 00000250 70696478           
   999 00000254 [100E0300]7264756D-     libeld "rdumpstr"
   999 0000025C 70737472           
  1000 00000260 [F0190300]7265636C-     libeld "reclaim"
  1000 00000268 61696D20           
  1001 0000026C [30210300]72657365-     libeld "reserve"
  1001 00000274 72766520           
  1002 00000278 [40370300]726D20-       libeld "rm"
  1002 00000278 <rep 6h>           
  1003 00000284 [90410300]726E20-       libeld "rn"
  1003 00000284 <rep 6h>           
  1004 00000290 [E0500300]7320-         libeld "s"
  1004 00000290 <rep 7h>           
  1005 0000029C [90660300]73627261-     libeld "sbranch"
  1005 000002A4 6E636820           
  1006 000002A8 [D0720300]73657420-     libeld "set"
  1006 000002A8 <rep 5h>           
  1007 000002B4 [A0850300]74736320-     libeld "tsc"
  1007 000002B4 <rep 5h>           
  1008 000002C0 [20950300]75736570-     libeld "useparat"
  1008 000002C8 61726174           
  1009 000002CC [10A40300]76617269-     libeld "variable"
  1009 000002D4 61626C65           
  1010 000002D8 [90B30300]77697468-     libeld "withhdr"
  1010 000002E0 68647220           
  1011 000002E4 [F0BF0300]7820-         libeld "x"
  1011 000002E4 <rep 7h>           
  1012                                  %endif
  1013                                  lib_end:
  1014                                  
  1015                                  %ifn _COMPRESSLIB
  1016                                  %if _COMPRESSED
  1017                                  	align 2, db 0
  1018                                  depack_saved_sp:	dw 0FFFFh
  1019                                  partialdepack:		db 0FFh
  1020                                  %endif
  1021                                  
  1022                                  msg:
  1023 000002F0 496E7465726E616C20-     .ext_error_internal:	asciz "Internal error in EXT LIB command.",13,10
  1023 000002F9 6572726F7220696E20-
  1023 00000302 455854204C49422063-
  1023 0000030B 6F6D6D616E642E0D0A-
  1023 00000314 00                 
  1024 00000315 455854204C49422063-     .ext_error_io:		asciz "EXT LIB command got I/O error.",13,10
  1024 0000031E 6F6D6D616E6420676F-
  1024 00000327 7420492F4F20657272-
  1024 00000330 6F722E0D0A00       
  1025 00000336 455854204C49423A20-     .ext_error_invalid:	asciz "EXT LIB: No or invalid Extension for lDebug header.",13,10
  1025 0000033F 4E6F206F7220696E76-
  1025 00000348 616C69642045787465-
  1025 00000351 6E73696F6E20666F72-
  1025 0000035A 206C44656275672068-
  1025 00000363 65616465722E0D0A00 
  1026 0000036C 4F7574206F66206D65-     .ext_error_oom:		asciz "Out of memory in EXT LIB command.",13,10
  1026 00000375 6D6F727920696E2045-
  1026 0000037E 5854204C494220636F-
  1026 00000387 6D6D616E642E0D0A00 
  1027 00000390 455854204C49423A20-     .notfound.1:		asciz 'EXT LIB: No ELD found by the name "'
  1027 00000399 4E6F20454C4420666F-
  1027 000003A2 756E64206279207468-
  1027 000003AB 65206E616D65202200 
  1028 000003B4 22210D0A00              .notfound.2:		asciz '"!',13,10
  1029 000003B9 455854204C49423A20-     .notfound.invalid:	asciz "EXT LIB: No ELD found, invalid name!",13,10
  1029 000003C2 4E6F20454C4420666F-
  1029 000003CB 756E642C20696E7661-
  1029 000003D4 6C6964206E616D6521-
  1029 000003DD 0D0A00             
  1030 000003E0 202000                  .between:		asciz "  "
  1031 000003E3 4E6F20646573637269-     .nodesc:		db "No description."
  1031 000003EC 7074696F6E2E       
  1032 000003F2 0D0A00                  .linebreak:		asciz 13,10
  1033                                  
  1034                                  depack_stack: equ $
  1035                                  
  1036 000003F5 455854204C49423A20-     .unexpected_eol:	asciz "EXT LIB: Unexpected End Of Line, expected closing quote mark!",13,10
  1036 000003FE 556E65787065637465-
  1036 00000407 6420456E64204F6620-
  1036 00000410 4C696E652C20657870-
  1036 00000419 656374656420636C6F-
  1036 00000422 73696E672071756F74-
  1036 0000042B 65206D61726B210D0A-
  1036 00000434 00                 
  1037 00000435 48454C5000              .help_keyword:		asciz "HELP"
  1038 0000043A 444553435249424500      .describe_keyword:	asciz "DESCRIBE"
  1039 00000443 444553435249424558-     .describex_keyword:	asciz "DESCRIBEX"
  1039 0000044C 00                 
  1040                                  %if _COMPRESSED && _ELD_TEST_LIB
  1041                                  .test_keyword:		asciz "TEST"
  1042                                  %endif
  1043 0000044D 5749444500              .wide_keyword:		asciz "WIDE"
  1044 00000452 455854204C49422063-     .help:			db "EXT LIB command. This ELD is a library of other ELDs.",13,10
  1044 0000045B 6F6D6D616E642E2054-
  1044 00000464 68697320454C442069-
  1044 0000046D 732061206C69627261-
  1044 00000476 7279206F66206F7468-
  1044 0000047F 657220454C44732E0D-
  1044 00000488 0A                 
  1045 00000489 52756E207769746820-     			db "Run with an ELD instance name to run another ELD.",13,10
  1045 00000492 616E20454C4420696E-
  1045 0000049B 7374616E6365206E61-
  1045 000004A4 6D6520746F2072756E-
  1045 000004AD 20616E6F7468657220-
  1045 000004B6 454C442E0D0A       
  1046 000004BC 52756E207769746820-     			db "Run with HELP DESCRIBE to dump descriptions (slow)",13,10
  1046 000004C5 48454C502044455343-
  1046 000004CE 5249424520746F2064-
  1046 000004D7 756D70206465736372-
  1046 000004E0 697074696F6E732028-
  1046 000004E9 736C6F77290D0A     
  1047 000004F0 206F72207769746820-     			db " or with HELP WIDE to display only known ELD names (fast).",13,10
  1047 000004F9 48454C502057494445-
  1047 00000502 20746F20646973706C-
  1047 0000050B 6179206F6E6C79206B-
  1047 00000514 6E6F776E20454C4420-
  1047 0000051D 6E616D657320286661-
  1047 00000526 7374292E0D0A       
  1048 0000052C 00                      			asciz
  1049 0000052D 0D0A                    .list:			db 13,10
  1050 0000052F 4C697374206F662063-     			asciz "List of contained ELDs:",13,10
  1050 00000538 6F6E7461696E656420-
  1050 00000541 454C44733A0D0A00   
  1051                                  
  1052                                  uinit_data: equ $
  1053                                  
  1054 00000549 00<rep 7h>              	align 16, db 0
  1055                                  init_data_end:
  1056                                  data_size equ $ - datastart
  1057                                  transient_data_size equ data_size
  1058                                  
  1059                                  %if _COMPRESSED
  1060                                  	absolute depack_stack
  1061                                  	alignb 2
  1062                                  		resb 256
  1063                                  depack_stack.top:
  1064                                  
  1065                                   %if uinit_data > depack_stack.top
  1066                                  	absolute uinit_data
  1067                                   %endif
  1068                                  %else
  1069                                  	absolute uinit_data
  1070                                  %endif
  1071                                  
  1072 00000549 ??                      	alignb 2
  1073 0000054A ????????????????        namebuffer:	resb 8
  1074 00000552 ????????                libseek:	resd 1
  1075 00000556 ????????                eldheader:	resd 1
  1076                                  
  1077                                  %if _COMPRESSED
  1078                                  depackskip:	resd 1
  1079                                  depackseek:	resd 1
  1080                                  depacked_buffer:resd 1
  1081                                  depack_left_length:	resw 1
  1082                                  depack_left_address:	resw 1
  1083                                  depacked_length:resw 1
  1084                                  depack_prior_sp:resw 1
  1085                                  	alignb 2
  1086                                  filebuffer:
  1087                                  %if _ALIGNPAGE
  1088                                  	resb 512
  1089                                  %else
  1090                                  	resb 256
  1091                                  %endif
  1092                                  .end:
  1093                                  	alignb 2
  1094                                  .next:		resw 1
  1095                                  .tail:		resw 1
  1096                                  handle:		resw 1
  1097                                  
  1098                                  	alignb 16
  1099                                  resultbuffer:
  1100                                  .size equ 4096
  1101                                  		resb .size
  1102                                  .end:
  1103                                  %endif
  1104                                  
  1105 0000055A ????????????            	alignb 16
  1106                                  resident_data_end:
  1107                                  uinit_data_end:
  1108                                  resident_data_size equ resident_data_end - datastart
  1109                                  
  1110                                  %if uinit_data_end >= init_data_end
  1111                                   total_data_size equ $ - datastart
  1112                                  %else
  1113                                   total_data_size equ init_data_end - datastart
  1114                                  %endif
  1115                                  %assign _DATA_SIZE total_data_size
  1116                                  
  1117                                  	usesection CODE
  1118                                  
  1119                                  %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 00000600 E8[0000]EB020000C3- <1> 	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
    28 00000608 E8[0000]EB020000C3- <1>
    28 00000610 E8[0000]EB020000C3- <1>
    28 00000618 E8[0000]EB020000C3- <1>
    28 00000620 E8[0000]EB020000C3- <1>
    28 00000628 E8[0000]EB020000C3- <1>
    28 00000630 E8[0000]EB020000C3- <1>
    28 00000638 E8[0000]EB020000C3- <1>
    28 00000640 E8[0000]EB020000C3- <1>
    28 00000648 E8[0000]EB020000C3- <1>
    28 00000650 E8[0000]EB020000C3- <1>
    28 00000658 E8[0000]EB020000C3- <1>
    28 00000660 E8[0000]EB020000C3- <1>
    28 00000668 E8[0000]EB020000C3- <1>
    28 00000670 E8[0000]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> %if _ELD_IDENTICALISE
    38                              <1>  ;%assign _ELDCALL_OPTIONAL 1
    39                              <1> %endif
    40                              <1> %ifn _ELDCALL_OPTIONAL
    41                              <1> %assign ELDCALL_OPTIONAL_STATUS 2		; not allowed
    42                              <1> %endif
    43                              <1> ;%ifn _ELDDATA_OPTIONAL
    44                              <1> ;%assign ELDDATA_OPTIONAL_STATUS 2		; not allowed
    45                              <1> ;%endif
    46                              <1> 	gendef MAP, ""
    47                              <1> 
    48                              <1> %ifnidni _MAP, ""
    49                              <1>  [map all _MAP]
    50                              <1> %endif
    51                              <1> 
    52                              <1> 
    53                              <1> endresident: equ ($ + _CURRENT_SECTION %+ FIXUP + 15) & ~15
    54                              <1> 
    55                              <1> %if _ELD_LINKER_PASSES
    56                              <1> %assign ELDLINKER 1
    57                              <1> 
    58                              <1> 	struc LINKTABLE
    59 00000000 ????????            <1> ltCodeToCode:	resw 2
    60 00000004 ????????            <1> ltCodeToData:	resw 2
    61 00000008 ????????            <1> ltDataToCode:	resw 2
    62 0000000C ????????            <1> ltDataToData:	resw 2
    63 00000010 ????????            <1> ltLinkData:	resw 2
    64 00000014 ????????            <1> ltLinkCode:	resw 2
    65                              <1> 	endstruc
    66                              <1> %endif
    67                              <1> 
    68                              <1> 
    69                              <1> linker:
    70                              <1> 		; The first 15 Bytes of the linker should be
    71                              <1> 		;  the same regardless of the linker options
    72                              <1> 		;  used (debug, passes, vstart). This allows
    73                              <1> 		;  the eldcomp ELD to match even if up to 15
    74                              <1> 		;  Bytes of the linker are trailing in the
    75                              <1> 		;  resident part of the ELD.
    76                              <1> 	lframe
    77                              <1>  %if ELDOTHER
    78                              <1> 	lvar dword, linkinfo_other
    79                              <1> 	lvar word, use_hash_other
    80                              <1>  %endif
    81 00000678 5589E5              <1> 	lenter
    82                              <1> 	lvar dword, instance
    83 0000067B 06                  <1> 	 push es
    84 0000067C 52                  <1> 	 push dx
    85                              <1> 	lvar word, targetsection_low_optional_high
    86 0000067D 50                  <1> 	 push ax
    87                              <1> 	lequ ?targetsection_low_optional_high, targetsection
    88                              <1> 	lequ ?targetsection_low_optional_high + 1, optional
    89                              <1> 	lvar dword, linkinfo
    90 0000067E 1E                  <1> 	 push ds
    91 0000067F 57                  <1> 	 push di
    92                              <1> 	lvar dword, nextreloc
    93 00000680 06                  <1> 	 push es
    94 00000681 52                  <1> 	 push dx
    95                              <1> 	lvar dword, entry
    96 00000682 06                  <1> 	 push es
    97 00000683 50                  <1> 	 push ax		; placeholder
    98 00000684 31C0                <1> 	xor ax, ax
    99 00000686 813DD1E1            <1> 	cmp word [di + eldlSignature], 0E1D1h
   100                              <1> %if ($ - linker) < 16
   101                              <1>  %error Expected invariant first paragraph of linker
   102                              <1> %endif
   103 0000068A 7403E95502          <1> 	jne .error_j
   104 0000068F 837D0601            <1> 	cmp word [di + eldlUseLinkHash], 1
   105 00000693 7603E94C02          <1> 	ja .error_j
   106 00000698 7201                <1> 	jb @F
   107 0000069A 48                  <1> 	dec ax
   108                              <1> @@:
   109                              <1> 	lvar word, use_hash
   110 0000069B 50                  <1> 	 push ax
   111                              <1> %if _ELD_IDENTICALISE && _ELD_LINKER_PASSES
   112                              <1> 	mov ax, linktable - code
   113                              <1> 	lvar word, lt
   114                              <1> 	 push ax
   115                              <1> %endif
   116                              <1> %if _ELD_LINKER_PASSES || ELDOTHER
   117 0000069C 31C0                <1> 	xor ax, ax
   118                              <1>  %if _ELD_LINKER_PASSES
   119                              <1> 	lvar word, pass
   120 0000069E 50                  <1> 	 push ax
   121                              <1> 	lvar word, amounterrors
   122 0000069F 50                  <1> 	 push ax
   123                              <1> 	lvar word, name
   124 000006A0 50                  <1> 	 push ax
   125                              <1>  %endif
   126                              <1>  %if ELDOTHER
   127                              <1> 	lvar word, other
   128                              <1> 	 push ax
   129                              <1>  %endif
   130                              <1> %endif
   131 000006A1 56                  <1> 	push si
   132 000006A2 53                  <1> 	push bx
   133                              <1> 
   134                              <1> 			; simple: add instance base (dx) to code
   135 000006A3 06                  <1> 	push es
   136 000006A4 1F                  <1> 	pop ds
   137                              <1> %if _ELD_LINKER_PASSES
   138                              <1> .pass:
   139 000006A5 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   140 000006A8 01D3                <1> 	add bx, dx
   141                              <1>  %if _ELD_IDENTICALISE
   142                              <1> 	add bx, word [bp + ?lt]
   143                              <1> 	mov si, word [ltCodeToCode + bx]
   144                              <1>  %else
   145 000006AA 8BB7280A            <1> 	mov si, word [linktable - code + ltCodeToCode + bx]
   146                              <1>  %endif
   147                              <1> %else
   148                              <1> 	mov si, internalcodetocoderelocations - code
   149                              <1> %endif
   150 000006AE 01D6                <1> 	add si, dx
   151                              <1> @@:
   152 000006B0 AD                  <1> 	lodsw
   153 000006B1 85C0                <1> 	test ax, ax		; was last ?
   154 000006B3 740B                <1> 	jz @F			; yes -->
   155 000006B5 93                  <1> 	xchg bx, ax		; bx = entry
   156 000006B6 01D3                <1> 	add bx, dx		; relocate the entry itself
   157                              <1> %if _ELD_CODE_VSTART
   158 000006B8 812F[0000]          <1> 	sub word [bx], code	; undo adjustment
   159                              <1> %endif
   160 000006BC 0117                <1> 	add word [bx], dx	; relocate word referenced by entry
   161 000006BE EBF0                <1> 	jmp @B
   162                              <1> 
   163                              <1> @@:
   164                              <1> 			; next, add heap data base (on stack) to code
   165                              <1> %if _ELD_LINKER_PASSES
   166 000006C0 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   167 000006C3 01D3                <1> 	add bx, dx
   168                              <1>  %if _ELD_IDENTICALISE
   169                              <1> 	add bx, word [bp + ?lt]
   170                              <1> 	mov si, word [ltCodeToData + bx]
   171                              <1>  %else
   172 000006C5 8BB72C0A            <1> 	mov si, word [linktable - code + ltCodeToData + bx]
   173                              <1>  %endif
   174                              <1> %else
   175                              <1> 	mov si, internalcodetodatarelocations - code
   176                              <1> %endif
   177 000006C9 01D6                <1> 	add si, dx
   178                              <1> @@:
   179 000006CB AD                  <1> 	lodsw
   180 000006CC 85C0                <1> 	test ax, ax		; was last ?
   181 000006CE 740C                <1> 	jz @F			; yes -->
   182 000006D0 93                  <1> 	xchg bx, ax		; bx = entry
   183 000006D1 01D3                <1> 	add bx, dx		; relocate the entry itself
   184 000006D3 58                  <1> 	pop ax			; ax -> heap data
   185 000006D4 50                  <1> 	push ax
   186                              <1> %if _ELD_DATA_VSTART
   187 000006D5 2D[0000]            <1> 	sub ax, datastart	; undo adjustment
   188                              <1> %endif
   189 000006D8 0107                <1> 	add word [bx], ax	; relocate word referenced by entry
   190 000006DA EBEF                <1> 	jmp @B
   191                              <1> 
   192                              <1> @@:
   193                              <1> 
   194                              <1> 			; add instance base (dx) to data
   195                              <1> %if _ELD_LINKER_PASSES
   196 000006DC 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   197 000006DF 01D3                <1> 	add bx, dx
   198                              <1>  %if _ELD_IDENTICALISE
   199                              <1> 	add bx, word [bp + ?lt]
   200                              <1> 	mov si, word [ltDataToCode + bx]
   201                              <1>  %else
   202 000006E1 8BB7300A            <1> 	mov si, word [linktable - code + ltDataToCode + bx]
   203                              <1>  %endif
   204                              <1> %else
   205                              <1> 	mov si, internaldatatocoderelocations - code
   206                              <1> %endif
   207 000006E5 01D6                <1> 	add si, dx
   208                              <1> @@:
   209 000006E7 AD                  <1> 	lodsw
   210 000006E8 83F8FF              <1> 	cmp ax, -1		; was last ?
   211 000006EB 740F                <1> 	je @F			; yes -->
   212 000006ED 93                  <1> 	xchg bx, ax		; bx = entry
   213 000006EE 58                  <1> 	pop ax
   214 000006EF 50                  <1> 	push ax
   215 000006F0 01C3                <1> 	add bx, ax		; relocate the entry itself
   216                              <1> %if _ELD_CODE_VSTART
   217 000006F2 36812F[0000]        <1> 	sub word [ss:bx], code	; undo adjustment
   218                              <1> %endif
   219 000006F7 360117              <1> 	add word [ss:bx], dx	; relocate word referenced by entry
   220 000006FA EBEB                <1> 	jmp @B
   221                              <1> 
   222                              <1> @@:
   223                              <1> 			; next, add heap data base (on stack) to data
   224                              <1> %if _ELD_LINKER_PASSES
   225 000006FC 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   226 000006FF 01D3                <1> 	add bx, dx
   227                              <1>  %if _ELD_IDENTICALISE
   228                              <1> 	add bx, word [bp + ?lt]
   229                              <1> 	mov si, word [ltDataToData + bx]
   230                              <1>  %else
   231 00000701 8BB7340A            <1> 	mov si, word [linktable - code + ltDataToData + bx]
   232                              <1>  %endif
   233                              <1> %else
   234                              <1> 	mov si, internaldatatodatarelocations - code
   235                              <1> %endif
   236 00000705 01D6                <1> 	add si, dx
   237                              <1> @@:
   238 00000707 AD                  <1> 	lodsw
   239 00000708 83F8FF              <1> 	cmp ax, -1		; was last ?
   240 0000070B 740D                <1> 	je @F			; yes -->
   241 0000070D 93                  <1> 	xchg bx, ax		; bx = entry
   242 0000070E 58                  <1> 	pop ax			; ax -> heap data
   243 0000070F 50                  <1> 	push ax
   244 00000710 01C3                <1> 	add bx, ax		; relocate the entry itself
   245                              <1> %if _ELD_DATA_VSTART
   246 00000712 2D[0000]            <1> 	sub ax, datastart	; undo adjustment
   247                              <1> %endif
   248 00000715 360107              <1> 	add word [ss:bx], ax	; relocate word referenced by entry
   249 00000718 EBED                <1> 	jmp @B
   250                              <1> 
   251                              <1> @@:
   252 0000071A 8B56FC              <1> 	mov dx, word [bp + ?instance]
   253                              <1> %if _ELD_LINKER_PASSES
   254 0000071D 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   255 00000720 01D3                <1> 	add bx, dx
   256                              <1>  %if _ELD_IDENTICALISE
   257                              <1> 	add bx, word [bp + ?lt]
   258                              <1> 	add dx, word [ltLinkData + bx]
   259                              <1>  %else
   260 00000722 0397380A            <1> 	add dx, word [linktable - code + ltLinkData + bx]
   261                              <1>  %endif
   262                              <1> %else
   263                              <1> 	add dx, linkerdatarelocations - code
   264                              <1> %endif
   265                              <1> .otherloop:
   266 00000726 8956F2              <1> 	mov word [bp + ?nextreloc], dx
   267                              <1> 
   268                              <1> .datarelocloop:		; must be done before further relocs
   269 00000729 C576F2              <1> 	lds si, [bp + ?nextreloc]
   270 0000072C AD                  <1> 	lodsw			; ax = section indicator
   271 0000072D 85C0                <1> 	test ax, ax		; end of table ?
   272 0000072F 7503E92301          <1> 	jz .donedatareloc
   273 00000734 48                  <1> 	dec ax			; al = 1 if data, 0 if code
   274 00000735 5B                  <1> 	pop bx
   275 00000736 53                  <1> 	push bx			; bx -> ELD data block
   276 00000737 8946FA              <1> 	mov word [bp + ?targetsection_low_optional_high], ax
   277 0000073A 84C0                <1> 	test al, al		; data ?
   278 0000073C AD                  <1> 	lodsw
   279 0000073D 7504                <1> 	jnz @F			; yes -->
   280 0000073F 0346FC              <1> 	add ax, word [bp + ?instance]
   281                              <1> 				; relocate entry into code
   282 00000742 A9                  <1> 	db __TEST_IMM16		; (skip add)
   283                              <1> @@:
   284 00000743 01D8                <1> 	add ax, bx		; relocate entry into data
   285 00000745 8946EE              <1> 	mov word [bp + ?entry], ax
   286 00000748 AD                  <1> 	lodsw
   287 00000749 8976F2              <1> 	mov word [bp + ?nextreloc], si
   288 0000074C E8DC00              <1> 	call .build_match
   289                              <1> %if _ELD_LINKER_PASSES
   290 0000074F 73D8                <1> 	jnc .datarelocloop
   291                              <1> %endif
   292 00000751 C45EF6              <1> 	les bx, [bp + ?linkinfo]
   293                              <1> %if ELDOTHER
   294                              <1> 	rol byte [bp + ?other], 1
   295                              <1> 	jnc @F
   296                              <1> 	les bx, [bp + ?linkinfo_other]
   297                              <1> @@:
   298                              <1> %endif
   299 00000754 268B4F08            <1> 	mov cx, word [es:bx + eldlDataAmount]	; amount data link info
   300 00000758 268B7F0A            <1> 	mov di, word [es:bx + eldlDataPrefixes]	; -> prefixes or hashes
   301                              <1> .datarelocfind:
   302 0000075C F2AF                <1> 	repne scasw			; scan initial
   303 0000075E 7541                <1> 	jne .datarelocnotfound
   304 00000760 57                  <1> 	push di
   305 00000761 51                  <1> 	push cx
   306 00000762 56                  <1> 	push si
   307 00000763 262B7F0A            <1> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   308 00000767 4F                  <1> 	dec di
   309 00000768 4F                  <1> 	dec di				; 0-based
   310 00000769 26037F0C            <1> 	add di, word [es:bx + eldlDataEntries]	; -> entry
   311 0000076D 268B3D              <1> 	mov di, [es:di]			; -> counted suffix/string
   312 00000770 B500                <1> 	mov ch, 0
   313 00000772 8A0C                <1> 	mov cl, byte [si]		; cx = length
   314 00000774 41                  <1> 	inc cx
   315                              <1> 	; cmp al, al			; ZR if length is zero
   316 00000775 F3A6                <1> 	repe cmpsb			; match ?
   317 00000777 5E                  <1> 	pop si
   318 00000778 59                  <1> 	pop cx
   319 00000779 5F                  <1> 	pop di
   320 0000077A 75E0                <1> 	jne .datarelocfind
   321 0000077C 8814                <1> 	mov byte [si], dl
   322 0000077E 262B7F0A            <1> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   323 00000782 4F                  <1> 	dec di
   324 00000783 4F                  <1> 	dec di				; 0-based
   325 00000784 26037F0E            <1> 	add di, word [es:bx + eldlDataAddresses]	; -> address (offset)
   326 00000788 268B05              <1> 	mov ax, word [es:di]
   327 0000078B E80700              <1> 	call .address_data_reloc
   328                              <1> %if _ELD_RELOC_VSTART
   329 0000078E 2D[0000]            <1> 	sub ax, relocateddata		; *not* a relocation
   330                              <1> %endif
   331 00000791 0104                <1> 	add word [si], ax		; relocate
   332 00000793 EB94                <1> 	jmp .datarelocloop
   333                              <1> 
   334                              <1> .address_data_reloc:
   335 00000795 C576EE              <1> 	lds si, [bp + ?entry]		; -> entry if in ELD code instance
   336 00000798 807EFA00            <1> 	cmp byte [bp + ?targetsection], 0
   337                              <1> 					; relocation in code ?
   338 0000079C 7402                <1> 	je @F				; yes -->
   339 0000079E 16                  <1> 	push ss
   340 0000079F 1F                  <1> 	pop ds				; => our ELD data block
   341                              <1> @@:
   342 000007A0 C3                  <1> 	retn
   343                              <1> 
   344                              <1> .datarelocnotfound:
   345 000007A1 8814                <1> 	mov byte [si], dl
   346 000007A3 807EFB00            <1> 	cmp byte [bp + ?optional], 0
   347                              <1> %if _ELD_DEBUG
   348                              <1> 	jne @F
   349                              <1>  %ifn _ELD_LINKER_PASSES
   350                              <1> 	mov si, 0			; (invalid link)
   351                              <1> linkdatarelocation internalflags6
   352                              <1> 	test si, si
   353                              <1> 	jz .datanotfound
   354                              <1> 	mov si, 0			; (invalid link)
   355                              <1> linkdatarelocation options7
   356                              <1> 	test si, si
   357                              <1> 	jz .datanotfound
   358                              <1>  %else
   359                              <1> 	cmp byte [bp + ?pass], 0
   360                              <1> 	je .datanotfound
   361                              <1>  %endif
   362                              <1> 	houdini
   363                              <1> 	jmp .datanotfound
   364                              <1> @@:
   365                              <1> %else
   366 000007A7 7417                <1> 	je .datanotfound
   367                              <1> %endif
   368                              <1> 
   369                              <1> %if ELDDATA_PMREQUIRED_STATUS
   370                              <1> 	mov si, relocateddata
   371                              <1> linkdatarelocation build_option_PM
   372                              <1> 	test si, si
   373                              <1> 	jz @F
   374                              <1> 	test byte [bp + ?optional], 2
   375                              <1> 	jnz .datanotfound
   376                              <1> @@:
   377                              <1> %endif
   378                              <1> 
   379                              <1> %if _ELD_LINKER_PASSES
   380 000007A9 36F606[0000]02      <1> 	testopt [ss:relocateddata], 2
   381                              <1> linkdatarelocation options7, -3
   382 000007AF 7406                <1> 	jz @F
   383 000007B1 BE[B00E]            <1> 	mov si, lmsg.warning_data_optional
   384                              <1> internalcoderelocation
   385 000007B4 E82B00              <1> 	call .notfound
   386                              <1> @@:
   387                              <1> %endif
   388 000007B7 E8DBFF              <1> 	call .address_data_reloc
   389 000007BA 832400              <1> 	and word [si], 0		; indicate optional data link failed
   390 000007BD E969FF              <1> 	jmp .datarelocloop
   391                              <1> 
   392                              <1> 
   393                              <1> %if _ELDCALL_OPTIONAL
   394                              <1> .coderelocnotfound:
   395                              <1> 	mov byte [si], dl
   396                              <1> 	cmp byte [bp + ?optional], 0
   397                              <1> %if _ELD_DEBUG
   398                              <1> 	jne @F
   399                              <1>  %ifn _ELD_LINKER_PASSES
   400                              <1> 	mov si, 0			; (invalid link)
   401                              <1> linkdatarelocation internalflags6
   402                              <1> 	test si, si
   403                              <1> 	jz .codenotfound
   404                              <1> 	mov si, 0			; (invalid link)
   405                              <1> linkdatarelocation options7
   406                              <1> 	test si, si
   407                              <1> 	jz .codenotfound
   408                              <1>  %else
   409                              <1> 	cmp byte [bp + ?pass], 0
   410                              <1> 	je .codenotfound
   411                              <1>  %endif
   412                              <1> 	houdini
   413                              <1> 	jmp .codenotfound
   414                              <1> @@:
   415                              <1> %else
   416                              <1> 	je .codenotfound
   417                              <1> %endif
   418                              <1> 
   419                              <1> %if ELDCALL_PMREQUIRED_STATUS
   420                              <1>  %if _ELD_LINKER_PASSES
   421                              <1>   %assign ELDLINKER 0
   422                              <1>  %endif
   423                              <1> 	mov si, relocateddata
   424                              <1> linkdatarelocation build_option_PM
   425                              <1>  %if _ELD_LINKER_PASSES
   426                              <1>   %assign ELDLINKER 1
   427                              <1>  %endif
   428                              <1> 	test si, si
   429                              <1> 	jz @F
   430                              <1> 	test byte [bp + ?optional], 2
   431                              <1> 	jnz .codenotfound
   432                              <1> @@:
   433                              <1> %endif
   434                              <1> 
   435                              <1> %if _ELD_LINKER_PASSES
   436                              <1> 	testopt [ss:relocateddata], 2
   437                              <1> linkdatarelocation options7, -3
   438                              <1> 	jz @F
   439                              <1> 	mov si, lmsg.warning_code_optional
   440                              <1> internalcoderelocation
   441                              <1> 	call .notfound
   442                              <1> @@:
   443                              <1> %endif
   444                              <1> 	lds si, [bp + ?entry]
   445                              <1> 	mov word [si], 9090h
   446                              <1> 	mov byte [si + 2], 90h		; indicate optional code link failed
   447                              <1> 	jmp .coderelocloop
   448                              <1> %endif
   449                              <1> 
   450                              <1> 
   451                              <1> %if _ELD_LINKER_PASSES
   452                              <1> .datanotfound:
   453 000007C0 BE[D20E]            <1> 	mov si, lmsg.error_data
   454                              <1> internalcoderelocation
   455 000007C3 E81C00              <1> 	call .notfound
   456 000007C6 7203E91901          <1> 	jnc .error_j
   457 000007CB FF46E8              <1> 	inc word [bp + ?amounterrors]
   458 000007CE E958FF              <1> 	jmp .datarelocloop
   459                              <1> 
   460                              <1> .codenotfound:
   461 000007D1 BE[EB0E]            <1> 	mov si, lmsg.error_code
   462                              <1> internalcoderelocation
   463 000007D4 E80B00              <1> 	call .notfound
   464 000007D7 7203E90801          <1> 	jnc .error_j
   465 000007DC FF46E8              <1> 	inc word [bp + ?amounterrors]
   466 000007DF E98400              <1> 	jmp .coderelocloop
   467                              <1> 
   468                              <1> .notfound:
   469 000007E2 807EEA00            <1> 	cmp byte [bp + ?pass], 0
   470 000007E6 743A                <1> 	je @F				; --> (NC)
   471 000007E8 16                  <1> 	 push ss
   472 000007E9 07                  <1> 	 pop es
   473 000007EA BF[0000]            <1> 	mov di, relocateddata
   474                              <1> linkdatarelocation line_out
   475 000007ED E83300              <1> 	call .copy
   476 000007F0 8B76E6              <1> 	mov si, word [bp + ?name]
   477 000007F3 AD                  <1> 	lodsw
   478 000007F4 E8[0000]EB020000    <1> 	extcall hexword
   479 000007FB 56                  <1> 	push si
   480 000007FC BE[040F]            <1> 	mov si, lmsg.error.2
   481                              <1> internalcoderelocation
   482 000007FF E82100              <1> 	call .copy
   483 00000802 5E                  <1> 	pop si
   484                              <1> %if _ELD_LINKER_PASSES
   485 00000803 56                  <1> 	push si
   486 00000804 E81C00              <1> 	call .copy
   487 00000807 5E                  <1> 	pop si
   488 00000808 C60400              <1> 	mov byte [si], 0		; mark as failed
   489                              <1> %else
   490                              <1> 	call .copy
   491                              <1> %endif
   492 0000080B B022                <1> 	mov al, '"'
   493 0000080D AA                  <1> 	stosb
   494 0000080E 16                  <1> 	 push ss
   495 0000080F 1F                  <1> 	 pop ds
   496 00000810 E8[0000]EB020000    <1> 	extcall putsline_crlf
   497 00000817 B8350E              <1> 	mov ax, 0E35h
   498 0000081A E8[0000]EB020000    <1> 	extcall setrc
   499 00000821 F9                  <1> 	stc				; CY, diagnostic displayed
   500                              <1> @@:
   501 00000822 C3                  <1> 	retn
   502                              <1> 
   503                              <1> .copy:
   504 00000823 E8[0000]EB020000    <1> 	extcall copy_single_counted_string
   505 0000082A C3                  <1> 	retn
   506                              <1> %else
   507                              <1> .datanotfound: equ .error_j
   508                              <1> .codenotfound: equ .error_j
   509                              <1> %endif
   510                              <1> 
   511                              <1> .build_match:
   512                              <1> %if _ELD_CODE_VSTART
   513 0000082B 2D[0000]            <1> 	sub ax, code
   514                              <1> %endif
   515 0000082E 0346FC              <1> 	add ax, word [bp + ?instance]
   516 00000831 96                  <1> 	xchg si, ax
   517                              <1> %if _ELD_LINKER_PASSES
   518 00000832 8976E6              <1> 	mov word [bp + ?name], si
   519                              <1> %endif
   520 00000835 AD                  <1> 	lodsw			; = hash, si -> counted string
   521 00000836 8A14                <1> 	mov dl, byte [si]
   522                              <1> %if _ELD_LINKER_PASSES
   523 00000838 84D2                <1> 	test dl, dl		; marked as already failed ?
   524 0000083A 750A                <1> 	jnz @F
   525 0000083C 837EE800            <1> 	cmp word [bp + ?amounterrors], 0
   526 00000840 7503E99F00          <1> 	je .error_j
   527 00000845 C3                  <1> 	retn			; (NC)
   528                              <1> 
   529                              <1> @@:
   530                              <1> %endif
   531                              <1> %if ELDOTHER
   532                              <1> 	rol byte [bp + ?other], 1
   533                              <1> 	jnc @F
   534                              <1> 	rol byte [bp + ?use_hash_other], 1
   535                              <1> 	jmp @FF
   536                              <1> 
   537                              <1> @@:
   538                              <1> %endif
   539 00000846 D046EC              <1> 	rol byte [bp + ?use_hash], 1
   540                              <1> @@:
   541 00000849 720A                <1> 	jc @F
   542 0000084B AC                  <1> 	lodsb
   543 0000084C 91                  <1> 	xchg cx, ax		; cl = length
   544 0000084D AD                  <1> 	lodsw			; ax = prefix
   545 0000084E 49                  <1> 	dec cx
   546 0000084F 49                  <1> 	dec cx
   547 00000850 4E                  <1> 	dec si
   548 00000851 8A14                <1> 	mov dl, byte [si]
   549 00000853 880C                <1> 	mov byte [si], cl	; si -> counted string suffix
   550                              <1> @@:
   551                              <1> %if _ELD_LINKER_PASSES
   552 00000855 F9                  <1> 	stc			; CY
   553                              <1> %endif
   554 00000856 C3                  <1> 	retn
   555                              <1> 
   556                              <1> 
   557                              <1> .donedatareloc:
   558                              <1> %if ELDOTHER
   559                              <1> 	rol byte [bp + ?other], 1
   560                              <1> 	jc .otherdone
   561                              <1> %endif
   562                              <1> 
   563 00000857 8B56FC              <1> 	mov dx, word [bp + ?instance]
   564                              <1> %if _ELD_LINKER_PASSES
   565 0000085A 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   566 0000085D 01D3                <1> 	add bx, dx
   567                              <1>  %if _ELD_IDENTICALISE
   568                              <1> 	add bx, word [bp + ?lt]
   569                              <1> 	add dx, word [ltLinkCode + bx]
   570                              <1>  %else
   571 0000085F 03973C0A            <1> 	add dx, word [linktable - code + ltLinkCode + bx]
   572                              <1>  %endif
   573                              <1> %else
   574                              <1> 	add dx, linkercoderelocations - code
   575                              <1> %endif
   576 00000863 8956F2              <1> 	mov word [bp + ?nextreloc], dx
   577                              <1> 
   578                              <1> .coderelocloop:
   579 00000866 C576F2              <1> 	lds si, [bp + ?nextreloc]
   580 00000869 AD                  <1> 	lodsw
   581                              <1> %if _ELDCALL_OPTIONAL
   582                              <1> 	dec ax
   583                              <1> 	js .donecodereloc
   584                              <1> 	mov word [bp + ?targetsection_low_optional_high], ax
   585                              <1> 	lodsw
   586                              <1> %endif
   587 0000086A 0346FC              <1> 	add ax, word [bp + ?instance]
   588 0000086D 8946EE              <1> 	mov word [bp + ?entry], ax
   589 00000870 AD                  <1> 	lodsw
   590 00000871 8976F2              <1> 	mov word [bp + ?nextreloc], si
   591                              <1> %ifn _ELDCALL_OPTIONAL
   592 00000874 85C0                <1> 	test ax, ax
   593 00000876 747E                <1> 	jz .donecodereloc
   594                              <1> %endif
   595 00000878 E8B0FF              <1> 	call .build_match
   596                              <1> %if _ELD_LINKER_PASSES
   597 0000087B 73E9                <1> 	jnc .coderelocloop
   598                              <1> %endif
   599 0000087D C45EF6              <1> 	les bx, [bp + ?linkinfo]
   600 00000880 268B4F10            <1> 	mov cx, word [es:bx + eldlCodeAmount]	; amount code link info
   601 00000884 268B7F12            <1> 	mov di, word [es:bx + eldlCodePrefixes]	; -> prefixes or hashes
   602                              <1> .coderelocfind:
   603 00000888 F2AF                <1> 	repne scasw			; scan initial
   604                              <1> %if _ELDCALL_OPTIONAL
   605                              <1> 	jne .coderelocnotfound
   606                              <1> %else
   607                              <1>  %if _ELD_DEBUG
   608                              <1> 	je @F
   609                              <1> 	houdini
   610                              <1> 	jmp .codenotfound
   611                              <1> @@:
   612                              <1>  %else
   613 0000088A 7403E942FF          <1> 	jne .codenotfound
   614                              <1>  %endif
   615                              <1> %endif
   616 0000088F 57                  <1> 	push di
   617 00000890 51                  <1> 	push cx
   618 00000891 56                  <1> 	push si
   619 00000892 262B7F12            <1> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   620 00000896 4F                  <1> 	dec di
   621 00000897 4F                  <1> 	dec di				; 0-based
   622 00000898 26037F14            <1> 	add di, word [es:bx + eldlCodeEntries]	; -> entry
   623 0000089C 268B3D              <1> 	mov di, [es:di]			; -> counted suffix/string
   624 0000089F B500                <1> 	mov ch, 0
   625 000008A1 8A0C                <1> 	mov cl, byte [si]		; cx = length
   626 000008A3 41                  <1> 	inc cx
   627                              <1> 	; cmp al, al			; ZR if length is zero
   628 000008A4 F3A6                <1> 	repe cmpsb			; match ?
   629 000008A6 5E                  <1> 	pop si
   630 000008A7 59                  <1> 	pop cx
   631 000008A8 5F                  <1> 	pop di
   632 000008A9 75DD                <1> 	jne .coderelocfind
   633 000008AB 8814                <1> 	mov byte [si], dl
   634 000008AD 262B7F12            <1> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   635 000008B1 4F                  <1> 	dec di
   636 000008B2 4F                  <1> 	dec di				; 0-based
   637 000008B3 01FF                <1> 	add di, di			; quadruple index
   638 000008B5 26037F16            <1> 	add di, word [es:bx + eldlCodeAddresses]	; -> address (offset, segment)
   639 000008B9 26FF35              <1> 	push word [es:di]
   640 000008BC C576EE              <1> 	lds si, [bp + ?entry]
   641 000008BF 8F4405              <1> 	pop word [si + 3 + 2]		; call near imm (3), jmp short (2)
   642                              <1> 					;  patch the destination address
   643 000008C2 803CE8              <1> 	cmp byte [si], 0E8h		; is it as expected ?
   644 000008C5 751D                <1> 	jne .error_j
   645 000008C7 268B7D02            <1> 	mov di, word [es:di + 2]
   646 000008CB BB[0000]            <1> 	mov bx, relocateddata
   647                              <1> linkdatarelocation linkcall_table	; ss:bx -> link call table
   648 000008CE 36833F01            <1> 	cmp word [ss:bx], 1		; is it initialised to format 1 ?
   649 000008D2 7510                <1> 	jne .error_j			; no -->
   650 000008D4 368B4F02            <1> 	mov cx, word [ss:bx + 2]	; get amount of segments
   651 000008D8 E30A                <1> 	jcxz .error_j			; none -->
   652                              <1> @@:
   653 000008DA 83C304              <1> 	add bx, 4			; -> next segment
   654 000008DD 36393F              <1> 	cmp word [ss:bx], di		; value matches ?
   655 000008E0 7405                <1> 	je @F				; yes, found -->
   656 000008E2 E2F6                <1> 	loop @B				; try remaining segments
   657                              <1> .error_j:
   658 000008E4 E98A00              <1> 	jmp .error
   659                              <1> 
   660                              <1> @@:
   661 000008E7 368B5F02            <1> 	mov bx, word [ss:bx + 2]	; -> call destination offset
   662                              <1> 		; si + 3 + delta = bx
   663                              <1> 		; delta = bx - si - 3
   664 000008EB 29F3                <1> 	sub bx, si
   665 000008ED 83EB03              <1> 	sub bx, 3
   666 000008F0 895C01              <1> 	mov word [si + 1], bx		; patch the call instruction
   667 000008F3 E970FF              <1> 	jmp .coderelocloop
   668                              <1> 
   669                              <1> .donecodereloc:
   670                              <1> %if _ELD_LINKER_PASSES
   671 000008F6 8B46E8              <1> 	mov ax, word [bp + ?amounterrors]
   672 000008F9 85C0                <1> 	test ax, ax
   673 000008FB 75E7                <1> 	jnz .error_j
   674 000008FD 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   675 00000900 85DB                <1> 	test bx, bx
   676 00000902 750B                <1> 	jnz @F
   677 00000904 43                  <1> 	inc bx
   678 00000905 43                  <1> 	inc bx
   679 00000906 895EEA              <1> 	mov word [bp + ?pass], bx
   680 00000909 8B56FC              <1> 	mov dx, word [bp + ?instance]
   681 0000090C E996FD              <1> 	jmp .pass
   682                              <1> 
   683                              <1> @@:
   684                              <1> %endif
   685                              <1> 
   686                              <1> %ifnidni _LISTING, ""
   687                              <1> %assign ELDLINKER 0
   688                              <1> .hint:
   689 0000090F 16                  <1> 	push ss
   690 00000910 1F                  <1> 	pop ds
   691 00000911 B02D                <1> 	mov al, 2Dh
   692 00000913 E8[0000]EB020000    <1> 	extcall intchk			; ZR if offset = -1 or segment = 0
   693                              <1> 					; CHG: ax, dx, bx
   694 0000091A 7437                <1> 	jz .no_hint
   695                              <1> 
   696 0000091C 8A26[0000]          <1> 	mov ah, byte [relocateddata]
   697                              <1> linkdatarelocation try_debugger_amis_multiplex_number
   698 00000920 E85500              <1> 	call plex_check
   699 00000923 7305                <1> 	jnc @F
   700                              <1> 
   701 00000925 B4FF                <1> 	mov ah, 0FFh		; start with multiplex number 0FFh
   702                              <1> .loop_hint:
   703 00000927 E84E00              <1> 	call plex_check
   704                              <1> @@:
   705 0000092A 7307                <1> 	jnc .end_hint		; if found --> (NC)
   706 0000092C 80EC01              <1> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   707 0000092F 73F6                <1> 	jnc .loop_hint		; try next if we didn't check all yet -->
   708 00000931 EB20                <1> 	jmp .no_hint
   709                              <1> 
   710                              <1> .end_hint:
   711 00000933 50                  <1> 	push ax
   712 00000934 C446FC              <1> 	les ax, [bp + ?instance]
   713 00000937 BF[2A0C]            <1> 	mov di, listmsg.hint.offset
   714                              <1> internalcoderelocation
   715 0000093A E8[0000]EB020000    <1> 	extcall hexword
   716 00000941 BB[0A0C]            <1> 	mov bx, listmsg.hint
   717                              <1> internalcoderelocation
   718 00000944 368B16[0000]        <1> 	mov dx, [ss:relocateddata]
   719                              <1> linkdatarelocation extseg	; must be 86 Mode segment even in PM
   720 00000949 58                  <1> 	pop ax
   721 0000094A B040                <1> 	mov al, 40h		; AMIS message display service
   722 0000094C E8[0000]EB020000    <1> 	extcall call_int2D
   723                              <1> .no_hint:
   724                              <1> %endif
   725                              <1> 
   726                              <1> %if ELDOTHER
   727                              <1> %assign ELDLINKER 0
   728                              <1> 	not byte [bp + ?other]
   729                              <1> 
   730                              <1> 	push ss
   731                              <1> 	pop ds
   732                              <1> 	mov al, 2Dh
   733                              <1> 	extcall intchk			; ZR if offset = -1 or segment = 0
   734                              <1> 					; CHG: ax, dx, bx
   735                              <1> 	jz .no_other
   736                              <1> 
   737                              <1> 	mov ah, byte [relocateddata]
   738                              <1> linkdatarelocation try_debugger_amis_multiplex_number
   739                              <1> 	call plex_check
   740                              <1> 	jnc @F
   741                              <1> 
   742                              <1> 	mov ah, 0FFh		; start with multiplex number 0FFh
   743                              <1> .loop_other:
   744                              <1> 	call plex_check
   745                              <1> @@:
   746                              <1> 	jnc .end_other		; if found --> (NC)
   747                              <1> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   748                              <1> 	jnc .loop_other		; try next if we didn't check all yet -->
   749                              <1> 	jmp .no_other
   750                              <1> 
   751                              <1> .end_other:
   752                              <1> 	mov al, 42h		; AMIS get other link info service
   753                              <1> 	extcall call_int2D
   754                              <1> 	cmp al, 0FFh
   755                              <1> 	jne .no_other
   756                              <1> 
   757                              <1> 	mov ax, si		; selector => PSP
   758                              <1> 	extcall ispm
   759                              <1> 	jz @F
   760                              <1> 	mov ax, dx		; segment => PSP
   761                              <1> @@:
   762                              <1> 	 push ss
   763                              <1> 	 pop ds
   764                              <1> 	mov word [otherds], ax
   765                              <1> internaldatarelocation		; current mode sel/seg
   766                              <1> 	mov word [otherseg], dx
   767                              <1> internaldatarelocation		; remember segment
   768                              <1> 
   769                              <1> 	mov ax, cx		; selector => link info
   770                              <1> 	extcall ispm
   771                              <1> 	jz @F
   772                              <1> 	mov ax, bx		; segment => link info
   773                              <1> @@:
   774                              <1> 	mov word [bp + ?linkinfo_other], di
   775                              <1> 	mov word [bp + ?linkinfo_other + 2], ax
   776                              <1> 
   777                              <1> 	mov ds, ax		; => link info
   778                              <1> 	xor ax, ax
   779                              <1> 	cmp word [di + eldlSignature], 0E1D1h
   780                              <1> 	jne .error_other
   781                              <1> 	cmp word [di + eldlUseLinkHash], 1
   782                              <1> 	ja .error_other
   783                              <1> 	jb @F
   784                              <1> 	dec ax
   785                              <1> @@:
   786                              <1> 	mov word [bp + ?use_hash_other], ax
   787                              <1> 
   788                              <1> 	mov dx, word [bp + ?instance]
   789                              <1> 	add dx, linkerotherdatarelocations - code
   790                              <1> 	jmp .otherloop
   791                              <1> 
   792                              <1> .error_other:
   793                              <1> 	push cs
   794                              <1> 	pop ds
   795                              <1> 	mov ax, 0E33h
   796                              <1> 	extcall setrc
   797                              <1> 	mov dx, lmsg.error_other
   798                              <1> internalcoderelocation
   799                              <1> 	jmp @F
   800                              <1> 
   801                              <1> .no_other:
   802                              <1> 	push cs
   803                              <1> 	pop ds
   804                              <1> 	mov ax, 0E34h
   805                              <1> 	extcall setrc
   806                              <1> 	mov dx, lmsg.no_other
   807                              <1> internalcoderelocation
   808                              <1> @@:
   809                              <1> 	extcall putsz
   810                              <1> 	jmp .error
   811                              <1> 
   812                              <1> .otherdone:
   813                              <1> %endif
   814                              <1> 
   815 00000953 5B                  <1> 	pop bx				; -> our heap data
   816 00000954 5E                  <1> 	pop si				; -> our command line tail
   817 00000955 16                  <1> 	 push ss
   818 00000956 1F                  <1> 	 pop ds
   819 00000957 C47EFC              <1> 	les di, [bp + ?instance]
   820 0000095A 268B4502            <1> 	mov ax, word [es:di + eldiEndCode]
   821                              <1> houdini
   822 0000095E 2D[8006]            <1> 	sub ax, strict word endresident + code
   823                              <1> internalcoderelocation
   824 00000961 26C74502[8006]      <1> 	mov word [es:di + eldiEndCode], endresident + code
   825                              <1> internalcoderelocation
   826 00000967 2906[0000]          <1> 	sub word [relocateddata], ax
   827                              <1> linkdatarelocation extseg_used
   828                              <1> %if _DATA_SIZE == 0
   829                              <1> 	xor ax, ax
   830                              <1> 	mov word [es:di + eldiStartData], ax
   831                              <1> 	mov word [es:di + eldiEndData], ax
   832                              <1> %endif
   833 0000096B 89EC5D              <1> 	lleave code
   834                              <1> 		; INP:	es => ELD code segment
   835                              <1> 		;	ds:si -> command line tail
   836                              <1> 		;	ds:bx -> ELD data block
   837                              <1> 		;	ss:sp -> far return address for current mode
   838                              <1> 		; STT:	ds = ss, UP, EI
   839 0000096E E9AFF6              <1> 	jmp start
   840                              <1> 
   841                              <1> .error:
   842 00000971 89EC5D              <1> 	lleave
   843 00000974 B8FFFF              <1> 	mov ax, -1
   844 00000977 CB                  <1> 	retf
   845                              <1> 
   846                              <1> 
   847                              <1> %ifnidni _LISTING, ""
   848                              <1>  %assign ELDHINT 1
   849                              <1> %else
   850                              <1>  %assign ELDHINT 0
   851                              <1> %endif
   852                              <1> 
   853                              <1> %if ELDOTHER || ELDHINT
   854                              <1> 		; INP:	ah = multiplex number to check
   855                              <1> 		; OUT:	CY if multiplex number unused or no signature match,
   856                              <1> 		;	 bp, ah, ds unmodified
   857                              <1> 		;	NC if match found,
   858                              <1> 		;	 ah = multiplex number (unmodified)
   859                              <1> 		; CHG:	si, di, es, cx, dx
   860                              <1> plex_check:
   861 00000978 16                  <1> 	push ss
   862 00000979 1F                  <1> 	pop ds
   863 0000097A F606[0000]08        <1> 	testopt [relocateddata], 8
   864                              <1> linkdatarelocation internalflags4, -3
   865 0000097F 740B                <1> 	jz @F
   866 00000981 BE[0000]            <1> 	mov si, relocateddata
   867                              <1> linkdatarelocation amis_multiplex_number, -2, optional
   868 00000984 85F6                <1> 	test si, si
   869 00000986 7404                <1> 	jz @F
   870 00000988 3A24                <1> 	cmp ah, byte [si]
   871 0000098A 7420                <1> 	je .notfound		; do not use our own multiplexer -->
   872                              <1> @@:
   873 0000098C B000                <1> 	mov al, 00h		; AMIS installation check
   874 0000098E E8[0000]EB020000    <1> 	extcall call_int2D	; AMIS (or "DOS reserved" = iret if no AMIS present)
   875 00000995 3CFF                <1> 	cmp al, 0FFh
   876 00000997 7513                <1> 	jne .notfound
   877 00000999 0E                  <1> 	push cs
   878 0000099A 1F                  <1> 	pop ds
   879 0000099B BE[FA0B]            <1> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
   880                              <1> internalcoderelocation
   881 0000099E E8[0000]EB020000    <1> 	extcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
   882 000009A5 B90800              <1> 	mov cx, 8		; Ignore description, only compare vendor and program name
   883 000009A8 F3A7                <1> 	repe cmpsw
   884 000009AA 7401                <1> 	je .checkret		; ZR, NC = match -->
   885                              <1> .notfound:
   886 000009AC F9                  <1> 	stc			; CY no match
   887                              <1> .checkret:
   888 000009AD C3                  <1> 	retn
   889                              <1> %endif
   890                              <1> 
   891                              <1> 
   892 000009AE 00<rep 2h>          <1> 	align 4, db 0
   893                              <1> linkercoderelocations:
   894                              <1> %if _ELDCALL_OPTIONAL
   895                              <1> 	dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
   896                              <1> %else
   897 000009B0 6505[320C]6D05-     <1> 	dw ELDCALL_CODE_RELOCATIONS, 0, 0
   897 000009B6 [3D0C]8205[4E0C]99- <1>
   897 000009BD 05[600C]0006[7A0C]- <1>
   897 000009C4 0806[860C]1006-     <1>
   897 000009CA [8F0C]1806[9B0C]20- <1>
   897 000009D1 06[A40C]2806[AC0C]- <1>
   897 000009D8 3006[B30C]3806-     <1>
   897 000009DE [BE0C]4006[C50C]48- <1>
   897 000009E5 06[DB0C]5006[E30C]- <1>
   897 000009EC 5806[EF0C]6006-     <1>
   897 000009F2 [FB0C]6806[020D]70- <1>
   897 000009F9 06[0A0D]1309[490D]- <1>
   897 00000A00 3A09[120D]4C09-     <1>
   897 00000A06 [520D]8E09[520D]9E- <1>
   897 00000A0D 09[5F0D]00000000    <1>
   898                              <1> %endif
   899                              <1> 
   900                              <1> %if _ELD_LINKER_PASSES
   901                              <1> linkerlinkercoderelocations:
   902                              <1> %if _ELDCALL_OPTIONAL
   903                              <1> 	dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
   904                              <1> %else
   905 00000A14 F407[120D]1008-     <1> 	dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
   905 00000A1A [1C0D]1A08[DB0C]23- <1>
   905 00000A21 08[2C0D]00000000    <1>
   906                              <1> %endif
   907                              <1> 
   908                              <1> 	align 2, db 0
   909                              <1> linktable:
   910                              <1> 	istruc LINKTABLE
   911                              <1> at ltCodeToCode
   912 00000A28 EA0B                <1> 	dw internallinkercodetocoderelocations - code
   913 00000A2A 2C0B                <1> 	dw internalcodetocoderelocations - code
   914                              <1> at ltCodeToData
   915 00000A2C F40B                <1> 	dw internallinkercodetodatarelocations - code
   916 00000A2E 5C0B                <1> 	dw internalcodetodatarelocations - code
   917                              <1> at ltDataToCode
   918 00000A30 F60B                <1> 	dw internallinkerdatatocoderelocations - code
   919 00000A32 D20B                <1> 	dw internaldatatocoderelocations - code
   920                              <1> at ltDataToData
   921 00000A34 F80B                <1> 	dw internallinkerdatatodatarelocations - code
   922 00000A36 D40B                <1> 	dw internaldatatodatarelocations - code
   923                              <1> at ltLinkData
   924 00000A38 D60B                <1> 	dw linkerlinkerdatarelocations - code
   925 00000A3A 400A                <1> 	dw linkerdatarelocations - code
   926                              <1> at ltLinkCode
   927 00000A3C 140A                <1> 	dw linkerlinkercoderelocations - code
   928 00000A3E B009                <1> 	dw linkercoderelocations - code
   929                              <1> 	iend
   930                              <1> %endif
   931                              <1> 
   932                              <1> 	align 2, db 0
   933                              <1> linkerdatarelocations:
   934 00000A40 01008A00[6A0D]0100- <1> 	dw LINK_DATA_RELOCATIONS, 0
   934 00000A48 9200[6A0D]01003B01- <1>
   934 00000A50 [6A0D]01008603-     <1>
   934 00000A56 [750D]01008A03-     <1>
   934 00000A5C [830D]0100C303-     <1>
   934 00000A62 [910D]0100C703-     <1>
   934 00000A68 [A00D]01001604-     <1>
   934 00000A6E [830D]01001F04-     <1>
   934 00000A74 [AF0D]01002504-     <1>
   934 00000A7A [BA0D]01005A04-     <1>
   934 00000A80 [C30D]01005E04-     <1>
   934 00000A86 [A00D]01007A04-     <1>
   934 00000A8C [830D]01009E04-     <1>
   934 00000A92 [830D]0100AB04-     <1>
   934 00000A98 [830D]0100C104-     <1>
   934 00000A9E [A00D]0100C504-     <1>
   934 00000AA4 [C30D]0100DB04-     <1>
   934 00000AAA [C30D]0100FA04-     <1>
   934 00000AB0 [CD0D]01000205-     <1>
   934 00000AB6 [D70D]01000505-     <1>
   934 00000ABC [E10D]01003705-     <1>
   934 00000AC2 [F30D]01003B05-     <1>
   934 00000AC8 [060E]01004205-     <1>
   934 00000ACE [160E]01004D05-     <1>
   934 00000AD4 [230E]01005B05-     <1>
   934 00000ADA [060E]01009305-     <1>
   934 00000AE0 [3A0E]01009705-     <1>
   934 00000AE6 [3A0E]0100A105-     <1>
   934 00000AEC [3A0E]0100A505-     <1>
   934 00000AF2 [3A0E]0100B205-     <1>
   934 00000AF8 [AF0D]0100BB05-     <1>
   934 00000AFE [BA0D]0100E305-     <1>
   934 00000B04 [830D]0100E905-     <1>
   934 00000B0A [A00D]01001E09-     <1>
   934 00000B10 [620E]01004709-     <1>
   934 00000B16 [BA0D]01006909-     <1>
   934 00000B1C [830D]01007C09-     <1>
   934 00000B22 [870E]01018209-     <1>
   934 00000B28 [980E]0000          <1>
   935                              <1> 
   936                              <1> 	align 2, db 0
   937                              <1> internalcodetocoderelocations:
   938 00000B2C B303B803EB03F00380- <1> 	dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
   938 00000B35 0484048B0492049804- <1>
   938 00000B3E A704B104B404BC04CA- <1>
   938 00000B47 04DF04E204E804CD05- <1>
   938 00000B50 380942095F0965099C- <1>
   938 00000B59 090000              <1>
   939                              <1> 
   940                              <1> 	align 2, db 0
   941                              <1> internalcodetodatarelocations:
   942 00000B5C 32004B0053005C006B- <1> 	dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
   942 00000B65 007E008400A100AF00- <1>
   942 00000B6E C100C500C800D600DD- <1>
   942 00000B77 00E100F400F8002C01- <1>
   942 00000B80 300157015C01690179- <1>
   942 00000B89 018401BA0111022802- <1>
   942 00000B92 2B02470258025C025F- <1>
   942 00000B9B 0269026D027B027F02- <1>
   942 00000BA4 A402A802D102EC02FA- <1>
   942 00000BAD 02FE02140322033103- <1>
   942 00000BB6 48034C0306040A044A- <1>
   942 00000BBF 044E04CD04E5040E05- <1>
   942 00000BC8 16051E052605DC0500- <1>
   942 00000BD1 00                  <1>
   943                              <1> 
   944                              <1> 	align 2, db 0
   945                              <1> internaldatatocoderelocations:
   946 00000BD2 FFFF                <1> 	dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
   947                              <1> 
   948                              <1> 	align 2, db 0
   949                              <1> internaldatatodatarelocations:
   950 00000BD4 FFFF                <1> 	dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
   951                              <1> 
   952                              <1> %if _ELD_LINKER_PASSES
   953                              <1> 	align 2, db 0
   954                              <1> linkerlinkerdatarelocations:
   955 00000BD6 0100AC07[460E]0100- <1> 	dw LINK_LINKER_DATA_RELOCATIONS, 0
   955 00000BDE EB07[6A0D]0100CC08- <1>
   955 00000BE6 [510E]0000          <1>
   956                              <1> 
   957                              <1> 	align 2, db 0
   958                              <1> internallinkercodetocoderelocations:
   959 00000BEA B207C107D207FD0700- <1> 	dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
   959 00000BF3 00                  <1>
   960                              <1> 
   961                              <1> 	align 2, db 0
   962                              <1> internallinkercodetodatarelocations:
   963 00000BF4 0000                <1> 	dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
   964                              <1> 
   965                              <1> 	align 2, db 0
   966                              <1> internallinkerdatatocoderelocations:
   967 00000BF6 FFFF                <1> 	dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
   968                              <1> 
   969                              <1> 	align 2, db 0
   970                              <1> internallinkerdatatodatarelocations:
   971 00000BF8 FFFF                <1> 	dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
   972                              <1> %endif
   973                              <1> 
   974                              <1> %if ELDOTHER
   975                              <1> 	align 2, db 0
   976                              <1> linkerotherdatarelocations:
   977                              <1> 	dw LINK_OTHER_DATA_RELOCATIONS, 0
   978                              <1> 
   979                              <1>  %ifnidn LINK_OTHER_LINKER_DATA_RELOCATIONS, ""
   980                              <1>   %error Other linker data links not supported
   981                              <1>  %endif
   982                              <1> %endif
   983                              <1> 
   984                              <1> %if ELDOTHER || ELDHINT
   985                              <1> 	align 2, db 0
   986                              <1> debuggeramissig:
   987 00000BFA 65636D20<rep 5h>    <1> 		fill 8, 32, db "ecm"
   988 00000C02 6C446562756720-     <1> 		fill 8, 32, db "lDebug"
   988 00000C02 <rep 2h>            <1>
   989                              <1> %endif
   990                              <1> 
   991                              <1> %ifnidni _LISTING, ""
   992                              <1> listmsg:
   993 00000C0A 547261634C6973742D- <1> .hint:		db "TracList-add-offset=",_LISTING,"::"
   993 00000C13 6164642D6F66667365- <1>
   993 00000C1C 743D6578746C69622E- <1>
   993 00000C25 6C73743A3A          <1>
   994 00000C2A 2D2D2D2D680D0A00    <1> .hint.offset:	asciz "----h",13,10
   995                              <1> %endif
   996                              <1> 
   997 00000C32 6831085F646F736361- <1> 	eldcall_dump_names ELDCALL_CODE_NAMES
   997 00000C3B 6C6C8EF70E646F7363- <1>
   997 00000C44 616C6C5F6578747365- <1>
   997 00000C4D 67FF8B0F79795F626F- <1>
   997 00000C56 6F745F726561642E62- <1>
   997 00000C5F 7863E41779795F626F- <1>
   997 00000C68 6F745F7365656B5F63- <1>
   997 00000C71 757272656E742E6278- <1>
   997 00000C7A D55509736B6970636F- <1>
   997 00000C83 6D6D61E83A06697365- <1>
   997 00000C8C 6F6C3F03C309697373- <1>
   997 00000C95 7472696E673FDDB906- <1>
   997 00000C9E 63686B656F6C551205- <1>
   997 00000CA7 707574737ABABD0463- <1>
   997 00000CB0 6D643367B108747269- <1>
   997 00000CB9 6D70757473C5C60470- <1>
   997 00000CC2 757473849013697365- <1>
   997 00000CCB 6F6C3F2E6E6F747365- <1>
   997 00000CD4 6D69636F6C6F6EB212- <1>
   997 00000CDD 057365747263A45509- <1>
   997 00000CE6 736B6970636F6D6D30- <1>
   997 00000CEF F12309757070657263- <1>
   997 00000CF8 617365289004697370- <1>
   997 00000D01 6D629605496E444F53- <1>
   997 00000D0A A7AA056572726F7284- <1>
   997 00000D13 8107686578776F7264- <1>
   997 00000D1C 6FA20D707574736C69- <1>
   997 00000D25 6E655F63726C66D0BB- <1>
   997 00000D2E 1A636F70795F73696E- <1>
   997 00000D37 676C655F636F756E74- <1>
   997 00000D40 65645F737472696E67- <1>
   997 00000D49 986906696E7463686B- <1>
   997 00000D52 21300A63616C6C5F69- <1>
   997 00000D5B 6E743244B774087365- <1>
   997 00000D64 746573326478        <1>
   998 00000D6A 84E3086C696E655F6F- <1> 	link_data_dump_names LINK_DATA_NAMES
   998 00000D73 75742BC80B65787473- <1>
   998 00000D7C 65675F73697A65E7D3- <1>
   998 00000D85 0B6578747365675F75- <1>
   998 00000D8E 736564F6340C657874- <1>
   998 00000D97 646174615F73697A65- <1>
   998 00000DA0 B2400C657874646174- <1>
   998 00000DA9 615F75736564EB4208- <1>
   998 00000DB2 657874647373656CD5- <1>
   998 00000DBB 2D066578747365672A- <1>
   998 00000DC4 AE0765787464617461- <1>
   998 00000DCD FF7E076C696E6B7365- <1>
   998 00000DD6 6CFA7E076C696E6B73- <1>
   998 00000DDF 65672B850F6C696E6B- <1>
   998 00000DE8 696E666F6164647265- <1>
   998 00000DF1 73730F08106C6F6164- <1>
   998 00000DFA 5F646174615F6C6F77- <1>
   998 00000E03 657374899F0D696E74- <1>
   998 00000E0C 65726E616C666C6167- <1>
   998 00000E15 73C71C0A6578745F68- <1>
   998 00000E1E 616E646C6522291465- <1>
   998 00000E27 78745F66696E697368- <1>
   998 00000E30 2E62705F69735F7365- <1>
   998 00000E39 748274096C6F61645F- <1>
   998 00000E42 646174615ABC086F70- <1>
   998 00000E4B 74696F6E733768440E- <1>
   998 00000E54 6C696E6B63616C6C5F- <1>
   998 00000E5D 7461626C65F09E2274- <1>
   998 00000E66 72795F646562756767- <1>
   998 00000E6F 65725F616D69735F6D- <1>
   998 00000E78 756C7469706C65785F- <1>
   998 00000E81 6E756D626572CB510E- <1>
   998 00000E8A 696E7465726E616C66- <1>
   998 00000E93 6C61677334688C1561- <1>
   998 00000E9C 6D69735F6D756C7469- <1>
   998 00000EA5 706C65785F6E756D62- <1>
   998 00000EAE 6572                <1>
   999                              <1> %if ELDOTHER
  1000                              <1> 	link_data_dump_names LINK_OTHER_DATA_NAMES
  1001                              <1> %endif
  1002                              <1> 
  1003                              <1> lmsg:
  1004                              <1> %if _ELD_LINKER_PASSES
  1005                              <1> %if _ELDCALL_OPTIONAL
  1006                              <1> .warning_code_optional:		counted "Optional code link missing, hash="
  1007                              <1> %endif
  1008 00000EB0 214F7074696F6E616C- <1> .warning_data_optional:		counted "Optional data link missing, hash="
  1008 00000EB9 2064617461206C696E- <1>
  1008 00000EC2 6B206D697373696E67- <1>
  1008 00000ECB 2C20686173683D      <1>
  1009 00000ED2 1844617461206C696E- <1> .error_data:			counted "Data link missing, hash="
  1009 00000EDB 6B206D697373696E67- <1>
  1009 00000EE4 2C20686173683D      <1>
  1010 00000EEB 18436F6465206C696E- <1> .error_code:			counted "Code link missing, hash="
  1010 00000EF4 6B206D697373696E67- <1>
  1010 00000EFD 2C20686173683D      <1>
  1011 00000F04 0A682C206C6162656C- <1> .error.2:			counted "h, label ",'"'
  1011 00000F0D 2022                <1>
  1012                              <1> %endif
  1013                              <1> %if ELDOTHER
  1014                              <1> .no_other:		asciz "ELD linker: No other link info found!",13,10
  1015                              <1> .error_other:		asciz "ELD linker: Other link info unknown format!",13,10
  1016                              <1> %endif
  1017                              <1> 
  1018 00000F0F 00                  <1> 	align 16, db 0
  1120                                  
  1121                                  	align 16
  1122                                  code_size equ $ - code
  1123                                  
  1124                                  %if _ALIGNPAGE
  1125                                  LIBOFFSETUNALIGNED equ DATAOFFSET + data_size
  1126                                  	addsection ALIGNED, follows=DATA vstart=0
  1127                                  aligned:
  1128                                  	times (((512) - ((LIBOFFSETUNALIGNED) % (512))) % (512)) db 0
  1129                                  	endarea aligned
  1130                                  
  1131                                  LIBOFFSET equ LIBOFFSETUNALIGNED + aligned_size
  1132                                  	addsection LIB, follows=ALIGNED vstart=0
  1133                                  %else
  1134                                  LIBOFFSET equ DATAOFFSET + data_size
  1135                                  	addsection LIB, follows=DATA vstart=0
  1136                                  %endif
  1137                                  lib_start:
  1138                                  
  1139                                   %if _COMPRESSED
  1140                                    %if _XLD
  1141                                     %if _LZEXEDAT
  1142                                  	incbin "packlib.xlz"
  1143                                     %else
  1144                                  	incbin "packlib.xhs"
  1145                                     %endif
  1146                                    %else
  1147                                     %if _LZEXEDAT
  1148                                  	incbin "packlib.elz"
  1149                                     %else
  1150                                  	incbin "packlib.ehs"
  1151                                     %endif
  1152                                    %endif
  1153                                  lib_compressed_end:
  1154                                  length_to_truncate equ $ - lib_start + LIBOFFSET
  1155                                  
  1156                                  	align 16, db 0
  1157                                  
  1158                                  	addsection LIBDEPACKED, follows=LIB vstart=0
  1159                                  library_start_skip:
  1160                                   %endif
  1161                                  
  1162 00000CF0 <bin CF0h>-             dump_incbin INCBINLIST
  1162 00001D40 <bin 1050h>-       
  1162 000029D0 <bin C90h>-        
  1162 00003610 <bin C40h>-        
  1162 00004110 <bin B00h>-        
  1162 000059F0 <bin 18E0h>-       
  1162 00006580 <bin B90h>-        
  1162 000072C0 <bin D40h>-        
  1162 00008A30 <bin 1770h>-       
  1162 000096B0 <bin C80h>-        
  1162 0000B140 <bin 1A90h>-       
  1162 0000C350 <bin 1210h>-       
  1162 0000CD60 <bin A10h>-        
  1162 0000E0B0 <bin 1350h>-       
  1162 0000EEC0 <bin E10h>-        
  1162 0000FCD0 <bin E10h>-        
  1162 00011090 <bin 13C0h>-       
  1162 000121F0 <bin 1160h>-       
  1162 00012A30 <bin 840h>-        
  1162 00014120 <bin 16F0h>-       
  1162 00014960 <bin 840h>-        
  1162 00015150 <bin 7F0h>-        
  1162 00015D80 <bin C30h>-        
  1162 00017000 <bin 1280h>-       
  1162 00017AE0 <bin AE0h>-        
  1162 00019190 <bin 16B0h>-       
  1162 00019910 <bin 780h>-        
  1162 0001A7A0 <bin E90h>-        
  1162 0001B5C0 <bin E20h>-        
  1162 0001C710 <bin 1150h>-       
  1162 0001D3D0 <bin CC0h>-        
  1162 0001E080 <bin CB0h>-        
  1162 0001EC50 <bin BD0h>-        
  1162 0001F990 <bin D40h>-        
  1162 00020550 <bin BC0h>-        
  1162 00021350 <bin E00h>-        
  1162 00021FA0 <bin C50h>-        
  1162 00022BC0 <bin C20h>-        
  1162 00023500 <bin 940h>-        
  1162 00025BC0 <bin 26C0h>-       
  1162 00028550 <bin 2990h>-       
  1162 00029640 <bin 10F0h>-       
  1162 0002B9C0 <bin 2380h>-       
  1162 0002CB90 <bin 11D0h>-       
  1162 0002DF60 <bin 13D0h>-       
  1162 0002EAC0 <bin B60h>-        
  1162 0002F6D0 <bin C10h>-        
  1162 00030200 <bin B30h>-        
  1162 00030E10 <bin C10h>-        
  1162 000319F0 <bin BE0h>-        
  1162 00032130 <bin 740h>-        
  1162 00033740 <bin 1610h>-       
  1162 00034190 <bin A50h>-        
  1162 000350E0 <bin F50h>-        
  1162 00036690 <bin 15B0h>-       
  1162 000372D0 <bin C40h>-        
  1162 000385A0 <bin 12D0h>-       
  1162 00039520 <bin F80h>-        
  1162 0003A410 <bin EF0h>-        
  1162 0003B390 <bin F80h>-        
  1162 0003BFF0 <bin C60h>-        
  1162 0003BFF0 <bin 12B0h>        
  1163                                  library_end_skip:
  1164                                  
  1165                                   %if _COMPRESSED
  1166                                  	dd length_to_truncate
  1167                                   %endif
  1168                                  %endif
