     1                                  
     2                                  ; Public Domain
     3                                  
     4                                  ; test run command: ; .; .
     5                                  
     6                                  %include "lmacros3.mac"
     1                              <1> [list -]
    14                              <2> [list -]
    14                              <1> [list -]
     7                                  
     8                                  %assign _COMPRESSED 1
     9                                  
    10                                  %include "extlib.asm"
     1                              <1> 
     2                              <1> ; Public Domain
     3                              <1> 
     4                              <1> ; test run command: ; .; .
     5                              <1> 
     6                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
     7                              <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"
     1                              <3> [list -]
    19                              <2> 
    20                              <2> 		; ELD executable header
    21                              <2> 	struc ELD_HEADER
    22 00000000 ????????            <2> eldhSignature:		resb 4	; "ELD1"
    23 00000004 ??????              <2> 			resb 3	; reserved
    24 00000007 ??                  <2> 			resb 1	; 26 (Ctrl-Z)
    25 00000008 ????????            <2> eldhCodeOffset:		resd 1	; position displacement from eldhSignature
    26 0000000C ????                <2> eldhCodeImageLength:	resw 1	; amount bytes, at least 32
    27 0000000E ????                <2> eldhCodeAllocLength:	resw 1	; amount bytes, added to prior. sum < 64 KiB
    28 00000010 ????????            <2> eldhDataOffset:		resd 1
    29 00000014 ????                <2> eldhDataImageLength:	resw 1	; (zero allowed)
    30 00000016 ????                <2> eldhDataAllocLength:	resw 1	; (zero allowed)
    31 00000018 ????                <2> eldhCodeEntrypoint:	resw 1	; within code section, used as displacement
    32 0000001A ????????            <2> eldhReserved:		resb 4	; reserved
    33 0000001E ????                <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 00000000 <res 20h>           <2> eldhxHeader:		resb ELD_HEADER_size
    39 00000020 ????????            <2> eldhxDescriptionOffset:	resd 1	; zero if none, from eldhxHeader. <= 128 Bytes
    40 00000024 ????????            <2> eldhxHelpOffset:	resd 1	; zero if none, from eldhxHeader
    41 00000028 ????????            <2> eldhxLibTable:		resd 1	; zero if none, from eldhxHeader
    42 0000002C ????????            <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 00000000 ????????????????    <2> eldthSignature:		resb 8	; "ELD1TAIL"
    48 00000008 ????????            <2> eldthHeaderOffset:	resd 1	; negative displacement from eldthSignature,
    49                              <2> 				;  add this dword to the seek offset
    50 0000000C ????                <2> eldthReserved:		resw 1	; reserved, must be initialised to zero
    51 0000000E ????                <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 00000000 ????                <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 00000002 ????                <2> eldltAmount:		resw 1
    62 00000004 ????????            <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 00000000 ????                <2> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    70 00000002 ????                <2> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    71 00000004 ????                <2> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    72 00000006 ????                <2> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    73 00000008 ????????????????    <2> eldiIdentifier:		resb 8	; blank-filled text
    74 00000010 ????                <2> eldiFlags:		resw 1	; flags
    75                              <2> eldiListing_size equ 14
    76 00000012 <res Eh>            <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 00000000 ????                <2> eldlSignature:		resw 1	; 0E1D1h
    85 00000002 ????????            <2> eldlReserved:		resw 2
    86 00000006 ????                <2> eldlUseLinkHash:	resw 1
    87 00000008 ????                <2> eldlDataAmount:		resw 1
    88 0000000A ????                <2> eldlDataPrefixes:	resw 1
    89 0000000C ????                <2> eldlDataEntries:	resw 1
    90 0000000E ????                <2> eldlDataAddresses:	resw 1
    91 00000010 ????                <2> eldlCodeAmount:		resw 1
    92 00000012 ????                <2> eldlCodePrefixes:	resw 1
    93 00000014 ????                <2> eldlCodeEntries:	resw 1
    94 00000016 ????                <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
     8                              <1> %include "eldcall.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug call 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 ELDCALL_MAC
    16                              <2> %define ELDCALL_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 "elddata.mac"
     1                              <3> %if 0
     2                              <3> 
     3                              <3> Extensions for lDebug data relocation macros
     4                              <3> 
     5                              <3> Copyright (C) 2008-2024 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 ELDDATA_MAC
    16                              <3> %define ELDDATA_MAC 1
    17                              <3> 
    18                              <3> %include "lmacros3.mac"
     1                              <4> [list -]
    19                              <3> %include "nasmhash.mac"
     1                              <4> 
     2                              <4> %if 0
     3                              <4> 
     4                              <4> Hashing macros
     5                              <4>  by E. C. Masloch, 2019
     6                              <4> 
     7                              <4> Usage of the works is permitted provided that this
     8                              <4> instrument is retained with the works, so that any entity
     9                              <4> that uses the works is notified of this instrument.
    10                              <4> 
    11                              <4> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <4> 
    13                              <4> %endif
    14                              <4> 
    15                              <4> %ifndef __NASMHASH_MAC__
    16                              <4> %assign __NASMHASH_MAC__ 1
    17                              <4> 
    18                              <4> 
    19                              <4> 	%macro hashdef 2+.nolist
    20                              <4> %ifempty %2
    21                              <4>  %assign _%1 1
    22                              <4> %else
    23                              <4> %ifstr %2
    24                              <4>  %define %%string %2
    25                              <4> %elifid %2
    26                              <4>  %defstr %%string %2
    27                              <4> %elifnum %2
    28                              <4>  %defstr %%string %2
    29                              <4> %eliftok %2
    30                              <4>  %defstr %%string %2
    31                              <4> %else
    32                              <4>  %error Unknown input
    33                              <4> %endif
    34                              <4> %strlen %%length %%string
    35                              <4> %assign %%hash 1
    36                              <4> %assign %%index 1
    37                              <4> %rep %%length
    38                              <4>  %substr %%char %%string %%index
    39                              <4>  %assign %%hash (%%hash * 31 + %%char) & 0FFFFh
    40                              <4>  %assign %%index %%index + 1
    41                              <4> %endrep
    42                              <4> %assign _%1 %%hash
    43                              <4> %endif
    44                              <4> 	%endmacro
    45                              <4> 
    46                              <4> 
    47                              <4> %endif
    20                              <3> %include "eldcheck.mac"
     1                              <4> %if 0
     2                              <4> 
     3                              <4> Extensions for lDebug relocation check macros
     4                              <4> 
     5                              <4> Copyright (C) 2008-2023 E. C. Masloch
     6                              <4> 
     7                              <4> Usage of the works is permitted provided that this
     8                              <4> instrument is retained with the works, so that any entity
     9                              <4> that uses the works is notified of this instrument.
    10                              <4> 
    11                              <4> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <4> 
    13                              <4> %endif
    14                              <4> 
    15                              <4> %ifndef ELDCHECK_MAC
    16                              <4> %define ELDCHECK_MAC 1
    17                              <4> 
    18                              <4> %assign ELDSTRICT 0
    19                              <4> %assign ELDSTRICTCOUNTER 0
    20                              <4> 
    21                              <4> 	%imacro eldstrict 1.nolist
    22                              <4> %ifidni %1, on
    23                              <4>  %assign ELDSTRICT 1
    24                              <4>  [warning +error=reloc-abs]
    25                              <4>  [warning +reloc-abs]
    26                              <4> %elifidni %1, off
    27                              <4>  %assign ELDSTRICT 0
    28                              <4>  [warning -reloc-abs]
    29                              <4> %else
    30                              <4>  %error Unknown keyword
    31                              <4> %endif
    32                              <4> 	%endmacro
    33                              <4> 
    34                              <4> 	%imacro reloc 1+.nolist
    35                              <4> %if ELDSTRICT
    36                              <4>  %if ELDSTRICTCOUNTER
    37                              <4>   %error Missing relocation
    38                              <4>  %endif
    39                              <4>  [warning -reloc-abs]
    40                              <4>  %assign ELDSTRICTCOUNTER 1
    41                              <4> %endif
    42                              <4> %1
    43                              <4> 	%endmacro
    44                              <4> 
    45                              <4> 	%imacro reloc2 1+.nolist
    46                              <4> %if ELDSTRICT
    47                              <4>  %if ELDSTRICTCOUNTER
    48                              <4>   %error Missing relocation
    49                              <4>  %endif
    50                              <4>  [warning -reloc-abs]
    51                              <4>  %assign ELDSTRICTCOUNTER 2
    52                              <4> %endif
    53                              <4> %1
    54                              <4> 	%endmacro
    55                              <4> 
    56                              <4> 	%imacro eldstrictcheck 0.nolist
    57                              <4> %if ELDSTRICT
    58                              <4>  %ifn ELDSTRICTCOUNTER
    59                              <4>   %error Unexpected relocation
    60                              <4>  %else
    61                              <4>   %assign ELDSTRICTCOUNTER ELDSTRICTCOUNTER - 1
    62                              <4>   %ifn ELDSTRICTCOUNTER
    63                              <4>    [warning +reloc-abs]
    64                              <4>   %endif
    65                              <4>  %endif
    66                              <4> %endif
    67                              <4> 	%endmacro
    68                              <4> 
    69                              <4> %endif
    70                              <4> 
    21                              <3> 
    22                              <3> 
    23                              <3> %assign ELDLINKER 0
    24                              <3> 
    25                              <3> %define INTERNAL_CODE_TO_CODE_RELOCATIONS ""
    26                              <3> %define INTERNAL_CODE_TO_DATA_RELOCATIONS ""
    27                              <3> %define INTERNAL_DATA_TO_CODE_RELOCATIONS ""
    28                              <3> %define INTERNAL_DATA_TO_DATA_RELOCATIONS ""
    29                              <3> %define INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS ""
    30                              <3> %define INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS ""
    31                              <3> %define INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS ""
    32                              <3> %define INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS ""
    33                              <3> %assign ELDDATA_OPTIONAL_STATUS 0		; not any seen yet
    34                              <3> %assign ELDDATA_PMREQUIRED_STATUS 0		; not any seen yet
    35                              <3> 
    36                              <3> 	%imacro internalcoderelocation 0-1.nolist -2
    37                              <3> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    38                              <3> %if ELDLINKER
    39                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    40                              <3>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    41                              <3>  %else
    42                              <3>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    43                              <3>  %endif
    44                              <3> %else
    45                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    46                              <3>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    47                              <3>  %else
    48                              <3>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    49                              <3>  %endif
    50                              <3> %endif
    51                              <3> 	eldstrictcheck
    52                              <3> 	%endmacro
    53                              <3> 
    54                              <3> 	%imacro internaldatarelocation 0-1.nolist -2
    55                              <3> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    56                              <3> %if ELDLINKER
    57                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    58                              <3>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    59                              <3>  %else
    60                              <3>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    61                              <3>  %endif
    62                              <3> %else
    63                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    64                              <3>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    65                              <3>  %else
    66                              <3>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    67                              <3>  %endif
    68                              <3> %endif
    69                              <3> 	eldstrictcheck
    70                              <3> 	%endmacro
    71                              <3> 
    72                              <3> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    73                              <3> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    74                              <3> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    75                              <3> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    76                              <3> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    77                              <3> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    78                              <3> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    79                              <3> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    80                              <3> 
    81                              <3> 
    82                              <3> %define LINK_DATA_RELOCATIONS ""
    83                              <3> %define LINK_LINKER_DATA_RELOCATIONS ""
    84                              <3> %define LINK_DATA_NAMES db ""
    85                              <3> %define LINK_DATA_DETECTION none, none
    86                              <3> 
    87                              <3> %define LINK_OTHER_DATA_RELOCATIONS ""
    88                              <3> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    89                              <3> %define LINK_OTHER_DATA_NAMES db ""
    90                              <3> %define LINK_OTHER_DATA_DETECTION none, none
    91                              <3> 
    92                              <3> %ifndef ELDOTHER
    93                              <3>  %assign ELDOTHER 0
    94                              <3> %endif
    95                              <3> %assign ELDOTHERLINK 0
    96                              <3> 
    97                              <3> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
    98                              <3> %if ELDOTHER
    99                              <3>  %assign ELDOTHERLINK 1
   100                              <3> %endif
   101                              <3> 	linkdatarelocation %1, %2, %3
   102                              <3> %assign ELDOTHERLINK 0
   103                              <3> 	%endmacro
   104                              <3> 
   105                              <3> 	%imacro linkdatarelocation 1-3.nolist -2, required
   106                              <3> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   107                              <3> %ifidni %3, required
   108                              <3>  %assign %%optional 0
   109                              <3> %elifidni %3, optional
   110                              <3>  %assign %%optional 100h
   111                              <3>  %if ELDDATA_OPTIONAL_STATUS == 0
   112                              <3>   %assign ELDDATA_OPTIONAL_STATUS 1
   113                              <3>  %elif ELDDATA_OPTIONAL_STATUS == 1
   114                              <3>  %else
   115                              <3>   %error Optional data link not allowed here
   116                              <3>  %endif
   117                              <3> %elifidni %3, PM required
   118                              <3>  %assign %%optional 300h
   119                              <3>  %assign ELDDATA_PMREQUIRED_STATUS 1
   120                              <3>  %if ELDDATA_OPTIONAL_STATUS == 0
   121                              <3>   %assign ELDDATA_OPTIONAL_STATUS 1
   122                              <3>  %elif ELDDATA_OPTIONAL_STATUS == 1
   123                              <3>  %else
   124                              <3>   %error Optional data link not allowed here
   125                              <3>  %endif
   126                              <3> %else
   127                              <3>  %fatal Unknown optional keyword
   128                              <3> %endif
   129                              <3> %ifidni _CURRENT_SECTION_TYPE, DATA
   130                              <3>  %assign %%DATASECTION 1
   131                              <3> %else
   132                              <3>  %assign %%DATASECTION 0
   133                              <3> %endif
   134                              <3> 	%if ELDOTHERLINK
   135                              <3> %if ELDLINKER
   136                              <3>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   137                              <3> %else
   138                              <3>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   139                              <3> %endif
   140                              <3> 	%else
   141                              <3> %if ELDLINKER
   142                              <3>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   143                              <3> %else
   144                              <3>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   145                              <3> %endif
   146                              <3> 	%endif
   147                              <3> %defstr %%string %1
   148                              <3> %strlen %%length %%string
   149                              <3> %if %%length > 64
   150                              <3>  %error Too long link name: %1
   151                              <3> %endif
   152                              <3> %define LINK_DATA_CHECK %1
   153                              <3> 	%if ELDOTHERLINK
   154                              <3> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   155                              <3> %if LINK_DATA_NEW
   156                              <3>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   157                              <3> 	hashdef HASH, %%string
   158                              <3>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   160                              <3> %else
   161                              <3>  %%name equ LINK_DATA_DUPLICATE
   162                              <3> %endif
   163                              <3> 	%else
   164                              <3> 	linkdata_detect LINK_DATA_DETECTION
   165                              <3> %if LINK_DATA_NEW
   166                              <3>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   167                              <3> 	hashdef HASH, %%string
   168                              <3>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   170                              <3> %else
   171                              <3>  %%name equ LINK_DATA_DUPLICATE
   172                              <3> %endif
   173                              <3> 	%endif
   174                              <3> 	eldstrictcheck
   175                              <3> 	%endmacro
   176                              <3> 
   177                              <3> 	%imacro linkdata_detect 2-*.nolist
   178                              <3> %assign LINK_DATA_NEW 1
   179                              <3> %rep (%0 - 2) / 2
   180                              <3>  %rotate 2
   181                              <3>  %ifidni %1, LINK_DATA_CHECK
   182                              <3>   %assign LINK_DATA_NEW 0
   183                              <3>   %xdefine LINK_DATA_DUPLICATE %2
   184                              <3>   %exitrep
   185                              <3>  %endif
   186                              <3> %endrep
   187                              <3> 	%endmacro
   188                              <3> 
   189                              <3> 	%imacro link_data_dump_names 1-*.nolist
   190                              <3> %rep %0
   191                              <3> 	%1
   192                              <3>  %rotate 1
   193                              <3> %endrep
   194                              <3> 	%endmacro
   195                              <3> 
   196                              <3> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   197                              <3> ; dw LINK_DATA_RELOCATIONS, 0, 0
   198                              <3> ; link_data_dump_names ELDCALL_CODE_NAMES
   199                              <3> 
   200                              <3> %endif
    21                              <2> 
    22                              <2> %assign ELDLINKER 0
    23                              <2> 
    24                              <2> [section relocatedzero nobits vstart=0]
    25                              <2> relocatedzero:
    26                              <2> __SECT__
    27                              <2> 
    28                              <2> 	numdef HOUDINI, 1
    29                              <2> 	numdef HOUDINI_CONDITIONAL, 1
    30                              <2> 
    31                              <2> %imacro houdini 0.nolist
    32                              <2> %if _HOUDINI
    33                              <2>  %if _HOUDINI_CONDITIONAL
    34                              <2> reloc	testopt [ss:relocateddata], 100h
    35                              <2> linkdatarelocation options7, -3
    36                              <2> 	jz %%skip
    37                              <2>  %endif
    38                              <2> reloc	testopt [ss:relocateddata], 100h
    39                              <2> linkdatarelocation internalflags6, -3
    40                              <2> 	jz %%skip
    41                              <2> 	int3
    42                              <2> %%skip:
    43                              <2> %endif
    44                              <2> %endmacro
    45                              <2> 
    46                              <2> %define ELDCALL_CODE_RELOCATIONS ""
    47                              <2> %define ELDCALL_LINKER_CODE_RELOCATIONS ""
    48                              <2> %define ELDCALL_CODE_RELOCATIONS_OPTIONAL ""
    49                              <2> %define ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ""
    50                              <2> %define ELDCALL_CODE_NAMES db ""
    51                              <2> %define ELDCALL_CODE_DETECTION none, none
    52                              <2> %assign ELDCALL_OPTIONAL_STATUS 0		; not any seen yet
    53                              <2> %assign ELDCALL_PMREQUIRED_STATUS 0		; not any seen yet
    54                              <2> 
    55                              <2> 	%imacro extcall 1-2.nolist required
    56                              <2> %ifidni _CURRENT_SECTION_TYPE, DATA
    57                              <2>  %error "ELD call cannot be used in ELD data block"
    58                              <2> %endif
    59                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP
    60                              <2> %ifidni %2, required
    61                              <2>  %assign %%optional 0
    62                              <2> %elifidni %2, optional
    63                              <2>  %assign %%optional 100h
    64                              <2>  %if ELDCALL_OPTIONAL_STATUS == 0
    65                              <2>   %assign ELDCALL_OPTIONAL_STATUS 1
    66                              <2>  %elif ELDCALL_OPTIONAL_STATUS == 1
    67                              <2>  %else
    68                              <2>   %error Optional code link not allowed here
    69                              <2>  %endif
    70                              <2> %elifidni %2, PM required
    71                              <2>  %assign %%optional 300h
    72                              <2>  %assign ELDCALL_PMREQUIRED_STATUS 1
    73                              <2>  %if ELDCALL_OPTIONAL_STATUS == 0
    74                              <2>   %assign ELDCALL_OPTIONAL_STATUS 1
    75                              <2>  %elif ELDCALL_OPTIONAL_STATUS == 1
    76                              <2>  %else
    77                              <2>   %error Optional code link not allowed here
    78                              <2>  %endif
    79                              <2> %else
    80                              <2>  %fatal Unknown optional keyword
    81                              <2> %endif
    82                              <2> %if 0
    83                              <2> [warning -reloc-rel-word]
    84                              <2> 	call near relocatedzero
    85                              <2> [warning +reloc-rel-word]
    86                              <2> %else
    87                              <2> 	db 0E8h
    88                              <2> reloc	dw relocatedzero
    89                              <2> 	eldstrictcheck
    90                              <2> %endif
    91                              <2> 	jmp strict short %%skipparameter
    92                              <2> 	dw 0
    93                              <2> %%skipparameter:
    94                              <2> %if ELDLINKER
    95                              <2>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS ELDCALL_LINKER_CODE_RELOCATIONS, %%entry, %%name
    96                              <2>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional, %%entry, %%name
    97                              <2> %else
    98                              <2>  %xdefine ELDCALL_CODE_RELOCATIONS ELDCALL_CODE_RELOCATIONS, %%entry, %%name
    99                              <2>  %xdefine ELDCALL_CODE_RELOCATIONS_OPTIONAL ELDCALL_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional, %%entry, %%name
   100                              <2> %endif
   101                              <2> %defstr %%string %1
   102                              <2> %strlen %%length %%string
   103                              <2> %if %%length > 64
   104                              <2>  %error Too long link name: %1
   105                              <2> %endif
   106                              <2> %define ELDCALL_CODE_CHECK %1
   107                              <2> 	linkcode_detect ELDCALL_CODE_DETECTION
   108                              <2> %if ELDCALL_CODE_NEW
   109                              <2>  %xdefine ELDCALL_CODE_DETECTION ELDCALL_CODE_DETECTION, %1, %%name
   110                              <2> 	hashdef HASH, %%string
   111                              <2> %xdefine ELDCALL_CODE_NAMES 	ELDCALL_CODE_NAMES, %%name:, dw _HASH, {counted %%string}
   113                              <2> %else
   114                              <2>  %%name equ ELDCALL_CODE_DUPLICATE
   115                              <2> %endif
   116                              <2> 	%endmacro
   117                              <2> 
   118                              <2> 	%imacro linkcode_detect 2-*.nolist
   119                              <2> %assign ELDCALL_CODE_NEW 1
   120                              <2> %rep (%0 - 2) / 2
   121                              <2>  %rotate 2
   122                              <2>  %ifidni %1, ELDCALL_CODE_CHECK
   123                              <2>   %assign ELDCALL_CODE_NEW 0
   124                              <2>   %xdefine ELDCALL_CODE_DUPLICATE %2
   125                              <2>   %exitrep
   126                              <2>  %endif
   127                              <2> %endrep
   128                              <2> 	%endmacro
   129                              <2> 
   130                              <2> 
   131                              <2> %define ELDCALL_CALLCALL_LIST none
   132                              <2> 
   133                              <2> 	%imacro extcallcall 1.nolist
   134                              <2> 	call %1
   135                              <2> %xdefine ELDCALL_CALLCALL_LIST ELDCALL_CALLCALL_LIST, %1
   136                              <2> 	%endmacro
   137                              <2> 
   138                              <2> %assign ELDCALLCALL_DUMPED 0
   139                              <2> 
   140                              <2> 	%imacro eldcall_dump_callcall 1-*.nolist
   141                              <2> %define ELDCALL_CALLCALL_PROCESSED none
   142                              <2>  %rep %0 - 1
   143                              <2>   %rotate 1
   144                              <2>   %define ELDCALL_CHECK %1
   145                              <2> 	eldcall_callcall_detect ELDCALL_CALLCALL_PROCESSED
   146                              <2>   %if ELDCALL_NEW
   147                              <2>    %xdefine ELDCALL_CALLCALL_PROCESSED ELDCALL_CALLCALL_PROCESSED, %1
   148                              <2> 	align 8, nop
   149                              <2> %1:
   150                              <2> 	extcall %1
   151                              <2> 	retn
   152                              <2>   %endif
   153                              <2>  %endrep
   154                              <2> %unimacro extcallcall 1.nolist
   155                              <2> %assign ELDCALLCALL_DUMPED 1
   156                              <2> %define ELDCALL_CALLCALL_LIST none
   157                              <2> 	%endmacro
   158                              <2> 
   159                              <2> 	%imacro eldcall_callcall_detect 1-*.nolist
   160                              <2> %assign ELDCALL_NEW 1
   161                              <2> %rep %0 - 1
   162                              <2>  %rotate 1
   163                              <2>  %ifidni %1, ELDCALL_CHECK
   164                              <2>   %assign ELDCALL_NEW 0
   165                              <2>   %exitrep
   166                              <2>  %endif
   167                              <2> %endrep
   168                              <2> 	%endmacro
   169                              <2> 
   170                              <2> 	%imacro eldcall_dump_names 1-*.nolist
   171                              <2> %rep %0
   172                              <2> 	%1
   173                              <2>  %rotate 1
   174                              <2> %endrep
   175                              <2> 	%endmacro
   176                              <2> 
   177                              <2> ; eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   178                              <2> ; if using optional code links:
   179                              <2> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
   180                              <2> ;  dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
   181                              <2> ; if not using optional code links:
   182                              <2> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
   183                              <2> ;  dw ELDCALL_CODE_RELOCATIONS, 0, 0
   184                              <2> ; eldcall_dump_names ELDCALL_CODE_NAMES
   185                              <2> 
   186                              <2> %endif
     9                              <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"
    19                              <2> %include "nasmhash.mac"
    20                              <2> %include "eldcheck.mac"
    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
    10                              <1> 
    11                              <1> 	numdef COMPRESSED, 0
    12                              <1> 	numdef COMPRESSLIB, 0
    13                              <1> %assign _ELDCOMPRESSED _COMPRESSED
    14                              <1> 	numdef ALIGNPAGE, 1
    15                              <1> 	excdef !_COMPRESSED, ALIGNPAGE
    16                              <1> 	numdef ELD_TEST_LIB, 0
    17                              <1>  	numdef ELD_ZERO_OFFSETS, 1
    18                              <1> 
    19                              <1> %assign _DEBUG 1
    20                              <1> %assign _CATCHINT0C 0
    21                              <1> %assign _CATCHINT0D 0
    22                              <1> %assign _CATCHINTFAULTCOND 0
    23                              <1> %assign _DEBUG_COND 1
    24                              <1> %assign _DELAY_BEFORE_BP 0
    25                              <1> %assign _DHIGHLIGHT 0
    26                              <1> %assign _GETLINEHIGHLIGHT 0
    27                              <1> %assign _IMMASM 0
    28                              <1> %assign _INPUT_FILE_BOOT 0
    29                              <1> %assign _INPUT_FILE_HANDLES 0
    30                              <1> %assign _MS_0RANGE_COMPAT 0
    31                              <1> %assign _PM 0
    32                              <1> %assign _RH 0
    33                              <1> %assign _SYMBOLIC 0
    34                              <1> %assign _VXCHG 0
    35                              <1> %include "options.mac"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> lDebug options and internal flags
     5                              <2> 
     6                              <2> Copyright (C) 2008-2023 E. C. Masloch
     7                              <2> 
     8                              <2> Usage of the works is permitted provided that this
     9                              <2> instrument is retained with the works, so that any entity
    10                              <2> that uses the works is notified of this instrument.
    11                              <2> 
    12                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                              <2> 
    14                              <2> %endif
    15                              <2> 
    16                              <2> 
    17                              <2> dispregs32	equ	  1	; RX: 32-bit register display (R, T/P/G)
    18                              <2> traceints	equ	  2	; TM: trace into interrupts (T)
    19                              <2> cpdepchars	equ	  4	; allow dumping of CP-dependent characters (D, DX)
    20                              <2> fakeindos	equ	  8	; always assume InDOS flag non-zero (all)
    21                              <2> nonpagingdevice	equ	 10h	; disallow paged output with [more] prompt (all exc. P, T)
    22                              <2> 	; This option was never used anywhere:
    23                              <2> ; pagingdevice	equ	 20h	; allow paged output with [more] prompt (all exc. P, T)
    24                              <2> 				; paged output is by default on if the output device is StdOut, else off
    25                              <2> hexrn		equ	 40h	; display raw hexadecimal content of FPU registers (RN)
    26                              <2> ;novdd		equ	 80h	; don't use a registered NTVDM VDD (L, W)
    27                              <2> nondospaging	equ	100h	; paging: don't use DOS for input when waiting for a key
    28                              <2> opt1_86mnohlt	equ	200h	; (86 Mode:) HLT doesn't work, don't use it
    29                              <2> biosidles	equ	400h	; don't idle with HLT or Int2F.1680, only call BIOS Int16.00
    30                              <2> opt_usegetinput	equ	800h	; use getinput for int 21h interactive input
    31                              <2> use_si_units	equ    1000h	; in disp_*_size use SI units (kB = 1000, etc)
    32                              <2> use_jedec_units	equ    2000h	; in disp_*_size use JEDEC units (kB = 1024)
    33                              <2> enable_serial	equ    4000h	; enable serial I/O (preferred over DOS or BIOS terminal)
    34                              <2> int8_disable_serial equ	   8000h	; disable serial I/O when breaking due to intr8
    35                              <2> gg_do_not_skip_bp equ	 1_0000h	; gg: do not skip a breakpoint (bb or gg)
    36                              <2> gg_no_autorepeat equ	 2_0000h	; gg: do not auto-repeat
    37                              <2> tp_do_not_skip_bp equ	 4_0000h	; T/TP/P: do not skip a (bb) breakpoint
    38                              <2> gg_bb_hit_no_repeat equ	 8_0000h	; gg: do not auto-repeat after bb hit
    39                              <2> tp_bb_hit_no_repeat equ	10_0000h	; T/TP/P: do not auto-repeat after bb hit
    40                              <2> gg_unexpected_no_repeat equ 20_0000h	; gg: do not auto-repeat after unexpectedinterrupt
    41                              <2> tp_unexpected_no_repeat equ 40_0000h	; T/TP/P
    42                              <2> ss_no_dump:		equ 80_0000h
    43                              <2> %if _SYMBOLIC
    44                              <2> dd_no_blanks_sym:	equ 100_0000h
    45                              <2> zz_no_pm_xms:		equ 200_0000h
    46                              <2> %endif
    47                              <2> rr_disasm_no_rept:	equ 1000_0000h
    48                              <2> rr_disasm_no_show:	equ 2000_0000h
    49                              <2> opt_cmdline_quiet_input:equ 4000_0000h
    50                              <2> opt_cmdline_quiet_output:equ 8000_0000h
    51                              <2> %if _SYMBOLIC
    52                              <2> DEFAULTOPTIONS	equ zz_no_pm_xms
    53                              <2> %else
    54                              <2> DEFAULTOPTIONS	equ 0
    55                              <2> %endif
    56                              <2> 
    57                              <2> 
    58                              <2> opt2_db_header:		equ 1
    59                              <2> opt2_db_trailer:	equ 2
    60                              <2> opt2_dw_header:		equ 10h
    61                              <2> opt2_dw_trailer:	equ 20h
    62                              <2> opt2_dd_header:		equ 100h
    63                              <2> opt2_dd_trailer:	equ 200h
    64                              <2> opt2_getinput_dpmi:	equ 800h
    65                              <2> opt2_hh_compat:		equ 1000h
    66                              <2> opt2_getc_idle:		equ 2000h
    67                              <2> opt2_getc_idle_dpmi:	equ 4000h
    68                              <2> opt2_re_cancel_tpg:	equ 8000h
    69                              <2> opt2_nn_compat:		equ 1_0000h
    70                              <2> opt2_nn_capitalise:	equ 2_0000h
    71                              <2> %if _MS_0RANGE_COMPAT
    72                              <2> opt2_0range_compat:	equ 4_0000h
    73                              <2> %endif
    74                              <2> opt2_rr16_compat:	equ 8_0000h
    75                              <2> opt2_r_prompt_compat:	equ 10_0000h
    76                              <2> opt2_r_separate:	equ 20_0000h
    77                              <2> opt2_r_linebreak_always:equ 40_0000h
    78                              <2> opt2_dpminohlt:		equ 8000_0000h	; DPMI doesn't like hlt
    79                              <2> DEFAULTOPTIONS2	equ opt2_dw_header | opt2_dd_header | opt2_getc_idle_dpmi | opt2_dpminohlt
    80                              <2> 
    81                              <2> 
    82                              <2> opt3_tt_no_paging:	equ 1
    83                              <2> opt3_tp_no_paging:	equ 2
    84                              <2> opt3_pp_no_paging:	equ 4
    85                              <2> opt3_gg_no_paging:	equ 8
    86                              <2> opt3_silence_paging_set:equ 100h
    87                              <2> opt3_silence_paging_on:	equ 200h
    88                              <2> opt3_paging_rc:		equ 1000h
    89                              <2> opt3_paging_yy:		equ 2000h
    90                              <2> opt3_paging_re:		equ 4000h
    91                              <2> opt3_r_highlight_diff:	equ 10000h
    92                              <2> opt3_r_highlight_dumb:	equ 20000h
    93                              <2> opt3_r_highlight_full:	equ 40000h
    94                              <2> opt3_r_highlight_eip:	equ 80000h
    95                              <2> %if _PM
    96                              <2> opt3_ss_b_bit_set:	equ   10_0000h
    97                              <2>  %if _BREAK_INSTALLDPMI
    98                              <2> opt3_break_installdpmi:	equ   20_0000h
    99                              <2>  %endif
   100                              <2> %endif
   101                              <2> %if _DHIGHLIGHT
   102                              <2> opt3_d_highlight:	equ   80_0000h
   103                              <2> %endif
   104                              <2> %if _GETLINEHIGHLIGHT
   105                              <2> opt3_getline_highlight:	equ  100_0000h
   106                              <2> %endif
   107                              <2> opt3_no_idle_2F:	equ  200_0000h
   108                              <2> %if _DELAY_BEFORE_BP
   109                              <2> opt3_delay_before_bp:	equ  400_0000h
   110                              <2> %endif
   111                              <2> opt3_no_call_amis:	equ  800_0000h
   112                              <2> opt3_disable_autorepeat:equ 1000_0000h
   113                              <2> opt3_check_ctrlc_keyb:	equ 2000_0000h
   114                              <2> opt3_check_ctrlc_0bh:	equ 4000_0000h
   115                              <2> opt3_tsr_quit_leave_tf:	equ 8000_0000h
   116                              <2> 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                              <2> 
   120                              <2> 
   121                              <2> opt4_int_2F_hook:	equ 2
   122                              <2> opt4_int_08_hook:	equ 4
   123                              <2> opt4_int_2D_hook:	equ 8
   124                              <2> %if _CATCHINTFAULTCOND
   125                              <2> opt4_int_fault_hook:	equ 10h
   126                              <2> %endif
   127                              <2> opt4_int_serial_force:	equ 1_0000h
   128                              <2> opt4_int_2F_force:	equ 2_0000h
   129                              <2> opt4_int_08_force:	equ 4_0000h
   130                              <2> opt4_int_2D_force:	equ 8_0000h
   131                              <2> %if _CATCHINT0D
   132                              <2> opt4_int_0D_force:	equ   10_0000h
   133                              <2> %endif
   134                              <2> %if _CATCHINT0C
   135                              <2> opt4_int_0C_force:	equ   20_0000h
   136                              <2> %endif
   137                              <2> opt4_int_00_force:	equ  100_0000h
   138                              <2> opt4_int_01_force:	equ  200_0000h
   139                              <2> opt4_int_03_force:	equ  400_0000h
   140                              <2> opt4_int_06_force:	equ  800_0000h
   141                              <2> opt4_int_18_force:	equ 1000_0000h
   142                              <2> opt4_int_19_force:	equ 2000_0000h
   143                              <2> opt4_int_09_force:	equ 4000_0000h	; not used at the same time as 15h
   144                              <2> opt4_int_15_force:	equ 4000_0000h	; not used at the same time as 09h
   145                              <2> opt4_int_07_force:	equ 8000_0000h
   146                              <2> DEFAULTOPTIONS4 equ opt4_int_2F_hook
   147                              <2> 
   148                              <2> 
   149                              <2> %if _VXCHG
   150                              <2> opt6_vv_mode:		equ 1
   151                              <2> opt6_vv_keep:		equ 2
   152                              <2> opt6_vv_int16:		equ 10h
   153                              <2>  %if _VXCHG_DEFAULT_ON
   154                              <2> DEFAULTOPTIONS6 equ opt6_share_serial_irq | opt6_vv_mode
   155                              <2>  %else
   156                              <2> DEFAULTOPTIONS6 equ opt6_share_serial_irq
   157                              <2>  %endif
   158                              <2> %else
   159                              <2> DEFAULTOPTIONS6 equ opt6_share_serial_irq
   160                              <2> %endif
   161                              <2> %if _DEBUG
   162                              <2> opt6_debug_exception_late:	equ  20h
   163                              <2> opt6_debug_exception_early:	equ  40h
   164                              <2>  %if _DEBUG_COND
   165                              <2> opt6_debug_exception:	equ  80h
   166                              <2> opt6_debug_mode:	equ 100h
   167                              <2>  %endif
   168                              <2> %endif
   169                              <2> opt6_bios_output:	equ 200h
   170                              <2> opt6_flat_binary:	equ 400h
   171                              <2> opt6_big_stack:		equ 800h
   172                              <2> opt6_40_columns:	equ 1000h
   173                              <2> opt6_40_indent_odd:	equ 2000h
   174                              <2> opt6_40_dash:		equ 4000h
   175                              <2> opt6_share_serial_irq:	equ 1_0000h
   176                              <2> opt6_serial_EOI_call:	equ 2_0000h
   177                              <2> %if _RH
   178                              <2> opt6_rh_mode:		equ 10_0000h
   179                              <2> %endif
   180                              <2> %if _DEBUG
   181                              <2> opt6_debug_putrunint_early:	equ  40_0000h
   182                              <2>  %if _DEBUG_COND
   183                              <2> opt6_debug_putrunint:		equ  80_0000h
   184                              <2>  %endif
   185                              <2> %endif
   186                              <2> opt6_bios_io:		equ 100_0000h
   187                              <2> opt6_immasm_display_uu:	equ 200_0000h
   188                              <2> opt6_immasm_debug:	equ 400_0000h
   189                              <2> opt6_immasm_flag:	equ 800_0000h
   190                              <2> opt6_immasm_nobranch:	equ 1000_0000h
   191                              <2> opt6_r_flags_style2:	equ 2000_0000h
   192                              <2> opt6_r_flags_style3:	equ 4000_0000h
   193                              <2> opt6_r_linebreak_conditional:	equ 8000_0000h
   194                              <2> 
   195                              <2> 
   196                              <2> DEFAULTOPTIONS7 equ opt7_no_tsr_ll
   197                              <2> opt7_no_free_oneshot_eld:	equ 1
   198                              <2> opt7_debug_optional_link:	equ 2
   199                              <2> opt7_quiet_install:		equ 4
   200                              <2> opt7_quick_run:			equ 8
   201                              <2> opt7_houdini:			equ 100h
   202                              <2> opt7_no_ensure:			equ 1000h
   203                              <2> opt7_no_tsr_ll:			equ 2000h
   204                              <2> 
   205                              <2> 
   206                              <2> oldpacket	equ	  1	; Int25/Int26 packet method available (L, W)
   207                              <2> newpacket	equ	  2	; Int21.7305 packet method available (L, W)
   208                              <2> ntpacket	equ	  4	; VDD registered and usable (L, W)
   209                              <2> pagedcommand	equ	  8	; allows paging in puts
   210                              <2> notstdinput	equ	 10h	; DEBUG's StdIn isn't a device with StdIn bit (is file or other device)
   211                              <2> inputfile	equ	 20h	; DEBUG's StdIn is a file, notstdinput also set
   212                              <2> notstdoutput	equ	 40h	; DEBUG's StdOut isn't a device with StdOut bit (is file or other device)
   213                              <2> outputfile	equ	  80h	; DEBUG's StdOut is a file, notstdoutput also set
   214                              <2> hooked2F	equ	 100h	; Int2F hooked
   215                              <2> nohook2F	equ	 200h	; don't hook Int2F.1687 (required for Win9x, DosEmu?)
   216                              <2> unused_dif1_dpminohlt equ 400h	; DPMI doesn't like hlt
   217                              <2> protectedmode	equ	 800h	; in (DPMI) protected mode
   218                              <2> debuggeeA20	equ	1000h	; state of debuggee's A20
   219                              <2> debuggerA20	equ	2000h	; state of debugger's A20 (will be on if possible)
   220                              <2> nodosloaded	equ	4000h	; No DOS loaded currently (Boot loader mode)
   221                              <2> has386		equ	8000h	; CPU is a 386
   222                              <2> usecharcounter	equ    1_0000h	; don't reset charcounter between calls to puts
   223                              <2> runningnt	equ    2_0000h	; running in NTVDM
   224                              <2> canswitchmode	equ    4_0000h	; can switch modes (auxbuff large enough, DPMI mode switch set up)
   225                              <2> modeswitched	equ    8_0000h	; switched mode (now in the mode that we weren't entered in)
   226                              <2> promptwaiting	equ   10_0000h	; puts: any more output needs to display a prompt first
   227                              <2> switchbuffer	equ   20_0000h	; mode switch needs a buffer (auxbuff)
   228                              <2> tsrmode		equ   40_0000h	; in TSR mode; DPI and DPP not valid
   229                              <2> attachedterm	equ   80_0000h	; the attached process terminated
   230                              <2> runningdosemu	equ  100_0000h	; running in dosemu
   231                              <2> ; load_is_ldp	equ  200_0000h	; boot load: partition specified as "ldp"
   232                              <2> tt_while:	equ  400_0000h	; tt: while condition specified
   233                              <2> tt_p:		equ  800_0000h	; tt: proceed past repeated string instructions
   234                              <2> tt_silent_mode:	equ 1000_0000h	; tt: run should be silent (dump at end)
   235                              <2> tt_silence:	equ 2000_0000h	; tt: silent writing (write to auxbuff instead)
   236                              <2> tt_no_bb:	equ 4000_0000h	; tt: do not use bb breakpoints
   237                              <2> tt_no_bb_first:	equ 8000_0000h	; tt: do not use bb breakpoints at first
   238                              <2> 
   239                              <2> 
   240                              <2> dif2_gg_is_first:	equ   1
   241                              <2> dif2_gg_skip_non_cseip:	equ   2
   242                              <2> dif2_gg_skip_cseip:	equ   4
   243                              <2> dif2_gg_is_gg:		equ   8
   244                              <2> dif2_gg_first_detected:	equ  10h
   245                              <2> dif2_gg_again:		equ  20h
   246                              <2> dif2_tpg_proceed_bp_set:equ  40h
   247                              <2> dif2_tpg_keep_proceed_bp: equ 80h
   248                              <2> dif2_tpg_have_bp:	equ 100h
   249                              <2> dif2_tpg_adjusted_cseip:equ 200h
   250                              <2> dif2_tpg_do_not_adjust:	equ 400h
   251                              <2> dif2_bp_failure:	equ 800h
   252                              <2> dif2_is_pp:		equ 1000h
   253                              <2> %if _SYMBOLIC
   254                              <2> dif2_createdprocess:	equ 800_0000h	; created empty debuggee process
   255                              <2> dif2_sym_req_xms:	equ 2000h
   256                              <2> dif2_sym_req_86mm:	equ 4000h
   257                              <2> dif2_sym_req_mask equ dif2_sym_req_86mm | dif2_sym_req_xms
   258                              <2> dif2_no_pm_xms:		equ 1_0000h
   259                              <2> dif2_xms_detection_done:equ 2_0000h
   260                              <2> %endif
   261                              <2> %if _INPUT_FILE_HANDLES
   262                              <2> dif2_input_file:	equ 10_0000h
   263                              <2> dif2_closed_input_file:	equ 20_0000h
   264                              <2> %endif
   265                              <2> dif2_did_getline_file:	equ 40_0000h
   266                              <2> %if _SYMBOLIC
   267                              <2> dif2_poison:		equ 80_0000h
   268                              <2> %endif
   269                              <2> dif2_boot_loaded_kernel:equ 100_0000h
   270                              <2> %if _INPUT_FILE_BOOT
   271                              <2> dif2_input_file_boot:	equ 200_0000h
   272                              <2> dif2_closed_input_file_boot:	equ 400_0000h
   273                              <2> %endif
   274                              <2> dif2_in_silence_dump:	equ 1000_0000h
   275                              <2> dif2_int31_segment:	equ 2000_0000h
   276                              <2> dif2_nn_compat:		equ 4000_0000h
   277                              <2> dif2_nn_capitalise:	equ 8000_0000h
   278                              <2> 
   279                              <2> 
   280                              <2> dif3_load_is_ldp:	equ 1	; boot load: partition specified as "ldp"
   281                              <2> dif3_load_is_sdp:	equ 2	; boot load: partition specified as "sdp"
   282                              <2> dif3_load_is_ydp:	equ 4	; boot load: partition specified as "ydp"
   283                              <2> dif3_load_is_dp:	equ dif3_load_is_ldp 				| dif3_load_is_sdp 				| dif3_load_is_ydp
   286                              <2> dif3_load_dir_dir:	equ 8
   287                              <2> dif3_input_terminal_override:	equ 10h
   288                              <2> dif3_input_serial_override:	equ 20h
   289                              <2> dif3_if_not:		equ 40h
   290                              <2> dif3_partition_changed:	equ 80h
   291                              <2> ;
   292                              <2> dif3_input_cmdline:	equ 100h; input reading from cmdline_buffer
   293                              <2> dif3_input_cmdline_closed: equ 200h
   294                              <2> dif3_at_line_end:	equ 400h
   295                              <2> dif3_quiet_input_single:equ 800h
   296                              <2> dif3_quiet_output:	equ 1000h
   297                              <2> dif3_unquiet_error:	equ 2000h
   298                              <2> dif3_unquiet_prompt:	equ 4000h
   299                              <2> dif3_unquiet:		equ dif3_unquiet_error | dif3_unquiet_prompt
   300                              <2> dif3_return_eof:	equ 8000h
   301                              <2> dif3_highlighting:	equ 1_0000h
   302                              <2> dif3_do_not_highlight:	equ 2_0000h
   303                              <2> dif3_int10_highlight:	equ 2_0000h
   304                              <2> dif3_nosymbols_1:	equ 4_0000h
   305                              <2> dif3_nosymbols_2:	equ 8_0000h
   306                              <2> %if _PM
   307                              <2> dif3_ss_b_bit_set:	equ  10_0000h
   308                              <2> %endif
   309                              <2> dif3_gotint19:		equ  20_0000h
   310                              <2> dif3_prior_pm:		equ  40_0000h
   311                              <2> %if _DELAY_BEFORE_BP
   312                              <2> dif3_delayed		equ  80_0000h
   313                              <2> %endif
   314                              <2> dif3_input_re:		equ 100_0000h	; input reading from re_buffer
   315                              <2> dif3_input_re_closed:	equ 200_0000h
   316                              <2> dif3_accept_getrange_0:	equ 400_0000h
   317                              <2> %if _INPUT_FILE_HANDLES || _INPUT_FILE_BOOT
   318                              <2> dif3_in_if:		equ 800_0000h
   319                              <2> %endif
   320                              <2> dif3_auxbuff_guarded_1:	equ 1000_0000h
   321                              <2> dif3_auxbuff_guarded_2:	equ 2000_0000h
   322                              <2> dif3_auxbuff_guarded_3:	equ 4000_0000h
   323                              <2> dif3_sss_is_reverse:	equ 8000_0000h
   324                              <2> 
   325                              <2> 
   326                              <2> dif4_int_serial_hooked:	equ 1
   327                              <2> dif4_int_2F_hooked:	equ 2
   328                              <2> dif4_int_08_hooked:	equ 4
   329                              <2> dif4_int_2D_hooked:	equ 8
   330                              <2> %if _CATCHINTFAULTCOND && _CATCHINT0D
   331                              <2> dif4_int_0D_hooked:	equ 10h
   332                              <2> %endif
   333                              <2> %if _CATCHINTFAULTCOND && _CATCHINT0C
   334                              <2> dif4_int_0C_hooked:	equ 20h
   335                              <2> %endif
   336                              <2> 
   337                              <2> 
   338                              <2> %if _VXCHG
   339                              <2> dif6_vv_mode:		equ 1
   340                              <2> %endif
   341                              <2> dif6_in_hook2F:		equ 2
   342                              <2> dif6_in_amis_hook2F:	equ 4
   343                              <2> dif6_debug_mode:	equ 100h
   344                              <2> dif6_locked:		equ 200h
   345                              <2> %if _RH
   346                              <2> dif6_rh_mode_was:	equ  8_0000h
   347                              <2> dif6_rh_mode:		equ 10_0000h
   348                              <2> dif6_rh_mode_2:		equ 20_0000h
   349                              <2> %endif
   350                              <2> dif6_device_mode:	equ 40_0000h
   351                              <2> dif6_cpdepchars:	equ 80_0000h
   352                              <2> %if _IMMASM
   353                              <2> dif6_immasm_no_output:	equ 100_0000h
   354                              <2> dif6_immasm:		equ 200_0000h
   355                              <2> dif6_immasm_rel8:	equ 400_0000h
   356                              <2> %endif
   357                              <2> 
   358                              <2> 
   359                              <2> disasm_lowercase	equ 1
   360                              <2> disasm_commablank	equ 2
   361                              <2> disasm_nasm		equ 4
   362                              <2> disasm_lowercase_refmem:equ 8
   363                              <2> disasm_show_short:	equ 10h
   364                              <2> disasm_show_near:	equ 20h
   365                              <2> disasm_show_far:	equ 40h
   366                              <2> disasm_nec:		equ 80h
   367                              <2> disasm_40_columns:	equ 100h
   368                              <2> disasm_no_indent:	equ 200h
   369                              <2> disasm_msdebug_mnemonofs: equ 400h
   370                              <2> disasm_a16_memref:	equ 1000h
   371                              <2> disasm_a32_memref:	equ 2000h
   372                              <2> disasm_a16_string:	equ 4000h
   373                              <2> disasm_a32_string:	equ 8000h
   374                              <2> disasm_hide_modrm:	equ 10000h
   375                              <2> disasm_asize_loop_nasm:	equ 20000h
   376                              <2> disasm_modrm_always:	equ 40000h
   377                              <2> DEFAULTASMOPTIONS equ disasm_lowercase|disasm_commablank|disasm_nasm 	| disasm_a16_memref | disasm_a32_memref 	| disasm_a16_string | disasm_a32_string
    36                              <1> 
    37                              <1> %include "iniload.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> lDebug iniload/boot interfacing structs and macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2023 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> 
    16                              <2> 	struc BS
    17 00000000 ??????              <2> bsJump:	resb 3
    18 00000003 ????????????????    <2> bsOEM:	resb 8
    19                              <2> bsBPB:
    20                              <2> 	endstruc
    21                              <2> 
    22                              <2> 	struc EBPB		;        BPB sec
    23 00000000 ????                <2> bpbBytesPerSector:	resw 1	; offset 00h 0Bh
    24 00000002 ??                  <2> bpbSectorsPerCluster:	resb 1	; offset 02h 0Dh
    25 00000003 ????                <2> bpbReservedSectors:	resw 1	; offset 03h 0Eh
    26 00000005 ??                  <2> bpbNumFATs:		resb 1	; offset 05h 10h
    27 00000006 ????                <2> bpbNumRootDirEnts:	resw 1	; offset 06h 11h -- 0 for FAT32
    28 00000008 ????                <2> bpbTotalSectors:	resw 1	; offset 08h 13h
    29 0000000A ??                  <2> bpbMediaID:		resb 1	; offset 0Ah 15h
    30 0000000B ????                <2> bpbSectorsPerFAT:	resw 1	; offset 0Bh 16h -- 0 for FAT32
    31 0000000D ????                <2> bpbCHSSectors:		resw 1	; offset 0Dh 18h
    32 0000000F ????                <2> bpbCHSHeads:		resw 1	; offset 0Fh 1Ah
    33 00000011 ????????            <2> bpbHiddenSectors:	resd 1	; offset 11h 1Ch
    34 00000015 ????????            <2> bpbTotalSectorsLarge:	resd 1	; offset 15h 20h
    35                              <2> bpbNew:				; offset 19h 24h
    36                              <2> 
    37 00000019 ????????            <2> ebpbSectorsPerFATLarge:	resd 1	; offset 19h 24h
    38 0000001D ????                <2> ebpbFSFlags:		resw 1	; offset 1Dh 28h
    39 0000001F ????                <2> ebpbFSVersion:		resw 1	; offset 1Fh 2Ah
    40 00000021 ????????            <2> ebpbRootCluster:	resd 1	; offset 21h 2Ch
    41 00000025 ????                <2> ebpbFSINFOSector:	resw 1	; offset 25h 30h
    42 00000027 ????                <2> ebpbBackupSector:	resw 1	; offset 27h 32h
    43 00000029 <res Ch>            <2> ebpbReserved:		resb 12	; offset 29h 34h
    44                              <2> ebpbNew:			; offset 35h 40h
    45                              <2> 	endstruc
    46                              <2> 
    47                              <2> 	struc BPBN		; ofs B16 S16 B32 S32
    48 00000000 ??                  <2> bpbnBootUnit:		resb 1	; 00h 19h 24h 35h 40h
    49 00000001 ??                  <2> 			resb 1	; 01h 1Ah 25h 36h 41h
    50 00000002 ??                  <2> bpbnExtBPBSignature:	resb 1	; 02h 1Bh 26h 37h 42h -- 29h for valid BPBN
    51 00000003 ????????            <2> bpbnSerialNumber:	resd 1	; 03h 1Ch 27h 38h 43h
    52 00000007 <res Bh>            <2> bpbnVolumeLabel:	resb 11	; 07h 20h 2Bh 3Ch 47h
    53 00000012 ????????????????    <2> bpbnFilesystemID:	resb 8	; 12h 2Bh 36h 47h 52h
    54                              <2> 	endstruc		; 1Ah 33h 3Eh 4Fh 5Ah
    55                              <2> 
    56                              <2> 	struc DIRENTRY
    57 00000000 ????????????????    <2> deName:		resb 8
    58 00000008 ??????              <2> deExt:		resb 3
    59 0000000B ??                  <2> deAttrib:	resb 1
    60 0000000C ??                  <2> dePlusSize:	resb 1
    61 0000000D ??????????????      <2> 		resb 7
    62 00000014 ????                <2> deClusterHigh:	resw 1
    63 00000016 ????                <2> deTime:		resw 1
    64 00000018 ????                <2> deDate:		resw 1
    65 0000001A ????                <2> deClusterLow:	resw 1
    66 0000001C ????????            <2> deSize:		resd 1
    67                              <2> 	endstruc
    68                              <2> 
    69                              <2> ATTR_READONLY	equ 1
    70                              <2> ATTR_HIDDEN	equ 2
    71                              <2> ATTR_SYSTEM	equ 4
    72                              <2> ATTR_VOLLABEL	equ 8
    73                              <2> ATTR_DIRECTORY	equ 10h
    74                              <2> ATTR_ARCHIVE	equ 20h
    75                              <2> 
    76                              <2> lsvclSignature		equ "CL"
    77                              <2> lsvclBufferLength	equ 256
    78                              <2> 
    79                              <2> 	struc LOADSTACKVARS, -10h
    80 FFFFFFF0 ????????            <2> lsvFirstCluster:	resd 1
    81 FFFFFFF4 ????????            <2> lsvFATSector:		resd 1
    82 FFFFFFF8 ????                <2> lsvFATSeg:		resw 1
    83 FFFFFFFA ????                <2> lsvLoadSeg:		resw 1
    84 FFFFFFFC ????????            <2> lsvDataStart:		resd 1
    85                              <2> 	endstruc
    86                              <2> 
    87                              <2> 	struc LOADDATA, LOADSTACKVARS - 10h
    88 FFFFFFE0 ????                <2> ldMemoryTop:	resw 1
    89 FFFFFFE2 ????                <2> ldLoadTop:	resw 1
    90 FFFFFFE4 ????                <2> ldSectorSeg:	resw 1
    91 FFFFFFE6 ??                  <2> ldFATType:	resb 1
    92                              <2> ldFlags:
    93 FFFFFFE7 ??                  <2> ldHasLBA:	resb 1
    94 FFFFFFE8 ????                <2> ldClusterSize:	resw 1
    95 FFFFFFEA ????                <2> ldParaPerSector:resw 1
    96                              <2> ldDirCluster:			; dword
    97                              <2> ldLoadingSeg:		; word
    98                              <2> ldQueryPatchValue:	; word
    99                              <2> lsvCommandLine:		; word
   100                              <2> .start:		equ $ - lsvclBufferLength
   101 FFFFFFEC ????                <2> .signature:	resw 1
   102                              <2> ldLoadUntilSeg:		; word
   103                              <2> lsvExtra:		; word
   104 FFFFFFEE ??                  <2> .partition:	resb 1	; byte
   105 FFFFFFEF ??                  <2> .flags:		resb 1	; byte
   106                              <2> 	endstruc
   107                              <2> 
   108                              <2> lsvefNoDataStart	equ 1
   109                              <2> lsvefPartitionNumber	equ 2
   110                              <2> 
   111                              <2> 	struc LOADCMDLINE, LOADDATA - lsvclBufferLength
   112                              <2> ldCommandLine:
   113 FFFFFEE0 <res 100h>          <2> .start:		resb lsvclBufferLength
   114                              <2> 	endstruc
   115                              <2> 
   116                              <2> ldfHasLBA:	equ 1
   117                              <2> ldfFATInvalid:	equ 2
   118                              <2> ldfFATBuffered:	equ 4
   119                              <2> 
   120                              <2> 	struc LOADDATA2, LOADDATA - 10h
   121 FFFFFFD0 ????????            <2> ldRootSector:		resd 1
   122 FFFFFFD4 ????                <2> ldEntriesPerSector:	resw 1
   123 FFFFFFD6 ????                <2> ldLastAvailableSector:	resw 1
   124 FFFFFFD8 ????                <2> ldParasLeft:		resw 1
   125 FFFFFFDA ????                <2> ldParasDone:		resw 1
   126                              <2> 	endstruc
   127                              <2> 
   128                              <2> 	struc LOADDATA3, LOADDATA2 - 10h
   129 FFFFFFC0 ????????            <2> ldMaxCluster:		resd 1
   130 FFFFFFC4 ????????            <2> ldFileSize:		resd 1
   131 FFFFFFC8 ????????            <2> ldCurrentCluster:	resd 1
   132 FFFFFFCC ????????            <2> ldCurrentSeek:		resd 1
   133                              <2> 	endstruc
   134                              <2> 
   135                              <2> 	struc LBAPACKET
   136 00000000 ????                <2> lpSize:		resw 1
   137 00000002 ????                <2> lpCount:	resw 1
   138 00000004 ????????            <2> lpBuffer:	resd 1
   139 00000008 ????????????????    <2> lpSector:	resq 1
   140                              <2> 	endstruc
   141                              <2> 
   142                              <2> 	struc PARTINFO
   143 00000000 ??                  <2> piBoot:		resb 1
   144 00000001 ??????              <2> piStartCHS:	resb 3
   145 00000004 ??                  <2> piType:		resb 1
   146 00000005 ??????              <2> piEndCHS:	resb 3
   147 00000008 ????????            <2> piStart:	resd 1
   148 0000000C ????????            <2> piLength:	resd 1
   149                              <2> 	endstruc
   150                              <2> 
   151                              <2> ptEmpty:		equ 0
   152                              <2> ptFAT12:		equ 1
   153                              <2> ptFAT16_16BIT_CHS:	equ 4
   154                              <2> ptExtendedCHS:		equ 5
   155                              <2> ptFAT16_CHS:		equ 6
   156                              <2> ptFAT32_CHS:		equ 0Bh
   157                              <2> ptFAT32:		equ 0Ch
   158                              <2> ptFAT16:		equ 0Eh
   159                              <2> ptExtended:		equ 0Fh
   160                              <2> ptLinux:		equ 83h
   161                              <2> ptExtendedLinux:	equ 85h
   162                              <2> 
   163                              <2> 
   164                              <2> 		; Flags of load_unit_flags
   165                              <2> lufForceCHS:		equ 1
   166                              <2> lufForceLBA:		equ 2
   167                              <2> lufForceGeometry:	equ 4
   168                              <2> luf_mask_writable equ lufForceCHS | lufForceLBA | lufForceGeometry
    38                              <1> 
    39                              <1> 	numdef XLD
    40                              <1> 
    41                              <1> %ifn _COMPRESSLIB
    42                              <1> 	cpu 8086
    43                              <1> 
    44                              <1> 	addsection RELOCATEDDATA, nobits vstart=_ELD_RELOC_VSTART
    45                              <1> relocateddata:
    46                              <1> 
    47                              <1> 	addsection HEADER, start=0
    48                              <1> 
    49                              <1> 	istruc ELD_HEADERX
    50                              <1> at eldhxHeader
    51                              <1> 		; ELD executable header
    52                              <1> 	istruc ELD_HEADER
    53 00000000 454C4431            <1> at eldhSignature,	db "ELD1"
    54 00000004 000000              <1> 			db 0,0,0
    55 00000007 1A                  <1> 			db 26
    56 00000008 50000000            <1> at eldhCodeOffset,	dd CODEOFFSET
    57 0000000C C012                <1> at eldhCodeImageLength,	dw code_size
    58 0000000E 0000                <1> at eldhCodeAllocLength,	dw 0
    59 00000010 10130000            <1> at eldhDataOffset,	dd DATAOFFSET
    60 00000014 5005                <1> at eldhDataImageLength,	dw data_size
    61 00000016 3012                <1> at eldhDataAllocLength,	dw total_data_size - data_size
    62 00000018 8809                <1> at eldhCodeEntrypoint,	dw linker - code
    63                              <1> at eldhReserved
    64 0000001A 00<rep 4h>2C00      <1> at eldhExtensionSize,	dw header_extension_end - $$
    65                              <1> 	iend
    66 00000020 [30000000]          <1> at eldhxDescriptionOffset,	dd description
    67 00000024 69170000            <1> at eldhxHelpOffset,		dd DATAOFFSET + msg.help - datastart
    68 00000028 10130000            <1> at eldhxLibTable,		dd DATAOFFSET + libtable - datastart
    69                              <1> PUT_ELDHX_DATETIME_OFFSET
    70                              <1> header_extension_end:
    71 0000002C 00<rep 4h>          <1> 	iend
    72                              <1> 
    73 00000030 455854204C49423A20- <1> description:		asciz "EXT LIB: library of ELDs."
    73 00000039 6C696272617279206F- <1>
    73 00000042 6620454C44732E00    <1>
    74                              <1> 
    75                              <1> 
    76 0000004A 00<rep 6h>          <1> 	align 16, db 0
    77                              <1> 
    78                              <1> CODEOFFSET equ $ - $$
    79                              <1> 	addsection CODE, follows=HEADER vstart=_ELD_CODE_VSTART
    80                              <1> %define CODEFIXUP - code + 0
    81                              <1> code:
    82                              <1> 		; ELD instance header
    83                              <1> 	istruc ELD_INSTANCE
    84                              <1> at eldiStartCode
    85 00000000 00<rep 2h>          <1> at eldiEndCode
    86 00000002 00<rep 2h>          <1> at eldiStartData
    87 00000004 00<rep 2h>          <1> at eldiEndData
    88 00000006 00<rep 2h>4558544C- <1> at eldiIdentifier,	fill 8, 32, db "EXTLIB"
    88 0000000C 494220<rep 2h>      <1>
    89 00000010 00<rep 2h>65787470- <1> at eldiListing,		asciz _ELD_LISTING
    89 00000016 616B2E6C737400      <1>
    90 0000001D 00<rep 3h>          <1> 	iend
    91                              <1> 
    92                              <1> start:
    93 00000020 16                  <1> 	push ss
    94 00000021 07                  <1> 	pop es
    95 00000022 E8EB08              <1> 	extcallcall skipcomma
    96 00000025 4E                  <1> 	dec si
    97 00000026 89F3                <1> 	mov bx, si
    98 00000028 AC                  <1> 	lodsb
    99 00000029 E8EC08              <1> 	extcallcall iseol?
   100 0000002C 8D74FF              <1> 	lea si, [si - 1]
   101 0000002F 740C                <1> 	je help
   102 00000031 BA[3C04]            <1> 	mov dx, msg.help_keyword
   103                              <1> internaldatarelocation
   104 00000034 E8E908              <1> 	extcallcall isstring?
   105 00000037 7404                <1> 	je help
   106                              <1> %if _COMPRESSED && _ELD_TEST_LIB
   107                              <1> 	mov dx, msg.test_keyword
   108                              <1> internaldatarelocation
   109                              <1> 	extcallcall isstring?
   110                              <1> 	je test
   111                              <1> %endif
   112 00000039 AC                  <1> 	lodsb
   113 0000003A E94001              <1> 	jmp getname
   114                              <1> 
   115                              <1> %if _COMPRESSED && _ELD_TEST_LIB
   116                              <1> test:
   117                              <1> 	xor cx, cx
   118                              <1> 	xor dx, dx
   119                              <1> 	call get_dxax_seek_lib_plus_cxdx
   120                              <1> 	jc .io_error
   121                              <1> 	mov word [libseek], ax
   122                              <1> internaldatarelocation
   123                              <1> 	mov word [libseek + 2], dx
   124                              <1> internaldatarelocation
   125                              <1> 
   126                              <1> 	mov cx, ELD_HEADERX_size
   127                              <1> 	sub sp, cx
   128                              <1> 
   129                              <1> 	xor ax, ax
   130                              <1> 	mov word [depackskip], ax
   131                              <1> internaldatarelocation
   132                              <1> 	mov word [depackskip + 2], ax
   133                              <1> internaldatarelocation
   134                              <1> 
   135                              <1> 	mov dx, sp
   136                              <1> 	call read_and_depack
   137                              <1> 	houdini
   138                              <1> 
   139                              <1> 	mov ax, (library_end_skip - library_start_skip - 16) & 0FFFFh
   140                              <1> 	mov dx, (library_end_skip - library_start_skip - 16) >> 16
   141                              <1> 
   142                              <1> 	mov word [depackskip], ax
   143                              <1> internaldatarelocation
   144                              <1> 	mov word [depackskip + 2], dx
   145                              <1> internaldatarelocation
   146                              <1> 
   147                              <1> 	mov cx, ELD_HEADERX_size
   148                              <1> 	mov dx, sp
   149                              <1> 	call read_and_depack
   150                              <1> 	houdini
   151                              <1> 	jc .io_error
   152                              <1> 	cmp cx, ax
   153                              <1> 	jne .io_error
   154                              <1> .io_error:
   155                              <1> 	mov word [depackskip], 30h
   156                              <1> internaldatarelocation -4
   157                              <1> 	mov word [depackskip + 2], 0
   158                              <1> internaldatarelocation -4
   159                              <1> 
   160                              <1> 	mov cx, 32
   161                              <1> 	mov dx, sp
   162                              <1> 	call read_and_depack
   163                              <1> 	houdini
   164                              <1> 
   165                              <1> 	extcallcall cmd3
   166                              <1> %endif
   167                              <1> 
   168                              <1> help:
   169 0000003D B90200              <1> 	mov cx, 2
   170 00000040 E8CD08              <1> 	extcallcall skipcomma
   171 00000043 E8D208              <1> 	extcallcall iseol?
   172 00000046 7426                <1> 	je .dispatch_eol
   173 00000048 4E                  <1> 	dec si
   174 00000049 49                  <1> 	dec cx
   175 0000004A BA[4104]            <1> 	mov dx, msg.describe_keyword
   176                              <1> internaldatarelocation
   177 0000004D E8D008              <1> 	extcallcall isstring?
   178 00000050 7418                <1> 	je .dispatch
   179                              <1> %if _COMPRESSED
   180 00000052 F616[F602]          <1> 	not byte [partialdepack]
   181                              <1> internaldatarelocation
   182                              <1> %endif
   183 00000056 BA[4A04]            <1> 	mov dx, msg.describex_keyword
   184                              <1> internaldatarelocation
   185 00000059 E8C408              <1> 	extcallcall isstring?
   186 0000005C 740C                <1> 	je .dispatch
   187 0000005E 49                  <1> 	dec cx
   188 0000005F BA[5404]            <1> 	mov dx, msg.wide_keyword
   189                              <1> internaldatarelocation
   190 00000062 E8BB08              <1> 	extcallcall isstring?
   191 00000065 7403                <1> 	je .dispatch
   192 00000067 E91609              <1> 	jmp error
   193                              <1> 
   194                              <1> .dispatch:
   195 0000006A AC                  <1> 	lodsb
   196 0000006B E8BA08              <1> 	extcallcall chkeol
   197                              <1> .dispatch_eol:
   198 0000006E BA[5904]            <1> 	mov dx, msg.help
   199                              <1> internaldatarelocation
   200 00000071 E8BC08              <1> 	extcallcall putsz
   201                              <1> 
   202 00000074 80F901              <1> 	cmp cl, 1
   203 00000077 7606                <1> 	jbe @F
   204 00000079 E8EC00              <1> 	call zerooffsets
   205 0000007C E8B908              <1> 	extcallcall cmd3
   206                              <1> 
   207                              <1> @@:
   208 0000007F 7431                <1> 	je describe
   209                              <1> 
   210                              <1> wide:
   211 00000081 BA[3405]            <1> 	mov dx, msg.list
   212                              <1> internaldatarelocation
   213 00000084 E8A908              <1> 	extcallcall putsz
   214                              <1> 
   215 00000087 BE[0C00]            <1> 	mov si, lib
   216                              <1> internaldatarelocation
   217 0000008A EB09                <1> 	jmp @F
   218                              <1> .loop:
   219 0000008C 81FF[4800]          <1> 	cmp di, relocateddata + 9 * 8
   220                              <1> linkdatarelocation line_out
   221 00000090 7206                <1> 	jb @FF
   222 00000092 E8AB08              <1> 	extcallcall trimputs
   223                              <1> @@:
   224 00000095 BF[0000]            <1> reloc	mov di, relocateddata
   225                              <1> linkdatarelocation line_out
   226                              <1> @@:
   227 00000098 8D7404              <1> 	lea si, [si + 4]
   228 0000009B B90800              <1> 	mov cx, 8
   229 0000009E F3A4                <1> 	rep movsb
   230 000000A0 B020                <1> 	mov al, 32
   231 000000A2 AA                  <1> 	stosb
   232                              <1> 
   233 000000A3 81FE[F402]          <1> 	cmp si, strict word lib_end
   234                              <1> internaldatarelocation
   235 000000A7 72E3                <1> 	jb .loop
   236 000000A9 E89408              <1> 	extcallcall trimputs
   237 000000AC E8B900              <1> 	call zerooffsets
   238 000000AF E88608              <1> 	extcallcall cmd3
   239                              <1> 
   240                              <1> 
   241                              <1> describe:
   242 000000B2 BA[3405]            <1> 	mov dx, msg.list
   243                              <1> internaldatarelocation
   244 000000B5 E87808              <1> 	extcallcall putsz
   245                              <1> 
   246 000000B8 31C9                <1> 	xor cx, cx
   247 000000BA 31D2                <1> 	xor dx, dx
   248 000000BC E86204              <1> 	call get_dxax_seek_lib_plus_cxdx
   249 000000BF 7303E93C04          <1> 	jc .io_error
   250 000000C4 A3[5805]            <1> 	mov word [libseek], ax
   251                              <1> internaldatarelocation
   252 000000C7 8916[5A05]          <1> 	mov word [libseek + 2], dx
   253                              <1> internaldatarelocation
   254                              <1> 
   255 000000CB BE[0C00]            <1> 	mov si, lib
   256                              <1> internaldatarelocation
   257                              <1> .loop:
   258 000000CE 8D5404              <1> 	lea dx, [si + 4]
   259 000000D1 B90800              <1> 	mov cx, 8
   260 000000D4 53                  <1> 	push bx
   261 000000D5 E87008              <1> 	extcallcall puts
   262 000000D8 5B                  <1> 	pop bx
   263 000000D9 BA[E703]            <1> 	mov dx, msg.between
   264                              <1> internaldatarelocation
   265 000000DC E85108              <1> 	extcallcall putsz
   266                              <1> 
   267                              <1> %if _COMPRESSED
   268 000000DF 8B04                <1> 	mov ax, word [si]
   269 000000E1 8B5402              <1> 	mov dx, word [si + 2]
   270                              <1> 
   271 000000E4 A3[5C05]            <1> 	mov word [eldheader], ax
   272                              <1> internaldatarelocation
   273 000000E7 8916[5E05]          <1> 	mov word [eldheader + 2], dx
   274                              <1> internaldatarelocation
   275                              <1> 
   276 000000EB A3[6005]            <1> 	mov word [depackskip], ax
   277                              <1> internaldatarelocation
   278 000000EE 8916[6205]          <1> 	mov word [depackskip + 2], dx
   279                              <1> internaldatarelocation
   280                              <1> %else
   281                              <1> 	mov dx, word [libseek]
   282                              <1> internaldatarelocation
   283                              <1> 	mov cx, word [libseek + 2]
   284                              <1> internaldatarelocation
   285                              <1> 
   286                              <1> 	add dx, word [si]
   287                              <1> 	adc cx, word [si + 2]
   288                              <1> 
   289                              <1> 	mov ax, 4200h
   290                              <1> 	call dos_or_boot_io
   291                              <1> 	jc .io_error
   292                              <1> 	mov word [eldheader], ax
   293                              <1> internaldatarelocation
   294                              <1> 	mov word [eldheader + 2], dx
   295                              <1> internaldatarelocation
   296                              <1> %endif
   297                              <1> 
   298 000000F2 B93000              <1> 	mov cx, ELD_HEADERX_size
   299 000000F5 29CC                <1> 	sub sp, cx
   300 000000F7 89E2                <1> 	mov dx, sp
   301                              <1> %if _COMPRESSED
   302 000000F9 E82006              <1> 	call read_and_depack
   303                              <1> %else
   304                              <1> 	mov ax, 3F00h
   305                              <1> 	call dos_or_boot_io
   306                              <1> %endif
   307 000000FC 7303E9FF03          <1> 	jc .io_error
   308 00000101 39C1                <1> 	cmp cx, ax
   309 00000103 7403E9F803          <1> 	jne .io_error
   310                              <1> 
   311 00000108 89E7                <1> 	mov di, sp
   312 0000010A 837D1E24            <1> 	cmp word [di + eldhExtensionSize], eldhxDescriptionOffset + 4
   313 0000010E 723D                <1> 	jb .nodesc
   314 00000110 8B4D22              <1> 	mov cx, word [di + eldhxDescriptionOffset + 2]
   315 00000113 8B5520              <1> 	mov dx, word [di + eldhxDescriptionOffset]
   316 00000116 89C8                <1> 	mov ax, cx
   317 00000118 09D0                <1> 	or ax, dx
   318 0000011A 7431                <1> 	jz .nodesc
   319                              <1> 
   320 0000011C B80042              <1> 	mov ax, 4200h
   321 0000011F 0316[5C05]          <1> 	add dx, word [eldheader]
   322                              <1> internaldatarelocation
   323 00000123 130E[5E05]          <1> 	adc cx, word [eldheader + 2]
   324                              <1> internaldatarelocation
   325                              <1> %if _COMPRESSED
   326 00000127 8916[6005]          <1> 	mov word [depackskip], dx
   327                              <1> internaldatarelocation
   328 0000012B 890E[6205]          <1> 	mov word [depackskip + 2], cx
   329                              <1> internaldatarelocation
   330                              <1> %else
   331                              <1> 	call dos_or_boot_io
   332                              <1> 	jc .io_error
   333                              <1> %endif
   334                              <1> 
   335 0000012F BF[0000]            <1> 	mov di, relocateddata
   336                              <1> linkdatarelocation line_out
   337 00000132 89FA                <1> 	mov dx, di
   338 00000134 31C0                <1> 	xor ax, ax
   339 00000136 B94000              <1> 	mov cx, words(128)
   340 00000139 F3AB                <1> 	rep stosw
   341 0000013B B17F                <1> 	mov cl, 127
   342                              <1> %if _COMPRESSED
   343 0000013D E8DC05              <1> 	call read_and_depack
   344                              <1> %else
   345                              <1> 	mov ax, 3F00h
   346                              <1> 	call dos_or_boot_io
   347                              <1> %endif
   348 00000140 7303E9BB03          <1> 	jc .io_error
   349                              <1> 	; cmp cx, ax
   350                              <1> 	; jne .io_error
   351                              <1> 
   352 00000145 E8E807              <1> 	extcallcall putsz
   353 00000148 BA[F903]            <1> 	mov dx, msg.linebreak
   354                              <1> internaldatarelocation
   355 0000014B EB03                <1> 	jmp @F
   356                              <1> .nodesc:
   357 0000014D BA[EA03]            <1> 	mov dx, msg.nodesc
   358                              <1> internaldatarelocation
   359                              <1> @@:
   360 00000150 E8DD07              <1> 	extcallcall putsz
   361 00000153 83C430              <1> 	add sp, ELD_HEADERX_size
   362 00000156 83C60C              <1> 	add si, 4 + 8
   363 00000159 81FE[F402]          <1> 	cmp si, strict word lib_end
   364                              <1> internaldatarelocation
   365 0000015D 7303E96CFF          <1> 	jb .loop
   366                              <1> 
   367                              <1> .io_error equ found.io_error
   368 00000162 E80300              <1> 	call zerooffsets
   369 00000165 E8D007              <1> 	extcallcall cmd3
   370                              <1> 
   371                              <1> 
   372                              <1> zerooffsets:
   373                              <1> %if _ELD_ZERO_OFFSETS
   374                              <1> 		; for debugging with eldcomp, zero the offsets
   375 00000168 31C0                <1> 	xor ax, ax
   376 0000016A BF[0400]            <1> 	mov di, ..@eldltOffset
   377                              <1> internaldatarelocation
   378 0000016D AB                  <1> 	stosw
   379 0000016E AB                  <1> 	stosw			; clear eldltOffset
   380                              <1>  %if _COMPRESSED
   381 0000016F AB                  <1> 	stosw
   382 00000170 AB                  <1> 	stosw			; clear libtab_compressed_length
   383                              <1>  %endif
   384                              <1> .loop:
   385 00000171 AB                  <1> 	stosw
   386 00000172 AB                  <1> 	stosw
   387 00000173 83C708              <1> 	add di, 8
   388 00000176 81FF[F402]          <1> 	cmp di, strict word lib_end
   389                              <1> internaldatarelocation
   390 0000017A 72F5                <1> 	jb .loop
   391                              <1> %endif
   392 0000017C C3                  <1> 	retn
   393                              <1> 
   394                              <1> 
   395                              <1> getname:
   396 0000017D 3C22                <1> 	cmp al, '"'
   397 0000017F 7419                <1> 	je quoted
   398 00000181 3C27                <1> 	cmp al, "'"
   399 00000183 7415                <1> 	je quoted
   400                              <1> unquoted:
   401 00000185 4E                  <1> 	dec si
   402                              <1> .loop:
   403 00000186 AC                  <1> 	lodsb
   404 00000187 3C20                <1> 	cmp al, 32
   405 00000189 7431                <1> 	je end
   406 0000018B 3C09                <1> 	cmp al, 9
   407 0000018D 742D                <1> 	je end
   408 0000018F 3C2C                <1> 	cmp al, ','
   409 00000191 7429                <1> 	je end
   410 00000193 E8BA07              <1> 	extcallcall iseol?.notsemicolon
   411 00000196 75EE                <1> 	jne .loop
   412 00000198 EB22                <1> 	jmp end
   413                              <1> 
   414                              <1> quoted:
   415 0000019A 43                  <1> 	inc bx
   416 0000019B 88C4                <1> 	mov ah, al
   417                              <1> .loop:
   418 0000019D AC                  <1> 	lodsb
   419 0000019E 38E0                <1> 	cmp al, ah
   420 000001A0 7414                <1> 	je end_quoted
   421 000001A2 E8AB07              <1> 	extcallcall iseol?.notsemicolon
   422 000001A5 75F6                <1> 	jne .loop
   423                              <1> unexpected_eol:
   424 000001A7 B8360E              <1> 	mov ax, 0E36h
   425 000001AA E8AB07              <1> 	extcallcall setrc
   426 000001AD BA[FC03]            <1> 	mov dx, msg.unexpected_eol
   427                              <1> internaldatarelocation
   428                              <1> putsz_cmd3:
   429 000001B0 E87D07              <1> 	extcallcall putsz
   430                              <1> cmd3_j:
   431 000001B3 E88207              <1> 	extcallcall cmd3
   432                              <1> 
   433                              <1> end_quoted:
   434 000001B6 8D4CFF              <1> 	lea cx, [si - 1]
   435 000001B9 AC                  <1> 	lodsb
   436 000001BA EB03                <1> 	jmp @F
   437                              <1> 
   438                              <1> end:
   439 000001BC 8D4CFF              <1> 	lea cx, [si - 1]
   440                              <1> @@:
   441 000001BF E89E07              <1> 	extcallcall skipcomm0
   442 000001C2 4E                  <1> 	dec si
   443                              <1> 
   444 000001C3 56                  <1> 	push si
   445 000001C4 29D9                <1> 	sub cx, bx
   446 000001C6 7503E92801          <1> 	jz notfound_invalid
   447                              <1> 
   448 000001CB 83F904              <1> 	cmp cx, 4
   449 000001CE 722A                <1> 	jb .notext
   450 000001D0 8D77FC              <1> 	lea si, [bx - 4]
   451 000001D3 01CE                <1> 	add si, cx
   452 000001D5 803C2E              <1> 	cmp byte [si], '.'
   453 000001D8 7520                <1> 	jne .notext
   454 000001DA 8B4402              <1> 	mov ax, word [si + 2]
   455 000001DD 25DFDF              <1> 	and ax, ~2020h
   456 000001E0 3D4C44              <1> 	cmp ax, "LD"
   457 000001E3 7515                <1> 	jne .notext
   458 000001E5 8A4401              <1> 	mov al, byte [si + 1]
   459 000001E8 24DF                <1> 	and al, ~20h
   460 000001EA 3C45                <1> 	cmp al, 'E'
   461 000001EC 7404                <1> 	je .ext
   462 000001EE 3C58                <1> 	cmp al, 'X'
   463 000001F0 7508                <1> 	jne .notext
   464                              <1> .ext:
   465 000001F2 83E904              <1> 	sub cx, 4
   466 000001F5 7503E9F900          <1> 	jz notfound_invalid
   467                              <1> .notext:
   468                              <1> 
   469 000001FA 83F908              <1> 	cmp cx, 8
   470 000001FD 7603E9F100          <1> 	ja notfound_invalid
   471 00000202 89DE                <1> 	mov si, bx
   472 00000204 BF[5005]            <1> 	mov di, namebuffer
   473                              <1> internaldatarelocation
   474 00000207 89CA                <1> 	mov dx, cx
   475                              <1> @@:
   476 00000209 AC                  <1> 	lodsb
   477 0000020A E85B07              <1> 	extcallcall uppercase
   478 0000020D AA                  <1> 	stosb
   479 0000020E E2F9                <1> 	loop @B
   480 00000210 F7DA                <1> 	neg dx
   481 00000212 83C208              <1> 	add dx, 8
   482 00000215 87CA                <1> 	xchg cx, dx
   483 00000217 B020                <1> 	mov al, 32
   484 00000219 F3AA                <1> 	rep stosb
   485 0000021B BF[5005]            <1> 	mov di, namebuffer
   486                              <1> internaldatarelocation
   487                              <1> 
   488                              <1> search_filename:
   489 0000021E BE[1000]            <1> 	mov si, lib + 4
   490                              <1> internaldatarelocation
   491                              <1> .loop:
   492 00000221 57                  <1> 	push di
   493 00000222 56                  <1> 	push si
   494 00000223 B90800              <1> 	mov cx, 8
   495                              <1> @@:
   496 00000226 AC                  <1> 	lodsb
   497 00000227 E83E07              <1> 	extcallcall uppercase
   498 0000022A AE                  <1> 	scasb
   499 0000022B 7502                <1> 	jne @F
   500 0000022D E2F7                <1> 	loop @B
   501                              <1> @@:
   502 0000022F 5E                  <1> 	pop si
   503 00000230 5F                  <1> 	pop di
   504 00000231 7503E9CC00          <1> 	je found
   505 00000236 83C60C              <1> 	add si, 8 + 4
   506 00000239 81FE[F402]          <1> 	cmp si, strict word lib_end
   507                              <1> internaldatarelocation
   508 0000023D 72E2                <1> 	jb .loop
   509                              <1> 
   510                              <1> search_instancename:
   511 0000023F 31C9                <1> 	xor cx, cx
   512 00000241 31D2                <1> 	xor dx, dx
   513 00000243 E8DB02              <1> 	call get_dxax_seek_lib_plus_cxdx
   514 00000246 7303E9B502          <1> 	jc .io_error
   515 0000024B A3[5805]            <1> 	mov word [libseek], ax
   516                              <1> internaldatarelocation
   517 0000024E 8916[5A05]          <1> 	mov word [libseek + 2], dx
   518                              <1> internaldatarelocation
   519                              <1> 
   520 00000252 BE[1000]            <1> 	mov si, lib + 4
   521                              <1> internaldatarelocation
   522                              <1> 
   523                              <1> .loop:
   524                              <1> %if _COMPRESSED
   525 00000255 8B44FC              <1> 	mov ax, word [si - 4]
   526 00000258 8B54FE              <1> 	mov dx, word [si - 4 + 2]
   527                              <1> 
   528 0000025B A3[6005]            <1> 	mov word [depackskip], ax
   529                              <1> internaldatarelocation
   530 0000025E 8916[6205]          <1> 	mov word [depackskip + 2], dx
   531                              <1> internaldatarelocation
   532                              <1> %else
   533                              <1> 	mov cx, word [si - 4 + 2]
   534                              <1> 	mov dx, word [si - 4]		; cx:dx = offset within lib section
   535                              <1> 	add dx, word [libseek]
   536                              <1> internaldatarelocation
   537                              <1> 	adc cx, word [libseek + 2]
   538                              <1> internaldatarelocation
   539                              <1> 	mov ax, 4200h
   540                              <1> 	call dos_or_boot_io
   541                              <1> 	jc .io_error
   542                              <1> %endif
   543                              <1> 
   544 00000262 A3[5C05]            <1> 	mov word [eldheader], ax
   545                              <1> internaldatarelocation
   546 00000265 8916[5E05]          <1> 	mov word [eldheader + 2], dx
   547                              <1> internaldatarelocation
   548                              <1> 
   549 00000269 B92000              <1> 	mov cx, ELD_HEADER_size
   550 0000026C 29CC                <1> 	sub sp, cx
   551 0000026E 89E2                <1> 	mov dx, sp
   552                              <1> %if _COMPRESSED
   553 00000270 E8A904              <1> 	call read_and_depack
   554                              <1> %else
   555                              <1> 	mov ax, 3F00h
   556                              <1> 	call dos_or_boot_io
   557                              <1> %endif
   558 00000273 7303E98802          <1> 	jc .io_error
   559 00000278 39C1                <1> 	cmp cx, ax
   560 0000027A 7403E98102          <1> 	jne .io_error
   561                              <1> 
   562 0000027F 89E7                <1> 	mov di, sp
   563 00000281 8B4D0A              <1> 	mov cx, word [di + eldhCodeOffset + 2]
   564 00000284 8B5508              <1> 	mov dx, word [di + eldhCodeOffset] ; cx:dx = offset within ELD
   565 00000287 0316[5C05]          <1> 	add dx, word [eldheader]
   566                              <1> internaldatarelocation
   567 0000028B 130E[5E05]          <1> 	adc cx, word [eldheader + 2]
   568                              <1> internaldatarelocation
   569                              <1> %if _COMPRESSED
   570 0000028F 8916[6005]          <1> 	mov word [depackskip], dx
   571                              <1> internaldatarelocation
   572 00000293 890E[6205]          <1> 	mov word [depackskip + 2], cx
   573                              <1> internaldatarelocation
   574                              <1> %else
   575                              <1> 	mov ax, 4200h
   576                              <1> 	call dos_or_boot_io
   577                              <1> 	jc .io_error
   578                              <1> %endif
   579                              <1> 
   580 00000297 89E2                <1> 	mov dx, sp
   581 00000299 B91000              <1> 	mov cx, eldiIdentifier + 8
   582                              <1> %if (eldiIdentifier + 8) > ELD_HEADER_size
   583                              <1>  %error Expected shorter instance header
   584                              <1> %endif
   585                              <1> %if _COMPRESSED
   586 0000029C E87D04              <1> 	call read_and_depack
   587                              <1> %else
   588                              <1> 	mov ax, 3F00h
   589                              <1> 	call dos_or_boot_io
   590                              <1> %endif
   591 0000029F 7303E95C02          <1> 	jc .io_error
   592 000002A4 39C1                <1> 	cmp cx, ax
   593 000002A6 7403E95502          <1> 	jne .io_error
   594                              <1> 
   595 000002AB 56                  <1> 	push si
   596 000002AC 8D7508              <1> 	lea si, [di + eldiIdentifier]
   597 000002AF BF[5005]            <1> 	mov di, namebuffer
   598                              <1> internaldatarelocation
   599                              <1> 
   600 000002B2 57                  <1> 	push di
   601 000002B3 B90800              <1> 	mov cx, 8
   602                              <1> @@:
   603 000002B6 AC                  <1> 	lodsb
   604 000002B7 E8AE06              <1> 	extcallcall uppercase
   605 000002BA AE                  <1> 	scasb
   606 000002BB 7502                <1> 	jne @F
   607 000002BD E2F7                <1> 	loop @B
   608                              <1> @@:
   609 000002BF 5F                  <1> 	pop di
   610 000002C0 5E                  <1> 	pop si
   611 000002C1 740E                <1> 	je .found
   612 000002C3 83C420              <1> 	add sp, ELD_HEADER_size
   613                              <1> 
   614 000002C6 83C60C              <1> 	add si, 8 + 4
   615 000002C9 81FE[F402]          <1> 	cmp si, strict word lib_end
   616                              <1> internaldatarelocation
   617 000002CD 7286                <1> 	jb .loop
   618 000002CF EB05                <1> 	jmp notfound
   619                              <1> 
   620                              <1> .found:
   621 000002D1 83C420              <1> 	add sp, ELD_HEADER_size
   622                              <1> 
   623                              <1> %ifn _COMPRESSED
   624                              <1> 	mov dx, word [eldheader]
   625                              <1> internaldatarelocation
   626                              <1> 	mov cx, word [eldheader + 2]
   627                              <1> internaldatarelocation
   628                              <1> 	mov ax, 4200h
   629                              <1> 	call dos_or_boot_io
   630                              <1> 	jc .io_error
   631                              <1> %endif
   632 000002D4 EB4C                <1> 	jmp found.header_variable
   633                              <1> 
   634                              <1> .io_error equ found.io_error
   635                              <1> 
   636                              <1> 
   637                              <1> notfound:
   638 000002D6 B8370E              <1> 	mov ax, 0E37h
   639 000002D9 E87C06              <1> 	extcallcall setrc
   640 000002DC BA[9703]            <1> 	mov dx, msg.notfound.1
   641                              <1> internaldatarelocation
   642 000002DF E84E06              <1> 	extcallcall putsz
   643 000002E2 89FA                <1> 	mov dx, di
   644 000002E4 B90800              <1> 	mov cx, 8
   645 000002E7 E85E06              <1> 	extcallcall puts
   646 000002EA BA[BB03]            <1> 	mov dx, msg.notfound.2
   647                              <1> internaldatarelocation
   648 000002ED E878FE              <1> 	call zerooffsets
   649 000002F0 E9BDFE              <1> 	jmp putsz_cmd3
   650                              <1> 
   651                              <1> notfound_invalid:
   652 000002F3 B8380E              <1> 	mov ax, 0E38h
   653 000002F6 E85F06              <1> 	extcallcall setrc
   654 000002F9 BA[C003]            <1> 	mov dx, msg.notfound.invalid
   655                              <1> internaldatarelocation
   656 000002FC E869FE              <1> 	call zerooffsets
   657 000002FF E9AEFE              <1> 	jmp putsz_cmd3
   658                              <1> 
   659                              <1> found:
   660                              <1> %if 0
   661                              <1> 	xor ax, ax
   662                              <1> 	retf
   663                              <1> %endif
   664                              <1> 
   665                              <1> %if _COMPRESSED
   666 00000302 31C9                <1> 	xor cx, cx
   667 00000304 31D2                <1> 	xor dx, dx
   668 00000306 E81802              <1> 	call get_dxax_seek_lib_plus_cxdx
   669 00000309 7303E9F201          <1> 	jc .io_error
   670 0000030E A3[5805]            <1> 	mov word [libseek], ax
   671                              <1> internaldatarelocation
   672 00000311 8916[5A05]          <1> 	mov word [libseek + 2], dx
   673                              <1> internaldatarelocation
   674                              <1> 
   675 00000315 8B54FE              <1> 	mov dx, word [si - 4 + 2]
   676 00000318 8B44FC              <1> 	mov ax, word [si - 4]		; dx:ax = offset within lib section
   677                              <1> %else
   678                              <1> 	mov cx, word [si - 4 + 2]
   679                              <1> 	mov dx, word [si - 4]		; cx:dx = offset within lib section
   680                              <1> 
   681                              <1> 	call get_dxax_seek_lib_plus_cxdx
   682                              <1> 	jc .io_error
   683                              <1> %endif
   684 0000031B A3[5C05]            <1> 	mov word [eldheader], ax
   685                              <1> internaldatarelocation
   686 0000031E 8916[5E05]          <1> 	mov word [eldheader + 2], dx
   687                              <1> internaldatarelocation
   688                              <1> .header_variable:
   689                              <1> 
   690                              <1> %assign _BOOTLDR 1
   691                              <1> %assign _APPLICATION 1
   692                              <1> %assign _DEVICE 1
   693                              <1> %assign _PM 1
   694                              <1> %define relocated(address) relocateddata
   695                              <1> %define doscall extcallcall _doscall
   696                              <1> %assign ELD 1
   697                              <1> %assign _DOSORBOOTIO 1
   698                              <1> 
   699                              <1> %include "loadeld.asm"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> lDebug load Extensions for lDebug
     5                              <2> 
     6                              <2> Copyright (C) 2008-2024 E. C. Masloch
     7                              <2> 
     8                              <2> Usage of the works is permitted provided that this
     9                              <2> instrument is retained with the works, so that any entity
    10                              <2> that uses the works is notified of this instrument.
    11                              <2> 
    12                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                              <2> 
    14                              <2> %endif
    15                              <2> 
    16                              <2> %if ELD
    17                              <2> %assign _ELDTRAILER 0
    18                              <2> 		numdef DOSORBOOTIO, 0
    19                              <2> 		numdef ELDCOMPRESSED, 0
    20                              <2> %else
    21                              <2> %assign _DOSORBOOTIO 0
    22                              <2> %assign _ELDCOMPRESSED 0
    23                              <2> 	push bp
    24                              <2> %endif
    25                              <2> 
    26                              <2> %if _ELDTRAILER
    27                              <2> 	xor ax, ax
    28                              <2> 	mov word [eldheader], ax
    29                              <2> internaldatarelocation
    30                              <2> 	mov word [eldheader + 2], ax
    31                              <2> internaldatarelocation
    32                              <2> 
    33                              <2> 	xchg cx, ax
    34                              <2> 	mov ax, 4202h
    35                              <2> 	xor dx, dx
    36                              <2> %if _BOOTLDR
    37                              <2>  %if _APPLICATION || _DEVICE
    38                              <2> 	testopt [relocated(internalflags)], nodosloaded
    39                              <2> linkdatarelocation internalflags, -3
    40                              <2> 	jz @F
    41                              <2>  %endif
    42                              <2> 	extcallcall yy_boot_seek_start.bx
    43                              <2> 	mov cx, word [load_data - LOADDATA2 + ldFileSize + 2]
    44                              <2> internaldatarelocation
    45                              <2> 	mov dx, word [load_data - LOADDATA2 + ldFileSize]
    46                              <2> internaldatarelocation
    47                              <2> 	extcallcall yy_boot_seek_current.bx
    48                              <2> 	mov dx, word [load_data - LOADDATA2 + ldCurrentSeek + 2]
    49                              <2> internaldatarelocation
    50                              <2> 	mov ax, word [load_data - LOADDATA2 + ldCurrentSeek]
    51                              <2> internaldatarelocation
    52                              <2>  %if _APPLICATION || _DEVICE
    53                              <2> 	jmp @FF
    54                              <2>  %endif
    55                              <2> %endif
    56                              <2> 
    57                              <2> @@:
    58                              <2> %if _APPLICATION || _DEVICE
    59                              <2> 	doscall
    60                              <2> %endif
    61                              <2> @@:
    62                              <2> 	jc .io_error
    63                              <2> 
    64                              <2> 	test dx, dx
    65                              <2> 	jnz @F
    66                              <2> 	cmp ax, ELD_HEADER_size + ELD_TRAILER_HEADER_size
    67                              <2> 	jb .no_trailer
    68                              <2> @@:
    69                              <2> 
    70                              <2> 	mov ax, 4201h
    71                              <2> 	mov cx, -1
    72                              <2> 	mov dx, - ELD_TRAILER_HEADER_size
    73                              <2> %if _BOOTLDR
    74                              <2>  %if _APPLICATION || _DEVICE
    75                              <2> 	testopt [relocated(internalflags)], nodosloaded
    76                              <2> linkdatarelocation internalflags, -3
    77                              <2> 	jz @F
    78                              <2>  %endif
    79                              <2> 	extcallcall yy_boot_seek_current.bx
    80                              <2> 	mov dx, word [load_data - LOADDATA2 + ldCurrentSeek + 2]
    81                              <2> internaldatarelocation
    82                              <2> 	mov ax, word [load_data - LOADDATA2 + ldCurrentSeek]
    83                              <2> internaldatarelocation
    84                              <2>  %if _APPLICATION || _DEVICE
    85                              <2> 	jmp @FF
    86                              <2>  %endif
    87                              <2> %endif
    88                              <2> 
    89                              <2> @@:
    90                              <2> %if _APPLICATION || _DEVICE
    91                              <2> 	doscall
    92                              <2> %endif
    93                              <2> @@:
    94                              <2> 	jc .io_error
    95                              <2> 
    96                              <2> 	push dx
    97                              <2> 	push ax
    98                              <2> 
    99                              <2> 	mov cx, fromwords(ELD_TRAILER_HEADER_size_w)
   100                              <2> 	sub sp, cx
   101                              <2> 	mov dx, sp
   102                              <2> 
   103                              <2> 	mov ah, 3Fh
   104                              <2> %if _BOOTLDR
   105                              <2>  %if _APPLICATION || _DEVICE
   106                              <2> 	testopt [relocated(internalflags)], nodosloaded
   107                              <2> linkdatarelocation internalflags, -3
   108                              <2> 	jz @F
   109                              <2>  %endif
   110                              <2> 	extcallcall yy_boot_read.bx
   111                              <2>  %if _APPLICATION || _DEVICE
   112                              <2> 	jmp @FF
   113                              <2>  %endif
   114                              <2> %endif
   115                              <2> 
   116                              <2> @@:
   117                              <2> %if _APPLICATION || _DEVICE
   118                              <2> 	doscall
   119                              <2> %endif
   120                              <2> @@:
   121                              <2> 	jc .io_error
   122                              <2> 	mov di, sp
   123                              <2> 	mov si, sp
   124                              <2> 
   125                              <2> 	cmp ax, cx
   126                              <2> 	jne .no_trailer_pop
   127                              <2> 
   128                              <2> 	xor dx, dx
   129                              <2> 	shr cx, 1
   130                              <2> @@:
   131                              <2> 	lodsw
   132                              <2> 	add dx, ax
   133                              <2> 	loop @B
   134                              <2> 	jnz .no_trailer_pop
   135                              <2> 
   136                              <2> 	pop ax
   137                              <2> 	cmp ax, "EL"
   138                              <2> 	jne .no_trailer_pop
   139                              <2> 	pop ax
   140                              <2> 	cmp ax, "D1"
   141                              <2> 	jne .no_trailer_pop
   142                              <2> 	pop ax
   143                              <2> 	cmp ax, "TA"
   144                              <2> 	jne .no_trailer_pop
   145                              <2> 	pop ax
   146                              <2> 	cmp ax, "IL"
   147                              <2> 	jne .no_trailer_pop
   148                              <2> 
   149                              <2> 	pop si
   150                              <2> 	pop cx			; cx:si = displacement to subtract
   151                              <2> 	pop ax			; reserved
   152                              <2> 	pop ax			; checksum
   153                              <2> 
   154                              <2> 	pop ax
   155                              <2> 	pop dx			; dx:ax = offset of trailer header
   156                              <2> 	add ax, si
   157                              <2> 	adc dx, cx		; dx:ax = offset of header
   158                              <2> 	jnc .io_error
   159                              <2> 
   160                              <2> 	mov word [eldheader], ax
   161                              <2> internaldatarelocation
   162                              <2> 	mov word [eldheader + 2], dx
   163                              <2> internaldatarelocation
   164                              <2> 
   165                              <2> .no_trailer_pop:
   166                              <2> 	lea sp, [di + fromwords(ELD_TRAILER_HEADER_size_w) + 4]
   167                              <2> 
   168                              <2> .no_trailer:
   169                              <2> 	mov ax, 4200h
   170                              <2> 	mov dx, word [eldheader]
   171                              <2> internaldatarelocation
   172                              <2> 	mov cx, word [eldheader + 2]
   173                              <2> internaldatarelocation
   174                              <2> 
   175                              <2> %if _BOOTLDR
   176                              <2>  %if _APPLICATION || _DEVICE
   177                              <2> 	testopt [relocated(internalflags)], nodosloaded
   178                              <2> linkdatarelocation internalflags, -3
   179                              <2> 	jz @F
   180                              <2>  %endif
   181                              <2> 	extcallcall yy_boot_seek_start.bx
   182                              <2> 	extcallcall yy_boot_seek_current.bx
   183                              <2>  %if _APPLICATION || _DEVICE
   184                              <2> 	jmp @FF
   185                              <2>  %endif
   186                              <2> %endif
   187                              <2> 
   188                              <2> @@:
   189                              <2> %if _APPLICATION || _DEVICE
   190                              <2> 	doscall
   191                              <2> %endif
   192                              <2> @@:
   193                              <2> 	jc .io_error
   194                              <2> %endif
   195                              <2> 
   196 00000322 B92000              <2> 	mov cx, fromwords(ELD_HEADER_size_w)
   197 00000325 29CC                <2> 	sub sp, cx
   198 00000327 89E2                <2> 	mov dx, sp		; es:dx and ds:dx
   199                              <2> %if _ELDCOMPRESSED
   200 00000329 FF36[5E05]          <2> 	push word [eldheader + 2]
   201                              <2> internaldatarelocation
   202 0000032D FF36[5C05]          <2> 	push word [eldheader]
   203                              <2> internaldatarelocation
   204 00000331 8F06[6005]          <2> 	pop word [depackskip]
   205                              <2> internaldatarelocation
   206 00000335 8F06[6205]          <2> 	pop word [depackskip + 2]
   207                              <2> internaldatarelocation
   208                              <2> 
   209 00000339 E8E003              <2> 	call read_and_depack
   210                              <2> %elif _DOSORBOOTIO
   211                              <2> 	mov ax, 3F00h
   212                              <2> 	call dos_or_boot_io
   213                              <2> %else
   214                              <2> 	mov ah, 3Fh
   215                              <2> %if _BOOTLDR
   216                              <2>  %if _APPLICATION || _DEVICE
   217                              <2> 	testopt [relocated(internalflags)], nodosloaded
   218                              <2> linkdatarelocation internalflags, -3
   219                              <2> 	jz @F
   220                              <2>  %endif
   221                              <2> 	extcallcall yy_boot_read.bx
   222                              <2>  %if _APPLICATION || _DEVICE
   223                              <2> 	jmp @FF
   224                              <2>  %endif
   225                              <2> %endif
   226                              <2> 
   227                              <2> @@:
   228                              <2> %if _APPLICATION || _DEVICE
   229                              <2> 	doscall
   230                              <2> %endif
   231                              <2> @@:
   232                              <2> %endif
   233 0000033C 7303E9BF01          <2> 	jc .io_error
   234 00000341 39C8                <2> 	cmp ax, cx
   235 00000343 7403E9C001          <2> 	jne .invalid
   236                              <2> 
   237 00000348 89E7                <2> 	mov di, sp
   238                              <2> 
   239 0000034A 58                  <2> 	pop ax
   240 0000034B 3D454C              <2> 	cmp ax, "EL"
   241 0000034E 7403E9B501          <2> 	jne .invalid
   242 00000353 58                  <2> 	pop ax
   243 00000354 3D4431              <2> 	cmp ax, "D1"
   244 00000357 7403E9AC01          <2> 	jne .invalid
   245 0000035C 58                  <2> 	pop ax
   246 0000035D 58                  <2> 	pop ax
   247 0000035E 80FC1A              <2> 	cmp ah, 26
   248 00000361 7403E9A201          <2> 	jne .invalid
   249                              <2> 
   250 00000366 A1[0000]            <2> 	mov ax, word [relocated(extseg_size)]
   251                              <2> linkdatarelocation extseg_size
   252 00000369 2B06[0000]          <2> 	sub ax, word [relocated(extseg_used)]
   253                              <2> linkdatarelocation extseg_used
   254 0000036D 7303E98601          <2> 	jc .error_internal
   255                              <2> %if ELD
   256 00000372 83E840              <2> 	sub ax, relocator_size
   257 00000375 7303E97E01          <2> 	jc .error_internal
   258                              <2> %endif
   259                              <2> 
   260 0000037A 8B4D0C              <2> 	mov cx, word [di + eldhCodeImageLength]
   261                              <2> %if ELD
   262 0000037D 39C8                <2> 	cmp ax, cx
   263 0000037F 7303E98C01          <2> 	jb .oom
   264                              <2> %endif
   265 00000384 034D0E              <2> 	add cx, word [di + eldhCodeAllocLength]
   266 00000387 7238                <2> 	jc .invalid_CY
   267 00000389 83C10F              <2> 	add cx, 15
   268 0000038C 7233                <2> 	jc .invalid_CY
   269 0000038E 80E1F0              <2> 	and cl, ~ 15
   270                              <2> 
   271                              <2> %if ELD
   272 00000391 2E0306[0200]        <2> 	add ax, word [cs:code + eldiEndCode]
   273                              <2> internalcoderelocation
   274 00000396 2E2B06[0000]        <2> 	sub ax, word [cs:code + eldiStartCode]
   275                              <2> internalcoderelocation
   276                              <2> %endif
   277 0000039B 39C8                <2> 	cmp ax, cx
   278 0000039D 7303E96E01          <2> 	jb .oom
   279                              <2> 
   280 000003A2 8B16[0000]          <2> 	mov dx, word [relocated(extdata_size)]
   281                              <2> linkdatarelocation extdata_size
   282 000003A6 2B16[0000]          <2> 	sub dx, word [relocated(extdata_used)]
   283                              <2> linkdatarelocation extdata_used
   284 000003AA 7303E94901          <2> 	jc .error_internal
   285                              <2> 
   286 000003AF 8B7514              <2> 	mov si, word [di + eldhDataImageLength]
   287                              <2> %if ELD
   288 000003B2 39F2                <2> 	cmp dx, si
   289 000003B4 7303E95701          <2> 	jb .oom
   290                              <2> %endif
   291 000003B9 037516              <2> 	add si, word [di + eldhDataAllocLength]
   292 000003BC 7203                <2> 	jc .invalid_CY
   293 000003BE 83C60F              <2> 	add si, 15
   294                              <2> .invalid_CY:
   295 000003C1 7303E94201          <2> 	jc .invalid
   296 000003C6 83E6F0              <2> 	and si, ~ 15
   297                              <2> 
   298                              <2> %if ELD
   299 000003C9 2E0316[0600]        <2> 	add dx, word [cs:code + eldiEndData]
   300                              <2> internalcoderelocation
   301 000003CE 2E2B16[0400]        <2> 	sub dx, word [cs:code + eldiStartData]
   302                              <2> internalcoderelocation
   303                              <2> %endif
   304 000003D3 39F2                <2> 	cmp dx, si
   305 000003D5 7303E93601          <2> 	jb .oom
   306                              <2> 
   307 000003DA 56                  <2> 	push si
   308 000003DB 51                  <2> 	push cx
   309                              <2> 
   310 000003DC B80042              <2> 	mov ax, 4200h
   311 000003DF 8B4D0A              <2> 	mov cx, word [di + eldhCodeOffset + 2]
   312 000003E2 8B5508              <2> 	mov dx, word [di + eldhCodeOffset]
   313                              <2> %if ELD || _ELDTRAILER
   314 000003E5 0316[5C05]          <2> 	add dx, word [eldheader]
   315                              <2> internaldatarelocation
   316 000003E9 130E[5E05]          <2> 	adc cx, word [eldheader + 2]
   317                              <2> internaldatarelocation
   318                              <2> %else
   319                              <2> 		; ELD header is at seek 0
   320                              <2> %endif
   321                              <2> %if _ELDCOMPRESSED
   322 000003ED 8916[6005]          <2> 	mov word [depackskip], dx
   323                              <2> internaldatarelocation
   324 000003F1 890E[6205]          <2> 	mov word [depackskip + 2], cx
   325                              <2> internaldatarelocation
   326                              <2> %elif _DOSORBOOTIO
   327                              <2> 	call dos_or_boot_io
   328                              <2> %else
   329                              <2> %if _BOOTLDR
   330                              <2>  %if _APPLICATION || _DEVICE
   331                              <2> 	testopt [relocated(internalflags)], nodosloaded
   332                              <2> linkdatarelocation internalflags, -3
   333                              <2> 	jz @F
   334                              <2>  %endif
   335                              <2> 	extcallcall yy_boot_seek_start.bx
   336                              <2> 	extcallcall yy_boot_seek_current.bx
   337                              <2>  %if _APPLICATION || _DEVICE
   338                              <2> 	jmp @FF
   339                              <2>  %endif
   340                              <2> %endif
   341                              <2> 
   342                              <2> @@:
   343                              <2> %if _APPLICATION || _DEVICE
   344                              <2> 	doscall
   345                              <2> %endif
   346                              <2> @@:
   347                              <2> %endif
   348 000003F5 7303E90601          <2> 	jc .io_error
   349                              <2> 
   350 000003FA 8B16[0000]          <2> 	mov dx, word [relocated(extseg_used)]
   351                              <2> linkdatarelocation extseg_used
   352                              <2> %if _PM
   353 000003FE E86F05              <2> 	extcallcall ispm
   354 00000401 7506                <2> 	jnz @F
   355 00000403 8E1E[0000]          <2> 	mov ds, word [relocated(extdssel)]
   356                              <2> linkdatarelocation extdssel
   357 00000407 EB04                <2> 	jmp @FF
   358                              <2> 
   359                              <2> @@:
   360                              <2> %endif
   361 00000409 8E1E[0000]          <2> 	mov ds, word [relocated(extseg)]
   362                              <2> linkdatarelocation extseg
   363                              <2> @@:
   364 0000040D 368B4D0C            <2> 	mov cx, word [ss:di + eldhCodeImageLength]
   365                              <2> %if _ELDCOMPRESSED
   366 00000411 1E                  <2> 	push ds
   367 00000412 07                  <2> 	pop es
   368 00000413 16                  <2> 	push ss
   369 00000414 1F                  <2> 	pop ds
   370 00000415 E80403              <2> 	call read_and_depack
   371 00000418 16                  <2> 	push ss
   372 00000419 07                  <2> 	pop es
   373                              <2> %elif _DOSORBOOTIO
   374                              <2> 	mov ax, 3FFFh
   375                              <2> 	call dos_or_boot_io
   376                              <2> %else
   377                              <2> 	mov ah, 3Fh
   378                              <2> %if _BOOTLDR
   379                              <2>  %if _APPLICATION || _DEVICE
   380                              <2> 	testopt [ss:relocated(internalflags)], nodosloaded
   381                              <2> linkdatarelocation internalflags, -3
   382                              <2> 	jz @F
   383                              <2>  %endif
   384                              <2> 	push ds
   385                              <2> 	pop es
   386                              <2> 	push ss
   387                              <2> 	pop ds
   388                              <2> 	extcallcall yy_boot_read.bx
   389                              <2> 	push ss
   390                              <2> 	pop es
   391                              <2>  %if _APPLICATION || _DEVICE
   392                              <2> 	jmp @FF
   393                              <2>  %endif
   394                              <2> %endif
   395                              <2> 
   396                              <2> @@:
   397                              <2> %if _APPLICATION || _DEVICE
   398                              <2> %if _PM
   399                              <2> 	extcallcall doscall_extseg
   400                              <2> %else
   401                              <2> 	doscall
   402                              <2> %endif
   403                              <2> %endif
   404                              <2> @@:
   405                              <2> %endif
   406 0000041A 16                  <2> 	 push ss
   407 0000041B 1F                  <2> 	 pop ds
   408 0000041C 7303E9DF00          <2> 	jc .io_error
   409 00000421 39C1                <2> 	cmp cx, ax
   410 00000423 7403E9D800          <2> 	jne .io_error
   411                              <2> 
   412 00000428 B80042              <2> 	mov ax, 4200h
   413 0000042B 8B4D12              <2> 	mov cx, word [di + eldhDataOffset + 2]
   414 0000042E 8B5510              <2> 	mov dx, word [di + eldhDataOffset]
   415                              <2> %if ELD || _ELDTRAILER
   416 00000431 0316[5C05]          <2> 	add dx, word [eldheader]
   417                              <2> internaldatarelocation
   418 00000435 130E[5E05]          <2> 	adc cx, word [eldheader + 2]
   419                              <2> internaldatarelocation
   420                              <2> %else
   421                              <2> 		; ELD header is at seek 0
   422                              <2> %endif
   423                              <2> 
   424                              <2> %if _ELDCOMPRESSED
   425 00000439 8916[6005]          <2> 	mov word [depackskip], dx
   426                              <2> internaldatarelocation
   427 0000043D 890E[6205]          <2> 	mov word [depackskip + 2], cx
   428                              <2> internaldatarelocation
   429                              <2> %elif _DOSORBOOTIO
   430                              <2> 	call dos_or_boot_io
   431                              <2> %else
   432                              <2> %if _BOOTLDR
   433                              <2>  %if _APPLICATION || _DEVICE
   434                              <2> 	testopt [relocated(internalflags)], nodosloaded
   435                              <2> linkdatarelocation internalflags, -3
   436                              <2> 	jz @F
   437                              <2>  %endif
   438                              <2> 	extcallcall yy_boot_seek_start.bx
   439                              <2> 	extcallcall yy_boot_seek_current.bx
   440                              <2>  %if _APPLICATION || _DEVICE
   441                              <2> 	jmp @FF
   442                              <2>  %endif
   443                              <2> %endif
   444                              <2> 
   445                              <2> @@:
   446                              <2> %if _APPLICATION || _DEVICE
   447                              <2> 	doscall
   448                              <2> %endif
   449                              <2> @@:
   450                              <2> %endif
   451 00000441 7303E9BA00          <2> 	jc .io_error
   452                              <2> 
   453                              <2> %if ELD
   454 00000446 8B16[0000]          <2> 	mov dx, word [relocateddata]
   455                              <2> linkdatarelocation extdata
   456                              <2> %else
   457                              <2> 	mov dx, ext_data_area
   458                              <2> %endif
   459 0000044A 0316[0000]          <2> 	add dx, word [relocated(extdata_used)]
   460                              <2> linkdatarelocation extdata_used
   461 0000044E 8B4D14              <2> 	mov cx, word [di + eldhDataImageLength]
   462                              <2> %if _ELDCOMPRESSED
   463 00000451 E8C802              <2> 	call read_and_depack
   464                              <2> %elif _DOSORBOOTIO
   465                              <2> 	mov ax, 3F00h
   466                              <2> 	call dos_or_boot_io
   467                              <2> %else
   468                              <2> 	mov ah, 3Fh
   469                              <2> %if _BOOTLDR
   470                              <2>  %if _APPLICATION || _DEVICE
   471                              <2> 	testopt [relocated(internalflags)], nodosloaded
   472                              <2> linkdatarelocation internalflags, -3
   473                              <2> 	jz @F
   474                              <2>  %endif
   475                              <2> 	extcallcall yy_boot_read.bx
   476                              <2>  %if _APPLICATION || _DEVICE
   477                              <2> 	jmp @FF
   478                              <2>  %endif
   479                              <2> %endif
   480                              <2> 
   481                              <2> @@:
   482                              <2> %if _APPLICATION || _DEVICE
   483                              <2> 	doscall
   484                              <2> %endif
   485                              <2> @@:
   486                              <2> %endif
   487 00000454 7303E9A700          <2> 	jc .io_error
   488 00000459 39C1                <2> 	cmp cx, ax
   489 0000045B 7403E9A000          <2> 	jne .io_error
   490                              <2> 
   491                              <2> %if _PM
   492 00000460 E85B04              <2> 	call get_es_ext
   493                              <2> %else
   494                              <2> 	mov es, word [extseg]
   495                              <2> %endif
   496                              <2> 
   497                              <2> %if ELD
   498 00000463 8B1E[0000]          <2> 	mov bx, word [relocateddata]
   499                              <2> linkdatarelocation extseg_used		; es:bx -> where we loaded code
   500                              <2> 
   501 00000467 8B4518              <2> 	mov ax, [di + eldhCodeEntrypoint]
   502 0000046A 05[0000]            <2> 	add ax, strict word code	; -> entry destination
   503                              <2> internalcoderelocation
   504 0000046D 26A3[FE08]          <2> 	mov word [es:relocator.entry], ax
   505                              <2> internalcoderelocation
   506                              <2> 
   507 00000471 8B450C              <2> 	mov ax, word [di + eldhCodeImageLength]
   508 00000474 26A3[D708]          <2> 	mov word [es:relocator.codelength], ax
   509                              <2> internalcoderelocation
   510                              <2> 
   511 00000478 8B4514              <2> 	mov ax, word [di + eldhDataImageLength]
   512 0000047B 26A3[E608]          <2> 	mov word [es:relocator.datalength], ax
   513                              <2> internalcoderelocation
   514                              <2> 
   515 0000047F 58                  <2> 	pop ax
   516                              <2> 
   517 00000480 26C707[0000]        <2> 	mov word [es:bx + eldiStartCode], code
   518                              <2> internalcoderelocation			; fix its start
   519                              <2> 
   520 00000485 89C7                <2> 	mov di, ax
   521 00000487 033E[0000]          <2> 	add di, word [relocateddata]
   522                              <2> linkdatarelocation extseg_used		; di -> relocator destination
   523 0000048B 50                  <2> 	push ax
   524 0000048C 83C040              <2> 	add ax, relocator_size
   525 0000048F 260106[0200]        <2> 	add word [es:code + eldiEndCode], ax
   526                              <2> internalcoderelocation			; grow our allocation
   527 00000494 0106[0000]          <2> 	add word [relocateddata], ax
   528                              <2> linkdatarelocation extseg_used		; ditto
   529 00000498 58                  <2> 	pop ax
   530                              <2> 
   531 00000499 26891E[DA08]        <2> 	mov word [es:relocator.codesource], bx
   532                              <2> internalcoderelocation			; -> start
   533 0000049E 05[0000]            <2> 	add ax, strict word code
   534                              <2> internalcoderelocation
   535 000004A1 26894702            <2> 	mov word [es:bx + eldiEndCode], ax
   536                              <2> 					; -> past destination
   537 000004A5 26A3[F508]          <2> 	mov word [es:relocator.extseg_used], ax
   538                              <2> internalcoderelocation			; new extseg_used
   539                              <2> 
   540 000004A9 58                  <2> 	pop ax
   541                              <2> 
   542 000004AA 8B16[0000]          <2> 	mov dx, word [relocateddata]
   543                              <2> linkdatarelocation extdata_used
   544 000004AE 0316[0000]          <2> 	add dx, word [relocateddata]
   545                              <2> linkdatarelocation extdata
   546                              <2> 
   547 000004B2 268916[E908]        <2> 	mov word [es:relocator.datasource], dx
   548                              <2> internalcoderelocation
   549                              <2> 
   550                              <2> 	houdini
   551 000004B7 BA[0000]            <2> 	mov dx, datastart
   552                              <2> internaldatarelocation
   553 000004BA 26895704            <2> 	mov word [es:bx + eldiStartData], dx
   554 000004BE 01D0                <2> 	add ax, dx
   555 000004C0 26894706            <2> 	mov word [es:bx + eldiEndData], ax
   556                              <2> 
   557 000004C4 2B06[0000]          <2> 	sub ax, word [relocateddata]
   558                              <2> linkdatarelocation extdata
   559 000004C8 26A3[FB08]          <2> 	mov word [es:relocator.extdata_used], ax
   560                              <2> internalcoderelocation			; new extdata_used
   561                              <2> 
   562 000004CC BA[0000]            <2> 	mov dx, code
   563                              <2> internalcoderelocation			; es:dx -> ELD code instance (dest)
   564 000004CF BB[0000]            <2> 	mov bx, datastart
   565                              <2> internaldatarelocation
   566                              <2> 
   567 000004D2 BE[D008]            <2> 	mov si, relocator
   568                              <2> internalcoderelocation
   569 000004D5 B92000              <2> 	mov cx, words(relocator_size)
   570 000004D8 06                  <2> 	 push es
   571 000004D9 1F                  <2> 	 pop ds
   572 000004DA 57                  <2> 	push di
   573 000004DB F3A5                <2> 	rep movsw
   574 000004DD 59                  <2> 	pop cx				; -> relocator entry
   575 000004DE 16                  <2> 	push ss
   576 000004DF 1F                  <2> 	pop ds
   577                              <2> %else
   578                              <2> 	pop ax				; allocated code size
   579                              <2> 	mov dx, word [extseg_used]
   580                              <2> 	mov bp, dx
   581                              <2> 	mov word [es:bp+eldiStartCode], dx
   582                              <2> 					; -> loaded code
   583                              <2> 	add ax, word [extseg_used]
   584                              <2> 	mov word [extseg_used], ax	; -> behind
   585                              <2> 	mov word [es:bp+eldiEndCode], ax; -> behind
   586                              <2> 
   587                              <2> 	pop ax				; allocated data size
   588                              <2> 	mov bx, word [extdata_used]
   589                              <2> 	add bx, ext_data_area		; -> loaded data
   590                              <2> 	mov word [es:bp+eldiStartData], bx
   591                              <2> 	add word [extdata_used], ax	; = amount new used
   592                              <2> 	add ax, bx			; -> behind
   593                              <2> 	mov word [es:bp+eldiEndData], ax
   594                              <2> 
   595                              <2> 	mov cx, [di + eldhCodeEntrypoint]
   596                              <2> 	add cx, dx
   597                              <2> %endif
   598 000004E0 83C418              <2> 	add sp, ELD_HEADER_size - 8
   599                              <2> 
   600                              <2> %if ELD
   601 000004E3 5E                  <2> 	pop si
   602 000004E4 A1[0000]            <2> 	mov ax, word [relocateddata]
   603                              <2> linkdatarelocation linksel
   604 000004E7 E88604              <2> 	extcallcall ispm
   605 000004EA 7403                <2> 	jz @F
   606 000004EC A1[0000]            <2> 	mov ax, word [relocateddata]
   607                              <2> linkdatarelocation linkseg
   608                              <2> @@:
   609                              <2> 
   610 000004EF BF[0000]            <2> 	mov di, relocateddata
   611                              <2> linkdatarelocation linkinfoaddress
   612 000004F2 8B3D                <2> 	mov di, [di]
   613 000004F4 8ED8                <2> 	mov ds, ax
   614                              <2> 
   615 000004F6 FFE1                <2> 	jmp cx
   616                              <2> 		; INP:	es:dx -> loaded initial ELD image
   617                              <2> 		;	 ELD instance structure filled
   618                              <2> 		;	es => ELD code area
   619                              <2> 		;	ds:di -> link info
   620                              <2> 		;	ss:bx -> loaded initial data
   621                              <2> 		;	ss:si -> command line tail
   622                              <2> 		;	cs:ip -> entrypoint
   623                              <2> 		;	ss:sp -> far return address for current mode
   624                              <2> 		; STT:	UP, EI
   625                              <2> %else
   626                              <2> ext_finish.bp_is_set equ $
   627                              <2> 	pop bp
   628                              <2> 
   629                              <2> 	mov si, word [ext_cmdline]
   630                              <2> 
   631                              <2> %if _MESSAGESEGMENT
   632                              <2>  %if _PM
   633                              <2> 	call get_messagesegsel
   634                              <2>  %else
   635                              <2>  	mov ds, word [ss:messageseg]
   636                              <2>  %endif
   637                              <2> %endif
   638                              <2> 	mov di, linkinfo
   639                              <2> 
   640                              <2> 	push cs
   641                              <2> 	call .transfer
   642                              <2> 		; INP:	es:dx -> loaded initial ELD image
   643                              <2> 		;	 ELD instance structure filled
   644                              <2> 		;	es => ELD code area
   645                              <2> 		;	ds:di -> link info
   646                              <2> 		;	ss:bx -> loaded initial data
   647                              <2> 		;	ss:si -> command line tail
   648                              <2> 		;	cs:ip -> entrypoint
   649                              <2> 		;	ss:sp -> far return address for current mode
   650                              <2> 		; STT:	UP, EI
   651                              <2> %endif
   700                              <1> 
   701                              <1> .error_internal:
   702 000004F8 BA[F702]            <1> 	mov dx, msg.ext_error_internal
   703                              <1> internaldatarelocation
   704 000004FB B8390E              <1> 	mov ax, 0E39h
   705 000004FE EB16                <1> 	jmp @F
   706                              <1> 
   707                              <1> .io_error:
   708 00000500 BA[1C03]            <1> 	mov dx, msg.ext_error_io
   709                              <1> internaldatarelocation
   710 00000503 B83A0E              <1> 	mov ax, 0E3Ah
   711 00000506 EB0E                <1> 	jmp @F
   712                              <1> 
   713                              <1> .invalid:
   714 00000508 BA[3D03]            <1> 	mov dx, msg.ext_error_invalid
   715                              <1> internaldatarelocation
   716 0000050B B83B0E              <1> 	mov ax, 0E3Bh
   717 0000050E EB06                <1> 	jmp @F
   718                              <1> 
   719                              <1> .oom:
   720 00000510 BA[7303]            <1> 	mov dx, msg.ext_error_oom
   721                              <1> internaldatarelocation
   722 00000513 B83C0E              <1> 	mov ax, 0E3Ch
   723                              <1> 
   724                              <1> @@:
   725 00000516 E83F04              <1> 	extcallcall setrc
   726 00000519 16                  <1> 	push ss
   727 0000051A 1F                  <1> 	pop ds
   728 0000051B E81204              <1> 	extcallcall putsz
   729 0000051E E81704              <1> 	extcallcall cmd3
   730                              <1> 
   731                              <1> 
   732                              <1> get_dxax_seek_lib_plus_cxdx:
   733 00000521 BB[0000]            <1> 	mov bx, relocateddata
   734                              <1> linkdatarelocation load_data_lowest	; make yy_boot_get and yy_boot_update no-ops
   735 00000524 F606[0100]40        <1> 	testopt [relocateddata], nodosloaded
   736                              <1> linkdatarelocation internalflags, -3
   737 00000529 750C                <1> 	jnz @F
   738 0000052B 8B1E[0000]          <1> 	mov bx, [relocateddata]
   739                              <1> linkdatarelocation ext_handle
   740 0000052F E84604              <1> 	extcallcall InDOS
   741 00000532 7403                <1> 	jz @F
   742 00000534 E84904              <1> 	extcallcall error
   743                              <1> @@:
   744 00000537 B8[0000]            <1> 	mov ax, relocateddata
   745                              <1> linkdatarelocation ext_finish.bp_is_set
   746                              <1> 
   747 0000053A B80142              <1> 	mov ax, 4201h
   748                              <1> lib_displacement equ LIBOFFSET - DATAOFFSET - data_size
   749 0000053D 81C2A001            <1> 	add dx, lib_displacement & 0FFFFh
   750 00000541 83D100              <1> 	adc cx, (lib_displacement >> 16) & 0FFFFh
   751                              <1> 	; jmp dos_or_boot_io
   752                              <1> 
   753                              <1> 
   754                              <1> dos_or_boot_io:
   755                              <1> %if _BOOTLDR
   756 00000544 36F606[0100]40      <1> reloc	testopt [ss:relocateddata], nodosloaded
   757                              <1> linkdatarelocation internalflags, -3
   758 0000054A 7515                <1> 	jnz .boot
   759                              <1> %endif
   760                              <1> .dos:
   761 0000054C 3DFF3F              <1> 	cmp ax, 3FFFh
   762 0000054F 7408                <1> 	je @F
   763 00000551 E8[0000]EB020000    <1> 	extcall _doscall
   764 00000558 C3                  <1> 	retn
   765                              <1> 
   766                              <1> @@:
   767 00000559 E8[0000]EB020000    <1> 	extcall doscall_extseg
   768 00000560 C3                  <1> 	retn
   769                              <1> 
   770                              <1> %if _BOOTLDR
   771                              <1> .boot:
   772 00000561 80FC3F              <1> 	cmp ah, 3Fh
   773 00000564 7512                <1> 	jne @F
   774 00000566 3CFF                <1> 	cmp al, 0FFh
   775 00000568 7504                <1> 	jne .bootread
   776                              <1> .bootread_ext:
   777 0000056A 1E                  <1> 	push ds
   778 0000056B 07                  <1> 	pop es
   779 0000056C 16                  <1> 	push ss
   780 0000056D 1F                  <1> 	pop ds
   781                              <1> .bootread:
   782 0000056E E8[0000]EB020000    <1> 	extcall yy_boot_read.bx
   783 00000575 16                  <1> 	push ss
   784 00000576 07                  <1> 	pop es
   785 00000577 C3                  <1> 	retn
   786                              <1> 
   787                              <1> @@:
   788 00000578 3D0042              <1> 	cmp ax, 4200h
   789 0000057B 7517                <1> 	jne @F
   790 0000057D 2B16[FCFF]          <1> 	sub dx, word [relocateddata - LOADDATA2 + ldCurrentSeek]
   791                              <1> linkdatarelocation load_data
   792 00000581 1B0E[FEFF]          <1> 	sbb cx, word [relocateddata - LOADDATA2 + ldCurrentSeek + 2]
   793                              <1> linkdatarelocation load_data
   794                              <1> 
   795                              <1> .boot_seek_current:
   796 00000585 E8[0000]EB020000    <1> 	extcall yy_boot_seek_current.bx
   797 0000058C A1[FCFF]            <1> 	mov ax, word [relocateddata - LOADDATA2 + ldCurrentSeek]
   798                              <1> linkdatarelocation load_data
   799 0000058F 8B16[FEFF]          <1> 	mov dx, word [relocateddata - LOADDATA2 + ldCurrentSeek + 2]
   800                              <1> linkdatarelocation load_data
   801 00000593 C3                  <1> 	retn
   802                              <1> 
   803                              <1> @@:
   804 00000594 3D0142              <1> 	cmp ax, 4201h
   805 00000597 74EC                <1> 	je .boot_seek_current
   806 00000599 E8E403              <1> 	extcallcall error
   807                              <1> %endif
   808                              <1> 
   809                              <1> 
   810                              <1> %if _COMPRESSED
   811                              <1> %assign _STANDALONE 0
   812                              <1>  %include "depack.asm"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> lDebug heatshrink/lzexedat depacker
     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> %include "lmacros3.mac"
     1                              <3> [list -]
    16                              <2> 
    17                              <2> 
    18                              <2> 	numdef LZEXEDAT,	0
    19                              <2> 	numdef DEPACKINLINELITERAL,	1
    20                              <2> 	numdef DXTAG,		1
    21                              <2> 	numdef LONGLITERAL,	0
    22                              <2> 	numdef MULTI,		0
    23                              <2> 	numdef STANDALONE,	1
    24                              <2> 	numdef DATEXE,		0
    25                              <2> 
    26                              <2> %ifn _STANDALONE
    27                              <2> 	overridedef DEBUG0,	0
    28                              <2> 	overridedef COUNTER,	0
    29                              <2> %else
    30                              <2>  %ifn _DATEXE
    31                              <2> 	overridedef MULTI,	0
    32                              <2>  %endif
    33                              <2> 	numdef DEBUG0,		0
    34                              <2> 	numdef COUNTER,		0, 32
    35                              <2> %if (_COUNTER - 1) & _COUNTER
    36                              <2>  %error COUNTER must be a power of two
    37                              <2> %endif
    38                              <2> 	numdef OUTBUFFER,	1
    39                              <2> 
    40                              <2> 
    41                              <2> %ifn _DATEXE
    42                              <2> 	cpu 8086
    43                              <2> 	org 256
    44                              <2> 	addsection CODE, start=256
    45                              <2> testprogram:
    46                              <2> 	mov si, 81h
    47                              <2> 
    48                              <2> 	cmp sp, stack.top
    49                              <2> 	jae @F
    50                              <2> error:
    51                              <2> 	mov dx, msg.error
    52                              <2> 	mov ah, 09h
    53                              <2> 	int 21h
    54                              <2> 	mov ax, 4CFFh
    55                              <2> 	int 21h
    56                              <2> 	int 20h
    57                              <2> 
    58                              <2> @@:
    59                              <2> 	lodsb
    60                              <2> 	cmp al, 9
    61                              <2> 	je @B
    62                              <2> 	cmp al, 32
    63                              <2> 	je @B
    64                              <2> 	cmp al, 13
    65                              <2> 	je error
    66                              <2> 	mov dx, si
    67                              <2> 	dec dx
    68                              <2> 
    69                              <2> @@:
    70                              <2> 	lodsb
    71                              <2> 	cmp al, 9
    72                              <2> 	je @F
    73                              <2> 	cmp al, 32
    74                              <2> 	je @F
    75                              <2> 	cmp al, 13
    76                              <2> 	jne @B
    77                              <2> @@:
    78                              <2> 	mov byte [si - 1], 0
    79                              <2> 
    80                              <2> 	mov ax, 3D00h | 1_010_0_000b	; RO, DENY WRITE, No inherit
    81                              <2> 	int 21h
    82                              <2> 	jc error
    83                              <2> 	mov word [handle], ax
    84                              <2> 
    85                              <2> 	xchg bx, ax
    86                              <2> 	mov ax, 4202h
    87                              <2> 	xor cx, cx
    88                              <2> 	xor dx, dx
    89                              <2> 	int 21h
    90                              <2> 	jc error
    91                              <2> 
    92                              <2> 	push dx
    93                              <2> 	push ax
    94                              <2> 	mov ax, 4200h
    95                              <2> 	xor cx, cx
    96                              <2> 	xor dx, dx
    97                              <2> 	int 21h
    98                              <2> 	jc error
    99                              <2> 
   100                              <2> 	mov ax, 3C00h
   101                              <2> 	xor cx, cx
   102                              <2> 	mov dx, msg.outname
   103                              <2> 	int 21h
   104                              <2> 	jc error
   105                              <2> 	mov word [handle2], ax
   106                              <2> 
   107                              <2> 	pop dx
   108                              <2> 	pop cx				; = file size
   109                              <2> %else	; _DATEXE
   110                              <2> 	usesection CODE
   111                              <2> datexe_depack:
   112                              <2> 	mov cx, word [insize + 2]
   113                              <2> 	mov dx, word [insize]
   114                              <2> %endif
   115                              <2> 	mov word [filebuffer.next], filebuffer
   116                              <2> 	mov word [filebuffer.tail], filebuffer
   117                              <2> %if _OUTBUFFER
   118                              <2> 	mov word [outbuffer.next], outbuffer
   119                              <2> %endif
   120                              <2> 
   121                              <2> %if _DATEXE
   122                              <2> 	mov ax, BUFFER
   123                              <2> 	mov es, ax
   124                              <2> %endif
   125                              <2> 	mov di, resultbuffer
   126                              <2> 	push di
   127                              <2> 	push cx
   128                              <2> 	mov ax, 0CCCCh
   129                              <2> 	mov cx, words(resultbuffer.end - resultbuffer)
   130                              <2> 	rep stosw
   131                              <2> 	pop cx
   132                              <2> 	pop di
   133                              <2> 	mov si, resultbuffer.end
   134                              <2> 
   135                              <2> %if _DATEXE
   136                              <2> 	mov ax, [format]
   137                              <2> ..@breakpoint_d:
   138                              <2> 	nop
   139                              <2> %endif
   140                              <2> 
   141                              <2> 	call depack
   142                              <2> %if _DATEXE
   143                              <2> 	mov dx, DATA
   144                              <2> 	mov ds, dx
   145                              <2> 
   146                              <2> 	sbb ax, ax
   147                              <2> 	jz @F
   148                              <2> 	mov dx, msg.decompresserror
   149                              <2> 	call disp_msg_counted
   150                              <2> 	mov ax, 4C0Bh
   151                              <2> 	int 21h
   152                              <2> @@:
   153                              <2> %if _OUTBUFFER
   154                              <2> 	mov di, [outbuffer.next]
   155                              <2> 	call dump_outbuffer
   156                              <2> %endif
   157                              <2> 
   158                              <2> 	mov bx, word [outhandle]
   159                              <2> 	mov ax, 4202h
   160                              <2> 	xor cx, cx
   161                              <2> 	xor dx, dx
   162                              <2> 	int 21h
   163                              <2> 	jc openoutfile.error
   164                              <2> 	mov word [outsize], ax
   165                              <2> 	mov word [outsize + 2], dx
   166                              <2> 
   167                              <2> 	rol byte [verbose], 1
   168                              <2> 	jc display_table_d
   169                              <2> display_short_d:
   170                              <2> 	mov dx, msg.short.1
   171                              <2> 	call disp_msg_counted
   172                              <2> 	mov ax, word [insize]
   173                              <2> 	mov dx, word [insize + 2]
   174                              <2> 	call disp_dxax_dec
   175                              <2> 	mov dx, msg.short.2
   176                              <2> 	call disp_msg_counted
   177                              <2> 	mov ax, word [outsize]
   178                              <2> 	mov dx, word [outsize + 2]
   179                              <2> 	call disp_dxax_dec
   180                              <2> 	mov dx, msg.short.3
   181                              <2> 	call disp_msg_counted
   182                              <2> 	call disp_percentage_swapped
   183                              <2> 	mov ax, 4C00h
   184                              <2> 	int 21h
   185                              <2> 
   186                              <2> 
   187                              <2> display_table_d:
   188                              <2> 	mov si, table_d
   189                              <2> .loop:
   190                              <2> 	lodsw
   191                              <2> 	test ax, ax
   192                              <2> 	jz .done
   193                              <2> 	xchg dx, ax
   194                              <2> 	call disp_msg_counted
   195                              <2> 	lodsw
   196                              <2> 	xchg bx, ax
   197                              <2> 	mov cx, [bx]
   198                              <2> 	mov dx, [bx + 2]
   199                              <2> 	lodsw
   200                              <2> 	xchg cx, ax
   201                              <2> 	call cx
   202                              <2> 	xchg cx, ax
   203                              <2> 	mov al, 32
   204                              <2> 	call disp_al
   205                              <2> 	lodsw
   206                              <2> 	xchg cx, ax
   207                              <2> 	call cx
   208                              <2> 	mov dx, msg.linebreak
   209                              <2> 	call disp_msg_counted
   210                              <2> 	jmp .loop
   211                              <2> 
   212                              <2> .done:
   213                              <2> 	mov dx, msg.done.6
   214                              <2> 	call disp_msg_counted
   215                              <2> 	call disp_percentage_swapped
   216                              <2> 	mov dx, msg.done
   217                              <2> 	call disp_msg_counted
   218                              <2> 	mov ax, 4C00h
   219                              <2> 	int 21h
   220                              <2> %else	; _DATEXE
   221                              <2> 	jc error
   222                              <2> 
   223                              <2> %if _OUTBUFFER
   224                              <2> 	mov di, [outbuffer.next]
   225                              <2> 	call dump_outbuffer
   226                              <2> %endif
   227                              <2> 
   228                              <2> 	push ss
   229                              <2> 	pop ds
   230                              <2> 	push ss
   231                              <2> 	pop es
   232                              <2> 
   233                              <2> 	mov ah, 3Eh
   234                              <2> 	mov bx, [handle]
   235                              <2> 	int 21h
   236                              <2> 
   237                              <2> 	mov ah, 3Eh
   238                              <2> 	mov bx, [handle2]
   239                              <2> 	int 21h
   240                              <2> 
   241                              <2> 	mov ax, 4C00h
   242                              <2> 	int 21h
   243                              <2> 	int 20h
   244                              <2> 
   245                              <2> 
   246                              <2> %if _COUNTER
   247                              <2> disp_al:
   248                              <2> 	push dx
   249                              <2> 	push ax
   250                              <2> 	xchg ax, dx
   251                              <2> 	mov ah, 02h
   252                              <2> 	int 21h
   253                              <2> 	pop ax
   254                              <2> 	pop dx
   255                              <2> 	retn
   256                              <2> %endif
   257                              <2> %endif	; _DATEXE
   258                              <2> 
   259                              <2> 
   260                              <2> 		; INP:	-
   261                              <2> 		; OUT:	Does not return if error (in this example)
   262                              <2> 		;	CY if error
   263                              <2> 		;	NC if success,
   264                              <2> 		;	 al = byte read from file
   265                              <2> 		; CHG:	si
   266                              <2> 		; REM:	In this example program we assume ds = es = ss.
   267                              <2> get_file_byte:
   268                              <2> %if _DATEXE
   269                              <2> 	push ds
   270                              <2> 	mov si, DATA
   271                              <2> 	mov ds, si
   272                              <2> %endif
   273                              <2> 	mov si, [filebuffer.next]
   274                              <2> 	cmp si, [filebuffer.tail]
   275                              <2> 	jb .buffered
   276                              <2> 
   277                              <2> 	push ax
   278                              <2> 	push bx
   279                              <2> 	push cx
   280                              <2> 	push dx
   281                              <2> 	mov dx, filebuffer
   282                              <2> 	mov [filebuffer.next], dx
   283                              <2> 	mov [filebuffer.tail], dx
   284                              <2> 	mov ah, 3Fh
   285                              <2> 	mov bx, [handle]
   286                              <2>         mov cx, filebuffer.end - filebuffer
   287                              <2> 
   288                              <2> 	int 21h
   289                              <2> %if _DATEXE
   290                              <2> 	jc getbuf.errorread
   291                              <2> 	test ax, ax
   292                              <2> 	jz getbuf.shortread
   293                              <2> %else
   294                              <2> 	jc error
   295                              <2> 	test ax, ax
   296                              <2> 	jz error
   297                              <2> %endif
   298                              <2> 	add ax, dx
   299                              <2> 	mov word [filebuffer.tail], ax
   300                              <2>         mov si, dx
   301                              <2> 	pop dx
   302                              <2> 	pop cx
   303                              <2> 	pop bx
   304                              <2> 	pop ax
   305                              <2> 
   306                              <2> .buffered:
   307                              <2> 	lodsb
   308                              <2> 	mov [filebuffer.next], si
   309                              <2> 	clc
   310                              <2> %if _DATEXE
   311                              <2> 	pop ds
   312                              <2> %endif
   313                              <2> 	retn
   314                              <2> 
   315                              <2> 
   316                              <2> %if _OUTBUFFER
   317                              <2> 		; INP:	ds:si -> data to write
   318                              <2> 		;	cx = length of data (may be zero)
   319                              <2> 		; OUT:	Does not return if error
   320                              <2> 		; CHG:	-
   321                              <2> 		; REM:	In this example program we assume ds = es = ss.
   322                              <2> put_file_data:
   323                              <2> 	push ax
   324                              <2> 	push bx
   325                              <2> 	push dx
   326                              <2> 	push di
   327                              <2> 	push si
   328                              <2> 	push cx
   329                              <2> %if _DATEXE
   330                              <2> 	push es
   331                              <2> 	mov di, DATA
   332                              <2> 	mov es, di
   333                              <2> 	es
   334                              <2> %endif
   335                              <2> 	mov di, [outbuffer.next]
   336                              <2> 	jcxz .end
   337                              <2> @@:
   338                              <2> 	cmp di, outbuffer.end
   339                              <2> 	jne @F
   340                              <2> 
   341                              <2> 	call dump_outbuffer
   342                              <2> 
   343                              <2> @@:
   344                              <2> 	movsb
   345                              <2> 	loop @BB
   346                              <2> %if _DATEXE
   347                              <2> 	es
   348                              <2> %endif
   349                              <2> 	mov [outbuffer.next], di
   350                              <2> .end:
   351                              <2> %if _DATEXE
   352                              <2> 	pop es
   353                              <2> %endif
   354                              <2> 	pop cx
   355                              <2> 	pop si
   356                              <2> 	pop di
   357                              <2> 	pop dx
   358                              <2> 	pop bx
   359                              <2> 	pop ax
   360                              <2> 	retn
   361                              <2> 
   362                              <2> dump_outbuffer:
   363                              <2> 	push cx
   364                              <2> %if _DATEXE
   365                              <2> 	push ds
   366                              <2> 	mov cx, DATA
   367                              <2> 	mov ds, cx
   368                              <2> %endif
   369                              <2> 	mov cx, di
   370                              <2> 	mov dx, outbuffer
   371                              <2> 	sub cx, dx
   372                              <2> 	jz @F
   373                              <2> 	mov bx, word [handle2]
   374                              <2> 	mov ah, 40h
   375                              <2> 	int 21h
   376                              <2> %if _DATEXE
   377                              <2> 	jc putbuf.errorwrite
   378                              <2> 	cmp ax, cx
   379                              <2> 	jne putbuf.shortwrite
   380                              <2> %else
   381                              <2> 	jc error
   382                              <2> 	cmp ax, cx
   383                              <2> 	jne error
   384                              <2> %endif
   385                              <2> @@:
   386                              <2> 	mov di, dx
   387                              <2> %if _DATEXE
   388                              <2> 	pop ds
   389                              <2> %endif
   390                              <2> 	pop cx
   391                              <2> 	retn
   392                              <2> %else
   393                              <2> 		; INP:	ds:si -> data to write
   394                              <2> 		;	cx = length of data (may be zero)
   395                              <2> 		; OUT:	Does not return if error
   396                              <2> 		; CHG:	-
   397                              <2> 		; REM:	In this example program we assume ds = es = ss.
   398                              <2> put_file_data:
   399                              <2> 	push ax
   400                              <2> 	push bx
   401                              <2> 	push dx
   402                              <2> 	mov dx, si
   403                              <2> 	mov ah, 40h
   404                              <2> %if _DATEXE
   405                              <2> 	push ds
   406                              <2> 	mov di, DATA
   407                              <2> 	mov ds, di
   408                              <2> %endif
   409                              <2> 	mov bx, [handle2]
   410                              <2> %if _DATEXE
   411                              <2> 	pop ds
   412                              <2> %endif
   413                              <2> 	jcxz @F
   414                              <2> 	int 21h
   415                              <2> %if _DATEXE
   416                              <2> 	jc putbuf.errorwrite
   417                              <2> 	cmp ax, cx
   418                              <2> 	jne putbuf.shortwrite
   419                              <2> %else
   420                              <2> 	jc error
   421                              <2> 	cmp ax, cx
   422                              <2> 	jne error
   423                              <2> %endif
   424                              <2> @@:
   425                              <2> 	pop dx
   426                              <2> 	pop bx
   427                              <2> 	pop ax
   428                              <2> 	retn
   429                              <2> %endif
   430                              <2> 
   431                              <2> 
   432                              <2> %ifn _DATEXE
   433                              <2> 	addsection DATA, align=1 follows=CODE
   434                              <2> msg:
   435                              <2> .error:		ascic "Error!",13,10
   436                              <2> .outname:	asciz "output.bin"
   437                              <2> 
   438                              <2> 
   439                              <2> 	addsection BSSDATA, align=16 nobits follows=DATA
   440                              <2> 	alignb 16
   441                              <2> resultbuffer:
   442                              <2> .size equ 4096
   443                              <2> 		resb .size
   444                              <2> .end:
   445                              <2> 
   446                              <2> %else
   447                              <2> 	usesection DATA
   448                              <2> %endif
   449                              <2> 	alignb 2
   450                              <2> filebuffer:	resb 256
   451                              <2> .end:
   452                              <2> 	alignb 2
   453                              <2> .next:		resw 1
   454                              <2> .tail:		resw 1
   455                              <2> %if _DATEXE
   456                              <2> handle equ inhandle
   457                              <2> handle2 equ outhandle
   458                              <2> %else
   459                              <2> handle:		resw 1
   460                              <2> handle2:	resw 1
   461                              <2> %endif
   462                              <2> 
   463                              <2> %if _OUTBUFFER
   464                              <2> outbuffer:	resb 256
   465                              <2> .end:
   466                              <2> .next:		resw 1
   467                              <2> %endif
   468                              <2> 
   469                              <2> %ifn _DATEXE
   470                              <2> stack:		resb 512
   471                              <2> .top:
   472                              <2> %endif
   473                              <2> 
   474                              <2> 
   475                              <2> 	usesection CODE
   476                              <2> %endif	; _STANDALONE
   477                              <2> 
   478                              <2> %if _MULTI
   479                              <2> 	overridedef LZEXEDAT, 1
   480                              <2> 	overridedef LONGLITERAL, 1
   481                              <2> %endif
   482                              <2> 
   483                              <2> 		; INP:	cx:dx = length of source
   484                              <2> 		;	es:di -> destination
   485                              <2> 		;	si -> behind end of destination (si > di)
   486                              <2> 		;	(al = format, 2 = heatshrink, 3 = lzexedat -4)
   487                              <2> 		;	(ah = 0FFh for switch4k on, 00h for off)
   488                              <2> 		; OUT:	NC if success
   489                              <2> 		;	CY if error,
   490                              <2> 		;	 bx = ?errordata (if _DEBUG0)
   491                              <2> 		; CHG:	ax, (bx), cx, dx, es, ds, si, di
   492                              <2> 		; STT:	UP
   493                              <2> depack:
   494                              <2> 	lframe near
   495 0000059C 5589E5              <2> 	lenter
   496                              <2>  %if _DEBUG0 || _COUNTER
   497                              <2> 	xor bx, bx
   498                              <2>  %endif
   499                              <2>  %if _DEBUG0
   500                              <2> 	lvar word,	errordata
   501                              <2> 	 push bx
   502                              <2>  %endif
   503                              <2> %if _MULTI
   504                              <2> 	mov bl, al
   505                              <2> %endif
   506                              <2> %if _COUNTER || _MULTI
   507                              <2> 	lvar word,	format_and_counter
   508                              <2> 	lequ ?format_and_counter + 1, counter
   509                              <2> 	lequ ?format_and_counter, format
   510                              <2> 	 push bx		; initialise counter (high byte) to zero
   511                              <2> 				; and format (low byte)
   512                              <2> %endif
   513                              <2> %if _DATEXE
   514                              <2> 	lvar word,	empty_and_switch4k
   515                              <2> 	lequ ?empty_and_switch4k + 1, switch4k
   516                              <2> 	 push ax
   517                              <2> %endif
   518                              <2> 
   519                              <2> 	lvar dword,	original_dst
   520 0000059F 06                  <2> 	 push es
   521 000005A0 57                  <2> 	 push di
   522                              <2> 	lvar dword,	dst
   523 000005A1 06                  <2> 	 push es
   524 000005A2 57                  <2> 	 push di
   525                              <2> 	lvar dword,	src_remaining
   526 000005A3 51                  <2> 	 push cx
   527 000005A4 52                  <2> 	 push dx
   528                              <2> 
   529 000005A5 89F1                <2> 	mov cx, si
   530 000005A7 29F9                <2> 	sub cx, di		; same flags as cmp si, di
   531 000005A9 7703E98F00          <2> 	jbe .error
   532                              <2> 
   533                              <2> %if _DXTAG
   534                              <2> 	lvar word,	dst_end
   535 000005AE 56                  <2> 	 push si		; push into [bp + ?dst_end]
   536                              <2> %else
   537                              <2> 	mov dx, si
   538                              <2> %endif
   539                              <2> 
   540 000005AF 31C0                <2> 	xor ax, ax
   541 000005B1 F3AA                <2> 	rep stosb		; prepare for matches before first data byte
   542                              <2> %if _LZEXEDAT || _MULTI
   543 000005B3 40                  <2> 	inc ax			; = 1
   544                              <2> %endif
   545                              <2> %if _MULTI
   546                              <2> 	lvar word,	word1
   547                              <2> 	lvar word,	word2
   548                              <2> 	lvar word,	word3
   549                              <2> 
   550                              <2> 	cmp byte [bp + ?format], 2
   551                              <2> 	jb .error
   552                              <2> 	sub byte [bp + ?format], 3
   553                              <2> 		; -1 = heatshrink, 0 = lzexedat -4, 1 = lzexedat -4 -l
   554                              <2> 	jb .hs_init
   555                              <2> 	cmp byte [bp + ?format], al
   556                              <2> 	ja .error
   557                              <2> %endif
   558                              <2> %if _LZEXEDAT
   559                              <2> .lze_init:
   560                              <2> %if _MULTI
   561                              <2> 	lequ ?word1,	tagbitscycle
   562                              <2> %else
   563                              <2> 	lvar word,	tagbitscycle
   564                              <2> %endif
   565 000005B4 50                  <2> 	 push ax		; = 1
   566                              <2> 
   567                              <2> %ifn _DXTAG
   568                              <2>  %if _MULTI
   569                              <2> 	lequ ?word2,	tagword
   570                              <2>  %else
   571                              <2> 	lvar word,	tagword
   572                              <2>  %endif
   573                              <2> 	 push ax
   574                              <2> %endif
   575 000005B5 E82901              <2> 	call get_bit			; ?tagbitscycle init to 1, ror sets CY
   576                              <2> 					;  (bogus result in CF is ignored)
   577                              <2> 
   578 000005B8 EB23                <2> 	jmp .lze_loop
   579                              <2> 
   580                              <2> .lze_literal:
   581                              <2> %if _LONGLITERAL
   582 000005BA 41                  <2> 	inc cx
   583                              <2> .loop_literal:
   584                              <2> %endif
   585                              <2> 
   586 000005BB E83D01              <2> 	call load_byte
   587                              <2> %if _LONGLITERAL
   588 000005BE 51                  <2> 	push cx
   589                              <2> %endif
   590                              <2> %if _DEPACKINLINELITERAL
   591                              <2> %if _LONGLITERAL
   592 000005BF B90100              <2> 	mov cx, 1
   593                              <2> %else
   594                              <2> 	inc cx				; cx = 1
   595                              <2> %endif
   596 000005C2 C47EF8              <2> 	les di, [bp + ?dst]		; -> destination
   597                              <2> %if _DXTAG
   598 000005C5 3B7EF2              <2> 	cmp di, [bp + ?dst_end]		; at end of circular buffer ?
   599                              <2> %else
   600                              <2> 	cmp di, dx
   601                              <2> %endif
   602 000005C8 7773                <2> 	ja .error			; invalid -->
   603 000005CA 7203                <2> 	jb @F				; no -->
   604 000005CC 8B7EFC              <2> 	mov di, word [bp + ?original_dst]	; yes, reset
   605                              <2> @@:
   606 000005CF 06                  <2> 	push es
   607 000005D0 1F                  <2> 	pop ds
   608 000005D1 89FE                <2> 	mov si, di			; ds:si -> where to store
   609 000005D3 AA                  <2> 	stosb				; store it
   610 000005D4 897EF8              <2> 	mov word [bp + ?dst], di	; update ?dst
   611 000005D7 E85902              <2> 	call put_file_data		; ds:si ->, length cx
   612                              <2> %else
   613                              <2> 	push ax				; on stack: the literal
   614                              <2> 	 push ss
   615                              <2> 	 pop ds
   616                              <2> 	mov si, sp			; ds:si -> data on stack
   617                              <2> %if _LONGLITERAL
   618                              <2> 	xor ax, ax
   619                              <2> %else
   620                              <2> 	xchg ax, cx			; ax = 0
   621                              <2> %endif
   622                              <2> 	inc ax				; length = 1
   623                              <2> 	mov bx, ax			; bx NZ
   624                              <2> 	call copy_data.bx
   625                              <2> 	pop ax				; (discard)
   626                              <2> d0	mov byte [bp + ?errordata], 75h
   627                              <2> 	jc .error
   628                              <2> %endif
   629                              <2> 
   630                              <2> %if _LONGLITERAL
   631 000005DA 59                  <2> 	pop cx
   632 000005DB E2DE                <2> 	loop .loop_literal
   633                              <2> %endif
   634                              <2> 
   635                              <2> %assign LENGTHOFLITERAL $ - .lze_literal
   636                              <2> %warning length of lze literal = LENGTHOFLITERAL
   636          ******************  <2>  warning: length of lze literal = 35 [-w+user]
   637                              <2> 
   638                              <2> .lze_loop:
   639 000005DD 31C9                <2> 	xor cx, cx			; ! ch = 0, cx = 0
   640 000005DF E8FF00              <2> 	call get_bit
   641 000005E2 72D6                <2> 	jc .lze_literal
   642                              <2> 
   643                              <2> .lze_notliteral:
   644                              <2> %if _COUNTER
   645                              <2> 	inc byte [bp + ?counter]
   646                              <2> 	test byte [bp + ?counter], _COUNTER - 1
   647                              <2> 	jnz @F
   648                              <2> 	mov al, '.'
   649                              <2> 	call disp_al_counter
   650                              <2> @@:
   651                              <2> %endif
   652                              <2> 
   653 000005E4 E8FA00              <2> 	call get_bit
   654 000005E7 7218                <2> 	jc .lze_combined
   655                              <2> 
   656                              <2> .lze_shortmatch:
   657                              <2> 		; cx = 0
   658 000005E9 E8F500              <2> 	call get_bit
   659 000005EC D1D1                <2> 	rcl cx, 1
   660 000005EE E8F000              <2> 	call get_bit
   661 000005F1 D1D1                <2> 	rcl cx, 1			; cx = 0..3
   662                              <2> 
   663 000005F3 E80501              <2> 	call load_byte			; load displacement
   664                              <2> 
   665 000005F6 B4FF                <2> 	mov ah, -1			; sign extend for negative number
   666 000005F8 93                  <2> 	xchg bx, ax			; bx = displacement (-1 to -256)
   667                              <2> 
   668                              <2> .lze_match_cx_plus_2:
   669 000005F9 41                  <2> 	inc cx
   670                              <2> .lze_match_cx_plus_1:
   671 000005FA 41                  <2> 	inc cx
   672                              <2> 
   673                              <2> 		; INP:	bx = match displacement (-1 to -4096)
   674                              <2> 		;	cx = match count (2 to 256)
   675 000005FB 93                  <2> 	xchg ax, bx			; ax = displacement, cx = count
   676 000005FC 91                  <2> 	xchg ax, cx			; cx = displacement, ax = length of match
   677 000005FD F7D9                <2> 	neg cx				; cx = index
   678 000005FF EB41                <2> 	jmp .lze_match
   679                              <2> .lze_loop_j1: equ .lze_loop
   680                              <2> 
   681                              <2> .lze_combined:
   682 00000601 E8EC00              <2> 	call load_word			; load combined word
   683                              <2> 
   684 00000604 89C3                <2> 	mov bx, ax
   685 00000606 F9                  <2> 	stc				; CY
   686 00000607 D0DF                <2> 	rcr bh, 1			; rotate in a 1
   687 00000609 D0FF                <2> 	sar bh, 1
   688 0000060B D0FF                <2> 	sar bh, 1			; fill top three bits with 1s
   689                              <2> %if _DATEXE
   690                              <2> 	rol byte [bp + ?switch4k], 1
   691                              <2> 	jnc .8k
   692                              <2> .4k:
   693                              <2> 	sar bh, 1			; fill top *four* bits with 1s
   694                              <2> 	and ah, 15
   695                              <2> 	jmp @F
   696                              <2> .8k:
   697                              <2> 	and ah, 7
   698                              <2> @@:
   699                              <2> %else
   700                              <2>  %if 1	; _4
   701 0000060D D0FF                <2> 	sar bh, 1			; fill top *four* bits with 1s
   702 0000060F 80E40F              <2> 	and ah, 15
   703                              <2>  %else
   704                              <2> 	and ah, 7
   705                              <2>  %endif
   706                              <2> %endif
   707 00000612 88E1                <2> 	mov cl, ah			; ch already = 0
   708 00000614 75E3                <2> 	jnz .lze_match_cx_plus_2	; length = cx + 2, bx = displacement
   709                              <2> 
   710                              <2> .lze_escape:
   711 00000616 E8E200              <2> 	call load_byte			; ah = 0
   712 00000619 3C01                <2> 	cmp al, 1
   713 0000061B 7213                <2> 	jb .end_check
   714 0000061D 91                  <2> 	xchg cx, ax			; cx = length
   715 0000061E 77DA                <2> 	ja .lze_match_cx_plus_1		; length = cx + 1, bx = displacement
   716                              <2> 
   717                              <2> %if _LONGLITERAL
   718                              <2>  %if _MULTI
   719                              <2> 	cmp byte [bp + ?format], 1
   720                              <2> 	jne .lze_normalise		; not lzexedat -4 -l -->
   721                              <2>  %endif
   722 00000620 87CB                <2> 	xchg cx, bx			; cx = displacement, top 4 or 3 bits sets
   723                              <2>  %if _DATEXE
   724                              <2> 	and ch, ~ 1110_0000b		; isolate 13-bit displacement
   725                              <2> 	rol byte [bp + ?switch4k], 1
   726                              <2> 	jnc @F
   727                              <2> 	and ch, ~ 1111_0000b		; isolate 12-bit displacement
   728                              <2> @@:
   729                              <2>  %else
   730                              <2>   %if 1 ; _4
   731 00000622 80E50F              <2> 	and ch, ~ 1111_0000b		; isolate 12-bit displacement
   732                              <2>   %else
   733                              <2> 	and ch, ~ 1110_0000b		; isolate 13-bit displacement
   734                              <2>   %endif
   735                              <2>  %endif
   736 00000625 E307                <2>  	jcxz .lze_normalise		; displacement 0 means segment change -->
   737 00000627 83F91A              <2>  	cmp cx, 26			; long literals command needs >= 26 bytes
   738 0000062A 7211                <2>  	jb .error			; (reserved for future expansion)
   739 0000062C EB8D                <2>  	jmp .loop_literal		; process the literals -->
   740                              <2> %endif
   741                              <2> .lze_normalise:
   742 0000062E EBAD                <2> 	jmp .lze_loop_j1
   743                              <2> 
   744                              <2> %if !_MULTI
   745                              <2> .end_check:
   746                              <2> d0	mov byte [bp + ?errordata], 7Dh
   747 00000630 31C9                <2> 	xor cx, cx
   748 00000632 394EF6              <2> 	cmp word [bp + ?src_remaining + 2], cx
   749 00000635 7506                <2> 	jne .error
   750 00000637 394EF4              <2> 	cmp word [bp + ?src_remaining], cx
   751 0000063A 7501                <2> 	jne .error
   752                              <2> 
   753                              <2> .end:
   754 0000063C A8                  <2> 	db __TEST_IMM8			; (NC)
   755                              <2> .error:
   756 0000063D F9                  <2> 	stc
   757                              <2> 
   758                              <2> %if _COUNTER
   759                              <2> 	lahf
   760                              <2> 	mov al, 13
   761                              <2> 	call disp_al_for_progress
   762                              <2> 	mov al, 10
   763                              <2> 	call disp_al_for_progress
   764                              <2> 	sahf
   765                              <2> %endif
   766                              <2> d0	mov bx, word [bp + ?errordata]
   767 0000063E 89EC5D              <2> 	lleave code
   768 00000641 C3                  <2> 	lret
   769                              <2> %endif
   770                              <2> %endif
   771                              <2> 
   772                              <2> %if _MULTI || !_LZEXEDAT
   773                              <2> .hs_init:
   774                              <2> @@:
   775                              <2> 	call read_byte
   776                              <2> d0	mov byte [bp + ?errordata], 70h
   777                              <2> 	jc .error
   778                              <2> 
   779                              <2> 	mov ah, 0
   780                              <2> 	test ax, ax
   781                              <2> d0	mov byte [bp + ?errordata], 71h
   782                              <2> 	jz .error
   783                              <2> 	cmp al, 15
   784                              <2> 	ja .error
   785                              <2> 
   786                              <2> %if _MULTI
   787                              <2> 	lequ ?word1,	window_size_bits
   788                              <2> %else
   789                              <2> 	lvar word,	window_size_bits
   790                              <2> %endif
   791                              <2> 	 push ax
   792                              <2> 
   793                              <2> 	xchg cx, ax
   794                              <2> 	mov ax, 1
   795                              <2> 	shl ax, cl
   796                              <2> 	cmp ax, resultbuffer.size
   797                              <2> 	ja .error
   798                              <2> 
   799                              <2> 	call read_byte
   800                              <2> d0	mov byte [bp + ?errordata], 72h
   801                              <2> 	jc .error
   802                              <2> 
   803                              <2> 	mov ah, 0
   804                              <2> 	test ax, ax
   805                              <2> d0	mov byte [bp + ?errordata], 73h
   806                              <2> 	jz .error
   807                              <2> 	cmp ax, word [bp + ?window_size_bits]
   808                              <2> 	jae .error
   809                              <2> 
   810                              <2> %if _MULTI
   811                              <2> 	lequ ?word2,	lookahead_size_bits
   812                              <2> %else
   813                              <2> 	lvar word,	lookahead_size_bits
   814                              <2> %endif
   815                              <2> 	 push ax
   816                              <2> 
   817                              <2> %if _DXTAG
   818                              <2> 	xor dx, dx			; dl = bit index, dh = current byte
   819                              <2> %else
   820                              <2> 	xor cx, cx
   821                              <2>  %if _MULTI
   822                              <2> 	lequ ?word3,	low_bit_index_and_high_current_byte
   823                              <2>  %else
   824                              <2> 	lvar word,	low_bit_index_and_high_current_byte
   825                              <2>  %endif
   826                              <2> 	 push cx
   827                              <2> %endif
   828                              <2> 
   829                              <2> .loop:
   830                              <2> %if _COUNTER
   831                              <2> 	inc byte [bp + ?counter]
   832                              <2> 	test byte [bp + ?counter], _COUNTER - 1
   833                              <2> 	jnz @F
   834                              <2> 	mov al, '.'
   835                              <2> 	call disp_al
   836                              <2> @@:
   837                              <2> %endif
   838                              <2> 
   839                              <2> 	mov cx, 1
   840                              <2> 	call get_bits
   841                              <2> 	jnc .notend			; (cx = 0 if jumping)
   842                              <2> 
   843                              <2> d0	mov byte [bp + ?errordata], 7Dh
   844                              <2> .end_check:
   845                              <2> 	xor ax, ax
   846                              <2> 	cmp word [bp + ?src_remaining], ax
   847                              <2> 	jne .error
   848                              <2> 	cmp word [bp + ?src_remaining + 2], ax
   849                              <2> 	jne .error
   850                              <2> 
   851                              <2> 	db __TEST_IMM8			; (NC)
   852                              <2> .error:
   853                              <2> 	stc
   854                              <2> 
   855                              <2> %if _COUNTER
   856                              <2> 	lahf
   857                              <2> 	mov al, 13
   858                              <2> 	call disp_al
   859                              <2> 	mov al, 10
   860                              <2> 	call disp_al
   861                              <2> 	sahf
   862                              <2> %endif
   863                              <2> d0	mov bx, word [bp + ?errordata]
   864                              <2> 	lleave code
   865                              <2> 	lret
   866                              <2> 
   867                              <2> .notend:				; (cx = 0)
   868                              <2> 	test al, al
   869                              <2> 	jz .notliteral
   870                              <2> 
   871                              <2> .hs_literal:
   872                              <2> 	mov cl, 8
   873                              <2> 	call get_bits			; cx = 0
   874                              <2> d0	mov byte [bp + ?errordata], 74h
   875                              <2> 	jc .end_check
   876                              <2> %if _DEPACKINLINELITERAL
   877                              <2> 	inc cx				; cx = 1
   878                              <2> 	les di, [bp + ?dst]		; -> destination
   879                              <2> %if _DXTAG
   880                              <2> 	cmp di, [bp + ?dst_end]		; at end of circular buffer ?
   881                              <2> %else
   882                              <2> 	cmp di, dx
   883                              <2> %endif
   884                              <2> 	ja .error			; invalid -->
   885                              <2> 	jb @F				; no -->
   886                              <2> 	mov di, word [bp + ?original_dst]	; yes, reset
   887                              <2> @@:
   888                              <2> 	push es
   889                              <2> 	pop ds
   890                              <2> 	mov si, di			; ds:si -> where to store
   891                              <2> 	stosb				; store it
   892                              <2> 	mov word [bp + ?dst], di	; update ?dst
   893                              <2> 	call put_file_data		; ds:si ->, length cx
   894                              <2> %else
   895                              <2> 	push ax				; on stack: the literal
   896                              <2> 	 push ss
   897                              <2> 	 pop ds
   898                              <2> 	mov si, sp			; ds:si -> data on stack
   899                              <2> 	xchg ax, cx			; ax = 0
   900                              <2> 	inc ax				; length = 1
   901                              <2> 	mov bx, ax			; bx NZ
   902                              <2> 	call copy_data.bx
   903                              <2> 	pop ax				; (discard)
   904                              <2> d0	mov byte [bp + ?errordata], 75h
   905                              <2> 	jc .error
   906                              <2> %endif
   907                              <2> %assign LENGTHOFLITERAL $ - .hs_literal
   908                              <2> %warning length of hs literal = LENGTHOFLITERAL
   909                              <2> 	jmp .loop
   910                              <2> 
   911                              <2> .notliteral:				; (cx = 0)
   912                              <2> 
   913                              <2> 	mov cl, byte [bp + ?window_size_bits]
   914                              <2> 					; cx = -w parameter
   915                              <2> 	call get_bits
   916                              <2> d0	mov byte [bp + ?errordata], 76h
   917                              <2> 	jc .end_check
   918                              <2> 		; ax = output index
   919                              <2> 		; cx = 0
   920                              <2> 	xchg bx, ax
   921                              <2> 	mov cl, byte [bp + ?lookahead_size_bits]
   922                              <2> 					; cx = -l parameter
   923                              <2> 	call get_bits
   924                              <2> d0	mov byte [bp + ?errordata], 77h
   925                              <2> 	jc .end_check
   926                              <2> 		; bx = output index less 1
   927                              <2> 		; ax = output count less 1
   928                              <2> 	inc bx				; = output index
   929                              <2> d0	mov byte [bp + ?errordata], 78h
   930                              <2> 	jz .error
   931                              <2> 
   932                              <2> 					; ax = length of match less one
   933                              <2> 	inc ax				; = length of match
   934                              <2> 	jz .error
   935                              <2> 
   936                              <2> 	mov cx, bx			; 1 .. 65535
   937                              <2> %endif
   938                              <2> 
   939                              <2> %if _LZEXEDAT
   940                              <2> .lze_match:
   941                              <2> %endif
   942                              <2> 
   943                              <2> 		; cx = index, ax = length
   944 00000642 C576F8              <2> 	lds si, [bp + ?dst]
   945 00000645 8B5EFC              <2> 	mov bx, word [bp + ?original_dst]
   946 00000648 F7DB                <2> 	neg bx
   947 0000064A 01F3                <2> 	add bx, si			; dst - original = length at start
   948 0000064C 29CB                <2> 	sub bx, cx			; length start - match distance
   949 0000064E 7324                <2> 	jae @F				; length start >= match distance -->
   950                              <2> 		; bx = negative length of matchable at end of buffer
   951                              <2> 
   952                              <2> %if _DXTAG
   953 00000650 8B76F2              <2> 	mov si, [bp + ?dst_end]
   954                              <2> %else
   955                              <2> 	mov si, dx
   956                              <2> %endif
   957 00000653 01DE                <2> 	add si, bx			; si -> match data
   958 00000655 89F3                <2> 	mov bx, si
   959 00000657 01C3                <2> 	add bx, ax			; -> behind match data (if fits)
   960 00000659 7205                <2> 	jc .full			; if doesn't fit, copy full -->
   961                              <2> %if _DXTAG
   962 0000065B 3B5EF2              <2> 	cmp bx, [bp + ?dst_end]		; -> behind is above-or-equal end ?
   963                              <2> %else
   964                              <2> 	cmp bx, dx
   965                              <2> %endif
   966                              <2> 	; jae .full			; yes -->
   967 0000065E 7216                <2> 	jb .copy_data			; ax has full length from tail of buffer -->
   968                              <2> 
   969                              <2> 		; if we branch to here,
   970                              <2> 		;  si + ax >= (word [bp + ?dst_end] or dx)
   971                              <2> 		;  therefore  ax >= (word [bp + ?dst_end] or dx) - si
   972                              <2> .full:
   973 00000660 50                  <2> 	push ax				; save original length
   974                              <2> 		; calculate word [bp + ?dst_end] - si
   975                              <2> %if _DXTAG
   976 00000661 8B46F2              <2> 	mov ax, [bp + ?dst_end]
   977                              <2> %else
   978                              <2> 	mov ax, dx
   979                              <2> %endif
   980 00000664 29F0                <2> 	sub ax, si			; -> end minus -> match data
   981 00000666 50                  <2> 	push ax				; save length
   982 00000667 E81400              <2> 	call copy_data
   983                              <2> d0	mov byte [bp + ?errordata], 1
   984 0000066A 72D1                <2> 	jc .error
   985 0000066C 5B                  <2> 	pop bx				; = done length
   986 0000066D 58                  <2> 	pop ax				; = entire length
   987 0000066E 29D8                <2> 	sub ax, bx			; entire length minus done length
   988 00000670 8B76FC              <2> 	mov si, word [bp + ?original_dst]	; -> start of buffer
   989 00000673 A9                  <2> 	db __TEST_IMM16			; skip sub
   990                              <2> @@:
   991 00000674 29CE                <2> 	sub si, cx			; -> into buffer
   992                              <2> 
   993                              <2> .copy_data:
   994 00000676 E80500              <2> 	call copy_data			; give ?dst -> dest, ds:si -> source
   995                              <2> 		; returns: ?dst incremented, ds:si -> after match source
   996                              <2> d0	mov byte [bp + ?errordata], 7Bh
   997 00000679 72C2                <2> 	jc .error
   998                              <2> 
   999                              <2> %if _MULTI
  1000                              <2> 		; end of common code, dispatch back to main loop
  1001                              <2> 	cmp byte [bp + ?format], 1
  1002                              <2> 	je @F				; lzexedat -4 -l -->
  1003                              <2> 	rol byte [bp + ?format], 1
  1004                              <2> 	jc .loop
  1005                              <2> @@:
  1006                              <2> 	jmp .lze_loop
  1007                              <2> %elif _LZEXEDAT
  1008 0000067B E95FFF              <2> 	jmp .lze_loop
  1009                              <2> %else
  1010                              <2> 	jmp .loop
  1011                              <2> %endif
  1012                              <2> 
  1013                              <2> 
  1014                              <2> 		; INP:	?dst -> destination,
  1015                              <2> 		;	 destination may overlap the circular buffer boundary.
  1016                              <2> 		;	ds:si -> source
  1017                              <2> 		;	ax = how long the data is (0 is valid),
  1018                              <2> 		;	 always 1 for literals.
  1019                              <2> 		;	 source must fit in circular buffer, except if
  1020                              <2> 		;	 source and destination overlap. in this case the
  1021                              <2> 		;	 source starts in the buffer but may extend past
  1022                              <2> 		;	 the circular buffer boundary.
  1023                              <2> 		;	word [?dst_end] or dx -> end of circular buffer
  1024                              <2> 		;	word [?original_dst] -> start of circular buffer
  1025                              <2> 		; OUT:	?dst incremented
  1026                              <2> 		;	CY if error (buffer too small)
  1027                              <2> 		;	NC if success
  1028                              <2> 		; CHG:	cx, bx, ax, es, di, ds, si
  1029                              <2> copy_data:
  1030                              <2> %ifn _DEPACKINLINELITERAL
  1031                              <2> 	xor bx, bx
  1032                              <2> .bx:
  1033                              <2> 		; bx = nonzero if literal
  1034                              <2> %endif
  1035                              <2> 
  1036                              <2> %if 0
  1037                              <2> 	push ax
  1038                              <2> 	push bx
  1039                              <2> 	push cx
  1040                              <2> 	push dx
  1041                              <2> 	mov ax, 4201h
  1042                              <2> 	mov cx, 0
  1043                              <2> 	mov dx, 0
  1044                              <2> 	mov bx, word [handle2]
  1045                              <2> 	int 21h
  1046                              <2> 	nop
  1047                              <2> 	pop dx
  1048                              <2> 	pop cx
  1049                              <2> 	pop bx
  1050                              <2> 	pop ax
  1051                              <2> %endif
  1052                              <2> 
  1053                              <2> d0	inc byte [bp + ?errordata + 1]
  1054                              <2> 
  1055 0000067E C47EF8              <2> 	les di, [bp + ?dst]
  1056                              <2> 
  1057 00000681 91                  <2> 	xchg cx, ax			; cx = remaining length
  1058 00000682 E344                <2> 	jcxz .end
  1059                              <2> 
  1060                              <2> %if _DXTAG
  1061 00000684 3B7EF2              <2> 	cmp di, [bp + ?dst_end]
  1062                              <2> %else
  1063                              <2> 	cmp di, dx
  1064                              <2> %endif
  1065 00000687 7744                <2> 	ja .ret_CY			; error
  1066                              <2> 		; literals may branch to .start_maybe_part
  1067 00000689 741D                <2> 	je .start_maybe_part		; ?dst -> at end (put whole data at start)
  1068 0000068B 01CF                <2> 	add di, cx			; -> behind data chunk (if fits)
  1069 0000068D 720A                <2> 	jc .fill			; doesn't fit -->
  1070                              <2> %if _DXTAG
  1071 0000068F 3B7EF2              <2> 	cmp di, [bp + ?dst_end]		; fits ?
  1072                              <2> %else
  1073                              <2> 	cmp di, dx
  1074                              <2> %endif
  1075                              <2> 		; literals never branch to .fill
  1076 00000692 7705                <2> 	ja .fill			; doesn't fit -->
  1077 00000694 8B7EF8              <2> 	mov di, word [bp + ?dst]	; restore -> destination
  1078                              <2> 		; ds:si l cx fits in circular buffer
  1079 00000697 EB2C                <2> 	jmp .mov			; store full up to below-or-equal -> end
  1080                              <2> 
  1081                              <2> .fill:
  1082 00000699 8B7EF8              <2> 	mov di, word [bp + ?dst]	; restore -> destination
  1083                              <2> %if _DXTAG
  1084 0000069C 8B46F2              <2> 	mov ax, [bp + ?dst_end]		; -> behind buffer
  1085                              <2> %else
  1086                              <2> 	mov ax, dx
  1087                              <2> %endif
  1088 0000069F 29F8                <2> 	sub ax, di			; -> behind buffer minus -> destination
  1089                              <2> 					; = length fitting at end
  1090 000006A1 29C1                <2> 	sub cx, ax			; cx -= length fitting at end
  1091                              <2> 					; = remaining length to store at start
  1092 000006A3 91                  <2> 	xchg cx, ax			; cx = length fitting at end
  1093 000006A4 E82800              <2> 	call .mov_and_put		; store at end
  1094 000006A7 91                  <2> 	xchg cx, ax			; cx = remaining length to store at start
  1095                              <2> 
  1096                              <2> .start_maybe_part:
  1097 000006A8 8B7EFC              <2> 	mov di, word [bp + ?original_dst]
  1098                              <2> %ifn _DEPACKINLINELITERAL
  1099                              <2> 	test bx, bx			; literal ?
  1100                              <2> 	jnz .mov			; yes -->
  1101                              <2> %endif
  1102                              <2> 		; literals never go here
  1103                              <2> 		; the following handles source overlapping destination
  1104                              <2> 		;  s.t. source crosses the circular buffer boundary.
  1105 000006AB 89F0                <2> 	mov ax, si
  1106 000006AD 01C8                <2> 	add ax, cx			; -> behind source
  1107 000006AF 7205                <2> 	jc .part			; CY, must copy part -->
  1108                              <2> %if _DXTAG
  1109 000006B1 3B46F2              <2> 	cmp ax, [bp + ?dst_end]		; below-or-equal end of buffer ?
  1110                              <2> %else
  1111                              <2> 	cmp ax, dx
  1112                              <2> %endif
  1113 000006B4 760F                <2> 	jbe .mov			; yes -->
  1114                              <2> .part:
  1115                              <2> %if _DXTAG
  1116 000006B6 8B46F2              <2> 	mov ax, [bp + ?dst_end]
  1117                              <2> %else
  1118                              <2> 	mov ax, dx
  1119                              <2> %endif
  1120 000006B9 29F0                <2> 	sub ax, si			; ax = how much source data remains
  1121 000006BB 29C1                <2> 	sub cx, ax			; cx = how much to copy after
  1122 000006BD 91                  <2> 	xchg cx, ax			; cx = part length (source data remains)
  1123 000006BE E80E00              <2> 	call .mov_and_put		; put from end
  1124 000006C1 91                  <2> 	xchg cx, ax			; cx = how much to copy from buffer start
  1125 000006C2 8B76FC              <2> 	mov si, word [bp + ?original_dst]	; -> start of buffer
  1126                              <2> 					; continue with di -> near start of buffer
  1127                              <2> .mov:
  1128 000006C5 E80700              <2> 	call .mov_and_put
  1129                              <2> 
  1130                              <2> .end:
  1131 000006C8 897EF8              <2> 	mov word [bp + ?dst], di
  1132 000006CB F8                  <2> 	clc
  1133                              <2> .ret:
  1134 000006CC C3                  <2> 	retn
  1135                              <2> 
  1136                              <2> .ret_CY:
  1137 000006CD F9                  <2> 	stc
  1138 000006CE C3                  <2> 	retn
  1139                              <2> 
  1140                              <2> .mov_and_put:
  1141 000006CF 1E                  <2> 	 push ds
  1142 000006D0 56                  <2> 	 push si
  1143 000006D1 06                  <2> 	push es
  1144 000006D2 57                  <2> 	push di
  1145 000006D3 51                  <2> 	push cx
  1146 000006D4 F3A4                <2> 	rep movsb
  1147 000006D6 59                  <2> 	pop cx
  1148 000006D7 5E                  <2> 	pop si
  1149 000006D8 1F                  <2> 	pop ds
  1150 000006D9 E85701              <2> 	call put_file_data
  1151 000006DC 5E                  <2> 	 pop si
  1152 000006DD 1F                  <2> 	 pop ds
  1153 000006DE 01CE                <2> 	add si, cx
  1154 000006E0 C3                  <2> 	retn
  1155                              <2> 
  1156                              <2> 
  1157                              <2> %if _LZEXEDAT
  1158                              <2> 		; INP:	?src_remaining
  1159                              <2> 		;	dx / word [?tagword] = tag word
  1160                              <2> 		;	word [?tagbitscycle] = circular tag bits indicator
  1161                              <2> 		;	 (there's always a single bit set in this word.
  1162                              <2> 		;	 if this word is equal to 1 on INP then the tag
  1163                              <2> 		;	 word must be reloaded, and the last bit shifted
  1164                              <2> 		;	 out of the INP prior tag word.)
  1165                              <2> 		; OUT:	NC if read a zero,
  1166                              <2> 		;	CY if read a one,
  1167                              <2> 		;	 ?src_remaining decremented
  1168                              <2> 		;	 dx / word [?tagword] updated
  1169                              <2> 		;	 word [?tagbitscycle] updated
  1170                              <2> 		;	branches to depack.error on error
  1171                              <2> 		; CHG:	ds, si, ax
  1172                              <2> get_bit:
  1173 000006E1 D14EF0              <2> 	ror word [bp + ?tagbitscycle], 1
  1174 000006E4 7307                <2> 	jnc .left
  1175                              <2> 		; after this branch not taken, the cycle word
  1176                              <2> 		;  wraps around to be equal to 8000h. this
  1177                              <2> 		;  will wrap around again after 15 more ror.
  1178 000006E6 E80700              <2> 	call load_word
  1179                              <2> %if _DXTAG
  1180 000006E9 D1EA                <2> 	shr dx, 1
  1181 000006EB 92                  <2> 	xchg dx, ax
  1182 000006EC C3                  <2> 	retn
  1183                              <2> 
  1184                              <2> .left:
  1185 000006ED D1EA                <2> 	shr dx, 1
  1186 000006EF C3                  <2> 	retn
  1187                              <2> %else
  1188                              <2> 	shr word [bp + ?tagword], 1
  1189                              <2> 	mov word [bp + ?tagword], ax
  1190                              <2> 	retn
  1191                              <2> 
  1192                              <2> .left:
  1193                              <2> 	shr word [bp + ?tagword], 1
  1194                              <2> 	retn
  1195                              <2> %endif
  1196                              <2> 
  1197                              <2> 		; lodsw with ?src_remaining check
  1198                              <2> load_word:
  1199 000006F0 E80800              <2> 	call load_byte
  1200 000006F3 86C4                <2> 	xchg al, ah
  1201 000006F5 E80300              <2> 	call load_byte
  1202 000006F8 86C4                <2> 	xchg al, ah
  1203 000006FA C3                  <2> 	retn
  1204                              <2> 
  1205                              <2> 		; lodsb with ?src_remaining check
  1206                              <2> load_byte:
  1207 000006FB E80600              <2> 	call read_byte
  1208                              <2> d0	mov byte [bp + ?errordata], 84h
  1209 000006FE 7303E93AFF          <2> 	jc depack.error
  1210 00000703 C3                  <2> 	retn
  1211                              <2> %endif
  1212                              <2> 
  1213                              <2> %if _MULTI || !_LZEXEDAT
  1214                              <2> 		; INP:	cx = 0..15
  1215                              <2> 		;	dl = bit index, dh = current byte
  1216                              <2> 		; OUT:	NC if successful,
  1217                              <2> 		;	 ax = value read
  1218                              <2> 		;	 cx = 0
  1219                              <2> 		;	 dx updated
  1220                              <2> 		;	CY if error
  1221                              <2> 		; CHG:	ds, si
  1222                              <2> get_bits:
  1223                              <2> %ifn _DXTAG
  1224                              <2> 	push dx
  1225                              <2> 	mov dx, word [bp + ?low_bit_index_and_high_current_byte]
  1226                              <2> %endif
  1227                              <2> 	cmp cx, 15
  1228                              <2> 	ja .error
  1229                              <2> 	test cx, cx
  1230                              <2> 	jz .error
  1231                              <2> 	xor ax, ax
  1232                              <2> .loop:
  1233                              <2> 	test dl, dl
  1234                              <2> 	jnz .havebit
  1235                              <2> 	push ax
  1236                              <2> 	call read_byte
  1237                              <2> 	mov dh, al
  1238                              <2> 	mov dl, 80h
  1239                              <2> 	pop ax
  1240                              <2> 	jc .error
  1241                              <2> .havebit:
  1242                              <2> 	shl ax, 1
  1243                              <2> 	test dh, dl
  1244                              <2> 	jz @F
  1245                              <2> 	inc ax
  1246                              <2> @@:
  1247                              <2> 	shr dl, 1
  1248                              <2> 	loop .loop
  1249                              <2> .end:
  1250                              <2> 	db __TEST_IMM8		; skip stc, NC
  1251                              <2> .error:
  1252                              <2> 	stc
  1253                              <2> %ifn _DXTAG
  1254                              <2> 	mov word [bp + ?low_bit_index_and_high_current_byte], dx
  1255                              <2> 	pop dx
  1256                              <2> %endif
  1257                              <2> 	retn
  1258                              <2> %endif
  1259                              <2> 
  1260                              <2> 
  1261                              <2> 		; INP:	?src_remaining
  1262                              <2> 		; OUT:	NC if success,
  1263                              <2> 		;	 al = value read
  1264                              <2> 		;	 ?src_remaining decremented
  1265                              <2> 		;	CY if error (source buffer too small),
  1266                              <2> 		;	 ?src_remaining = 0
  1267                              <2> 		; CHG:	ds, si
  1268                              <2> read_byte:
  1269 00000704 836EF401            <2> 	sub word [bp + ?src_remaining], 1
  1270 00000708 835EF600            <2> 	sbb word [bp + ?src_remaining + 2], 0
  1271 0000070C 7204                <2> 	jb .empty
  1272                              <2> 
  1273 0000070E E8D500              <2> 	call get_file_byte
  1274 00000711 C3                  <2> 	retn
  1275                              <2> 
  1276                              <2> .empty:
  1277 00000712 8366F400            <2> 	and word [bp + ?src_remaining], 0
  1278 00000716 8366F600            <2> 	and word [bp + ?src_remaining + 2], 0
  1279 0000071A F9                  <2> 	stc
  1280 0000071B C3                  <2> 	retn
  1281                              <2> 
  1282                              <2> 	lleave ctx
  1283                              <2> 
  1284                              <2> %if _MULTI
  1285                              <2> 	resetdef LONGLITERAL
  1286                              <2> 	resetdef LZEXEDAT
  1287                              <2> %endif
  1288                              <2> 
  1289                              <2> %ifn _STANDALONE
  1290                              <2> 	resetdef COUNTER
  1291                              <2> 	resetdef DEBUG0
  1292                              <2> 
  1293                              <2> 
  1294                              <2> read_and_depack:
  1295                              <2> 	houdini
  1296                              <2> 
  1297                              <2> 		; common setup for depacking
  1298 0000071C 891E[7807]          <2> reloc	mov word [handle], bx
  1299                              <2> internaldatarelocation
  1300                              <2> 
  1301 00000720 8916[6805]          <2> reloc	mov word [depacked_buffer], dx
  1302                              <2> internaldatarelocation
  1303 00000724 8C06[6A05]          <2> reloc	mov word [depacked_buffer + 2], es
  1304                              <2> internaldatarelocation
  1305 00000728 890E[7005]          <2> reloc	mov word [depacked_length], cx
  1306                              <2> internaldatarelocation
  1307                              <2> 
  1308 0000072C D006[F602]          <2> reloc	rol byte [partialdepack], 1
  1309                              <2> internaldatarelocation
  1310 00000730 7335                <2> 	jnc .new
  1311                              <2> 		; did we save a prior partial depack ?
  1312 00000732 833E[F402]FF        <2> reloc	cmp word [depack_saved_sp], strict byte 0FFFFh
  1313                              <2> internaldatarelocation -3
  1314 00000737 742E                <2> 	je .new				; no -->
  1315 00000739 A1[6605]            <2> reloc	mov ax, word [depackseek + 2]
  1316                              <2> internaldatarelocation
  1317 0000073C 3B06[6205]          <2> reloc	cmp ax, word [depackskip + 2]
  1318                              <2> internaldatarelocation
  1319 00000740 7507                <2> 	jne @F
  1320 00000742 A1[6405]            <2> reloc	mov ax, word [depackseek]
  1321                              <2> internaldatarelocation
  1322 00000745 3B06[6005]          <2> reloc	cmp ax, word [depackskip]
  1323                              <2> internaldatarelocation
  1324                              <2> @@:
  1325 00000749 771C                <2> 	ja .new				; seek is > skip, must rewind -->
  1326                              <2> 
  1327 0000074B A1[6405]            <2> reloc	mov ax, word [depackseek]
  1328                              <2> internaldatarelocation
  1329 0000074E 2906[6005]          <2> reloc	sub word [depackskip], ax
  1330                              <2> internaldatarelocation
  1331 00000752 A1[6605]            <2> reloc	mov ax, word [depackseek + 2]
  1332                              <2> internaldatarelocation
  1333 00000755 1906[6205]          <2> reloc	sbb word [depackskip + 2], ax	; skip -= seek
  1334                              <2> internaldatarelocation
  1335                              <2> 
  1336 00000759 52                  <2> 	push dx
  1337 0000075A 53                  <2> 	push bx
  1338 0000075B 57                  <2> 	push di
  1339 0000075C 56                  <2> 	push si
  1340 0000075D 06                  <2> 	push es
  1341 0000075E 55                  <2> 	push bp
  1342 0000075F 51                  <2> 	push cx				; stack frame must match what .read expects
  1343                              <2> 
  1344 00000760 8926[7205]          <2> reloc	mov word [depack_prior_sp], sp
  1345                              <2> internaldatarelocation			; store our sp
  1346 00000764 E92C01              <2> 	jmp put_file_data.entry		; continue depacking
  1347                              <2> 
  1348                              <2> 
  1349                              <2> .new:
  1350 00000767 52                  <2> 	push dx
  1351 00000768 51                  <2> 	push cx
  1352 00000769 06                  <2> 	push es
  1353 0000076A 8B16[5805]          <2> reloc	mov dx, word [libseek]
  1354                              <2> internaldatarelocation
  1355 0000076E 8B0E[5A05]          <2> reloc	mov cx, word [libseek + 2]
  1356                              <2> internaldatarelocation
  1357 00000772 B80042              <2> 	mov ax, 4200h
  1358 00000775 E8CCFD              <2> 	call dos_or_boot_io
  1359 00000778 07                  <2> 	pop es
  1360 00000779 7266                <2> 	jc .io_error
  1361                              <2> 
  1362 0000077B C706[7407][7405]    <2> reloc2	mov word [filebuffer.next], filebuffer
  1363                              <2> internaldatarelocation -4
  1364                              <2> internaldatarelocation
  1365 00000781 C706[7607][7405]    <2> reloc2	mov word [filebuffer.tail], filebuffer
  1366                              <2> internaldatarelocation -4
  1367                              <2> internaldatarelocation
  1368                              <2> 
  1369 00000787 59                  <2> 	pop cx
  1370 00000788 5A                  <2> 	pop dx
  1371                              <2> 
  1372 00000789 31C0                <2> 	xor ax, ax
  1373 0000078B A3[6405]            <2> reloc	mov word [depackseek], ax
  1374                              <2> internaldatarelocation
  1375 0000078E A3[6605]            <2> reloc	mov word [depackseek + 2], ax
  1376                              <2> internaldatarelocation
  1377                              <2> 
  1378 00000791 52                  <2> 	push dx
  1379 00000792 53                  <2> 	push bx
  1380 00000793 57                  <2> 	push di
  1381 00000794 56                  <2> 	push si
  1382 00000795 06                  <2> 	push es
  1383 00000796 55                  <2> 	push bp
  1384 00000797 51                  <2> 	push cx
  1385 00000798 16                  <2> 	 push ss
  1386 00000799 07                  <2> 	 pop es
  1387 0000079A BF[8007]            <2> reloc	mov di, resultbuffer
  1388                              <2> internaldatarelocation
  1389 0000079D BE[8017]            <2> reloc	mov si, resultbuffer.end
  1390                              <2> internaldatarelocation
  1391                              <2> 
  1392 000007A0 8B0E[0A00]          <2> reloc	mov cx, word [libtab_compressed_length + 2]
  1393                              <2> internaldatarelocation
  1394 000007A4 8B16[0800]          <2> reloc	mov dx, word [libtab_compressed_length]
  1395                              <2> internaldatarelocation
  1396                              <2> 
  1397 000007A8 8926[7205]          <2> reloc	mov word [depack_prior_sp], sp
  1398                              <2> internaldatarelocation
  1399 000007AC BC[FC04]            <2> reloc	mov sp, depack_stack.top
  1400                              <2> internaldatarelocation
  1401                              <2> %if _MULTI
  1402                              <2> reloc	mov al, byte [depack_format]
  1403                              <2> internaldatarelocation
  1404                              <2> %endif
  1405 000007AF E8EAFD              <2> 	call depack
  1406 000007B2 C706[F402]FFFF      <2> reloc	mov word [depack_saved_sp], 0FFFFh
  1407                              <2> internaldatarelocation -4
  1408                              <2> .read:
  1409 000007B8 16                  <2> 	 push ss
  1410 000007B9 1F                  <2> 	 pop ds
  1411                              <2> 
  1412 000007BA FF36[6405]          <2> reloc	push word [depackseek]
  1413                              <2> internaldatarelocation
  1414 000007BE FF36[6605]          <2> reloc	push word [depackseek + 2]
  1415                              <2> internaldatarelocation
  1416 000007C2 8F06[6205]          <2> reloc	pop word [depackskip + 2]
  1417                              <2> internaldatarelocation
  1418 000007C6 8F06[6005]          <2> reloc	pop word [depackskip]
  1419                              <2> internaldatarelocation
  1420                              <2> 
  1421 000007CA 8B26[7205]          <2> reloc	mov sp, word [depack_prior_sp]
  1422                              <2> internaldatarelocation
  1423 000007CE 7209                <2> 	jc @F
  1424 000007D0 A1[7005]            <2> reloc	mov ax, word [depacked_length]
  1425                              <2> internaldatarelocation
  1426 000007D3 F7D8                <2> 	neg ax			; - remain
  1427 000007D5 59                  <2> 	pop cx
  1428 000007D6 01C8                <2> 	add ax, cx		; requested - remain = how much read
  1429 000007D8 A8                  <2> 	db __TEST_IMM8		; skip pop, NC
  1430                              <2> @@:
  1431 000007D9 59                  <2> 	pop cx
  1432 000007DA 5D                  <2> 	pop bp
  1433 000007DB 07                  <2> 	pop es
  1434 000007DC 5E                  <2> 	pop si
  1435 000007DD 5F                  <2> 	pop di
  1436 000007DE 5B                  <2> 	pop bx
  1437 000007DF 5A                  <2> 	pop dx
  1438 000007E0 C3                  <2> 	retn
  1439                              <2> 
  1440                              <2> .io_error:
  1441 000007E1 83C404              <2> 	add sp, 4
  1442 000007E4 F9                  <2> 	stc
  1443 000007E5 C3                  <2> 	retn
  1444                              <2> 
  1445                              <2> 
  1446                              <2> get_file_byte:
  1447 000007E6 368B36[7407]        <2> reloc	mov si, [ss:filebuffer.next]
  1448                              <2> internaldatarelocation
  1449 000007EB 363B36[7607]        <2> reloc	cmp si, [ss:filebuffer.tail]
  1450                              <2> internaldatarelocation
  1451 000007F0 7238                <2> 	jb .buffered
  1452                              <2> 
  1453 000007F2 50                  <2> 	push ax
  1454 000007F3 53                  <2> 	push bx
  1455 000007F4 51                  <2> 	push cx
  1456 000007F5 52                  <2> 	push dx
  1457 000007F6 06                  <2> 	push es
  1458 000007F7 1E                  <2> 	push ds
  1459                              <2> 
  1460 000007F8 16                  <2> 	 push ss
  1461 000007F9 1F                  <2> 	 pop ds
  1462 000007FA 16                  <2> 	 push ss
  1463 000007FB 07                  <2> 	 pop es
  1464 000007FC BA[7405]            <2> reloc	mov dx, filebuffer
  1465                              <2> internaldatarelocation
  1466 000007FF 8916[7407]          <2> reloc	mov [filebuffer.next], dx
  1467                              <2> internaldatarelocation
  1468 00000803 8916[7607]          <2> reloc	mov [filebuffer.tail], dx
  1469                              <2> internaldatarelocation
  1470 00000807 B8003F              <2> 	mov ax, 3F00h
  1471 0000080A 8B1E[7807]          <2> reloc	mov bx, [handle]
  1472                              <2> internaldatarelocation
  1473 0000080E B90002              <2> 	mov cx, filebuffer.end - filebuffer
  1474 00000811 E830FD              <2> 	call dos_or_boot_io
  1475 00000814 720C                <2> 	jc @F			; CY -->
  1476 00000816 85C0                <2> 	test ax, ax
  1477 00000818 F9                  <2> 	stc			; CY
  1478 00000819 7407                <2> 	jz @F
  1479 0000081B 01D0                <2> 	add ax, dx		; NC
  1480 0000081D A3[7607]            <2> reloc	mov word [filebuffer.tail], ax
  1481                              <2> internaldatarelocation
  1482 00000820 89D6                <2> 	mov si, dx
  1483                              <2> @@:
  1484 00000822 1F                  <2> 	pop ds
  1485 00000823 07                  <2> 	pop es
  1486 00000824 5A                  <2> 	pop dx
  1487 00000825 59                  <2> 	pop cx
  1488 00000826 5B                  <2> 	pop bx
  1489 00000827 58                  <2> 	pop ax
  1490 00000828 7208                <2> 	jc .ret
  1491                              <2> .buffered:
  1492 0000082A 36AC                <2> 	ss lodsb
  1493 0000082C 368936[7407]        <2> reloc	mov [ss:filebuffer.next], si
  1494                              <2> internaldatarelocation
  1495 00000831 F8                  <2> 	clc
  1496                              <2> .ret:
  1497 00000832 C3                  <2> 	retn
  1498                              <2> 
  1499                              <2> 
  1500                              <2> 		; INP:	ds:si -> data to write
  1501                              <2> 		;	cx = length of data (may be zero)
  1502                              <2> 		; OUT:	Does not return if error
  1503                              <2> 		; CHG:	-
  1504                              <2> put_file_data:
  1505 00000833 50                  <2> 	push ax
  1506 00000834 53                  <2> 	push bx
  1507 00000835 51                  <2> 	push cx
  1508 00000836 52                  <2> 	push dx
  1509 00000837 1E                  <2> 	push ds
  1510 00000838 56                  <2> 	push si
  1511 00000839 06                  <2> 	push es
  1512 0000083A 57                  <2> 	push di
  1513 0000083B 16                  <2> 	 push ss
  1514 0000083C 1F                  <2> 	 pop ds
  1515                              <2> .entry2:
  1516                              <2> %if 0
  1517                              <2> reloc	cmp word [depackseek], strict word 0AFh
  1518                              <2> internaldatarelocation -4
  1519                              <2> 	jne @F
  1520                              <2> reloc	cmp word [depackseek + 2], strict byte 0
  1521                              <2> internaldatarelocation -3
  1522                              <2> 	jne @F
  1523                              <2> 	houdini
  1524                              <2> @@:
  1525                              <2> %endif
  1526 0000083D 51                  <2> 	push cx			; put data length, add to depackseek maybe
  1527 0000083E 833E[6205]00        <2> reloc	cmp word [depackskip + 2], strict byte 0
  1528                              <2> internaldatarelocation -3
  1529 00000843 755D                <2> 	jne .skip
  1530 00000845 390E[6005]          <2> reloc	cmp word [depackskip], cx
  1531                              <2> internaldatarelocation
  1532 00000849 7357                <2> 	jae .skip		; still have to skip -->
  1533 0000084B 31D2                <2> 	xor dx, dx
  1534 0000084D 8716[6005]          <2> reloc	xchg dx, word [depackskip]
  1535                              <2> internaldatarelocation		; how much to skip in this step
  1536                              <2> 				; dx = how many bytes skipped
  1537 00000851 01D6                <2> 	add si, dx		; -> data to copy (part of put data)
  1538 00000853 29D1                <2> 	sub cx, dx		; data - skip = length of data to copy, at least 1
  1539 00000855 7454                <2> 	jz .ret_cx		; (not needed ?)
  1540 00000857 51                  <2> 	push cx			; = how many bytes left at si
  1541 00000858 C43E[6805]          <2> reloc	les di, [depacked_buffer]
  1542                              <2> internaldatarelocation
  1543 0000085C A1[7005]            <2> reloc	mov ax, word [depacked_length]
  1544                              <2> internaldatarelocation		; how much we want to read
  1545 0000085F 39C8                <2> 	cmp ax, cx
  1546 00000861 7302                <2> 	jae @F
  1547 00000863 89C1                <2> 	mov cx, ax		; cx = min(ax, cx) lesser of requested, available
  1548                              <2> @@:
  1549 00000865 89C8                <2> 	mov ax, cx		; how much we want to copy
  1550 00000867 F3A4                <2> 	rep movsb		; copy to user buffer, si -> data left if any
  1551                              <2> 
  1552 00000869 893E[6805]          <2> reloc	mov word [depacked_buffer], di
  1553                              <2> internaldatarelocation		; -> past copied data
  1554 0000086D 2906[7005]          <2> reloc	sub word [depacked_length], ax
  1555                              <2> internaldatarelocation		; decrement count of how much still wanted
  1556                              <2> 		; this is NZ only if available < requested
  1557 00000871 59                  <2> 	pop cx			; = how many bytes left at prior si -> data just copied
  1558 00000872 7537                <2> 	jnz .ret_cx		; go add full length of put data to depackseek
  1559 00000874 01C2                <2> 	add dx, ax		; how many bytes processed (skipped + copied)
  1560 00000876 0116[6405]          <2> reloc	add word [depackseek], dx
  1561                              <2> internaldatarelocation
  1562 0000087A 8316[6605]00        <2> reloc	adc word [depackseek + 2], strict byte 0
  1563                              <2> internaldatarelocation -3	; add to seek the last bit processed
  1564 0000087F 5A                  <2> 	pop dx			; discard cx on stack
  1565 00000880 29C1                <2> 	sub cx, ax		; = how many bytes left after new si ->
  1566 00000882 890E[6C05]          <2> reloc	mov word [depack_left_length], cx
  1567                              <2> internaldatarelocation		; = amount data left after new si ->
  1568 00000886 8936[6E05]          <2> reloc	mov word [depack_left_address], si
  1569                              <2> internaldatarelocation		; at current depackseek -> data left if any
  1570 0000088A 55                  <2> 	push bp
  1571 0000088B 8926[F402]          <2> reloc	mov word [depack_saved_sp], sp
  1572                              <2> internaldatarelocation
  1573 0000088F F8                  <2> 	clc
  1574 00000890 E925FF              <2> 	jmp read_and_depack.read
  1575                              <2> 
  1576                              <2> .entry:
  1577 00000893 8B26[F402]          <2> reloc	mov sp, word [depack_saved_sp]
  1578                              <2> internaldatarelocation
  1579 00000897 5D                  <2> 	pop bp
  1580 00000898 8B0E[6C05]          <2> reloc	mov cx, word [depack_left_length]
  1581                              <2> internaldatarelocation
  1582 0000089C 8B36[6E05]          <2> reloc	mov si, word [depack_left_address]
  1583                              <2> internaldatarelocation
  1584 000008A0 EB9B                <2> 	jmp .entry2
  1585                              <2> 
  1586                              <2> .skip:
  1587 000008A2 290E[6005]          <2> reloc	sub word [depackskip], cx
  1588                              <2> internaldatarelocation
  1589 000008A6 831E[6205]00        <2> reloc	sbb word [depackskip + 2], strict byte 0
  1590                              <2> internaldatarelocation -3
  1591                              <2> 
  1592                              <2> .ret_cx:
  1593 000008AB 59                  <2> 	pop cx
  1594 000008AC 010E[6405]          <2> reloc	add word [depackseek], cx
  1595                              <2> internaldatarelocation
  1596 000008B0 8316[6605]00        <2> reloc	adc word [depackseek + 2], strict byte 0
  1597                              <2> internaldatarelocation -3
  1598                              <2> 
  1599                              <2> .ret:
  1600 000008B5 5F                  <2> 	pop di
  1601 000008B6 07                  <2> 	pop es
  1602 000008B7 5E                  <2> 	pop si
  1603 000008B8 1F                  <2> 	pop ds
  1604 000008B9 5A                  <2> 	pop dx
  1605 000008BA 59                  <2> 	pop cx
  1606 000008BB 5B                  <2> 	pop bx
  1607 000008BC 58                  <2> 	pop ax
  1608 000008BD C3                  <2> 	retn
  1609                              <2> %endif
   813                              <1> %endif
   814                              <1> 
   815                              <1> 
   816                              <1> get_es_ext:
   817 000008BE 8E06[0000]          <1> reloc	mov es, word [relocateddata]
   818                              <1> linkdatarelocation extdssel
   819 000008C2 E8AB00              <1> 	extcallcall ispm
   820 000008C5 7404                <1> 	jz @F
   821 000008C7 8E06[0000]          <1> reloc	mov es, word [relocateddata]
   822                              <1> linkdatarelocation extseg
   823                              <1> @@:
   824 000008CB C3                  <1> 	retn
   825                              <1> 
   826                              <1> 
   827 000008CC 90<rep 4h>          <1> 	align 16
   828                              <1> relocator:
   829 000008D0 56                  <1> 	push si
   830 000008D1 57                  <1> 	push di
   831 000008D2 1E                  <1> 	push ds
   832 000008D3 06                  <1> 	push es
   833                              <1> 
   834 000008D4 06                  <1> 	 push es
   835 000008D5 1F                  <1> 	 pop ds
   836 000008D6 B90000              <1> 	mov cx, 0
   837                              <1> .codelength equ $ - 2
   838 000008D9 BE0000              <1> 	mov si, 0
   839                              <1> .codesource equ $ - 2
   840 000008DC BF[0000]            <1> 	mov di, code
   841                              <1> .codedestination equ $ - 2
   842                              <1> internalcoderelocation
   843 000008DF F3A4                <1> 	rep movsb
   844                              <1> 
   845 000008E1 16                  <1> 	 push ss
   846 000008E2 07                  <1> 	 pop es
   847 000008E3 16                  <1> 	 push ss
   848 000008E4 1F                  <1> 	 pop ds
   849 000008E5 B90000              <1> 	mov cx, 0
   850                              <1> .datalength equ $ - 2
   851 000008E8 BE0000              <1> 	mov si, 0
   852                              <1> .datasource equ $ - 2
   853 000008EB BF[0000]            <1> 	mov di, datastart
   854                              <1> .datadestination equ $ - 2
   855                              <1> internaldatarelocation
   856 000008EE F3A4                <1> 	rep movsb
   857                              <1> 
   858 000008F0 07                  <1> 	pop es
   859 000008F1 C706[0000]0000      <1> 	mov word [relocateddata], 0
   860                              <1> linkdatarelocation extseg_used, -4
   861                              <1> .extseg_used equ $ - 2
   862 000008F7 C706[0000]0000      <1> 	mov word [relocateddata], 0
   863                              <1> linkdatarelocation extdata_used, -4
   864                              <1> .extdata_used equ $ - 2
   865                              <1> 
   866 000008FD B90000              <1> 	mov cx, 0
   867                              <1> .entry equ $ - 2
   868 00000900 1F                  <1> 	pop ds
   869 00000901 5F                  <1> 	pop di
   870 00000902 5E                  <1> 	pop si
   871 00000903 FFE1                <1> 	jmp cx
   872                              <1> 
   873 00000905 90<rep Bh>          <1> 	align 16
   874                              <1> 	endarea relocator
   875                              <1> 
   876                              <1> 
   877                              <1> DATAOFFSET equ CODEOFFSET + code_size
   878                              <1> 	addsection DATA, follows=CODE vstart=_ELD_DATA_VSTART
   879                              <1> datastart:
   880                              <1> PUT_ELD_DATETIME
   881                              <1> 
   882                              <1> %define INCBINLIST db ""
   883                              <1> 
   884                              <1> 	%imacro libeld 1-2.nolist
   885                              <1> %strcat %%label "lib_", %1
   886                              <1> %deftok %%token %%label
   887                              <1> %if _XLD
   888                              <1>  %strcat %%filename %1,".xld"
   889                              <1> %else
   890                              <1>  %strcat %%filename %1,".eld"
   891                              <1> %endif
   892                              <1> %xdefine INCBINLIST INCBINLIST, {align 16, db 0}, %%token:, incbin %%filename
   893                              <1> 	dd %%token
   894                              <1> 	fill 8, 32, db %1
   895                              <1> 	%endmacro
   896                              <1> 
   897                              <1> 	%imacro dump_incbin 1-*.nolist
   898                              <1> %rep %0
   899                              <1> 	%1
   900                              <1>  %rotate 1
   901                              <1> %endrep
   902                              <1> 	%endmacro
   903                              <1> 
   904                              <1> %ifn _COMPRESSED
   905                              <1> 	overridedef LZEXEDAT, 0
   906                              <1> %endif
   907                              <1> %ifn _LZEXEDAT
   908                              <1> 	overridedef LONGLITERAL, 0
   909                              <1> %endif
   910                              <1> 
   911                              <1> 	align 4, db 0
   912                              <1> libtable:
   913                              <1>  istruc ELD_LIBTABLE
   914 00000000 0400                <1> at eldltFormat,		dw 2 * !!_COMPRESSED + !!_LZEXEDAT + !!_LONGLITERAL
   915                              <1> 	; 0 = uncompressed
   916                              <1> 	; 1 = legacy heatshrink format (no libtab compressed length)
   917                              <1> 	; 2 = heatshrink format (prepended with -w and -l bytes)
   918                              <1> 	; 3 = lzexedat -4 format (current revision starts with a 1 bit)
   919                              <1> 	; 4 = lzexedat -4 -l format (current revision starts with a 1 bit)
   920 00000002 3E00                <1> at eldltAmount,		dw (lib_end - lib) / 12
   921                              <1> at eldltOffset
   922 00000004 001A0000            <1> ..@eldltOffset:		dd LIBOFFSET
   923                              <1>  iend
   924                              <1>  %if _COMPRESSED
   925                              <1> libtab_compressed_length:
   926 00000008 D93B0200            <1> 			dd (lib_compressed_end - lib_start)
   927                              <1>  %endif
   928                              <1> %else
   929                              <1> 		; Collect the binaries and compress them solidly.
   930                              <1> 	%imacro libeld 1-2.nolist
   931                              <1> %strcat %%label "lib_", %1
   932                              <1> %deftok %%token %%label
   933                              <1> %if _XLD
   934                              <1>  %strcat %%filename %1,".xld"
   935                              <1> %else
   936                              <1>  %strcat %%filename %1,".eld"
   937                              <1> %endif
   938                              <1> 	align 16, db 0
   939                              <1> %%token:
   940                              <1> 	incbin %%filename
   941                              <1> 	%endmacro
   942                              <1> %endif
   943                              <1> 
   944                              <1> 	numdef ELD_DEBUG_LIB, 0
   945                              <1> lib:
   946                              <1> %if _ELD_DEBUG_LIB
   947                              <1> libeld "eldteste"
   948                              <1> libeld "eldtestf"
   949                              <1> %else
   950 0000000C [00000000]61666F72- <1> libeld "aformat"
   950 00000014 6D617420            <1>
   951 00000018 [F00C0000]616C6961- <1> libeld "alias"
   951 00000020 7320<rep 3h>        <1>
   952 00000024 [401D0000]616D6973- <1> libeld "amiscmd"
   952 0000002C 636D6420            <1>
   953 00000030 [D0290000]616D6973- <1> libeld "amismsg"
   953 00000038 6D736720            <1>
   954 0000003C [10360000]616D6973- <1> libeld "amisoth"
   954 00000044 6F746820            <1>
   955 00000048 [10410000]616D6974- <1> libeld "amitsrs"
   955 00000050 73727320            <1>
   956 00000054 [F0590000]616D6F75- <1> libeld "amount"
   956 0000005C 6E7420<rep 2h>      <1>
   957 00000060 [80650000]62617365- <1> libeld "bases"
   957 00000068 7320<rep 3h>        <1>
   958 0000006C [C0720000]626F6F74- <1> libeld "bootdir"
   958 00000074 64697220            <1>
   959 00000078 [308A0000]63686563- <1> libeld "checksum"
   959 00000080 6B73756D            <1>
   960 00000084 [B0960000]63687374- <1> libeld "chstool"
   960 0000008C 6F6F6C20            <1>
   961 00000090 [40B10000]636F20-   <1> libeld "co"
   961 00000090 <rep 6h>            <1>
   962 0000009C [50C30000]636F6E66- <1> libeld "config"
   962 000000A4 696720<rep 2h>      <1>
   963 000000A8 [60CD0000]64626974- <1> libeld "dbitmap"
   963 000000B0 6D617020            <1>
   964 000000B4 [B0E00000]64657669- <1> libeld "devices"
   964 000000BC 63657320            <1>
   965 000000C0 [C0EE0000]64686D20- <1> libeld "dhm"
   965 000000C0 <rep 5h>            <1>
   966 000000CC [D0FC0000]646920-   <1> libeld "di"
   966 000000CC <rep 6h>            <1>
   967 000000D8 [90100100]646D20-   <1> libeld "dm"
   967 000000D8 <rep 6h>            <1>
   968 000000E4 [F0210100]646F7363- <1> libeld "doscd"
   968 000000EC 6420<rep 3h>        <1>
   969 000000F0 [302A0100]646F7364- <1> libeld "dosdir"
   969 000000F8 697220<rep 2h>      <1>
   970 000000FC [20410100]646F7364- <1> libeld "dosdrive"
   970 00000104 72697665            <1>
   971 00000108 [60490100]646F7370- <1> libeld "dospwd"
   971 00000110 776420<rep 2h>      <1>
   972 00000114 [50510100]646F7373- <1> libeld "dosseek"
   972 0000011C 65656B20            <1>
   973 00000120 [805D0100]646F7373- <1> libeld "dosspace"
   973 00000128 70616365            <1>
   974 0000012C [00700100]646F7373- <1> libeld "dosstrat"
   974 00000134 74726174            <1>
   975 00000138 [E07A0100]64706220- <1> libeld "dpb"
   975 00000138 <rep 5h>            <1>
   976 00000144 [90910100]64746164- <1> libeld "dtadisp"
   976 0000014C 69737020            <1>
   977 00000150 [10990100]647820-   <1> libeld "dx"
   977 00000150 <rep 6h>            <1>
   978 0000015C [A0A70100]65727266- <1> libeld "errfix"
   978 00000164 697820<rep 2h>      <1>
   979 00000168 [C0B50100]6578746E- <1> libeld "extname"
   979 00000170 616D6520            <1>
   980 00000174 [10C70100]68696E74- <1> libeld "hint"
   980 0000017C 20<rep 4h>          <1>
   981 00000180 [D0D30100]68696E74- <1> libeld "hintoth"
   981 00000188 6F746820            <1>
   982 0000018C [80E00100]68697374- <1> libeld "history"
   982 00000194 6F727920            <1>
   983 00000198 [50EC0100]69666578- <1> libeld "ifext"
   983 000001A0 7420<rep 3h>        <1>
   984 000001A4 [90F90100]696E6A65- <1> libeld "inject"
   984 000001AC 637420<rep 2h>      <1>
   985 000001B0 [50050200]696E7374- <1> libeld "instnoth"
   985 000001B8 6E6F7468            <1>
   986 000001BC [50130200]696E7374- <1> libeld "instnoun"
   986 000001C4 6E6F756E            <1>
   987 000001C8 [A01F0200]6B636D64- <1> libeld "kcmdline"
   987 000001D0 6C696E65            <1>
   988 000001D4 [C02B0200]6B646973- <1> libeld "kdisplay"
   988 000001DC 706C6179            <1>
   989 000001E0 [00350200]6C646D65- <1> libeld "ldmem"
   989 000001E8 6D20<rep 3h>        <1>
   990 000001EC [C05B0200]6C646D65- <1> libeld "ldmemoth"
   990 000001F4 6D6F7468            <1>
   991 000001F8 [50850200]6C696E66- <1> libeld "linfo"
   991 00000200 6F20<rep 3h>        <1>
   992 00000204 [40960200]6C697374- <1> libeld "list"
   992 0000020C 20<rep 4h>          <1>
   993 00000210 [C0B90200]70617468- <1> libeld "path"
   993 00000218 20<rep 4h>          <1>
   994 0000021C [90CB0200]7072696E- <1> libeld "printf"
   994 00000224 746620<rep 2h>      <1>
   995 00000228 [60DF0200]71756965- <1> libeld "quiet"
   995 00000230 7420<rep 3h>        <1>
   996 00000234 [C0EA0200]71756974- <1> libeld "quit"
   996 0000023C 20<rep 4h>          <1>
   997 00000240 [D0F60200]72636578- <1> libeld "rcexec"
   997 00000248 656320<rep 2h>      <1>
   998 0000024C [00020300]7264756D- <1> libeld "rdumpidx"
   998 00000254 70696478            <1>
   999 00000258 [100E0300]7264756D- <1> libeld "rdumpstr"
   999 00000260 70737472            <1>
  1000 00000264 [F0190300]7265636C- <1> libeld "reclaim"
  1000 0000026C 61696D20            <1>
  1001 00000270 [30210300]72657365- <1> libeld "reserve"
  1001 00000278 72766520            <1>
  1002 0000027C [40370300]726D20-   <1> libeld "rm"
  1002 0000027C <rep 6h>            <1>
  1003 00000288 [90410300]726E20-   <1> libeld "rn"
  1003 00000288 <rep 6h>            <1>
  1004 00000294 [E0500300]7320-     <1> libeld "s"
  1004 00000294 <rep 7h>            <1>
  1005 000002A0 [90660300]73627261- <1> libeld "sbranch"
  1005 000002A8 6E636820            <1>
  1006 000002AC [D0720300]73657420- <1> libeld "set"
  1006 000002AC <rep 5h>            <1>
  1007 000002B8 [A0850300]74736320- <1> libeld "tsc"
  1007 000002B8 <rep 5h>            <1>
  1008 000002C4 [20950300]75736570- <1> libeld "useparat"
  1008 000002CC 61726174            <1>
  1009 000002D0 [10A40300]76617269- <1> libeld "variable"
  1009 000002D8 61626C65            <1>
  1010 000002DC [90B30300]77697468- <1> libeld "withhdr"
  1010 000002E4 68647220            <1>
  1011 000002E8 [F0BF0300]7820-     <1> libeld "x"
  1011 000002E8 <rep 7h>            <1>
  1012                              <1> %endif
  1013                              <1> lib_end:
  1014                              <1> 
  1015                              <1> %ifn _COMPRESSLIB
  1016                              <1> %if _COMPRESSED
  1017                              <1> 	align 2, db 0
  1018 000002F4 FFFF                <1> depack_saved_sp:	dw 0FFFFh
  1019 000002F6 FF                  <1> partialdepack:		db 0FFh
  1020                              <1> %endif
  1021                              <1> 
  1022                              <1> msg:
  1023 000002F7 496E7465726E616C20- <1> .ext_error_internal:	asciz "Internal error in EXT LIB command.",13,10
  1023 00000300 6572726F7220696E20- <1>
  1023 00000309 455854204C49422063- <1>
  1023 00000312 6F6D6D616E642E0D0A- <1>
  1023 0000031B 00                  <1>
  1024 0000031C 455854204C49422063- <1> .ext_error_io:		asciz "EXT LIB command got I/O error.",13,10
  1024 00000325 6F6D6D616E6420676F- <1>
  1024 0000032E 7420492F4F20657272- <1>
  1024 00000337 6F722E0D0A00        <1>
  1025 0000033D 455854204C49423A20- <1> .ext_error_invalid:	asciz "EXT LIB: No or invalid Extension for lDebug header.",13,10
  1025 00000346 4E6F206F7220696E76- <1>
  1025 0000034F 616C69642045787465- <1>
  1025 00000358 6E73696F6E20666F72- <1>
  1025 00000361 206C44656275672068- <1>
  1025 0000036A 65616465722E0D0A00  <1>
  1026 00000373 4F7574206F66206D65- <1> .ext_error_oom:		asciz "Out of memory in EXT LIB command.",13,10
  1026 0000037C 6D6F727920696E2045- <1>
  1026 00000385 5854204C494220636F- <1>
  1026 0000038E 6D6D616E642E0D0A00  <1>
  1027 00000397 455854204C49423A20- <1> .notfound.1:		asciz 'EXT LIB: No ELD found by the name "'
  1027 000003A0 4E6F20454C4420666F- <1>
  1027 000003A9 756E64206279207468- <1>
  1027 000003B2 65206E616D65202200  <1>
  1028 000003BB 22210D0A00          <1> .notfound.2:		asciz '"!',13,10
  1029 000003C0 455854204C49423A20- <1> .notfound.invalid:	asciz "EXT LIB: No ELD found, invalid name!",13,10
  1029 000003C9 4E6F20454C4420666F- <1>
  1029 000003D2 756E642C20696E7661- <1>
  1029 000003DB 6C6964206E616D6521- <1>
  1029 000003E4 0D0A00              <1>
  1030 000003E7 202000              <1> .between:		asciz "  "
  1031 000003EA 4E6F20646573637269- <1> .nodesc:		db "No description."
  1031 000003F3 7074696F6E2E        <1>
  1032 000003F9 0D0A00              <1> .linebreak:		asciz 13,10
  1033                              <1> 
  1034                              <1> depack_stack: equ $
  1035                              <1> 
  1036 000003FC 455854204C49423A20- <1> .unexpected_eol:	asciz "EXT LIB: Unexpected End Of Line, expected closing quote mark!",13,10
  1036 00000405 556E65787065637465- <1>
  1036 0000040E 6420456E64204F6620- <1>
  1036 00000417 4C696E652C20657870- <1>
  1036 00000420 656374656420636C6F- <1>
  1036 00000429 73696E672071756F74- <1>
  1036 00000432 65206D61726B210D0A- <1>
  1036 0000043B 00                  <1>
  1037 0000043C 48454C5000          <1> .help_keyword:		asciz "HELP"
  1038 00000441 444553435249424500  <1> .describe_keyword:	asciz "DESCRIBE"
  1039 0000044A 444553435249424558- <1> .describex_keyword:	asciz "DESCRIBEX"
  1039 00000453 00                  <1>
  1040                              <1> %if _COMPRESSED && _ELD_TEST_LIB
  1041                              <1> .test_keyword:		asciz "TEST"
  1042                              <1> %endif
  1043 00000454 5749444500          <1> .wide_keyword:		asciz "WIDE"
  1044 00000459 455854204C49422063- <1> .help:			db "EXT LIB command. This ELD is a library of other ELDs.",13,10
  1044 00000462 6F6D6D616E642E2054- <1>
  1044 0000046B 68697320454C442069- <1>
  1044 00000474 732061206C69627261- <1>
  1044 0000047D 7279206F66206F7468- <1>
  1044 00000486 657220454C44732E0D- <1>
  1044 0000048F 0A                  <1>
  1045 00000490 52756E207769746820- <1> 			db "Run with an ELD instance name to run another ELD.",13,10
  1045 00000499 616E20454C4420696E- <1>
  1045 000004A2 7374616E6365206E61- <1>
  1045 000004AB 6D6520746F2072756E- <1>
  1045 000004B4 20616E6F7468657220- <1>
  1045 000004BD 454C442E0D0A        <1>
  1046 000004C3 52756E207769746820- <1> 			db "Run with HELP DESCRIBE to dump descriptions (slow)",13,10
  1046 000004CC 48454C502044455343- <1>
  1046 000004D5 5249424520746F2064- <1>
  1046 000004DE 756D70206465736372- <1>
  1046 000004E7 697074696F6E732028- <1>
  1046 000004F0 736C6F77290D0A      <1>
  1047 000004F7 206F72207769746820- <1> 			db " or with HELP WIDE to display only known ELD names (fast).",13,10
  1047 00000500 48454C502057494445- <1>
  1047 00000509 20746F20646973706C- <1>
  1047 00000512 6179206F6E6C79206B- <1>
  1047 0000051B 6E6F776E20454C4420- <1>
  1047 00000524 6E616D657320286661- <1>
  1047 0000052D 7374292E0D0A        <1>
  1048 00000533 00                  <1> 			asciz
  1049 00000534 0D0A                <1> .list:			db 13,10
  1050 00000536 4C697374206F662063- <1> 			asciz "List of contained ELDs:",13,10
  1050 0000053F 6F6E7461696E656420- <1>
  1050 00000548 454C44733A0D0A00    <1>
  1051                              <1> 
  1052                              <1> uinit_data: equ $
  1053                              <1> 
  1054                              <1> 	align 16, db 0
  1055                              <1> init_data_end:
  1056                              <1> data_size equ $ - datastart
  1057                              <1> transient_data_size equ data_size
  1058                              <1> 
  1059                              <1> %if _COMPRESSED
  1060                              <1> 	absolute depack_stack
  1061                              <1> 	alignb 2
  1062 000003FC <res 100h>          <1> 		resb 256
  1063                              <1> depack_stack.top:
  1064                              <1> 
  1065                              <1>  %if uinit_data > depack_stack.top
  1066                              <1> 	absolute uinit_data
  1067                              <1>  %endif
  1068                              <1> %else
  1069                              <1> 	absolute uinit_data
  1070                              <1> %endif
  1071                              <1> 
  1072                              <1> 	alignb 2
  1073 00000550 ????????????????    <1> namebuffer:	resb 8
  1074 00000558 ????????            <1> libseek:	resd 1
  1075 0000055C ????????            <1> eldheader:	resd 1
  1076                              <1> 
  1077                              <1> %if _COMPRESSED
  1078 00000560 ????????            <1> depackskip:	resd 1
  1079 00000564 ????????            <1> depackseek:	resd 1
  1080 00000568 ????????            <1> depacked_buffer:resd 1
  1081 0000056C ????                <1> depack_left_length:	resw 1
  1082 0000056E ????                <1> depack_left_address:	resw 1
  1083 00000570 ????                <1> depacked_length:resw 1
  1084 00000572 ????                <1> depack_prior_sp:resw 1
  1085                              <1> 	alignb 2
  1086                              <1> filebuffer:
  1087                              <1> %if _ALIGNPAGE
  1088 00000574 <res 200h>          <1> 	resb 512
  1089                              <1> %else
  1090                              <1> 	resb 256
  1091                              <1> %endif
  1092                              <1> .end:
  1093                              <1> 	alignb 2
  1094 00000774 ????                <1> .next:		resw 1
  1095 00000776 ????                <1> .tail:		resw 1
  1096 00000778 ????                <1> handle:		resw 1
  1097                              <1> 
  1098 0000077A ????????????        <1> 	alignb 16
  1099                              <1> resultbuffer:
  1100                              <1> .size equ 4096
  1101 00000780 <res 1000h>         <1> 		resb .size
  1102                              <1> .end:
  1103                              <1> %endif
  1104                              <1> 
  1105                              <1> 	alignb 16
  1106                              <1> resident_data_end:
  1107                              <1> uinit_data_end:
  1108                              <1> resident_data_size equ resident_data_end - datastart
  1109                              <1> 
  1110                              <1> %if uinit_data_end >= init_data_end
  1111                              <1>  total_data_size equ $ - datastart
  1112                              <1> %else
  1113                              <1>  total_data_size equ init_data_end - datastart
  1114                              <1> %endif
  1115                              <1> %assign _DATA_SIZE total_data_size
  1116                              <1> 
  1117                              <1> 	usesection CODE
  1118                              <1> 
  1119                              <1> %include "eldlink.asm"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug linker
     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> %include "lmacros3.mac"
     1                              <3> [list -]
    16                              <2> %include "eld.mac"
     1                              <3> %if 0
     2                              <3> 
     3                              <3> Extensions for lDebug macros
     4                              <3> 
     5                              <3> Copyright (C) 2008-2025 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 ELD_MAC
    16                              <3> %define ELD_MAC 1
    17                              <3> 
    18                              <3> %include "lmacros3.mac"
    19                              <3> 
    20                              <3> 		; ELD executable header
    21                              <3> 	struc ELD_HEADER
    22                              <3> eldhSignature:		resb 4	; "ELD1"
    23                              <3> 			resb 3	; reserved
    24                              <3> 			resb 1	; 26 (Ctrl-Z)
    25                              <3> eldhCodeOffset:		resd 1	; position displacement from eldhSignature
    26                              <3> eldhCodeImageLength:	resw 1	; amount bytes, at least 32
    27                              <3> eldhCodeAllocLength:	resw 1	; amount bytes, added to prior. sum < 64 KiB
    28                              <3> eldhDataOffset:		resd 1
    29                              <3> eldhDataImageLength:	resw 1	; (zero allowed)
    30                              <3> eldhDataAllocLength:	resw 1	; (zero allowed)
    31                              <3> eldhCodeEntrypoint:	resw 1	; within code section, used as displacement
    32                              <3> eldhReserved:		resb 4	; reserved
    33                              <3> eldhExtensionSize:	resw 1	; from eldhSignature, -> past eldhx fields in use
    34                              <3> 	endstruc
    35                              <3> 	endarea ELD_HEADER, 1
    36                              <3> 
    37                              <3> 	struc ELD_HEADERX
    38                              <3> eldhxHeader:		resb ELD_HEADER_size
    39                              <3> eldhxDescriptionOffset:	resd 1	; zero if none, from eldhxHeader. <= 128 Bytes
    40                              <3> eldhxHelpOffset:	resd 1	; zero if none, from eldhxHeader
    41                              <3> eldhxLibTable:		resd 1	; zero if none, from eldhxHeader
    42                              <3> eldhxDateTimeOffset:	resd 1	; zero if none, from eldhxHeader
    43                              <3> 	alignb 16
    44                              <3> 	endstruc
    45                              <3> 
    46                              <3> 	struc ELD_TRAILER_HEADER
    47                              <3> eldthSignature:		resb 8	; "ELD1TAIL"
    48                              <3> eldthHeaderOffset:	resd 1	; negative displacement from eldthSignature,
    49                              <3> 				;  add this dword to the seek offset
    50                              <3> eldthReserved:		resw 1	; reserved, must be initialised to zero
    51                              <3> eldthChecksum:		resw 1	; sum of all words in trailer header = 0
    52                              <3> 	endstruc
    53                              <3> 	endarea ELD_TRAILER_HEADER, 1
    54                              <3> 
    55                              <3> 	struc ELD_LIBTABLE
    56                              <3> eldltFormat:		resw 1
    57                              <3> 	; 0 = uncompressed
    58                              <3> 	; 2 = heatshrink compressed
    59                              <3> 	; 3 = lzexedat -4 compressed
    60                              <3> 	; 4 = lzexedat -4 -l compressed
    61                              <3> eldltAmount:		resw 1
    62                              <3> eldltOffset:		resd 1	; from eldhxHeader
    63                              <3> eldltCompressedLength:		; (dword, only present if format 2, 3, or 4)
    64                              <3> 	endstruc
    65                              <3> 	endarea ELD_LIBTABLE, 1
    66                              <3> 
    67                              <3> 		; ELD instance header
    68                              <3> 	struc ELD_INSTANCE
    69                              <3> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    70                              <3> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    71                              <3> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    72                              <3> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    73                              <3> eldiIdentifier:		resb 8	; blank-filled text
    74                              <3> eldiFlags:		resw 1	; flags
    75                              <3> eldiListing_size equ 14
    76                              <3> eldiListing:		resb eldiListing_size
    77                              <3> 				; ASCIZ listing file name
    78                              <3> 	endstruc
    79                              <3> 		; flags for eldiFlags:
    80                              <3> eldifResident:		equ 1
    81                              <3> 
    82                              <3> 		; ELD link info header
    83                              <3> 	struc ELD_LINKINFO
    84                              <3> eldlSignature:		resw 1	; 0E1D1h
    85                              <3> eldlReserved:		resw 2
    86                              <3> eldlUseLinkHash:	resw 1
    87                              <3> eldlDataAmount:		resw 1
    88                              <3> eldlDataPrefixes:	resw 1
    89                              <3> eldlDataEntries:	resw 1
    90                              <3> eldlDataAddresses:	resw 1
    91                              <3> eldlCodeAmount:		resw 1
    92                              <3> eldlCodePrefixes:	resw 1
    93                              <3> eldlCodeEntries:	resw 1
    94                              <3> eldlCodeAddresses:	resw 1
    95                              <3> 	endstruc
    96                              <3> 
    97                              <3> 	numdef ELD_CODE_VSTART, 9001h
    98                              <3> 	numdef ELD_DATA_VSTART, 8000h
    99                              <3> 	numdef ELD_RELOC_VSTART, 8000h
   100                              <3> 
   101                              <3> 	numdef ELD_RECLAIM_HINT, 0
   102                              <3> 	strdef ELD_LISTING, ""
   103                              <3> 	numdef ELD_DATETIME, 0
   104                              <3> 
   105                              <3> %if _ELD_DATETIME
   106                              <3>  %define PUT_ELDHX_DATETIME_OFFSET at eldhxDateTimeOffset, dd DATAOFFSET + datetime - datastart
   107                              <3>  %macro PUT_ELD_DATETIME 0.nolist
   108                              <3> datetime:	asciz __UTC_DATE__,'T',__UTC_TIME__,'Z'
   109                              <3> 		asciz		; for future extension
   110                              <3>  %endmacro
   111                              <3> %else
   112                              <3>  %define PUT_ELDHX_DATETIME_OFFSET
   113                              <3>  %define PUT_ELD_DATETIME
   114                              <3> %endif
   115                              <3> 
   116                              <3> %endif
    17                              <2> 
    18                              <2> 	cpu 8086
    19                              <2> 
    20                              <2> %if ELDSTRICT
    21                              <2>  %if ELDSTRICTCOUNTER
    22                              <2>   %error Missing relocation
    23                              <2>  %endif
    24                              <2> %endif
    25                              <2> 	eldstrict off		; linker does some relocations
    26                              <2> 
    27                              <2> %ifn ELDCALLCALL_DUMPED
    28 00000910 E8[0000]EB020000C3- <2> 	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
    28 00000918 E8[0000]EB020000C3- <2>
    28 00000920 E8[0000]EB020000C3- <2>
    28 00000928 E8[0000]EB020000C3- <2>
    28 00000930 E8[0000]EB020000C3- <2>
    28 00000938 E8[0000]EB020000C3- <2>
    28 00000940 E8[0000]EB020000C3- <2>
    28 00000948 E8[0000]EB020000C3- <2>
    28 00000950 E8[0000]EB020000C3- <2>
    28 00000958 E8[0000]EB020000C3- <2>
    28 00000960 E8[0000]EB020000C3- <2>
    28 00000968 E8[0000]EB020000C3- <2>
    28 00000970 E8[0000]EB020000C3- <2>
    28 00000978 E8[0000]EB020000C3- <2>
    28 00000980 E8[0000]EB020000C3  <2>
    29                              <2> %endif
    30                              <2> 
    31                              <2> 	numdef ELD_IDENTICALISE, 0
    32                              <2> 	numdef ELD_DEBUG, 0
    33                              <2> 	numdef ELD_LINKER_PASSES, 1
    34                              <2> 	strdef LISTING, _ELD_LISTING
    35                              <2> 	numdef ELDCALL_OPTIONAL, ELDCALL_OPTIONAL_STATUS
    36                              <2> 	numdef ELDDATA_OPTIONAL, ELDDATA_OPTIONAL_STATUS
    37                              <2> %if _ELD_IDENTICALISE
    38                              <2>  ;%assign _ELDCALL_OPTIONAL 1
    39                              <2> %endif
    40                              <2> %ifn _ELDCALL_OPTIONAL
    41                              <2> %assign ELDCALL_OPTIONAL_STATUS 2		; not allowed
    42                              <2> %endif
    43                              <2> ;%ifn _ELDDATA_OPTIONAL
    44                              <2> ;%assign ELDDATA_OPTIONAL_STATUS 2		; not allowed
    45                              <2> ;%endif
    46                              <2> 	gendef MAP, ""
    47                              <2> 
    48                              <2> %ifnidni _MAP, ""
    49                              <2>  [map all _MAP]
    50                              <2> %endif
    51                              <2> 
    52                              <2> 
    53                              <2> endresident: equ ($ + _CURRENT_SECTION %+ FIXUP + 15) & ~15
    54                              <2> 
    55                              <2> %if _ELD_LINKER_PASSES
    56                              <2> %assign ELDLINKER 1
    57                              <2> 
    58                              <2> 	struc LINKTABLE
    59 00000000 ????????            <2> ltCodeToCode:	resw 2
    60 00000004 ????????            <2> ltCodeToData:	resw 2
    61 00000008 ????????            <2> ltDataToCode:	resw 2
    62 0000000C ????????            <2> ltDataToData:	resw 2
    63 00000010 ????????            <2> ltLinkData:	resw 2
    64 00000014 ????????            <2> ltLinkCode:	resw 2
    65                              <2> 	endstruc
    66                              <2> %endif
    67                              <2> 
    68                              <2> 
    69                              <2> linker:
    70                              <2> 		; The first 15 Bytes of the linker should be
    71                              <2> 		;  the same regardless of the linker options
    72                              <2> 		;  used (debug, passes, vstart). This allows
    73                              <2> 		;  the eldcomp ELD to match even if up to 15
    74                              <2> 		;  Bytes of the linker are trailing in the
    75                              <2> 		;  resident part of the ELD.
    76                              <2> 	lframe
    77                              <2>  %if ELDOTHER
    78                              <2> 	lvar dword, linkinfo_other
    79                              <2> 	lvar word, use_hash_other
    80                              <2>  %endif
    81 00000988 5589E5              <2> 	lenter
    82                              <2> 	lvar dword, instance
    83 0000098B 06                  <2> 	 push es
    84 0000098C 52                  <2> 	 push dx
    85                              <2> 	lvar word, targetsection_low_optional_high
    86 0000098D 50                  <2> 	 push ax
    87                              <2> 	lequ ?targetsection_low_optional_high, targetsection
    88                              <2> 	lequ ?targetsection_low_optional_high + 1, optional
    89                              <2> 	lvar dword, linkinfo
    90 0000098E 1E                  <2> 	 push ds
    91 0000098F 57                  <2> 	 push di
    92                              <2> 	lvar dword, nextreloc
    93 00000990 06                  <2> 	 push es
    94 00000991 52                  <2> 	 push dx
    95                              <2> 	lvar dword, entry
    96 00000992 06                  <2> 	 push es
    97 00000993 50                  <2> 	 push ax		; placeholder
    98 00000994 31C0                <2> 	xor ax, ax
    99 00000996 813DD1E1            <2> 	cmp word [di + eldlSignature], 0E1D1h
   100                              <2> %if ($ - linker) < 16
   101                              <2>  %error Expected invariant first paragraph of linker
   102                              <2> %endif
   103 0000099A 7403E95502          <2> 	jne .error_j
   104 0000099F 837D0601            <2> 	cmp word [di + eldlUseLinkHash], 1
   105 000009A3 7603E94C02          <2> 	ja .error_j
   106 000009A8 7201                <2> 	jb @F
   107 000009AA 48                  <2> 	dec ax
   108                              <2> @@:
   109                              <2> 	lvar word, use_hash
   110 000009AB 50                  <2> 	 push ax
   111                              <2> %if _ELD_IDENTICALISE && _ELD_LINKER_PASSES
   112                              <2> 	mov ax, linktable - code
   113                              <2> 	lvar word, lt
   114                              <2> 	 push ax
   115                              <2> %endif
   116                              <2> %if _ELD_LINKER_PASSES || ELDOTHER
   117 000009AC 31C0                <2> 	xor ax, ax
   118                              <2>  %if _ELD_LINKER_PASSES
   119                              <2> 	lvar word, pass
   120 000009AE 50                  <2> 	 push ax
   121                              <2> 	lvar word, amounterrors
   122 000009AF 50                  <2> 	 push ax
   123                              <2> 	lvar word, name
   124 000009B0 50                  <2> 	 push ax
   125                              <2>  %endif
   126                              <2>  %if ELDOTHER
   127                              <2> 	lvar word, other
   128                              <2> 	 push ax
   129                              <2>  %endif
   130                              <2> %endif
   131 000009B1 56                  <2> 	push si
   132 000009B2 53                  <2> 	push bx
   133                              <2> 
   134                              <2> 			; simple: add instance base (dx) to code
   135 000009B3 06                  <2> 	push es
   136 000009B4 1F                  <2> 	pop ds
   137                              <2> %if _ELD_LINKER_PASSES
   138                              <2> .pass:
   139 000009B5 8B5EEA              <2> 	mov bx, word [bp + ?pass]
   140 000009B8 01D3                <2> 	add bx, dx
   141                              <2>  %if _ELD_IDENTICALISE
   142                              <2> 	add bx, word [bp + ?lt]
   143                              <2> 	mov si, word [ltCodeToCode + bx]
   144                              <2>  %else
   145 000009BA 8BB7380D            <2> 	mov si, word [linktable - code + ltCodeToCode + bx]
   146                              <2>  %endif
   147                              <2> %else
   148                              <2> 	mov si, internalcodetocoderelocations - code
   149                              <2> %endif
   150 000009BE 01D6                <2> 	add si, dx
   151                              <2> @@:
   152 000009C0 AD                  <2> 	lodsw
   153 000009C1 85C0                <2> 	test ax, ax		; was last ?
   154 000009C3 740B                <2> 	jz @F			; yes -->
   155 000009C5 93                  <2> 	xchg bx, ax		; bx = entry
   156 000009C6 01D3                <2> 	add bx, dx		; relocate the entry itself
   157                              <2> %if _ELD_CODE_VSTART
   158 000009C8 812F[0000]          <2> 	sub word [bx], code	; undo adjustment
   159                              <2> %endif
   160 000009CC 0117                <2> 	add word [bx], dx	; relocate word referenced by entry
   161 000009CE EBF0                <2> 	jmp @B
   162                              <2> 
   163                              <2> @@:
   164                              <2> 			; next, add heap data base (on stack) to code
   165                              <2> %if _ELD_LINKER_PASSES
   166 000009D0 8B5EEA              <2> 	mov bx, word [bp + ?pass]
   167 000009D3 01D3                <2> 	add bx, dx
   168                              <2>  %if _ELD_IDENTICALISE
   169                              <2> 	add bx, word [bp + ?lt]
   170                              <2> 	mov si, word [ltCodeToData + bx]
   171                              <2>  %else
   172 000009D5 8BB73C0D            <2> 	mov si, word [linktable - code + ltCodeToData + bx]
   173                              <2>  %endif
   174                              <2> %else
   175                              <2> 	mov si, internalcodetodatarelocations - code
   176                              <2> %endif
   177 000009D9 01D6                <2> 	add si, dx
   178                              <2> @@:
   179 000009DB AD                  <2> 	lodsw
   180 000009DC 85C0                <2> 	test ax, ax		; was last ?
   181 000009DE 740C                <2> 	jz @F			; yes -->
   182 000009E0 93                  <2> 	xchg bx, ax		; bx = entry
   183 000009E1 01D3                <2> 	add bx, dx		; relocate the entry itself
   184 000009E3 58                  <2> 	pop ax			; ax -> heap data
   185 000009E4 50                  <2> 	push ax
   186                              <2> %if _ELD_DATA_VSTART
   187 000009E5 2D[0000]            <2> 	sub ax, datastart	; undo adjustment
   188                              <2> %endif
   189 000009E8 0107                <2> 	add word [bx], ax	; relocate word referenced by entry
   190 000009EA EBEF                <2> 	jmp @B
   191                              <2> 
   192                              <2> @@:
   193                              <2> 
   194                              <2> 			; add instance base (dx) to data
   195                              <2> %if _ELD_LINKER_PASSES
   196 000009EC 8B5EEA              <2> 	mov bx, word [bp + ?pass]
   197 000009EF 01D3                <2> 	add bx, dx
   198                              <2>  %if _ELD_IDENTICALISE
   199                              <2> 	add bx, word [bp + ?lt]
   200                              <2> 	mov si, word [ltDataToCode + bx]
   201                              <2>  %else
   202 000009F1 8BB7400D            <2> 	mov si, word [linktable - code + ltDataToCode + bx]
   203                              <2>  %endif
   204                              <2> %else
   205                              <2> 	mov si, internaldatatocoderelocations - code
   206                              <2> %endif
   207 000009F5 01D6                <2> 	add si, dx
   208                              <2> @@:
   209 000009F7 AD                  <2> 	lodsw
   210 000009F8 83F8FF              <2> 	cmp ax, -1		; was last ?
   211 000009FB 740F                <2> 	je @F			; yes -->
   212 000009FD 93                  <2> 	xchg bx, ax		; bx = entry
   213 000009FE 58                  <2> 	pop ax
   214 000009FF 50                  <2> 	push ax
   215 00000A00 01C3                <2> 	add bx, ax		; relocate the entry itself
   216                              <2> %if _ELD_CODE_VSTART
   217 00000A02 36812F[0000]        <2> 	sub word [ss:bx], code	; undo adjustment
   218                              <2> %endif
   219 00000A07 360117              <2> 	add word [ss:bx], dx	; relocate word referenced by entry
   220 00000A0A EBEB                <2> 	jmp @B
   221                              <2> 
   222                              <2> @@:
   223                              <2> 			; next, add heap data base (on stack) to data
   224                              <2> %if _ELD_LINKER_PASSES
   225 00000A0C 8B5EEA              <2> 	mov bx, word [bp + ?pass]
   226 00000A0F 01D3                <2> 	add bx, dx
   227                              <2>  %if _ELD_IDENTICALISE
   228                              <2> 	add bx, word [bp + ?lt]
   229                              <2> 	mov si, word [ltDataToData + bx]
   230                              <2>  %else
   231 00000A11 8BB7440D            <2> 	mov si, word [linktable - code + ltDataToData + bx]
   232                              <2>  %endif
   233                              <2> %else
   234                              <2> 	mov si, internaldatatodatarelocations - code
   235                              <2> %endif
   236 00000A15 01D6                <2> 	add si, dx
   237                              <2> @@:
   238 00000A17 AD                  <2> 	lodsw
   239 00000A18 83F8FF              <2> 	cmp ax, -1		; was last ?
   240 00000A1B 740D                <2> 	je @F			; yes -->
   241 00000A1D 93                  <2> 	xchg bx, ax		; bx = entry
   242 00000A1E 58                  <2> 	pop ax			; ax -> heap data
   243 00000A1F 50                  <2> 	push ax
   244 00000A20 01C3                <2> 	add bx, ax		; relocate the entry itself
   245                              <2> %if _ELD_DATA_VSTART
   246 00000A22 2D[0000]            <2> 	sub ax, datastart	; undo adjustment
   247                              <2> %endif
   248 00000A25 360107              <2> 	add word [ss:bx], ax	; relocate word referenced by entry
   249 00000A28 EBED                <2> 	jmp @B
   250                              <2> 
   251                              <2> @@:
   252 00000A2A 8B56FC              <2> 	mov dx, word [bp + ?instance]
   253                              <2> %if _ELD_LINKER_PASSES
   254 00000A2D 8B5EEA              <2> 	mov bx, word [bp + ?pass]
   255 00000A30 01D3                <2> 	add bx, dx
   256                              <2>  %if _ELD_IDENTICALISE
   257                              <2> 	add bx, word [bp + ?lt]
   258                              <2> 	add dx, word [ltLinkData + bx]
   259                              <2>  %else
   260 00000A32 0397480D            <2> 	add dx, word [linktable - code + ltLinkData + bx]
   261                              <2>  %endif
   262                              <2> %else
   263                              <2> 	add dx, linkerdatarelocations - code
   264                              <2> %endif
   265                              <2> .otherloop:
   266 00000A36 8956F2              <2> 	mov word [bp + ?nextreloc], dx
   267                              <2> 
   268                              <2> .datarelocloop:		; must be done before further relocs
   269 00000A39 C576F2              <2> 	lds si, [bp + ?nextreloc]
   270 00000A3C AD                  <2> 	lodsw			; ax = section indicator
   271 00000A3D 85C0                <2> 	test ax, ax		; end of table ?
   272 00000A3F 7503E92301          <2> 	jz .donedatareloc
   273 00000A44 48                  <2> 	dec ax			; al = 1 if data, 0 if code
   274 00000A45 5B                  <2> 	pop bx
   275 00000A46 53                  <2> 	push bx			; bx -> ELD data block
   276 00000A47 8946FA              <2> 	mov word [bp + ?targetsection_low_optional_high], ax
   277 00000A4A 84C0                <2> 	test al, al		; data ?
   278 00000A4C AD                  <2> 	lodsw
   279 00000A4D 7504                <2> 	jnz @F			; yes -->
   280 00000A4F 0346FC              <2> 	add ax, word [bp + ?instance]
   281                              <2> 				; relocate entry into code
   282 00000A52 A9                  <2> 	db __TEST_IMM16		; (skip add)
   283                              <2> @@:
   284 00000A53 01D8                <2> 	add ax, bx		; relocate entry into data
   285 00000A55 8946EE              <2> 	mov word [bp + ?entry], ax
   286 00000A58 AD                  <2> 	lodsw
   287 00000A59 8976F2              <2> 	mov word [bp + ?nextreloc], si
   288 00000A5C E8DC00              <2> 	call .build_match
   289                              <2> %if _ELD_LINKER_PASSES
   290 00000A5F 73D8                <2> 	jnc .datarelocloop
   291                              <2> %endif
   292 00000A61 C45EF6              <2> 	les bx, [bp + ?linkinfo]
   293                              <2> %if ELDOTHER
   294                              <2> 	rol byte [bp + ?other], 1
   295                              <2> 	jnc @F
   296                              <2> 	les bx, [bp + ?linkinfo_other]
   297                              <2> @@:
   298                              <2> %endif
   299 00000A64 268B4F08            <2> 	mov cx, word [es:bx + eldlDataAmount]	; amount data link info
   300 00000A68 268B7F0A            <2> 	mov di, word [es:bx + eldlDataPrefixes]	; -> prefixes or hashes
   301                              <2> .datarelocfind:
   302 00000A6C F2AF                <2> 	repne scasw			; scan initial
   303 00000A6E 7541                <2> 	jne .datarelocnotfound
   304 00000A70 57                  <2> 	push di
   305 00000A71 51                  <2> 	push cx
   306 00000A72 56                  <2> 	push si
   307 00000A73 262B7F0A            <2> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   308 00000A77 4F                  <2> 	dec di
   309 00000A78 4F                  <2> 	dec di				; 0-based
   310 00000A79 26037F0C            <2> 	add di, word [es:bx + eldlDataEntries]	; -> entry
   311 00000A7D 268B3D              <2> 	mov di, [es:di]			; -> counted suffix/string
   312 00000A80 B500                <2> 	mov ch, 0
   313 00000A82 8A0C                <2> 	mov cl, byte [si]		; cx = length
   314 00000A84 41                  <2> 	inc cx
   315                              <2> 	; cmp al, al			; ZR if length is zero
   316 00000A85 F3A6                <2> 	repe cmpsb			; match ?
   317 00000A87 5E                  <2> 	pop si
   318 00000A88 59                  <2> 	pop cx
   319 00000A89 5F                  <2> 	pop di
   320 00000A8A 75E0                <2> 	jne .datarelocfind
   321 00000A8C 8814                <2> 	mov byte [si], dl
   322 00000A8E 262B7F0A            <2> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   323 00000A92 4F                  <2> 	dec di
   324 00000A93 4F                  <2> 	dec di				; 0-based
   325 00000A94 26037F0E            <2> 	add di, word [es:bx + eldlDataAddresses]	; -> address (offset)
   326 00000A98 268B05              <2> 	mov ax, word [es:di]
   327 00000A9B E80700              <2> 	call .address_data_reloc
   328                              <2> %if _ELD_RELOC_VSTART
   329 00000A9E 2D[0000]            <2> 	sub ax, relocateddata		; *not* a relocation
   330                              <2> %endif
   331 00000AA1 0104                <2> 	add word [si], ax		; relocate
   332 00000AA3 EB94                <2> 	jmp .datarelocloop
   333                              <2> 
   334                              <2> .address_data_reloc:
   335 00000AA5 C576EE              <2> 	lds si, [bp + ?entry]		; -> entry if in ELD code instance
   336 00000AA8 807EFA00            <2> 	cmp byte [bp + ?targetsection], 0
   337                              <2> 					; relocation in code ?
   338 00000AAC 7402                <2> 	je @F				; yes -->
   339 00000AAE 16                  <2> 	push ss
   340 00000AAF 1F                  <2> 	pop ds				; => our ELD data block
   341                              <2> @@:
   342 00000AB0 C3                  <2> 	retn
   343                              <2> 
   344                              <2> .datarelocnotfound:
   345 00000AB1 8814                <2> 	mov byte [si], dl
   346 00000AB3 807EFB00            <2> 	cmp byte [bp + ?optional], 0
   347                              <2> %if _ELD_DEBUG
   348                              <2> 	jne @F
   349                              <2>  %ifn _ELD_LINKER_PASSES
   350                              <2> 	mov si, 0			; (invalid link)
   351                              <2> linkdatarelocation internalflags6
   352                              <2> 	test si, si
   353                              <2> 	jz .datanotfound
   354                              <2> 	mov si, 0			; (invalid link)
   355                              <2> linkdatarelocation options7
   356                              <2> 	test si, si
   357                              <2> 	jz .datanotfound
   358                              <2>  %else
   359                              <2> 	cmp byte [bp + ?pass], 0
   360                              <2> 	je .datanotfound
   361                              <2>  %endif
   362                              <2> 	houdini
   363                              <2> 	jmp .datanotfound
   364                              <2> @@:
   365                              <2> %else
   366 00000AB7 7417                <2> 	je .datanotfound
   367                              <2> %endif
   368                              <2> 
   369                              <2> %if ELDDATA_PMREQUIRED_STATUS
   370                              <2> 	mov si, relocateddata
   371                              <2> linkdatarelocation build_option_PM
   372                              <2> 	test si, si
   373                              <2> 	jz @F
   374                              <2> 	test byte [bp + ?optional], 2
   375                              <2> 	jnz .datanotfound
   376                              <2> @@:
   377                              <2> %endif
   378                              <2> 
   379                              <2> %if _ELD_LINKER_PASSES
   380 00000AB9 36F606[0000]02      <2> 	testopt [ss:relocateddata], 2
   381                              <2> linkdatarelocation options7, -3
   382 00000ABF 7406                <2> 	jz @F
   383 00000AC1 BE[5812]            <2> 	mov si, lmsg.warning_data_optional
   384                              <2> internalcoderelocation
   385 00000AC4 E82B00              <2> 	call .notfound
   386                              <2> @@:
   387                              <2> %endif
   388 00000AC7 E8DBFF              <2> 	call .address_data_reloc
   389 00000ACA 832400              <2> 	and word [si], 0		; indicate optional data link failed
   390 00000ACD E969FF              <2> 	jmp .datarelocloop
   391                              <2> 
   392                              <2> 
   393                              <2> %if _ELDCALL_OPTIONAL
   394                              <2> .coderelocnotfound:
   395                              <2> 	mov byte [si], dl
   396                              <2> 	cmp byte [bp + ?optional], 0
   397                              <2> %if _ELD_DEBUG
   398                              <2> 	jne @F
   399                              <2>  %ifn _ELD_LINKER_PASSES
   400                              <2> 	mov si, 0			; (invalid link)
   401                              <2> linkdatarelocation internalflags6
   402                              <2> 	test si, si
   403                              <2> 	jz .codenotfound
   404                              <2> 	mov si, 0			; (invalid link)
   405                              <2> linkdatarelocation options7
   406                              <2> 	test si, si
   407                              <2> 	jz .codenotfound
   408                              <2>  %else
   409                              <2> 	cmp byte [bp + ?pass], 0
   410                              <2> 	je .codenotfound
   411                              <2>  %endif
   412                              <2> 	houdini
   413                              <2> 	jmp .codenotfound
   414                              <2> @@:
   415                              <2> %else
   416                              <2> 	je .codenotfound
   417                              <2> %endif
   418                              <2> 
   419                              <2> %if ELDCALL_PMREQUIRED_STATUS
   420                              <2>  %if _ELD_LINKER_PASSES
   421                              <2>   %assign ELDLINKER 0
   422                              <2>  %endif
   423                              <2> 	mov si, relocateddata
   424                              <2> linkdatarelocation build_option_PM
   425                              <2>  %if _ELD_LINKER_PASSES
   426                              <2>   %assign ELDLINKER 1
   427                              <2>  %endif
   428                              <2> 	test si, si
   429                              <2> 	jz @F
   430                              <2> 	test byte [bp + ?optional], 2
   431                              <2> 	jnz .codenotfound
   432                              <2> @@:
   433                              <2> %endif
   434                              <2> 
   435                              <2> %if _ELD_LINKER_PASSES
   436                              <2> 	testopt [ss:relocateddata], 2
   437                              <2> linkdatarelocation options7, -3
   438                              <2> 	jz @F
   439                              <2> 	mov si, lmsg.warning_code_optional
   440                              <2> internalcoderelocation
   441                              <2> 	call .notfound
   442                              <2> @@:
   443                              <2> %endif
   444                              <2> 	lds si, [bp + ?entry]
   445                              <2> 	mov word [si], 9090h
   446                              <2> 	mov byte [si + 2], 90h		; indicate optional code link failed
   447                              <2> 	jmp .coderelocloop
   448                              <2> %endif
   449                              <2> 
   450                              <2> 
   451                              <2> %if _ELD_LINKER_PASSES
   452                              <2> .datanotfound:
   453 00000AD0 BE[7A12]            <2> 	mov si, lmsg.error_data
   454                              <2> internalcoderelocation
   455 00000AD3 E81C00              <2> 	call .notfound
   456 00000AD6 7203E91901          <2> 	jnc .error_j
   457 00000ADB FF46E8              <2> 	inc word [bp + ?amounterrors]
   458 00000ADE E958FF              <2> 	jmp .datarelocloop
   459                              <2> 
   460                              <2> .codenotfound:
   461 00000AE1 BE[9312]            <2> 	mov si, lmsg.error_code
   462                              <2> internalcoderelocation
   463 00000AE4 E80B00              <2> 	call .notfound
   464 00000AE7 7203E90801          <2> 	jnc .error_j
   465 00000AEC FF46E8              <2> 	inc word [bp + ?amounterrors]
   466 00000AEF E98400              <2> 	jmp .coderelocloop
   467                              <2> 
   468                              <2> .notfound:
   469 00000AF2 807EEA00            <2> 	cmp byte [bp + ?pass], 0
   470 00000AF6 743A                <2> 	je @F				; --> (NC)
   471 00000AF8 16                  <2> 	 push ss
   472 00000AF9 07                  <2> 	 pop es
   473 00000AFA BF[0000]            <2> 	mov di, relocateddata
   474                              <2> linkdatarelocation line_out
   475 00000AFD E83300              <2> 	call .copy
   476 00000B00 8B76E6              <2> 	mov si, word [bp + ?name]
   477 00000B03 AD                  <2> 	lodsw
   478 00000B04 E8[0000]EB020000    <2> 	extcall hexword
   479 00000B0B 56                  <2> 	push si
   480 00000B0C BE[AC12]            <2> 	mov si, lmsg.error.2
   481                              <2> internalcoderelocation
   482 00000B0F E82100              <2> 	call .copy
   483 00000B12 5E                  <2> 	pop si
   484                              <2> %if _ELD_LINKER_PASSES
   485 00000B13 56                  <2> 	push si
   486 00000B14 E81C00              <2> 	call .copy
   487 00000B17 5E                  <2> 	pop si
   488 00000B18 C60400              <2> 	mov byte [si], 0		; mark as failed
   489                              <2> %else
   490                              <2> 	call .copy
   491                              <2> %endif
   492 00000B1B B022                <2> 	mov al, '"'
   493 00000B1D AA                  <2> 	stosb
   494 00000B1E 16                  <2> 	 push ss
   495 00000B1F 1F                  <2> 	 pop ds
   496 00000B20 E8[0000]EB020000    <2> 	extcall putsline_crlf
   497 00000B27 B8350E              <2> 	mov ax, 0E35h
   498 00000B2A E8[0000]EB020000    <2> 	extcall setrc
   499 00000B31 F9                  <2> 	stc				; CY, diagnostic displayed
   500                              <2> @@:
   501 00000B32 C3                  <2> 	retn
   502                              <2> 
   503                              <2> .copy:
   504 00000B33 E8[0000]EB020000    <2> 	extcall copy_single_counted_string
   505 00000B3A C3                  <2> 	retn
   506                              <2> %else
   507                              <2> .datanotfound: equ .error_j
   508                              <2> .codenotfound: equ .error_j
   509                              <2> %endif
   510                              <2> 
   511                              <2> .build_match:
   512                              <2> %if _ELD_CODE_VSTART
   513 00000B3B 2D[0000]            <2> 	sub ax, code
   514                              <2> %endif
   515 00000B3E 0346FC              <2> 	add ax, word [bp + ?instance]
   516 00000B41 96                  <2> 	xchg si, ax
   517                              <2> %if _ELD_LINKER_PASSES
   518 00000B42 8976E6              <2> 	mov word [bp + ?name], si
   519                              <2> %endif
   520 00000B45 AD                  <2> 	lodsw			; = hash, si -> counted string
   521 00000B46 8A14                <2> 	mov dl, byte [si]
   522                              <2> %if _ELD_LINKER_PASSES
   523 00000B48 84D2                <2> 	test dl, dl		; marked as already failed ?
   524 00000B4A 750A                <2> 	jnz @F
   525 00000B4C 837EE800            <2> 	cmp word [bp + ?amounterrors], 0
   526 00000B50 7503E99F00          <2> 	je .error_j
   527 00000B55 C3                  <2> 	retn			; (NC)
   528                              <2> 
   529                              <2> @@:
   530                              <2> %endif
   531                              <2> %if ELDOTHER
   532                              <2> 	rol byte [bp + ?other], 1
   533                              <2> 	jnc @F
   534                              <2> 	rol byte [bp + ?use_hash_other], 1
   535                              <2> 	jmp @FF
   536                              <2> 
   537                              <2> @@:
   538                              <2> %endif
   539 00000B56 D046EC              <2> 	rol byte [bp + ?use_hash], 1
   540                              <2> @@:
   541 00000B59 720A                <2> 	jc @F
   542 00000B5B AC                  <2> 	lodsb
   543 00000B5C 91                  <2> 	xchg cx, ax		; cl = length
   544 00000B5D AD                  <2> 	lodsw			; ax = prefix
   545 00000B5E 49                  <2> 	dec cx
   546 00000B5F 49                  <2> 	dec cx
   547 00000B60 4E                  <2> 	dec si
   548 00000B61 8A14                <2> 	mov dl, byte [si]
   549 00000B63 880C                <2> 	mov byte [si], cl	; si -> counted string suffix
   550                              <2> @@:
   551                              <2> %if _ELD_LINKER_PASSES
   552 00000B65 F9                  <2> 	stc			; CY
   553                              <2> %endif
   554 00000B66 C3                  <2> 	retn
   555                              <2> 
   556                              <2> 
   557                              <2> .donedatareloc:
   558                              <2> %if ELDOTHER
   559                              <2> 	rol byte [bp + ?other], 1
   560                              <2> 	jc .otherdone
   561                              <2> %endif
   562                              <2> 
   563 00000B67 8B56FC              <2> 	mov dx, word [bp + ?instance]
   564                              <2> %if _ELD_LINKER_PASSES
   565 00000B6A 8B5EEA              <2> 	mov bx, word [bp + ?pass]
   566 00000B6D 01D3                <2> 	add bx, dx
   567                              <2>  %if _ELD_IDENTICALISE
   568                              <2> 	add bx, word [bp + ?lt]
   569                              <2> 	add dx, word [ltLinkCode + bx]
   570                              <2>  %else
   571 00000B6F 03974C0D            <2> 	add dx, word [linktable - code + ltLinkCode + bx]
   572                              <2>  %endif
   573                              <2> %else
   574                              <2> 	add dx, linkercoderelocations - code
   575                              <2> %endif
   576 00000B73 8956F2              <2> 	mov word [bp + ?nextreloc], dx
   577                              <2> 
   578                              <2> .coderelocloop:
   579 00000B76 C576F2              <2> 	lds si, [bp + ?nextreloc]
   580 00000B79 AD                  <2> 	lodsw
   581                              <2> %if _ELDCALL_OPTIONAL
   582                              <2> 	dec ax
   583                              <2> 	js .donecodereloc
   584                              <2> 	mov word [bp + ?targetsection_low_optional_high], ax
   585                              <2> 	lodsw
   586                              <2> %endif
   587 00000B7A 0346FC              <2> 	add ax, word [bp + ?instance]
   588 00000B7D 8946EE              <2> 	mov word [bp + ?entry], ax
   589 00000B80 AD                  <2> 	lodsw
   590 00000B81 8976F2              <2> 	mov word [bp + ?nextreloc], si
   591                              <2> %ifn _ELDCALL_OPTIONAL
   592 00000B84 85C0                <2> 	test ax, ax
   593 00000B86 747E                <2> 	jz .donecodereloc
   594                              <2> %endif
   595 00000B88 E8B0FF              <2> 	call .build_match
   596                              <2> %if _ELD_LINKER_PASSES
   597 00000B8B 73E9                <2> 	jnc .coderelocloop
   598                              <2> %endif
   599 00000B8D C45EF6              <2> 	les bx, [bp + ?linkinfo]
   600 00000B90 268B4F10            <2> 	mov cx, word [es:bx + eldlCodeAmount]	; amount code link info
   601 00000B94 268B7F12            <2> 	mov di, word [es:bx + eldlCodePrefixes]	; -> prefixes or hashes
   602                              <2> .coderelocfind:
   603 00000B98 F2AF                <2> 	repne scasw			; scan initial
   604                              <2> %if _ELDCALL_OPTIONAL
   605                              <2> 	jne .coderelocnotfound
   606                              <2> %else
   607                              <2>  %if _ELD_DEBUG
   608                              <2> 	je @F
   609                              <2> 	houdini
   610                              <2> 	jmp .codenotfound
   611                              <2> @@:
   612                              <2>  %else
   613 00000B9A 7403E942FF          <2> 	jne .codenotfound
   614                              <2>  %endif
   615                              <2> %endif
   616 00000B9F 57                  <2> 	push di
   617 00000BA0 51                  <2> 	push cx
   618 00000BA1 56                  <2> 	push si
   619 00000BA2 262B7F12            <2> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   620 00000BA6 4F                  <2> 	dec di
   621 00000BA7 4F                  <2> 	dec di				; 0-based
   622 00000BA8 26037F14            <2> 	add di, word [es:bx + eldlCodeEntries]	; -> entry
   623 00000BAC 268B3D              <2> 	mov di, [es:di]			; -> counted suffix/string
   624 00000BAF B500                <2> 	mov ch, 0
   625 00000BB1 8A0C                <2> 	mov cl, byte [si]		; cx = length
   626 00000BB3 41                  <2> 	inc cx
   627                              <2> 	; cmp al, al			; ZR if length is zero
   628 00000BB4 F3A6                <2> 	repe cmpsb			; match ?
   629 00000BB6 5E                  <2> 	pop si
   630 00000BB7 59                  <2> 	pop cx
   631 00000BB8 5F                  <2> 	pop di
   632 00000BB9 75DD                <2> 	jne .coderelocfind
   633 00000BBB 8814                <2> 	mov byte [si], dl
   634 00000BBD 262B7F12            <2> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   635 00000BC1 4F                  <2> 	dec di
   636 00000BC2 4F                  <2> 	dec di				; 0-based
   637 00000BC3 01FF                <2> 	add di, di			; quadruple index
   638 00000BC5 26037F16            <2> 	add di, word [es:bx + eldlCodeAddresses]	; -> address (offset, segment)
   639 00000BC9 26FF35              <2> 	push word [es:di]
   640 00000BCC C576EE              <2> 	lds si, [bp + ?entry]
   641 00000BCF 8F4405              <2> 	pop word [si + 3 + 2]		; call near imm (3), jmp short (2)
   642                              <2> 					;  patch the destination address
   643 00000BD2 803CE8              <2> 	cmp byte [si], 0E8h		; is it as expected ?
   644 00000BD5 751D                <2> 	jne .error_j
   645 00000BD7 268B7D02            <2> 	mov di, word [es:di + 2]
   646 00000BDB BB[0000]            <2> 	mov bx, relocateddata
   647                              <2> linkdatarelocation linkcall_table	; ss:bx -> link call table
   648 00000BDE 36833F01            <2> 	cmp word [ss:bx], 1		; is it initialised to format 1 ?
   649 00000BE2 7510                <2> 	jne .error_j			; no -->
   650 00000BE4 368B4F02            <2> 	mov cx, word [ss:bx + 2]	; get amount of segments
   651 00000BE8 E30A                <2> 	jcxz .error_j			; none -->
   652                              <2> @@:
   653 00000BEA 83C304              <2> 	add bx, 4			; -> next segment
   654 00000BED 36393F              <2> 	cmp word [ss:bx], di		; value matches ?
   655 00000BF0 7405                <2> 	je @F				; yes, found -->
   656 00000BF2 E2F6                <2> 	loop @B				; try remaining segments
   657                              <2> .error_j:
   658 00000BF4 E98A00              <2> 	jmp .error
   659                              <2> 
   660                              <2> @@:
   661 00000BF7 368B5F02            <2> 	mov bx, word [ss:bx + 2]	; -> call destination offset
   662                              <2> 		; si + 3 + delta = bx
   663                              <2> 		; delta = bx - si - 3
   664 00000BFB 29F3                <2> 	sub bx, si
   665 00000BFD 83EB03              <2> 	sub bx, 3
   666 00000C00 895C01              <2> 	mov word [si + 1], bx		; patch the call instruction
   667 00000C03 E970FF              <2> 	jmp .coderelocloop
   668                              <2> 
   669                              <2> .donecodereloc:
   670                              <2> %if _ELD_LINKER_PASSES
   671 00000C06 8B46E8              <2> 	mov ax, word [bp + ?amounterrors]
   672 00000C09 85C0                <2> 	test ax, ax
   673 00000C0B 75E7                <2> 	jnz .error_j
   674 00000C0D 8B5EEA              <2> 	mov bx, word [bp + ?pass]
   675 00000C10 85DB                <2> 	test bx, bx
   676 00000C12 750B                <2> 	jnz @F
   677 00000C14 43                  <2> 	inc bx
   678 00000C15 43                  <2> 	inc bx
   679 00000C16 895EEA              <2> 	mov word [bp + ?pass], bx
   680 00000C19 8B56FC              <2> 	mov dx, word [bp + ?instance]
   681 00000C1C E996FD              <2> 	jmp .pass
   682                              <2> 
   683                              <2> @@:
   684                              <2> %endif
   685                              <2> 
   686                              <2> %ifnidni _LISTING, ""
   687                              <2> %assign ELDLINKER 0
   688                              <2> .hint:
   689 00000C1F 16                  <2> 	push ss
   690 00000C20 1F                  <2> 	pop ds
   691 00000C21 B02D                <2> 	mov al, 2Dh
   692 00000C23 E8[0000]EB020000    <2> 	extcall intchk			; ZR if offset = -1 or segment = 0
   693                              <2> 					; CHG: ax, dx, bx
   694 00000C2A 7437                <2> 	jz .no_hint
   695                              <2> 
   696 00000C2C 8A26[0000]          <2> 	mov ah, byte [relocateddata]
   697                              <2> linkdatarelocation try_debugger_amis_multiplex_number
   698 00000C30 E85500              <2> 	call plex_check
   699 00000C33 7305                <2> 	jnc @F
   700                              <2> 
   701 00000C35 B4FF                <2> 	mov ah, 0FFh		; start with multiplex number 0FFh
   702                              <2> .loop_hint:
   703 00000C37 E84E00              <2> 	call plex_check
   704                              <2> @@:
   705 00000C3A 7307                <2> 	jnc .end_hint		; if found --> (NC)
   706 00000C3C 80EC01              <2> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   707 00000C3F 73F6                <2> 	jnc .loop_hint		; try next if we didn't check all yet -->
   708 00000C41 EB20                <2> 	jmp .no_hint
   709                              <2> 
   710                              <2> .end_hint:
   711 00000C43 50                  <2> 	push ax
   712 00000C44 C446FC              <2> 	les ax, [bp + ?instance]
   713 00000C47 BF[D20F]            <2> 	mov di, listmsg.hint.offset
   714                              <2> internalcoderelocation
   715 00000C4A E8[0000]EB020000    <2> 	extcall hexword
   716 00000C51 BB[B20F]            <2> 	mov bx, listmsg.hint
   717                              <2> internalcoderelocation
   718 00000C54 368B16[0000]        <2> 	mov dx, [ss:relocateddata]
   719                              <2> linkdatarelocation extseg	; must be 86 Mode segment even in PM
   720 00000C59 58                  <2> 	pop ax
   721 00000C5A B040                <2> 	mov al, 40h		; AMIS message display service
   722 00000C5C E8[0000]EB020000    <2> 	extcall call_int2D
   723                              <2> .no_hint:
   724                              <2> %endif
   725                              <2> 
   726                              <2> %if ELDOTHER
   727                              <2> %assign ELDLINKER 0
   728                              <2> 	not byte [bp + ?other]
   729                              <2> 
   730                              <2> 	push ss
   731                              <2> 	pop ds
   732                              <2> 	mov al, 2Dh
   733                              <2> 	extcall intchk			; ZR if offset = -1 or segment = 0
   734                              <2> 					; CHG: ax, dx, bx
   735                              <2> 	jz .no_other
   736                              <2> 
   737                              <2> 	mov ah, byte [relocateddata]
   738                              <2> linkdatarelocation try_debugger_amis_multiplex_number
   739                              <2> 	call plex_check
   740                              <2> 	jnc @F
   741                              <2> 
   742                              <2> 	mov ah, 0FFh		; start with multiplex number 0FFh
   743                              <2> .loop_other:
   744                              <2> 	call plex_check
   745                              <2> @@:
   746                              <2> 	jnc .end_other		; if found --> (NC)
   747                              <2> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   748                              <2> 	jnc .loop_other		; try next if we didn't check all yet -->
   749                              <2> 	jmp .no_other
   750                              <2> 
   751                              <2> .end_other:
   752                              <2> 	mov al, 42h		; AMIS get other link info service
   753                              <2> 	extcall call_int2D
   754                              <2> 	cmp al, 0FFh
   755                              <2> 	jne .no_other
   756                              <2> 
   757                              <2> 	mov ax, si		; selector => PSP
   758                              <2> 	extcall ispm
   759                              <2> 	jz @F
   760                              <2> 	mov ax, dx		; segment => PSP
   761                              <2> @@:
   762                              <2> 	 push ss
   763                              <2> 	 pop ds
   764                              <2> 	mov word [otherds], ax
   765                              <2> internaldatarelocation		; current mode sel/seg
   766                              <2> 	mov word [otherseg], dx
   767                              <2> internaldatarelocation		; remember segment
   768                              <2> 
   769                              <2> 	mov ax, cx		; selector => link info
   770                              <2> 	extcall ispm
   771                              <2> 	jz @F
   772                              <2> 	mov ax, bx		; segment => link info
   773                              <2> @@:
   774                              <2> 	mov word [bp + ?linkinfo_other], di
   775                              <2> 	mov word [bp + ?linkinfo_other + 2], ax
   776                              <2> 
   777                              <2> 	mov ds, ax		; => link info
   778                              <2> 	xor ax, ax
   779                              <2> 	cmp word [di + eldlSignature], 0E1D1h
   780                              <2> 	jne .error_other
   781                              <2> 	cmp word [di + eldlUseLinkHash], 1
   782                              <2> 	ja .error_other
   783                              <2> 	jb @F
   784                              <2> 	dec ax
   785                              <2> @@:
   786                              <2> 	mov word [bp + ?use_hash_other], ax
   787                              <2> 
   788                              <2> 	mov dx, word [bp + ?instance]
   789                              <2> 	add dx, linkerotherdatarelocations - code
   790                              <2> 	jmp .otherloop
   791                              <2> 
   792                              <2> .error_other:
   793                              <2> 	push cs
   794                              <2> 	pop ds
   795                              <2> 	mov ax, 0E33h
   796                              <2> 	extcall setrc
   797                              <2> 	mov dx, lmsg.error_other
   798                              <2> internalcoderelocation
   799                              <2> 	jmp @F
   800                              <2> 
   801                              <2> .no_other:
   802                              <2> 	push cs
   803                              <2> 	pop ds
   804                              <2> 	mov ax, 0E34h
   805                              <2> 	extcall setrc
   806                              <2> 	mov dx, lmsg.no_other
   807                              <2> internalcoderelocation
   808                              <2> @@:
   809                              <2> 	extcall putsz
   810                              <2> 	jmp .error
   811                              <2> 
   812                              <2> .otherdone:
   813                              <2> %endif
   814                              <2> 
   815 00000C63 5B                  <2> 	pop bx				; -> our heap data
   816 00000C64 5E                  <2> 	pop si				; -> our command line tail
   817 00000C65 16                  <2> 	 push ss
   818 00000C66 1F                  <2> 	 pop ds
   819 00000C67 C47EFC              <2> 	les di, [bp + ?instance]
   820 00000C6A 268B4502            <2> 	mov ax, word [es:di + eldiEndCode]
   821                              <2> houdini
   822 00000C6E 2D[9009]            <2> 	sub ax, strict word endresident + code
   823                              <2> internalcoderelocation
   824 00000C71 26C74502[9009]      <2> 	mov word [es:di + eldiEndCode], endresident + code
   825                              <2> internalcoderelocation
   826 00000C77 2906[0000]          <2> 	sub word [relocateddata], ax
   827                              <2> linkdatarelocation extseg_used
   828                              <2> %if _DATA_SIZE == 0
   829                              <2> 	xor ax, ax
   830                              <2> 	mov word [es:di + eldiStartData], ax
   831                              <2> 	mov word [es:di + eldiEndData], ax
   832                              <2> %endif
   833 00000C7B 89EC5D              <2> 	lleave code
   834                              <2> 		; INP:	es => ELD code segment
   835                              <2> 		;	ds:si -> command line tail
   836                              <2> 		;	ds:bx -> ELD data block
   837                              <2> 		;	ss:sp -> far return address for current mode
   838                              <2> 		; STT:	ds = ss, UP, EI
   839 00000C7E E99FF3              <2> 	jmp start
   840                              <2> 
   841                              <2> .error:
   842 00000C81 89EC5D              <2> 	lleave
   843 00000C84 B8FFFF              <2> 	mov ax, -1
   844 00000C87 CB                  <2> 	retf
   845                              <2> 
   846                              <2> 
   847                              <2> %ifnidni _LISTING, ""
   848                              <2>  %assign ELDHINT 1
   849                              <2> %else
   850                              <2>  %assign ELDHINT 0
   851                              <2> %endif
   852                              <2> 
   853                              <2> %if ELDOTHER || ELDHINT
   854                              <2> 		; INP:	ah = multiplex number to check
   855                              <2> 		; OUT:	CY if multiplex number unused or no signature match,
   856                              <2> 		;	 bp, ah, ds unmodified
   857                              <2> 		;	NC if match found,
   858                              <2> 		;	 ah = multiplex number (unmodified)
   859                              <2> 		; CHG:	si, di, es, cx, dx
   860                              <2> plex_check:
   861 00000C88 16                  <2> 	push ss
   862 00000C89 1F                  <2> 	pop ds
   863 00000C8A F606[0000]08        <2> 	testopt [relocateddata], 8
   864                              <2> linkdatarelocation internalflags4, -3
   865 00000C8F 740B                <2> 	jz @F
   866 00000C91 BE[0000]            <2> 	mov si, relocateddata
   867                              <2> linkdatarelocation amis_multiplex_number, -2, optional
   868 00000C94 85F6                <2> 	test si, si
   869 00000C96 7404                <2> 	jz @F
   870 00000C98 3A24                <2> 	cmp ah, byte [si]
   871 00000C9A 7420                <2> 	je .notfound		; do not use our own multiplexer -->
   872                              <2> @@:
   873 00000C9C B000                <2> 	mov al, 00h		; AMIS installation check
   874 00000C9E E8[0000]EB020000    <2> 	extcall call_int2D	; AMIS (or "DOS reserved" = iret if no AMIS present)
   875 00000CA5 3CFF                <2> 	cmp al, 0FFh
   876 00000CA7 7513                <2> 	jne .notfound
   877 00000CA9 0E                  <2> 	push cs
   878 00000CAA 1F                  <2> 	pop ds
   879 00000CAB BE[A20F]            <2> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
   880                              <2> internalcoderelocation
   881 00000CAE E8[0000]EB020000    <2> 	extcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
   882 00000CB5 B90800              <2> 	mov cx, 8		; Ignore description, only compare vendor and program name
   883 00000CB8 F3A7                <2> 	repe cmpsw
   884 00000CBA 7401                <2> 	je .checkret		; ZR, NC = match -->
   885                              <2> .notfound:
   886 00000CBC F9                  <2> 	stc			; CY no match
   887                              <2> .checkret:
   888 00000CBD C3                  <2> 	retn
   889                              <2> %endif
   890                              <2> 
   891                              <2> 
   892 00000CBE 00<rep 2h>          <2> 	align 4, db 0
   893                              <2> linkercoderelocations:
   894                              <2> %if _ELDCALL_OPTIONAL
   895                              <2> 	dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
   896                              <2> %else
   897 00000CC0 5105[DA0F]5905-     <2> 	dw ELDCALL_CODE_RELOCATIONS, 0, 0
   897 00000CC6 [E50F]6E05[F60F]85- <2>
   897 00000CCD 05[0810]1009[2210]- <2>
   897 00000CD4 1809[2E10]2009-     <2>
   897 00000CDA [3710]2809[4310]30- <2>
   897 00000CE1 09[4C10]3809[5410]- <2>
   897 00000CE8 4009[5B10]4809-     <2>
   897 00000CEE [6610]5009[6D10]58- <2>
   897 00000CF5 09[8310]6009[8B10]- <2>
   897 00000CFC 6809[9710]7009-     <2>
   897 00000D02 [A310]7809[AA10]80- <2>
   897 00000D09 09[B210]230C[F110]- <2>
   897 00000D10 4A0C[BA10]5C0C-     <2>
   897 00000D16 [FA10]9E0C[FA10]AE- <2>
   897 00000D1D 0C[0711]00000000    <2>
   898                              <2> %endif
   899                              <2> 
   900                              <2> %if _ELD_LINKER_PASSES
   901                              <2> linkerlinkercoderelocations:
   902                              <2> %if _ELDCALL_OPTIONAL
   903                              <2> 	dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
   904                              <2> %else
   905 00000D24 040B[BA10]200B-     <2> 	dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
   905 00000D2A [C410]2A0B[8310]33- <2>
   905 00000D31 0B[D410]00000000    <2>
   906                              <2> %endif
   907                              <2> 
   908                              <2> 	align 2, db 0
   909                              <2> linktable:
   910                              <2> 	istruc LINKTABLE
   911                              <2> at ltCodeToCode
   912 00000D38 920F                <2> 	dw internallinkercodetocoderelocations - code
   913 00000D3A 3C0E                <2> 	dw internalcodetocoderelocations - code
   914                              <2> at ltCodeToData
   915 00000D3C 9C0F                <2> 	dw internallinkercodetodatarelocations - code
   916 00000D3E 6C0E                <2> 	dw internalcodetodatarelocations - code
   917                              <2> at ltDataToCode
   918 00000D40 9E0F                <2> 	dw internallinkerdatatocoderelocations - code
   919 00000D42 7A0F                <2> 	dw internaldatatocoderelocations - code
   920                              <2> at ltDataToData
   921 00000D44 A00F                <2> 	dw internallinkerdatatodatarelocations - code
   922 00000D46 7C0F                <2> 	dw internaldatatodatarelocations - code
   923                              <2> at ltLinkData
   924 00000D48 7E0F                <2> 	dw linkerlinkerdatarelocations - code
   925 00000D4A 500D                <2> 	dw linkerdatarelocations - code
   926                              <2> at ltLinkCode
   927 00000D4C 240D                <2> 	dw linkerlinkercoderelocations - code
   928 00000D4E C00C                <2> 	dw linkercoderelocations - code
   929                              <2> 	iend
   930                              <2> %endif
   931                              <2> 
   932                              <2> 	align 2, db 0
   933                              <2> linkerdatarelocations:
   934 00000D50 01008E00[1211]0100- <2> 	dw LINK_DATA_RELOCATIONS, 0
   934 00000D58 9600[1211]01003001- <2>
   934 00000D60 [1211]01006703-     <2>
   934 00000D66 [1D11]01006B03-     <2>
   934 00000D6C [2B11]0100A403-     <2>
   934 00000D72 [3911]0100A803-     <2>
   934 00000D78 [4811]0100FC03-     <2>
   934 00000D7E [2B11]01000504-     <2>
   934 00000D84 [5711]01000B04-     <2>
   934 00000D8A [6211]01004804-     <2>
   934 00000D90 [6B11]01004C04-     <2>
   934 00000D96 [4811]01006504-     <2>
   934 00000D9C [2B11]01008904-     <2>
   934 00000DA2 [2B11]01009604-     <2>
   934 00000DA8 [2B11]0100AC04-     <2>
   934 00000DAE [4811]0100B004-     <2>
   934 00000DB4 [6B11]0100C604-     <2>
   934 00000DBA [6B11]0100E504-     <2>
   934 00000DC0 [7511]0100ED04-     <2>
   934 00000DC6 [7F11]0100F004-     <2>
   934 00000DCC [8911]01002205-     <2>
   934 00000DD2 [9B11]01002605-     <2>
   934 00000DD8 [AE11]01002D05-     <2>
   934 00000DDE [BE11]01003805-     <2>
   934 00000DE4 [CB11]01004705-     <2>
   934 00000DEA [AE11]01007F05-     <2>
   934 00000DF0 [E211]01008305-     <2>
   934 00000DF6 [E211]01008D05-     <2>
   934 00000DFC [E211]01009105-     <2>
   934 00000E02 [E211]0100C008-     <2>
   934 00000E08 [5711]0100C908-     <2>
   934 00000E0E [6211]0100F308-     <2>
   934 00000E14 [2B11]0100F908-     <2>
   934 00000E1A [4811]01002E0C-     <2>
   934 00000E20 [0A12]0100570C-     <2>
   934 00000E26 [6211]0100790C-     <2>
   934 00000E2C [2B11]01008C0C-     <2>
   934 00000E32 [2F12]0101920C-     <2>
   934 00000E38 [4012]0000          <2>
   935                              <2> 
   936                              <2> 	align 2, db 0
   937                              <2> internalcodetocoderelocations:
   938 00000E3C 94039903CC03D1036B- <2> 	dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
   938 00000E45 046F0476047D048304- <2>
   938 00000E4E 92049C049F04A704B5- <2>
   938 00000E57 04CA04CD04D304DD08- <2>
   938 00000E60 480C520C6F0C750CAC- <2>
   938 00000E69 0C0000              <2>
   939                              <2> 
   940                              <2> 	align 2, db 0
   941                              <2> internalcodetodatarelocations:
   942 00000E6C 32004B005400570060- <2> 	dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
   942 00000E75 006F0082008800A500- <2>
   942 00000E7E B300C500C900CC00DA- <2>
   942 00000E87 00E500E900EC00F000- <2>
   942 00000E90 2101250129012D0149- <2>
   942 00000E99 014E015B016B017801- <2>
   942 00000EA2 AE0105021C021F023B- <2>
   942 00000EAB 024C02500253025C02- <2>
   942 00000EB4 60026302670289028D- <2>
   942 00000EBD 0291029502B002CB02- <2>
   942 00000EC6 DD02EB02FA020F0313- <2>
   942 00000ECF 031C0320032B032F03- <2>
   942 00000ED8 33033703E703EB03EF- <2>
   942 00000EE1 03F303330437043B04- <2>
   942 00000EEA 3F04B804D004F90401- <2>
   942 00000EF3 05090511051E072207- <2>
   942 00000EFC 26072A072E0734073A- <2>
   942 00000F05 073E07430747074C07- <2>
   942 00000F0E 50075307570762076C- <2>
   942 00000F17 0770077D077F078307- <2>
   942 00000F20 85078C078F079B079E- <2>
   942 00000F29 07A207A607AA07AD07- <2>
   942 00000F32 B407BC07C007C407C8- <2>
   942 00000F3B 07CC07D107E907EE07- <2>
   942 00000F44 FD07010805080C081E- <2>
   942 00000F4D 082F08400847084F08- <2>
   942 00000F56 5A085D086B086F0878- <2>
   942 00000F5F 087C08840888088D08- <2>
   942 00000F68 95089A089E08A408A8- <2>
   942 00000F71 08AE08B208EC080000  <2>
   943                              <2> 
   944                              <2> 	align 2, db 0
   945                              <2> internaldatatocoderelocations:
   946 00000F7A FFFF                <2> 	dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
   947                              <2> 
   948                              <2> 	align 2, db 0
   949                              <2> internaldatatodatarelocations:
   950 00000F7C FFFF                <2> 	dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
   951                              <2> 
   952                              <2> %if _ELD_LINKER_PASSES
   953                              <2> 	align 2, db 0
   954                              <2> linkerlinkerdatarelocations:
   955 00000F7E 0100BC0A[EE11]0100- <2> 	dw LINK_LINKER_DATA_RELOCATIONS, 0
   955 00000F86 FB0A[1211]0100DC0B- <2>
   955 00000F8E [F911]0000          <2>
   956                              <2> 
   957                              <2> 	align 2, db 0
   958                              <2> internallinkercodetocoderelocations:
   959 00000F92 C20AD10AE20A0D0B00- <2> 	dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
   959 00000F9B 00                  <2>
   960                              <2> 
   961                              <2> 	align 2, db 0
   962                              <2> internallinkercodetodatarelocations:
   963 00000F9C 0000                <2> 	dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
   964                              <2> 
   965                              <2> 	align 2, db 0
   966                              <2> internallinkerdatatocoderelocations:
   967 00000F9E FFFF                <2> 	dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
   968                              <2> 
   969                              <2> 	align 2, db 0
   970                              <2> internallinkerdatatodatarelocations:
   971 00000FA0 FFFF                <2> 	dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
   972                              <2> %endif
   973                              <2> 
   974                              <2> %if ELDOTHER
   975                              <2> 	align 2, db 0
   976                              <2> linkerotherdatarelocations:
   977                              <2> 	dw LINK_OTHER_DATA_RELOCATIONS, 0
   978                              <2> 
   979                              <2>  %ifnidn LINK_OTHER_LINKER_DATA_RELOCATIONS, ""
   980                              <2>   %error Other linker data links not supported
   981                              <2>  %endif
   982                              <2> %endif
   983                              <2> 
   984                              <2> %if ELDOTHER || ELDHINT
   985                              <2> 	align 2, db 0
   986                              <2> debuggeramissig:
   987 00000FA2 65636D20<rep 5h>    <2> 		fill 8, 32, db "ecm"
   988 00000FAA 6C446562756720-     <2> 		fill 8, 32, db "lDebug"
   988 00000FAA <rep 2h>            <2>
   989                              <2> %endif
   990                              <2> 
   991                              <2> %ifnidni _LISTING, ""
   992                              <2> listmsg:
   993 00000FB2 547261634C6973742D- <2> .hint:		db "TracList-add-offset=",_LISTING,"::"
   993 00000FBB 6164642D6F66667365- <2>
   993 00000FC4 743D65787470616B2E- <2>
   993 00000FCD 6C73743A3A          <2>
   994 00000FD2 2D2D2D2D680D0A00    <2> .hint.offset:	asciz "----h",13,10
   995                              <2> %endif
   996                              <2> 
   997 00000FDA 6831085F646F736361- <2> 	eldcall_dump_names ELDCALL_CODE_NAMES
   997 00000FE3 6C6C8EF70E646F7363- <2>
   997 00000FEC 616C6C5F6578747365- <2>
   997 00000FF5 67FF8B0F79795F626F- <2>
   997 00000FFE 6F745F726561642E62- <2>
   997 00001007 7863E41779795F626F- <2>
   997 00001010 6F745F7365656B5F63- <2>
   997 00001019 757272656E742E6278- <2>
   997 00001022 D55509736B6970636F- <2>
   997 0000102B 6D6D61E83A06697365- <2>
   997 00001034 6F6C3F03C309697373- <2>
   997 0000103D 7472696E673FDDB906- <2>
   997 00001046 63686B656F6C551205- <2>
   997 0000104F 707574737ABABD0463- <2>
   997 00001058 6D643367B108747269- <2>
   997 00001061 6D70757473C5C60470- <2>
   997 0000106A 757473849013697365- <2>
   997 00001073 6F6C3F2E6E6F747365- <2>
   997 0000107C 6D69636F6C6F6EB212- <2>
   997 00001085 057365747263A45509- <2>
   997 0000108E 736B6970636F6D6D30- <2>
   997 00001097 F12309757070657263- <2>
   997 000010A0 617365289004697370- <2>
   997 000010A9 6D629605496E444F53- <2>
   997 000010B2 A7AA056572726F7284- <2>
   997 000010BB 8107686578776F7264- <2>
   997 000010C4 6FA20D707574736C69- <2>
   997 000010CD 6E655F63726C66D0BB- <2>
   997 000010D6 1A636F70795F73696E- <2>
   997 000010DF 676C655F636F756E74- <2>
   997 000010E8 65645F737472696E67- <2>
   997 000010F1 986906696E7463686B- <2>
   997 000010FA 21300A63616C6C5F69- <2>
   997 00001103 6E743244B774087365- <2>
   997 0000110C 746573326478        <2>
   998 00001112 84E3086C696E655F6F- <2> 	link_data_dump_names LINK_DATA_NAMES
   998 0000111B 75742BC80B65787473- <2>
   998 00001124 65675F73697A65E7D3- <2>
   998 0000112D 0B6578747365675F75- <2>
   998 00001136 736564F6340C657874- <2>
   998 0000113F 646174615F73697A65- <2>
   998 00001148 B2400C657874646174- <2>
   998 00001151 615F75736564EB4208- <2>
   998 0000115A 657874647373656CD5- <2>
   998 00001163 2D066578747365672A- <2>
   998 0000116C AE0765787464617461- <2>
   998 00001175 FF7E076C696E6B7365- <2>
   998 0000117E 6CFA7E076C696E6B73- <2>
   998 00001187 65672B850F6C696E6B- <2>
   998 00001190 696E666F6164647265- <2>
   998 00001199 73730F08106C6F6164- <2>
   998 000011A2 5F646174615F6C6F77- <2>
   998 000011AB 657374899F0D696E74- <2>
   998 000011B4 65726E616C666C6167- <2>
   998 000011BD 73C71C0A6578745F68- <2>
   998 000011C6 616E646C6522291465- <2>
   998 000011CF 78745F66696E697368- <2>
   998 000011D8 2E62705F69735F7365- <2>
   998 000011E1 748274096C6F61645F- <2>
   998 000011EA 646174615ABC086F70- <2>
   998 000011F3 74696F6E733768440E- <2>
   998 000011FC 6C696E6B63616C6C5F- <2>
   998 00001205 7461626C65F09E2274- <2>
   998 0000120E 72795F646562756767- <2>
   998 00001217 65725F616D69735F6D- <2>
   998 00001220 756C7469706C65785F- <2>
   998 00001229 6E756D626572CB510E- <2>
   998 00001232 696E7465726E616C66- <2>
   998 0000123B 6C61677334688C1561- <2>
   998 00001244 6D69735F6D756C7469- <2>
   998 0000124D 706C65785F6E756D62- <2>
   998 00001256 6572                <2>
   999                              <2> %if ELDOTHER
  1000                              <2> 	link_data_dump_names LINK_OTHER_DATA_NAMES
  1001                              <2> %endif
  1002                              <2> 
  1003                              <2> lmsg:
  1004                              <2> %if _ELD_LINKER_PASSES
  1005                              <2> %if _ELDCALL_OPTIONAL
  1006                              <2> .warning_code_optional:		counted "Optional code link missing, hash="
  1007                              <2> %endif
  1008 00001258 214F7074696F6E616C- <2> .warning_data_optional:		counted "Optional data link missing, hash="
  1008 00001261 2064617461206C696E- <2>
  1008 0000126A 6B206D697373696E67- <2>
  1008 00001273 2C20686173683D      <2>
  1009 0000127A 1844617461206C696E- <2> .error_data:			counted "Data link missing, hash="
  1009 00001283 6B206D697373696E67- <2>
  1009 0000128C 2C20686173683D      <2>
  1010 00001293 18436F6465206C696E- <2> .error_code:			counted "Code link missing, hash="
  1010 0000129C 6B206D697373696E67- <2>
  1010 000012A5 2C20686173683D      <2>
  1011 000012AC 0A682C206C6162656C- <2> .error.2:			counted "h, label ",'"'
  1011 000012B5 2022                <2>
  1012                              <2> %endif
  1013                              <2> %if ELDOTHER
  1014                              <2> .no_other:		asciz "ELD linker: No other link info found!",13,10
  1015                              <2> .error_other:		asciz "ELD linker: Other link info unknown format!",13,10
  1016                              <2> %endif
  1017                              <2> 
  1018 000012B7 00<rep 9h>          <2> 	align 16, db 0
  1120                              <1> 
  1121                              <1> 	align 16
  1122                              <1> code_size equ $ - code
  1123                              <1> 
  1124                              <1> %if _ALIGNPAGE
  1125                              <1> LIBOFFSETUNALIGNED equ DATAOFFSET + data_size
  1126                              <1> 	addsection ALIGNED, follows=DATA vstart=0
  1127                              <1> aligned:
  1128 00000000 00<rep 1A0h>        <1> 	times (((512) - ((LIBOFFSETUNALIGNED) % (512))) % (512)) db 0
  1129                              <1> 	endarea aligned
  1130                              <1> 
  1131                              <1> LIBOFFSET equ LIBOFFSETUNALIGNED + aligned_size
  1132                              <1> 	addsection LIB, follows=ALIGNED vstart=0
  1133                              <1> %else
  1134                              <1> LIBOFFSET equ DATAOFFSET + data_size
  1135                              <1> 	addsection LIB, follows=DATA vstart=0
  1136                              <1> %endif
  1137                              <1> lib_start:
  1138                              <1> 
  1139                              <1>  %if _COMPRESSED
  1140                              <1>   %if _XLD
  1141                              <1>    %if _LZEXEDAT
  1142                              <1> 	incbin "packlib.xlz"
  1143                              <1>    %else
  1144                              <1> 	incbin "packlib.xhs"
  1145                              <1>    %endif
  1146                              <1>   %else
  1147                              <1>    %if _LZEXEDAT
  1148 00000000 <bin 23BD9h>        <1> 	incbin "packlib.elz"
  1149                              <1>    %else
  1150                              <1> 	incbin "packlib.ehs"
  1151                              <1>    %endif
  1152                              <1>   %endif
  1153                              <1> lib_compressed_end:
  1154                              <1> length_to_truncate equ $ - lib_start + LIBOFFSET
  1155                              <1> 
  1156 00023BD9 00<rep 7h>          <1> 	align 16, db 0
  1157                              <1> 
  1158                              <1> 	addsection LIBDEPACKED, follows=LIB vstart=0
  1159                              <1> library_start_skip:
  1160                              <1>  %endif
  1161                              <1> 
  1162 00000CF0 <bin CF0h>-         <1> dump_incbin INCBINLIST
  1162 00001D40 <bin 1050h>-        <1>
  1162 000029D0 <bin C90h>-         <1>
  1162 00003610 <bin C40h>-         <1>
  1162 00004110 <bin B00h>-         <1>
  1162 000059F0 <bin 18E0h>-        <1>
  1162 00006580 <bin B90h>-         <1>
  1162 000072C0 <bin D40h>-         <1>
  1162 00008A30 <bin 1770h>-        <1>
  1162 000096B0 <bin C80h>-         <1>
  1162 0000B140 <bin 1A90h>-        <1>
  1162 0000C350 <bin 1210h>-        <1>
  1162 0000CD60 <bin A10h>-         <1>
  1162 0000E0B0 <bin 1350h>-        <1>
  1162 0000EEC0 <bin E10h>-         <1>
  1162 0000FCD0 <bin E10h>-         <1>
  1162 00011090 <bin 13C0h>-        <1>
  1162 000121F0 <bin 1160h>-        <1>
  1162 00012A30 <bin 840h>-         <1>
  1162 00014120 <bin 16F0h>-        <1>
  1162 00014960 <bin 840h>-         <1>
  1162 00015150 <bin 7F0h>-         <1>
  1162 00015D80 <bin C30h>-         <1>
  1162 00017000 <bin 1280h>-        <1>
  1162 00017AE0 <bin AE0h>-         <1>
  1162 00019190 <bin 16B0h>-        <1>
  1162 00019910 <bin 780h>-         <1>
  1162 0001A7A0 <bin E90h>-         <1>
  1162 0001B5C0 <bin E20h>-         <1>
  1162 0001C710 <bin 1150h>-        <1>
  1162 0001D3D0 <bin CC0h>-         <1>
  1162 0001E080 <bin CB0h>-         <1>
  1162 0001EC50 <bin BD0h>-         <1>
  1162 0001F990 <bin D40h>-         <1>
  1162 00020550 <bin BC0h>-         <1>
  1162 00021350 <bin E00h>-         <1>
  1162 00021FA0 <bin C50h>-         <1>
  1162 00022BC0 <bin C20h>-         <1>
  1162 00023500 <bin 940h>-         <1>
  1162 00025BC0 <bin 26C0h>-        <1>
  1162 00028550 <bin 2990h>-        <1>
  1162 00029640 <bin 10F0h>-        <1>
  1162 0002B9C0 <bin 2380h>-        <1>
  1162 0002CB90 <bin 11D0h>-        <1>
  1162 0002DF60 <bin 13D0h>-        <1>
  1162 0002EAC0 <bin B60h>-         <1>
  1162 0002F6D0 <bin C10h>-         <1>
  1162 00030200 <bin B30h>-         <1>
  1162 00030E10 <bin C10h>-         <1>
  1162 000319F0 <bin BE0h>-         <1>
  1162 00032130 <bin 740h>-         <1>
  1162 00033740 <bin 1610h>-        <1>
  1162 00034190 <bin A50h>-         <1>
  1162 000350E0 <bin F50h>-         <1>
  1162 00036690 <bin 15B0h>-        <1>
  1162 000372D0 <bin C40h>-         <1>
  1162 000385A0 <bin 12D0h>-        <1>
  1162 00039520 <bin F80h>-         <1>
  1162 0003A410 <bin EF0h>-         <1>
  1162 0003B390 <bin F80h>-         <1>
  1162 0003BFF0 <bin C60h>-         <1>
  1162 0003BFF0 <bin 12B0h>         <1>
  1163                              <1> library_end_skip:
  1164                              <1> 
  1165                              <1>  %if _COMPRESSED
  1166 0003D2A0 D9550200            <1> 	dd length_to_truncate
  1167                              <1>  %endif
  1168                              <1> %endif
