     1                                  
     2                                  ; Public Domain
     3                                  
     4                                  ; test run command: list.eld; .; .
     5                                  
     6                                  %include "lmacros3.mac"
     1                              <1> [list -]
    14                              <2> [list -]
    14                              <1> [list -]
     7                                  %include "eld.mac"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> Extensions for lDebug macros
     4                              <1> 
     5                              <1> Copyright (C) 2008-2025 E. C. Masloch
     6                              <1> 
     7                              <1> Usage of the works is permitted provided that this
     8                              <1> instrument is retained with the works, so that any entity
     9                              <1> that uses the works is notified of this instrument.
    10                              <1> 
    11                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <1> 
    13                              <1> %endif
    14                              <1> 
    15                              <1> %ifndef ELD_MAC
    16                              <1> %define ELD_MAC 1
    17                              <1> 
    18                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
    19                              <1> 
    20                              <1> 		; ELD executable header
    21                              <1> 	struc ELD_HEADER
    22 00000000 ????????            <1> eldhSignature:		resb 4	; "ELD1"
    23 00000004 ??????              <1> 			resb 3	; reserved
    24 00000007 ??                  <1> 			resb 1	; 26 (Ctrl-Z)
    25 00000008 ????????            <1> eldhCodeOffset:		resd 1	; position displacement from eldhSignature
    26 0000000C ????                <1> eldhCodeImageLength:	resw 1	; amount bytes, at least 32
    27 0000000E ????                <1> eldhCodeAllocLength:	resw 1	; amount bytes, added to prior. sum < 64 KiB
    28 00000010 ????????            <1> eldhDataOffset:		resd 1
    29 00000014 ????                <1> eldhDataImageLength:	resw 1	; (zero allowed)
    30 00000016 ????                <1> eldhDataAllocLength:	resw 1	; (zero allowed)
    31 00000018 ????                <1> eldhCodeEntrypoint:	resw 1	; within code section, used as displacement
    32 0000001A ????????            <1> eldhReserved:		resb 4	; reserved
    33 0000001E ????                <1> eldhExtensionSize:	resw 1	; from eldhSignature, -> past eldhx fields in use
    34                              <1> 	endstruc
    35                              <1> 	endarea ELD_HEADER, 1
    36                              <1> 
    37                              <1> 	struc ELD_HEADERX
    38 00000000 <res 20h>           <1> eldhxHeader:		resb ELD_HEADER_size
    39 00000020 ????????            <1> eldhxDescriptionOffset:	resd 1	; zero if none, from eldhxHeader. <= 128 Bytes
    40 00000024 ????????            <1> eldhxHelpOffset:	resd 1	; zero if none, from eldhxHeader
    41 00000028 ????????            <1> eldhxLibTable:		resd 1	; zero if none, from eldhxHeader
    42 0000002C ????????            <1> eldhxDateTimeOffset:	resd 1	; zero if none, from eldhxHeader
    43                              <1> 	alignb 16
    44                              <1> 	endstruc
    45                              <1> 
    46                              <1> 	struc ELD_TRAILER_HEADER
    47 00000000 ????????????????    <1> eldthSignature:		resb 8	; "ELD1TAIL"
    48 00000008 ????????            <1> eldthHeaderOffset:	resd 1	; negative displacement from eldthSignature,
    49                              <1> 				;  add this dword to the seek offset
    50 0000000C ????                <1> eldthReserved:		resw 1	; reserved, must be initialised to zero
    51 0000000E ????                <1> eldthChecksum:		resw 1	; sum of all words in trailer header = 0
    52                              <1> 	endstruc
    53                              <1> 	endarea ELD_TRAILER_HEADER, 1
    54                              <1> 
    55                              <1> 	struc ELD_LIBTABLE
    56 00000000 ????                <1> eldltFormat:		resw 1
    57                              <1> 	; 0 = uncompressed
    58                              <1> 	; 2 = heatshrink compressed
    59                              <1> 	; 3 = lzexedat -4 compressed
    60                              <1> 	; 4 = lzexedat -4 -l compressed
    61 00000002 ????                <1> eldltAmount:		resw 1
    62 00000004 ????????            <1> eldltOffset:		resd 1	; from eldhxHeader
    63                              <1> eldltCompressedLength:		; (dword, only present if format 2, 3, or 4)
    64                              <1> 	endstruc
    65                              <1> 	endarea ELD_LIBTABLE, 1
    66                              <1> 
    67                              <1> 		; ELD instance header
    68                              <1> 	struc ELD_INSTANCE
    69 00000000 ????                <1> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    70 00000002 ????                <1> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    71 00000004 ????                <1> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    72 00000006 ????                <1> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    73 00000008 ????????????????    <1> eldiIdentifier:		resb 8	; blank-filled text
    74 00000010 ????                <1> eldiFlags:		resw 1	; flags
    75                              <1> eldiListing_size equ 14
    76 00000012 <res Eh>            <1> eldiListing:		resb eldiListing_size
    77                              <1> 				; ASCIZ listing file name
    78                              <1> 	endstruc
    79                              <1> 		; flags for eldiFlags:
    80                              <1> eldifResident:		equ 1
    81                              <1> 
    82                              <1> 		; ELD link info header
    83                              <1> 	struc ELD_LINKINFO
    84 00000000 ????                <1> eldlSignature:		resw 1	; 0E1D1h
    85 00000002 ????????            <1> eldlReserved:		resw 2
    86 00000006 ????                <1> eldlUseLinkHash:	resw 1
    87 00000008 ????                <1> eldlDataAmount:		resw 1
    88 0000000A ????                <1> eldlDataPrefixes:	resw 1
    89 0000000C ????                <1> eldlDataEntries:	resw 1
    90 0000000E ????                <1> eldlDataAddresses:	resw 1
    91 00000010 ????                <1> eldlCodeAmount:		resw 1
    92 00000012 ????                <1> eldlCodePrefixes:	resw 1
    93 00000014 ????                <1> eldlCodeEntries:	resw 1
    94 00000016 ????                <1> eldlCodeAddresses:	resw 1
    95                              <1> 	endstruc
    96                              <1> 
    97                              <1> 	numdef ELD_CODE_VSTART, 9001h
    98                              <1> 	numdef ELD_DATA_VSTART, 8000h
    99                              <1> 	numdef ELD_RELOC_VSTART, 8000h
   100                              <1> 
   101                              <1> 	numdef ELD_RECLAIM_HINT, 0
   102                              <1> 	strdef ELD_LISTING, ""
   103                              <1> 	numdef ELD_DATETIME, 0
   104                              <1> 
   105                              <1> %if _ELD_DATETIME
   106                              <1>  %define PUT_ELDHX_DATETIME_OFFSET at eldhxDateTimeOffset, dd DATAOFFSET + datetime - datastart
   107                              <1>  %macro PUT_ELD_DATETIME 0.nolist
   108                              <1> datetime:	asciz __UTC_DATE__,'T',__UTC_TIME__,'Z'
   109                              <1> 		asciz		; for future extension
   110                              <1>  %endmacro
   111                              <1> %else
   112                              <1>  %define PUT_ELDHX_DATETIME_OFFSET
   113                              <1>  %define PUT_ELD_DATETIME
   114                              <1> %endif
   115                              <1> 
   116                              <1> %endif
     8                                  %include "eldcall.mac"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> Extensions for lDebug call macros
     4                              <1> 
     5                              <1> Copyright (C) 2008-2024 E. C. Masloch
     6                              <1> 
     7                              <1> Usage of the works is permitted provided that this
     8                              <1> instrument is retained with the works, so that any entity
     9                              <1> that uses the works is notified of this instrument.
    10                              <1> 
    11                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <1> 
    13                              <1> %endif
    14                              <1> 
    15                              <1> %ifndef ELDCALL_MAC
    16                              <1> %define ELDCALL_MAC 1
    17                              <1> 
    18                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
    19                              <1> %include "nasmhash.mac"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> Hashing macros
     5                              <2>  by E. C. Masloch, 2019
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef __NASMHASH_MAC__
    16                              <2> %assign __NASMHASH_MAC__ 1
    17                              <2> 
    18                              <2> 
    19                              <2> 	%macro hashdef 2+.nolist
    20                              <2> %ifempty %2
    21                              <2>  %assign _%1 1
    22                              <2> %else
    23                              <2> %ifstr %2
    24                              <2>  %define %%string %2
    25                              <2> %elifid %2
    26                              <2>  %defstr %%string %2
    27                              <2> %elifnum %2
    28                              <2>  %defstr %%string %2
    29                              <2> %eliftok %2
    30                              <2>  %defstr %%string %2
    31                              <2> %else
    32                              <2>  %error Unknown input
    33                              <2> %endif
    34                              <2> %strlen %%length %%string
    35                              <2> %assign %%hash 1
    36                              <2> %assign %%index 1
    37                              <2> %rep %%length
    38                              <2>  %substr %%char %%string %%index
    39                              <2>  %assign %%hash (%%hash * 31 + %%char) & 0FFFFh
    40                              <2>  %assign %%index %%index + 1
    41                              <2> %endrep
    42                              <2> %assign _%1 %%hash
    43                              <2> %endif
    44                              <2> 	%endmacro
    45                              <2> 
    46                              <2> 
    47                              <2> %endif
    20                              <1> %include "elddata.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug data relocation macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2024 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELDDATA_MAC
    16                              <2> %define ELDDATA_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
     1                              <3> [list -]
    19                              <2> %include "nasmhash.mac"
     1                              <3> 
     2                              <3> %if 0
     3                              <3> 
     4                              <3> Hashing macros
     5                              <3>  by E. C. Masloch, 2019
     6                              <3> 
     7                              <3> Usage of the works is permitted provided that this
     8                              <3> instrument is retained with the works, so that any entity
     9                              <3> that uses the works is notified of this instrument.
    10                              <3> 
    11                              <3> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <3> 
    13                              <3> %endif
    14                              <3> 
    15                              <3> %ifndef __NASMHASH_MAC__
    16                              <3> %assign __NASMHASH_MAC__ 1
    17                              <3> 
    18                              <3> 
    19                              <3> 	%macro hashdef 2+.nolist
    20                              <3> %ifempty %2
    21                              <3>  %assign _%1 1
    22                              <3> %else
    23                              <3> %ifstr %2
    24                              <3>  %define %%string %2
    25                              <3> %elifid %2
    26                              <3>  %defstr %%string %2
    27                              <3> %elifnum %2
    28                              <3>  %defstr %%string %2
    29                              <3> %eliftok %2
    30                              <3>  %defstr %%string %2
    31                              <3> %else
    32                              <3>  %error Unknown input
    33                              <3> %endif
    34                              <3> %strlen %%length %%string
    35                              <3> %assign %%hash 1
    36                              <3> %assign %%index 1
    37                              <3> %rep %%length
    38                              <3>  %substr %%char %%string %%index
    39                              <3>  %assign %%hash (%%hash * 31 + %%char) & 0FFFFh
    40                              <3>  %assign %%index %%index + 1
    41                              <3> %endrep
    42                              <3> %assign _%1 %%hash
    43                              <3> %endif
    44                              <3> 	%endmacro
    45                              <3> 
    46                              <3> 
    47                              <3> %endif
    20                              <2> %include "eldcheck.mac"
     1                              <3> %if 0
     2                              <3> 
     3                              <3> Extensions for lDebug relocation check macros
     4                              <3> 
     5                              <3> Copyright (C) 2008-2023 E. C. Masloch
     6                              <3> 
     7                              <3> Usage of the works is permitted provided that this
     8                              <3> instrument is retained with the works, so that any entity
     9                              <3> that uses the works is notified of this instrument.
    10                              <3> 
    11                              <3> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <3> 
    13                              <3> %endif
    14                              <3> 
    15                              <3> %ifndef ELDCHECK_MAC
    16                              <3> %define ELDCHECK_MAC 1
    17                              <3> 
    18                              <3> %assign ELDSTRICT 0
    19                              <3> %assign ELDSTRICTCOUNTER 0
    20                              <3> 
    21                              <3> 	%imacro eldstrict 1.nolist
    22                              <3> %ifidni %1, on
    23                              <3>  %assign ELDSTRICT 1
    24                              <3>  [warning +error=reloc-abs]
    25                              <3>  [warning +reloc-abs]
    26                              <3> %elifidni %1, off
    27                              <3>  %assign ELDSTRICT 0
    28                              <3>  [warning -reloc-abs]
    29                              <3> %else
    30                              <3>  %error Unknown keyword
    31                              <3> %endif
    32                              <3> 	%endmacro
    33                              <3> 
    34                              <3> 	%imacro reloc 1+.nolist
    35                              <3> %if ELDSTRICT
    36                              <3>  %if ELDSTRICTCOUNTER
    37                              <3>   %error Missing relocation
    38                              <3>  %endif
    39                              <3>  [warning -reloc-abs]
    40                              <3>  %assign ELDSTRICTCOUNTER 1
    41                              <3> %endif
    42                              <3> %1
    43                              <3> 	%endmacro
    44                              <3> 
    45                              <3> 	%imacro reloc2 1+.nolist
    46                              <3> %if ELDSTRICT
    47                              <3>  %if ELDSTRICTCOUNTER
    48                              <3>   %error Missing relocation
    49                              <3>  %endif
    50                              <3>  [warning -reloc-abs]
    51                              <3>  %assign ELDSTRICTCOUNTER 2
    52                              <3> %endif
    53                              <3> %1
    54                              <3> 	%endmacro
    55                              <3> 
    56                              <3> 	%imacro eldstrictcheck 0.nolist
    57                              <3> %if ELDSTRICT
    58                              <3>  %ifn ELDSTRICTCOUNTER
    59                              <3>   %error Unexpected relocation
    60                              <3>  %else
    61                              <3>   %assign ELDSTRICTCOUNTER ELDSTRICTCOUNTER - 1
    62                              <3>   %ifn ELDSTRICTCOUNTER
    63                              <3>    [warning +reloc-abs]
    64                              <3>   %endif
    65                              <3>  %endif
    66                              <3> %endif
    67                              <3> 	%endmacro
    68                              <3> 
    69                              <3> %endif
    70                              <3> 
    21                              <2> 
    22                              <2> 
    23                              <2> %assign ELDLINKER 0
    24                              <2> 
    25                              <2> %define INTERNAL_CODE_TO_CODE_RELOCATIONS ""
    26                              <2> %define INTERNAL_CODE_TO_DATA_RELOCATIONS ""
    27                              <2> %define INTERNAL_DATA_TO_CODE_RELOCATIONS ""
    28                              <2> %define INTERNAL_DATA_TO_DATA_RELOCATIONS ""
    29                              <2> %define INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS ""
    30                              <2> %define INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS ""
    31                              <2> %define INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS ""
    32                              <2> %define INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS ""
    33                              <2> %assign ELDDATA_OPTIONAL_STATUS 0		; not any seen yet
    34                              <2> %assign ELDDATA_PMREQUIRED_STATUS 0		; not any seen yet
    35                              <2> 
    36                              <2> 	%imacro internalcoderelocation 0-1.nolist -2
    37                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    38                              <2> %if ELDLINKER
    39                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    40                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    41                              <2>  %else
    42                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    43                              <2>  %endif
    44                              <2> %else
    45                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    46                              <2>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    47                              <2>  %else
    48                              <2>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    49                              <2>  %endif
    50                              <2> %endif
    51                              <2> 	eldstrictcheck
    52                              <2> 	%endmacro
    53                              <2> 
    54                              <2> 	%imacro internaldatarelocation 0-1.nolist -2
    55                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    56                              <2> %if ELDLINKER
    57                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    58                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    59                              <2>  %else
    60                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    61                              <2>  %endif
    62                              <2> %else
    63                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    64                              <2>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    65                              <2>  %else
    66                              <2>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    67                              <2>  %endif
    68                              <2> %endif
    69                              <2> 	eldstrictcheck
    70                              <2> 	%endmacro
    71                              <2> 
    72                              <2> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    73                              <2> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    74                              <2> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    75                              <2> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    76                              <2> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    77                              <2> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    78                              <2> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    79                              <2> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    80                              <2> 
    81                              <2> 
    82                              <2> %define LINK_DATA_RELOCATIONS ""
    83                              <2> %define LINK_LINKER_DATA_RELOCATIONS ""
    84                              <2> %define LINK_DATA_NAMES db ""
    85                              <2> %define LINK_DATA_DETECTION none, none
    86                              <2> 
    87                              <2> %define LINK_OTHER_DATA_RELOCATIONS ""
    88                              <2> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    89                              <2> %define LINK_OTHER_DATA_NAMES db ""
    90                              <2> %define LINK_OTHER_DATA_DETECTION none, none
    91                              <2> 
    92                              <2> %ifndef ELDOTHER
    93                              <2>  %assign ELDOTHER 0
    94                              <2> %endif
    95                              <2> %assign ELDOTHERLINK 0
    96                              <2> 
    97                              <2> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
    98                              <2> %if ELDOTHER
    99                              <2>  %assign ELDOTHERLINK 1
   100                              <2> %endif
   101                              <2> 	linkdatarelocation %1, %2, %3
   102                              <2> %assign ELDOTHERLINK 0
   103                              <2> 	%endmacro
   104                              <2> 
   105                              <2> 	%imacro linkdatarelocation 1-3.nolist -2, required
   106                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   107                              <2> %ifidni %3, required
   108                              <2>  %assign %%optional 0
   109                              <2> %elifidni %3, optional
   110                              <2>  %assign %%optional 100h
   111                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   112                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   113                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   114                              <2>  %else
   115                              <2>   %error Optional data link not allowed here
   116                              <2>  %endif
   117                              <2> %elifidni %3, PM required
   118                              <2>  %assign %%optional 300h
   119                              <2>  %assign ELDDATA_PMREQUIRED_STATUS 1
   120                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   121                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   122                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   123                              <2>  %else
   124                              <2>   %error Optional data link not allowed here
   125                              <2>  %endif
   126                              <2> %else
   127                              <2>  %fatal Unknown optional keyword
   128                              <2> %endif
   129                              <2> %ifidni _CURRENT_SECTION_TYPE, DATA
   130                              <2>  %assign %%DATASECTION 1
   131                              <2> %else
   132                              <2>  %assign %%DATASECTION 0
   133                              <2> %endif
   134                              <2> 	%if ELDOTHERLINK
   135                              <2> %if ELDLINKER
   136                              <2>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   137                              <2> %else
   138                              <2>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   139                              <2> %endif
   140                              <2> 	%else
   141                              <2> %if ELDLINKER
   142                              <2>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   143                              <2> %else
   144                              <2>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   145                              <2> %endif
   146                              <2> 	%endif
   147                              <2> %defstr %%string %1
   148                              <2> %strlen %%length %%string
   149                              <2> %if %%length > 64
   150                              <2>  %error Too long link name: %1
   151                              <2> %endif
   152                              <2> %define LINK_DATA_CHECK %1
   153                              <2> 	%if ELDOTHERLINK
   154                              <2> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   155                              <2> %if LINK_DATA_NEW
   156                              <2>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   157                              <2> 	hashdef HASH, %%string
   158                              <2>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   160                              <2> %else
   161                              <2>  %%name equ LINK_DATA_DUPLICATE
   162                              <2> %endif
   163                              <2> 	%else
   164                              <2> 	linkdata_detect LINK_DATA_DETECTION
   165                              <2> %if LINK_DATA_NEW
   166                              <2>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   167                              <2> 	hashdef HASH, %%string
   168                              <2>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   170                              <2> %else
   171                              <2>  %%name equ LINK_DATA_DUPLICATE
   172                              <2> %endif
   173                              <2> 	%endif
   174                              <2> 	eldstrictcheck
   175                              <2> 	%endmacro
   176                              <2> 
   177                              <2> 	%imacro linkdata_detect 2-*.nolist
   178                              <2> %assign LINK_DATA_NEW 1
   179                              <2> %rep (%0 - 2) / 2
   180                              <2>  %rotate 2
   181                              <2>  %ifidni %1, LINK_DATA_CHECK
   182                              <2>   %assign LINK_DATA_NEW 0
   183                              <2>   %xdefine LINK_DATA_DUPLICATE %2
   184                              <2>   %exitrep
   185                              <2>  %endif
   186                              <2> %endrep
   187                              <2> 	%endmacro
   188                              <2> 
   189                              <2> 	%imacro link_data_dump_names 1-*.nolist
   190                              <2> %rep %0
   191                              <2> 	%1
   192                              <2>  %rotate 1
   193                              <2> %endrep
   194                              <2> 	%endmacro
   195                              <2> 
   196                              <2> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   197                              <2> ; dw LINK_DATA_RELOCATIONS, 0, 0
   198                              <2> ; link_data_dump_names ELDCALL_CODE_NAMES
   199                              <2> 
   200                              <2> %endif
    21                              <1> 
    22                              <1> %assign ELDLINKER 0
    23                              <1> 
    24                              <1> [section relocatedzero nobits vstart=0]
    25                              <1> relocatedzero:
    26                              <1> __SECT__
    27                              <1> 
    28                              <1> 	numdef HOUDINI, 1
    29                              <1> 	numdef HOUDINI_CONDITIONAL, 1
    30                              <1> 
    31                              <1> %imacro houdini 0.nolist
    32                              <1> %if _HOUDINI
    33                              <1>  %if _HOUDINI_CONDITIONAL
    34                              <1> reloc	testopt [ss:relocateddata], 100h
    35                              <1> linkdatarelocation options7, -3
    36                              <1> 	jz %%skip
    37                              <1>  %endif
    38                              <1> reloc	testopt [ss:relocateddata], 100h
    39                              <1> linkdatarelocation internalflags6, -3
    40                              <1> 	jz %%skip
    41                              <1> 	int3
    42                              <1> %%skip:
    43                              <1> %endif
    44                              <1> %endmacro
    45                              <1> 
    46                              <1> %define ELDCALL_CODE_RELOCATIONS ""
    47                              <1> %define ELDCALL_LINKER_CODE_RELOCATIONS ""
    48                              <1> %define ELDCALL_CODE_RELOCATIONS_OPTIONAL ""
    49                              <1> %define ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ""
    50                              <1> %define ELDCALL_CODE_NAMES db ""
    51                              <1> %define ELDCALL_CODE_DETECTION none, none
    52                              <1> %assign ELDCALL_OPTIONAL_STATUS 0		; not any seen yet
    53                              <1> %assign ELDCALL_PMREQUIRED_STATUS 0		; not any seen yet
    54                              <1> 
    55                              <1> 	%imacro extcall 1-2.nolist required
    56                              <1> %ifidni _CURRENT_SECTION_TYPE, DATA
    57                              <1>  %error "ELD call cannot be used in ELD data block"
    58                              <1> %endif
    59                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP
    60                              <1> %ifidni %2, required
    61                              <1>  %assign %%optional 0
    62                              <1> %elifidni %2, optional
    63                              <1>  %assign %%optional 100h
    64                              <1>  %if ELDCALL_OPTIONAL_STATUS == 0
    65                              <1>   %assign ELDCALL_OPTIONAL_STATUS 1
    66                              <1>  %elif ELDCALL_OPTIONAL_STATUS == 1
    67                              <1>  %else
    68                              <1>   %error Optional code link not allowed here
    69                              <1>  %endif
    70                              <1> %elifidni %2, PM required
    71                              <1>  %assign %%optional 300h
    72                              <1>  %assign ELDCALL_PMREQUIRED_STATUS 1
    73                              <1>  %if ELDCALL_OPTIONAL_STATUS == 0
    74                              <1>   %assign ELDCALL_OPTIONAL_STATUS 1
    75                              <1>  %elif ELDCALL_OPTIONAL_STATUS == 1
    76                              <1>  %else
    77                              <1>   %error Optional code link not allowed here
    78                              <1>  %endif
    79                              <1> %else
    80                              <1>  %fatal Unknown optional keyword
    81                              <1> %endif
    82                              <1> %if 0
    83                              <1> [warning -reloc-rel-word]
    84                              <1> 	call near relocatedzero
    85                              <1> [warning +reloc-rel-word]
    86                              <1> %else
    87                              <1> 	db 0E8h
    88                              <1> reloc	dw relocatedzero
    89                              <1> 	eldstrictcheck
    90                              <1> %endif
    91                              <1> 	jmp strict short %%skipparameter
    92                              <1> 	dw 0
    93                              <1> %%skipparameter:
    94                              <1> %if ELDLINKER
    95                              <1>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS ELDCALL_LINKER_CODE_RELOCATIONS, %%entry, %%name
    96                              <1>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional, %%entry, %%name
    97                              <1> %else
    98                              <1>  %xdefine ELDCALL_CODE_RELOCATIONS ELDCALL_CODE_RELOCATIONS, %%entry, %%name
    99                              <1>  %xdefine ELDCALL_CODE_RELOCATIONS_OPTIONAL ELDCALL_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional, %%entry, %%name
   100                              <1> %endif
   101                              <1> %defstr %%string %1
   102                              <1> %strlen %%length %%string
   103                              <1> %if %%length > 64
   104                              <1>  %error Too long link name: %1
   105                              <1> %endif
   106                              <1> %define ELDCALL_CODE_CHECK %1
   107                              <1> 	linkcode_detect ELDCALL_CODE_DETECTION
   108                              <1> %if ELDCALL_CODE_NEW
   109                              <1>  %xdefine ELDCALL_CODE_DETECTION ELDCALL_CODE_DETECTION, %1, %%name
   110                              <1> 	hashdef HASH, %%string
   111                              <1> %xdefine ELDCALL_CODE_NAMES 	ELDCALL_CODE_NAMES, %%name:, dw _HASH, {counted %%string}
   113                              <1> %else
   114                              <1>  %%name equ ELDCALL_CODE_DUPLICATE
   115                              <1> %endif
   116                              <1> 	%endmacro
   117                              <1> 
   118                              <1> 	%imacro linkcode_detect 2-*.nolist
   119                              <1> %assign ELDCALL_CODE_NEW 1
   120                              <1> %rep (%0 - 2) / 2
   121                              <1>  %rotate 2
   122                              <1>  %ifidni %1, ELDCALL_CODE_CHECK
   123                              <1>   %assign ELDCALL_CODE_NEW 0
   124                              <1>   %xdefine ELDCALL_CODE_DUPLICATE %2
   125                              <1>   %exitrep
   126                              <1>  %endif
   127                              <1> %endrep
   128                              <1> 	%endmacro
   129                              <1> 
   130                              <1> 
   131                              <1> %define ELDCALL_CALLCALL_LIST none
   132                              <1> 
   133                              <1> 	%imacro extcallcall 1.nolist
   134                              <1> 	call %1
   135                              <1> %xdefine ELDCALL_CALLCALL_LIST ELDCALL_CALLCALL_LIST, %1
   136                              <1> 	%endmacro
   137                              <1> 
   138                              <1> %assign ELDCALLCALL_DUMPED 0
   139                              <1> 
   140                              <1> 	%imacro eldcall_dump_callcall 1-*.nolist
   141                              <1> %define ELDCALL_CALLCALL_PROCESSED none
   142                              <1>  %rep %0 - 1
   143                              <1>   %rotate 1
   144                              <1>   %define ELDCALL_CHECK %1
   145                              <1> 	eldcall_callcall_detect ELDCALL_CALLCALL_PROCESSED
   146                              <1>   %if ELDCALL_NEW
   147                              <1>    %xdefine ELDCALL_CALLCALL_PROCESSED ELDCALL_CALLCALL_PROCESSED, %1
   148                              <1> 	align 8, nop
   149                              <1> %1:
   150                              <1> 	extcall %1
   151                              <1> 	retn
   152                              <1>   %endif
   153                              <1>  %endrep
   154                              <1> %unimacro extcallcall 1.nolist
   155                              <1> %assign ELDCALLCALL_DUMPED 1
   156                              <1> %define ELDCALL_CALLCALL_LIST none
   157                              <1> 	%endmacro
   158                              <1> 
   159                              <1> 	%imacro eldcall_callcall_detect 1-*.nolist
   160                              <1> %assign ELDCALL_NEW 1
   161                              <1> %rep %0 - 1
   162                              <1>  %rotate 1
   163                              <1>  %ifidni %1, ELDCALL_CHECK
   164                              <1>   %assign ELDCALL_NEW 0
   165                              <1>   %exitrep
   166                              <1>  %endif
   167                              <1> %endrep
   168                              <1> 	%endmacro
   169                              <1> 
   170                              <1> 	%imacro eldcall_dump_names 1-*.nolist
   171                              <1> %rep %0
   172                              <1> 	%1
   173                              <1>  %rotate 1
   174                              <1> %endrep
   175                              <1> 	%endmacro
   176                              <1> 
   177                              <1> ; eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   178                              <1> ; if using optional code links:
   179                              <1> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
   180                              <1> ;  dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
   181                              <1> ; if not using optional code links:
   182                              <1> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
   183                              <1> ;  dw ELDCALL_CODE_RELOCATIONS, 0, 0
   184                              <1> ; eldcall_dump_names ELDCALL_CODE_NAMES
   185                              <1> 
   186                              <1> %endif
     9                                  %include "elddata.mac"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> Extensions for lDebug data relocation macros
     4                              <1> 
     5                              <1> Copyright (C) 2008-2024 E. C. Masloch
     6                              <1> 
     7                              <1> Usage of the works is permitted provided that this
     8                              <1> instrument is retained with the works, so that any entity
     9                              <1> that uses the works is notified of this instrument.
    10                              <1> 
    11                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <1> 
    13                              <1> %endif
    14                              <1> 
    15                              <1> %ifndef ELDDATA_MAC
    16                              <1> %define ELDDATA_MAC 1
    17                              <1> 
    18                              <1> %include "lmacros3.mac"
    19                              <1> %include "nasmhash.mac"
    20                              <1> %include "eldcheck.mac"
    21                              <1> 
    22                              <1> 
    23                              <1> %assign ELDLINKER 0
    24                              <1> 
    25                              <1> %define INTERNAL_CODE_TO_CODE_RELOCATIONS ""
    26                              <1> %define INTERNAL_CODE_TO_DATA_RELOCATIONS ""
    27                              <1> %define INTERNAL_DATA_TO_CODE_RELOCATIONS ""
    28                              <1> %define INTERNAL_DATA_TO_DATA_RELOCATIONS ""
    29                              <1> %define INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS ""
    30                              <1> %define INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS ""
    31                              <1> %define INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS ""
    32                              <1> %define INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS ""
    33                              <1> %assign ELDDATA_OPTIONAL_STATUS 0		; not any seen yet
    34                              <1> %assign ELDDATA_PMREQUIRED_STATUS 0		; not any seen yet
    35                              <1> 
    36                              <1> 	%imacro internalcoderelocation 0-1.nolist -2
    37                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    38                              <1> %if ELDLINKER
    39                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    40                              <1>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    41                              <1>  %else
    42                              <1>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    43                              <1>  %endif
    44                              <1> %else
    45                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    46                              <1>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    47                              <1>  %else
    48                              <1>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    49                              <1>  %endif
    50                              <1> %endif
    51                              <1> 	eldstrictcheck
    52                              <1> 	%endmacro
    53                              <1> 
    54                              <1> 	%imacro internaldatarelocation 0-1.nolist -2
    55                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    56                              <1> %if ELDLINKER
    57                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    58                              <1>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    59                              <1>  %else
    60                              <1>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    61                              <1>  %endif
    62                              <1> %else
    63                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    64                              <1>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    65                              <1>  %else
    66                              <1>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    67                              <1>  %endif
    68                              <1> %endif
    69                              <1> 	eldstrictcheck
    70                              <1> 	%endmacro
    71                              <1> 
    72                              <1> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    73                              <1> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    74                              <1> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    75                              <1> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    76                              <1> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    77                              <1> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    78                              <1> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    79                              <1> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    80                              <1> 
    81                              <1> 
    82                              <1> %define LINK_DATA_RELOCATIONS ""
    83                              <1> %define LINK_LINKER_DATA_RELOCATIONS ""
    84                              <1> %define LINK_DATA_NAMES db ""
    85                              <1> %define LINK_DATA_DETECTION none, none
    86                              <1> 
    87                              <1> %define LINK_OTHER_DATA_RELOCATIONS ""
    88                              <1> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    89                              <1> %define LINK_OTHER_DATA_NAMES db ""
    90                              <1> %define LINK_OTHER_DATA_DETECTION none, none
    91                              <1> 
    92                              <1> %ifndef ELDOTHER
    93                              <1>  %assign ELDOTHER 0
    94                              <1> %endif
    95                              <1> %assign ELDOTHERLINK 0
    96                              <1> 
    97                              <1> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
    98                              <1> %if ELDOTHER
    99                              <1>  %assign ELDOTHERLINK 1
   100                              <1> %endif
   101                              <1> 	linkdatarelocation %1, %2, %3
   102                              <1> %assign ELDOTHERLINK 0
   103                              <1> 	%endmacro
   104                              <1> 
   105                              <1> 	%imacro linkdatarelocation 1-3.nolist -2, required
   106                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   107                              <1> %ifidni %3, required
   108                              <1>  %assign %%optional 0
   109                              <1> %elifidni %3, optional
   110                              <1>  %assign %%optional 100h
   111                              <1>  %if ELDDATA_OPTIONAL_STATUS == 0
   112                              <1>   %assign ELDDATA_OPTIONAL_STATUS 1
   113                              <1>  %elif ELDDATA_OPTIONAL_STATUS == 1
   114                              <1>  %else
   115                              <1>   %error Optional data link not allowed here
   116                              <1>  %endif
   117                              <1> %elifidni %3, PM required
   118                              <1>  %assign %%optional 300h
   119                              <1>  %assign ELDDATA_PMREQUIRED_STATUS 1
   120                              <1>  %if ELDDATA_OPTIONAL_STATUS == 0
   121                              <1>   %assign ELDDATA_OPTIONAL_STATUS 1
   122                              <1>  %elif ELDDATA_OPTIONAL_STATUS == 1
   123                              <1>  %else
   124                              <1>   %error Optional data link not allowed here
   125                              <1>  %endif
   126                              <1> %else
   127                              <1>  %fatal Unknown optional keyword
   128                              <1> %endif
   129                              <1> %ifidni _CURRENT_SECTION_TYPE, DATA
   130                              <1>  %assign %%DATASECTION 1
   131                              <1> %else
   132                              <1>  %assign %%DATASECTION 0
   133                              <1> %endif
   134                              <1> 	%if ELDOTHERLINK
   135                              <1> %if ELDLINKER
   136                              <1>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   137                              <1> %else
   138                              <1>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   139                              <1> %endif
   140                              <1> 	%else
   141                              <1> %if ELDLINKER
   142                              <1>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   143                              <1> %else
   144                              <1>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   145                              <1> %endif
   146                              <1> 	%endif
   147                              <1> %defstr %%string %1
   148                              <1> %strlen %%length %%string
   149                              <1> %if %%length > 64
   150                              <1>  %error Too long link name: %1
   151                              <1> %endif
   152                              <1> %define LINK_DATA_CHECK %1
   153                              <1> 	%if ELDOTHERLINK
   154                              <1> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   155                              <1> %if LINK_DATA_NEW
   156                              <1>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   157                              <1> 	hashdef HASH, %%string
   158                              <1>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   160                              <1> %else
   161                              <1>  %%name equ LINK_DATA_DUPLICATE
   162                              <1> %endif
   163                              <1> 	%else
   164                              <1> 	linkdata_detect LINK_DATA_DETECTION
   165                              <1> %if LINK_DATA_NEW
   166                              <1>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   167                              <1> 	hashdef HASH, %%string
   168                              <1>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   170                              <1> %else
   171                              <1>  %%name equ LINK_DATA_DUPLICATE
   172                              <1> %endif
   173                              <1> 	%endif
   174                              <1> 	eldstrictcheck
   175                              <1> 	%endmacro
   176                              <1> 
   177                              <1> 	%imacro linkdata_detect 2-*.nolist
   178                              <1> %assign LINK_DATA_NEW 1
   179                              <1> %rep (%0 - 2) / 2
   180                              <1>  %rotate 2
   181                              <1>  %ifidni %1, LINK_DATA_CHECK
   182                              <1>   %assign LINK_DATA_NEW 0
   183                              <1>   %xdefine LINK_DATA_DUPLICATE %2
   184                              <1>   %exitrep
   185                              <1>  %endif
   186                              <1> %endrep
   187                              <1> 	%endmacro
   188                              <1> 
   189                              <1> 	%imacro link_data_dump_names 1-*.nolist
   190                              <1> %rep %0
   191                              <1> 	%1
   192                              <1>  %rotate 1
   193                              <1> %endrep
   194                              <1> 	%endmacro
   195                              <1> 
   196                              <1> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   197                              <1> ; dw LINK_DATA_RELOCATIONS, 0, 0
   198                              <1> ; link_data_dump_names ELDCALL_CODE_NAMES
   199                              <1> 
   200                              <1> %endif
    10                                  
    11                                  %assign _CATCHINT0C 0
    12                                  %assign _CATCHINT0D 0
    13                                  %assign _CATCHINTFAULTCOND 0
    14                                  %assign _DEBUG 0
    15                                  %assign _DELAY_BEFORE_BP 0
    16                                  %assign _DHIGHLIGHT 0
    17                                  %assign _GETLINEHIGHLIGHT 0
    18                                  %assign _IMMASM 0
    19                                  %assign _INPUT_FILE_BOOT 0
    20                                  %assign _INPUT_FILE_HANDLES 0
    21                                  %assign _MS_0RANGE_COMPAT 0
    22                                  %assign _PM 0
    23                                  %assign _RH 0
    24                                  %assign _SYMBOLIC 0
    25                                  %assign _VXCHG 0
    26                                  %include "options.mac"
     1                              <1> 
     2                              <1> %if 0
     3                              <1> 
     4                              <1> lDebug options and internal flags
     5                              <1> 
     6                              <1> Copyright (C) 2008-2023 E. C. Masloch
     7                              <1> 
     8                              <1> Usage of the works is permitted provided that this
     9                              <1> instrument is retained with the works, so that any entity
    10                              <1> that uses the works is notified of this instrument.
    11                              <1> 
    12                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                              <1> 
    14                              <1> %endif
    15                              <1> 
    16                              <1> 
    17                              <1> dispregs32	equ	  1	; RX: 32-bit register display (R, T/P/G)
    18                              <1> traceints	equ	  2	; TM: trace into interrupts (T)
    19                              <1> cpdepchars	equ	  4	; allow dumping of CP-dependent characters (D, DX)
    20                              <1> fakeindos	equ	  8	; always assume InDOS flag non-zero (all)
    21                              <1> nonpagingdevice	equ	 10h	; disallow paged output with [more] prompt (all exc. P, T)
    22                              <1> 	; This option was never used anywhere:
    23                              <1> ; pagingdevice	equ	 20h	; allow paged output with [more] prompt (all exc. P, T)
    24                              <1> 				; paged output is by default on if the output device is StdOut, else off
    25                              <1> hexrn		equ	 40h	; display raw hexadecimal content of FPU registers (RN)
    26                              <1> ;novdd		equ	 80h	; don't use a registered NTVDM VDD (L, W)
    27                              <1> nondospaging	equ	100h	; paging: don't use DOS for input when waiting for a key
    28                              <1> opt1_86mnohlt	equ	200h	; (86 Mode:) HLT doesn't work, don't use it
    29                              <1> biosidles	equ	400h	; don't idle with HLT or Int2F.1680, only call BIOS Int16.00
    30                              <1> opt_usegetinput	equ	800h	; use getinput for int 21h interactive input
    31                              <1> use_si_units	equ    1000h	; in disp_*_size use SI units (kB = 1000, etc)
    32                              <1> use_jedec_units	equ    2000h	; in disp_*_size use JEDEC units (kB = 1024)
    33                              <1> enable_serial	equ    4000h	; enable serial I/O (preferred over DOS or BIOS terminal)
    34                              <1> int8_disable_serial equ	   8000h	; disable serial I/O when breaking due to intr8
    35                              <1> gg_do_not_skip_bp equ	 1_0000h	; gg: do not skip a breakpoint (bb or gg)
    36                              <1> gg_no_autorepeat equ	 2_0000h	; gg: do not auto-repeat
    37                              <1> tp_do_not_skip_bp equ	 4_0000h	; T/TP/P: do not skip a (bb) breakpoint
    38                              <1> gg_bb_hit_no_repeat equ	 8_0000h	; gg: do not auto-repeat after bb hit
    39                              <1> tp_bb_hit_no_repeat equ	10_0000h	; T/TP/P: do not auto-repeat after bb hit
    40                              <1> gg_unexpected_no_repeat equ 20_0000h	; gg: do not auto-repeat after unexpectedinterrupt
    41                              <1> tp_unexpected_no_repeat equ 40_0000h	; T/TP/P
    42                              <1> ss_no_dump:		equ 80_0000h
    43                              <1> %if _SYMBOLIC
    44                              <1> dd_no_blanks_sym:	equ 100_0000h
    45                              <1> zz_no_pm_xms:		equ 200_0000h
    46                              <1> %endif
    47                              <1> rr_disasm_no_rept:	equ 1000_0000h
    48                              <1> rr_disasm_no_show:	equ 2000_0000h
    49                              <1> opt_cmdline_quiet_input:equ 4000_0000h
    50                              <1> opt_cmdline_quiet_output:equ 8000_0000h
    51                              <1> %if _SYMBOLIC
    52                              <1> DEFAULTOPTIONS	equ zz_no_pm_xms
    53                              <1> %else
    54                              <1> DEFAULTOPTIONS	equ 0
    55                              <1> %endif
    56                              <1> 
    57                              <1> 
    58                              <1> opt2_db_header:		equ 1
    59                              <1> opt2_db_trailer:	equ 2
    60                              <1> opt2_dw_header:		equ 10h
    61                              <1> opt2_dw_trailer:	equ 20h
    62                              <1> opt2_dd_header:		equ 100h
    63                              <1> opt2_dd_trailer:	equ 200h
    64                              <1> opt2_getinput_dpmi:	equ 800h
    65                              <1> opt2_hh_compat:		equ 1000h
    66                              <1> opt2_getc_idle:		equ 2000h
    67                              <1> opt2_getc_idle_dpmi:	equ 4000h
    68                              <1> opt2_re_cancel_tpg:	equ 8000h
    69                              <1> opt2_nn_compat:		equ 1_0000h
    70                              <1> opt2_nn_capitalise:	equ 2_0000h
    71                              <1> %if _MS_0RANGE_COMPAT
    72                              <1> opt2_0range_compat:	equ 4_0000h
    73                              <1> %endif
    74                              <1> opt2_rr16_compat:	equ 8_0000h
    75                              <1> opt2_r_prompt_compat:	equ 10_0000h
    76                              <1> opt2_r_separate:	equ 20_0000h
    77                              <1> opt2_r_linebreak_always:equ 40_0000h
    78                              <1> opt2_dpminohlt:		equ 8000_0000h	; DPMI doesn't like hlt
    79                              <1> DEFAULTOPTIONS2	equ opt2_dw_header | opt2_dd_header | opt2_getc_idle_dpmi | opt2_dpminohlt
    80                              <1> 
    81                              <1> 
    82                              <1> opt3_tt_no_paging:	equ 1
    83                              <1> opt3_tp_no_paging:	equ 2
    84                              <1> opt3_pp_no_paging:	equ 4
    85                              <1> opt3_gg_no_paging:	equ 8
    86                              <1> opt3_silence_paging_set:equ 100h
    87                              <1> opt3_silence_paging_on:	equ 200h
    88                              <1> opt3_paging_rc:		equ 1000h
    89                              <1> opt3_paging_yy:		equ 2000h
    90                              <1> opt3_paging_re:		equ 4000h
    91                              <1> opt3_r_highlight_diff:	equ 10000h
    92                              <1> opt3_r_highlight_dumb:	equ 20000h
    93                              <1> opt3_r_highlight_full:	equ 40000h
    94                              <1> opt3_r_highlight_eip:	equ 80000h
    95                              <1> %if _PM
    96                              <1> opt3_ss_b_bit_set:	equ   10_0000h
    97                              <1>  %if _BREAK_INSTALLDPMI
    98                              <1> opt3_break_installdpmi:	equ   20_0000h
    99                              <1>  %endif
   100                              <1> %endif
   101                              <1> %if _DHIGHLIGHT
   102                              <1> opt3_d_highlight:	equ   80_0000h
   103                              <1> %endif
   104                              <1> %if _GETLINEHIGHLIGHT
   105                              <1> opt3_getline_highlight:	equ  100_0000h
   106                              <1> %endif
   107                              <1> opt3_no_idle_2F:	equ  200_0000h
   108                              <1> %if _DELAY_BEFORE_BP
   109                              <1> opt3_delay_before_bp:	equ  400_0000h
   110                              <1> %endif
   111                              <1> opt3_no_call_amis:	equ  800_0000h
   112                              <1> opt3_disable_autorepeat:equ 1000_0000h
   113                              <1> opt3_check_ctrlc_keyb:	equ 2000_0000h
   114                              <1> opt3_check_ctrlc_0bh:	equ 4000_0000h
   115                              <1> opt3_tsr_quit_leave_tf:	equ 8000_0000h
   116                              <1> DEFAULTOPTIONS3	equ opt3_tt_no_paging | opt3_tp_no_paging 		| opt3_pp_no_paging | opt3_gg_no_paging 		| opt3_check_ctrlc_keyb | opt3_check_ctrlc_0bh
   119                              <1> 
   120                              <1> 
   121                              <1> opt4_int_2F_hook:	equ 2
   122                              <1> opt4_int_08_hook:	equ 4
   123                              <1> opt4_int_2D_hook:	equ 8
   124                              <1> %if _CATCHINTFAULTCOND
   125                              <1> opt4_int_fault_hook:	equ 10h
   126                              <1> %endif
   127                              <1> opt4_int_serial_force:	equ 1_0000h
   128                              <1> opt4_int_2F_force:	equ 2_0000h
   129                              <1> opt4_int_08_force:	equ 4_0000h
   130                              <1> opt4_int_2D_force:	equ 8_0000h
   131                              <1> %if _CATCHINT0D
   132                              <1> opt4_int_0D_force:	equ   10_0000h
   133                              <1> %endif
   134                              <1> %if _CATCHINT0C
   135                              <1> opt4_int_0C_force:	equ   20_0000h
   136                              <1> %endif
   137                              <1> opt4_int_00_force:	equ  100_0000h
   138                              <1> opt4_int_01_force:	equ  200_0000h
   139                              <1> opt4_int_03_force:	equ  400_0000h
   140                              <1> opt4_int_06_force:	equ  800_0000h
   141                              <1> opt4_int_18_force:	equ 1000_0000h
   142                              <1> opt4_int_19_force:	equ 2000_0000h
   143                              <1> opt4_int_09_force:	equ 4000_0000h	; not used at the same time as 15h
   144                              <1> opt4_int_15_force:	equ 4000_0000h	; not used at the same time as 09h
   145                              <1> opt4_int_07_force:	equ 8000_0000h
   146                              <1> DEFAULTOPTIONS4 equ opt4_int_2F_hook
   147                              <1> 
   148                              <1> 
   149                              <1> %if _VXCHG
   150                              <1> opt6_vv_mode:		equ 1
   151                              <1> opt6_vv_keep:		equ 2
   152                              <1> opt6_vv_int16:		equ 10h
   153                              <1>  %if _VXCHG_DEFAULT_ON
   154                              <1> DEFAULTOPTIONS6 equ opt6_share_serial_irq | opt6_vv_mode
   155                              <1>  %else
   156                              <1> DEFAULTOPTIONS6 equ opt6_share_serial_irq
   157                              <1>  %endif
   158                              <1> %else
   159                              <1> DEFAULTOPTIONS6 equ opt6_share_serial_irq
   160                              <1> %endif
   161                              <1> %if _DEBUG
   162                              <1> opt6_debug_exception_late:	equ  20h
   163                              <1> opt6_debug_exception_early:	equ  40h
   164                              <1>  %if _DEBUG_COND
   165                              <1> opt6_debug_exception:	equ  80h
   166                              <1> opt6_debug_mode:	equ 100h
   167                              <1>  %endif
   168                              <1> %endif
   169                              <1> opt6_bios_output:	equ 200h
   170                              <1> opt6_flat_binary:	equ 400h
   171                              <1> opt6_big_stack:		equ 800h
   172                              <1> opt6_40_columns:	equ 1000h
   173                              <1> opt6_40_indent_odd:	equ 2000h
   174                              <1> opt6_40_dash:		equ 4000h
   175                              <1> opt6_share_serial_irq:	equ 1_0000h
   176                              <1> opt6_serial_EOI_call:	equ 2_0000h
   177                              <1> %if _RH
   178                              <1> opt6_rh_mode:		equ 10_0000h
   179                              <1> %endif
   180                              <1> %if _DEBUG
   181                              <1> opt6_debug_putrunint_early:	equ  40_0000h
   182                              <1>  %if _DEBUG_COND
   183                              <1> opt6_debug_putrunint:		equ  80_0000h
   184                              <1>  %endif
   185                              <1> %endif
   186                              <1> opt6_bios_io:		equ 100_0000h
   187                              <1> opt6_immasm_display_uu:	equ 200_0000h
   188                              <1> opt6_immasm_debug:	equ 400_0000h
   189                              <1> opt6_immasm_flag:	equ 800_0000h
   190                              <1> opt6_immasm_nobranch:	equ 1000_0000h
   191                              <1> opt6_r_flags_style2:	equ 2000_0000h
   192                              <1> opt6_r_flags_style3:	equ 4000_0000h
   193                              <1> opt6_r_linebreak_conditional:	equ 8000_0000h
   194                              <1> 
   195                              <1> 
   196                              <1> DEFAULTOPTIONS7 equ opt7_no_tsr_ll
   197                              <1> opt7_no_free_oneshot_eld:	equ 1
   198                              <1> opt7_debug_optional_link:	equ 2
   199                              <1> opt7_quiet_install:		equ 4
   200                              <1> opt7_quick_run:			equ 8
   201                              <1> opt7_houdini:			equ 100h
   202                              <1> opt7_no_ensure:			equ 1000h
   203                              <1> opt7_no_tsr_ll:			equ 2000h
   204                              <1> 
   205                              <1> 
   206                              <1> oldpacket	equ	  1	; Int25/Int26 packet method available (L, W)
   207                              <1> newpacket	equ	  2	; Int21.7305 packet method available (L, W)
   208                              <1> ntpacket	equ	  4	; VDD registered and usable (L, W)
   209                              <1> pagedcommand	equ	  8	; allows paging in puts
   210                              <1> notstdinput	equ	 10h	; DEBUG's StdIn isn't a device with StdIn bit (is file or other device)
   211                              <1> inputfile	equ	 20h	; DEBUG's StdIn is a file, notstdinput also set
   212                              <1> notstdoutput	equ	 40h	; DEBUG's StdOut isn't a device with StdOut bit (is file or other device)
   213                              <1> outputfile	equ	  80h	; DEBUG's StdOut is a file, notstdoutput also set
   214                              <1> hooked2F	equ	 100h	; Int2F hooked
   215                              <1> nohook2F	equ	 200h	; don't hook Int2F.1687 (required for Win9x, DosEmu?)
   216                              <1> unused_dif1_dpminohlt equ 400h	; DPMI doesn't like hlt
   217                              <1> protectedmode	equ	 800h	; in (DPMI) protected mode
   218                              <1> debuggeeA20	equ	1000h	; state of debuggee's A20
   219                              <1> debuggerA20	equ	2000h	; state of debugger's A20 (will be on if possible)
   220                              <1> nodosloaded	equ	4000h	; No DOS loaded currently (Boot loader mode)
   221                              <1> has386		equ	8000h	; CPU is a 386
   222                              <1> usecharcounter	equ    1_0000h	; don't reset charcounter between calls to puts
   223                              <1> runningnt	equ    2_0000h	; running in NTVDM
   224                              <1> canswitchmode	equ    4_0000h	; can switch modes (auxbuff large enough, DPMI mode switch set up)
   225                              <1> modeswitched	equ    8_0000h	; switched mode (now in the mode that we weren't entered in)
   226                              <1> promptwaiting	equ   10_0000h	; puts: any more output needs to display a prompt first
   227                              <1> switchbuffer	equ   20_0000h	; mode switch needs a buffer (auxbuff)
   228                              <1> tsrmode		equ   40_0000h	; in TSR mode; DPI and DPP not valid
   229                              <1> attachedterm	equ   80_0000h	; the attached process terminated
   230                              <1> runningdosemu	equ  100_0000h	; running in dosemu
   231                              <1> ; load_is_ldp	equ  200_0000h	; boot load: partition specified as "ldp"
   232                              <1> tt_while:	equ  400_0000h	; tt: while condition specified
   233                              <1> tt_p:		equ  800_0000h	; tt: proceed past repeated string instructions
   234                              <1> tt_silent_mode:	equ 1000_0000h	; tt: run should be silent (dump at end)
   235                              <1> tt_silence:	equ 2000_0000h	; tt: silent writing (write to auxbuff instead)
   236                              <1> tt_no_bb:	equ 4000_0000h	; tt: do not use bb breakpoints
   237                              <1> tt_no_bb_first:	equ 8000_0000h	; tt: do not use bb breakpoints at first
   238                              <1> 
   239                              <1> 
   240                              <1> dif2_gg_is_first:	equ   1
   241                              <1> dif2_gg_skip_non_cseip:	equ   2
   242                              <1> dif2_gg_skip_cseip:	equ   4
   243                              <1> dif2_gg_is_gg:		equ   8
   244                              <1> dif2_gg_first_detected:	equ  10h
   245                              <1> dif2_gg_again:		equ  20h
   246                              <1> dif2_tpg_proceed_bp_set:equ  40h
   247                              <1> dif2_tpg_keep_proceed_bp: equ 80h
   248                              <1> dif2_tpg_have_bp:	equ 100h
   249                              <1> dif2_tpg_adjusted_cseip:equ 200h
   250                              <1> dif2_tpg_do_not_adjust:	equ 400h
   251                              <1> dif2_bp_failure:	equ 800h
   252                              <1> dif2_is_pp:		equ 1000h
   253                              <1> %if _SYMBOLIC
   254                              <1> dif2_createdprocess:	equ 800_0000h	; created empty debuggee process
   255                              <1> dif2_sym_req_xms:	equ 2000h
   256                              <1> dif2_sym_req_86mm:	equ 4000h
   257                              <1> dif2_sym_req_mask equ dif2_sym_req_86mm | dif2_sym_req_xms
   258                              <1> dif2_no_pm_xms:		equ 1_0000h
   259                              <1> dif2_xms_detection_done:equ 2_0000h
   260                              <1> %endif
   261                              <1> %if _INPUT_FILE_HANDLES
   262                              <1> dif2_input_file:	equ 10_0000h
   263                              <1> dif2_closed_input_file:	equ 20_0000h
   264                              <1> %endif
   265                              <1> dif2_did_getline_file:	equ 40_0000h
   266                              <1> %if _SYMBOLIC
   267                              <1> dif2_poison:		equ 80_0000h
   268                              <1> %endif
   269                              <1> dif2_boot_loaded_kernel:equ 100_0000h
   270                              <1> %if _INPUT_FILE_BOOT
   271                              <1> dif2_input_file_boot:	equ 200_0000h
   272                              <1> dif2_closed_input_file_boot:	equ 400_0000h
   273                              <1> %endif
   274                              <1> dif2_in_silence_dump:	equ 1000_0000h
   275                              <1> dif2_int31_segment:	equ 2000_0000h
   276                              <1> dif2_nn_compat:		equ 4000_0000h
   277                              <1> dif2_nn_capitalise:	equ 8000_0000h
   278                              <1> 
   279                              <1> 
   280                              <1> dif3_load_is_ldp:	equ 1	; boot load: partition specified as "ldp"
   281                              <1> dif3_load_is_sdp:	equ 2	; boot load: partition specified as "sdp"
   282                              <1> dif3_load_is_ydp:	equ 4	; boot load: partition specified as "ydp"
   283                              <1> dif3_load_is_dp:	equ dif3_load_is_ldp 				| dif3_load_is_sdp 				| dif3_load_is_ydp
   286                              <1> dif3_load_dir_dir:	equ 8
   287                              <1> dif3_input_terminal_override:	equ 10h
   288                              <1> dif3_input_serial_override:	equ 20h
   289                              <1> dif3_if_not:		equ 40h
   290                              <1> dif3_partition_changed:	equ 80h
   291                              <1> ;
   292                              <1> dif3_input_cmdline:	equ 100h; input reading from cmdline_buffer
   293                              <1> dif3_input_cmdline_closed: equ 200h
   294                              <1> dif3_at_line_end:	equ 400h
   295                              <1> dif3_quiet_input_single:equ 800h
   296                              <1> dif3_quiet_output:	equ 1000h
   297                              <1> dif3_unquiet_error:	equ 2000h
   298                              <1> dif3_unquiet_prompt:	equ 4000h
   299                              <1> dif3_unquiet:		equ dif3_unquiet_error | dif3_unquiet_prompt
   300                              <1> dif3_return_eof:	equ 8000h
   301                              <1> dif3_highlighting:	equ 1_0000h
   302                              <1> dif3_do_not_highlight:	equ 2_0000h
   303                              <1> dif3_int10_highlight:	equ 2_0000h
   304                              <1> dif3_nosymbols_1:	equ 4_0000h
   305                              <1> dif3_nosymbols_2:	equ 8_0000h
   306                              <1> %if _PM
   307                              <1> dif3_ss_b_bit_set:	equ  10_0000h
   308                              <1> %endif
   309                              <1> dif3_gotint19:		equ  20_0000h
   310                              <1> dif3_prior_pm:		equ  40_0000h
   311                              <1> %if _DELAY_BEFORE_BP
   312                              <1> dif3_delayed		equ  80_0000h
   313                              <1> %endif
   314                              <1> dif3_input_re:		equ 100_0000h	; input reading from re_buffer
   315                              <1> dif3_input_re_closed:	equ 200_0000h
   316                              <1> dif3_accept_getrange_0:	equ 400_0000h
   317                              <1> %if _INPUT_FILE_HANDLES || _INPUT_FILE_BOOT
   318                              <1> dif3_in_if:		equ 800_0000h
   319                              <1> %endif
   320                              <1> dif3_auxbuff_guarded_1:	equ 1000_0000h
   321                              <1> dif3_auxbuff_guarded_2:	equ 2000_0000h
   322                              <1> dif3_auxbuff_guarded_3:	equ 4000_0000h
   323                              <1> dif3_sss_is_reverse:	equ 8000_0000h
   324                              <1> 
   325                              <1> 
   326                              <1> dif4_int_serial_hooked:	equ 1
   327                              <1> dif4_int_2F_hooked:	equ 2
   328                              <1> dif4_int_08_hooked:	equ 4
   329                              <1> dif4_int_2D_hooked:	equ 8
   330                              <1> %if _CATCHINTFAULTCOND && _CATCHINT0D
   331                              <1> dif4_int_0D_hooked:	equ 10h
   332                              <1> %endif
   333                              <1> %if _CATCHINTFAULTCOND && _CATCHINT0C
   334                              <1> dif4_int_0C_hooked:	equ 20h
   335                              <1> %endif
   336                              <1> 
   337                              <1> 
   338                              <1> %if _VXCHG
   339                              <1> dif6_vv_mode:		equ 1
   340                              <1> %endif
   341                              <1> dif6_in_hook2F:		equ 2
   342                              <1> dif6_in_amis_hook2F:	equ 4
   343                              <1> dif6_debug_mode:	equ 100h
   344                              <1> dif6_locked:		equ 200h
   345                              <1> %if _RH
   346                              <1> dif6_rh_mode_was:	equ  8_0000h
   347                              <1> dif6_rh_mode:		equ 10_0000h
   348                              <1> dif6_rh_mode_2:		equ 20_0000h
   349                              <1> %endif
   350                              <1> dif6_device_mode:	equ 40_0000h
   351                              <1> dif6_cpdepchars:	equ 80_0000h
   352                              <1> %if _IMMASM
   353                              <1> dif6_immasm_no_output:	equ 100_0000h
   354                              <1> dif6_immasm:		equ 200_0000h
   355                              <1> dif6_immasm_rel8:	equ 400_0000h
   356                              <1> %endif
   357                              <1> 
   358                              <1> 
   359                              <1> disasm_lowercase	equ 1
   360                              <1> disasm_commablank	equ 2
   361                              <1> disasm_nasm		equ 4
   362                              <1> disasm_lowercase_refmem:equ 8
   363                              <1> disasm_show_short:	equ 10h
   364                              <1> disasm_show_near:	equ 20h
   365                              <1> disasm_show_far:	equ 40h
   366                              <1> disasm_nec:		equ 80h
   367                              <1> disasm_40_columns:	equ 100h
   368                              <1> disasm_no_indent:	equ 200h
   369                              <1> disasm_msdebug_mnemonofs: equ 400h
   370                              <1> disasm_a16_memref:	equ 1000h
   371                              <1> disasm_a32_memref:	equ 2000h
   372                              <1> disasm_a16_string:	equ 4000h
   373                              <1> disasm_a32_string:	equ 8000h
   374                              <1> disasm_hide_modrm:	equ 10000h
   375                              <1> disasm_asize_loop_nasm:	equ 20000h
   376                              <1> disasm_modrm_always:	equ 40000h
   377                              <1> DEFAULTASMOPTIONS equ disasm_lowercase|disasm_commablank|disasm_nasm 	| disasm_a16_memref | disasm_a32_memref 	| disasm_a16_string | disasm_a32_string
    27                                  
    28                                  %include "iniload.mac"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> lDebug iniload/boot interfacing structs and macros
     4                              <1> 
     5                              <1> Copyright (C) 2008-2023 E. C. Masloch
     6                              <1> 
     7                              <1> Usage of the works is permitted provided that this
     8                              <1> instrument is retained with the works, so that any entity
     9                              <1> that uses the works is notified of this instrument.
    10                              <1> 
    11                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <1> 
    13                              <1> %endif
    14                              <1> 
    15                              <1> 
    16                              <1> 	struc BS
    17 00000000 ??????              <1> bsJump:	resb 3
    18 00000003 ????????????????    <1> bsOEM:	resb 8
    19                              <1> bsBPB:
    20                              <1> 	endstruc
    21                              <1> 
    22                              <1> 	struc EBPB		;        BPB sec
    23 00000000 ????                <1> bpbBytesPerSector:	resw 1	; offset 00h 0Bh
    24 00000002 ??                  <1> bpbSectorsPerCluster:	resb 1	; offset 02h 0Dh
    25 00000003 ????                <1> bpbReservedSectors:	resw 1	; offset 03h 0Eh
    26 00000005 ??                  <1> bpbNumFATs:		resb 1	; offset 05h 10h
    27 00000006 ????                <1> bpbNumRootDirEnts:	resw 1	; offset 06h 11h -- 0 for FAT32
    28 00000008 ????                <1> bpbTotalSectors:	resw 1	; offset 08h 13h
    29 0000000A ??                  <1> bpbMediaID:		resb 1	; offset 0Ah 15h
    30 0000000B ????                <1> bpbSectorsPerFAT:	resw 1	; offset 0Bh 16h -- 0 for FAT32
    31 0000000D ????                <1> bpbCHSSectors:		resw 1	; offset 0Dh 18h
    32 0000000F ????                <1> bpbCHSHeads:		resw 1	; offset 0Fh 1Ah
    33 00000011 ????????            <1> bpbHiddenSectors:	resd 1	; offset 11h 1Ch
    34 00000015 ????????            <1> bpbTotalSectorsLarge:	resd 1	; offset 15h 20h
    35                              <1> bpbNew:				; offset 19h 24h
    36                              <1> 
    37 00000019 ????????            <1> ebpbSectorsPerFATLarge:	resd 1	; offset 19h 24h
    38 0000001D ????                <1> ebpbFSFlags:		resw 1	; offset 1Dh 28h
    39 0000001F ????                <1> ebpbFSVersion:		resw 1	; offset 1Fh 2Ah
    40 00000021 ????????            <1> ebpbRootCluster:	resd 1	; offset 21h 2Ch
    41 00000025 ????                <1> ebpbFSINFOSector:	resw 1	; offset 25h 30h
    42 00000027 ????                <1> ebpbBackupSector:	resw 1	; offset 27h 32h
    43 00000029 <res Ch>            <1> ebpbReserved:		resb 12	; offset 29h 34h
    44                              <1> ebpbNew:			; offset 35h 40h
    45                              <1> 	endstruc
    46                              <1> 
    47                              <1> 	struc BPBN		; ofs B16 S16 B32 S32
    48 00000000 ??                  <1> bpbnBootUnit:		resb 1	; 00h 19h 24h 35h 40h
    49 00000001 ??                  <1> 			resb 1	; 01h 1Ah 25h 36h 41h
    50 00000002 ??                  <1> bpbnExtBPBSignature:	resb 1	; 02h 1Bh 26h 37h 42h -- 29h for valid BPBN
    51 00000003 ????????            <1> bpbnSerialNumber:	resd 1	; 03h 1Ch 27h 38h 43h
    52 00000007 <res Bh>            <1> bpbnVolumeLabel:	resb 11	; 07h 20h 2Bh 3Ch 47h
    53 00000012 ????????????????    <1> bpbnFilesystemID:	resb 8	; 12h 2Bh 36h 47h 52h
    54                              <1> 	endstruc		; 1Ah 33h 3Eh 4Fh 5Ah
    55                              <1> 
    56                              <1> 	struc DIRENTRY
    57 00000000 ????????????????    <1> deName:		resb 8
    58 00000008 ??????              <1> deExt:		resb 3
    59 0000000B ??                  <1> deAttrib:	resb 1
    60 0000000C ??                  <1> dePlusSize:	resb 1
    61 0000000D ??????????????      <1> 		resb 7
    62 00000014 ????                <1> deClusterHigh:	resw 1
    63 00000016 ????                <1> deTime:		resw 1
    64 00000018 ????                <1> deDate:		resw 1
    65 0000001A ????                <1> deClusterLow:	resw 1
    66 0000001C ????????            <1> deSize:		resd 1
    67                              <1> 	endstruc
    68                              <1> 
    69                              <1> ATTR_READONLY	equ 1
    70                              <1> ATTR_HIDDEN	equ 2
    71                              <1> ATTR_SYSTEM	equ 4
    72                              <1> ATTR_VOLLABEL	equ 8
    73                              <1> ATTR_DIRECTORY	equ 10h
    74                              <1> ATTR_ARCHIVE	equ 20h
    75                              <1> 
    76                              <1> lsvclSignature		equ "CL"
    77                              <1> lsvclBufferLength	equ 256
    78                              <1> 
    79                              <1> 	struc LOADSTACKVARS, -10h
    80 FFFFFFF0 ????????            <1> lsvFirstCluster:	resd 1
    81 FFFFFFF4 ????????            <1> lsvFATSector:		resd 1
    82 FFFFFFF8 ????                <1> lsvFATSeg:		resw 1
    83 FFFFFFFA ????                <1> lsvLoadSeg:		resw 1
    84 FFFFFFFC ????????            <1> lsvDataStart:		resd 1
    85                              <1> 	endstruc
    86                              <1> 
    87                              <1> 	struc LOADDATA, LOADSTACKVARS - 10h
    88 FFFFFFE0 ????                <1> ldMemoryTop:	resw 1
    89 FFFFFFE2 ????                <1> ldLoadTop:	resw 1
    90 FFFFFFE4 ????                <1> ldSectorSeg:	resw 1
    91 FFFFFFE6 ??                  <1> ldFATType:	resb 1
    92                              <1> ldFlags:
    93 FFFFFFE7 ??                  <1> ldHasLBA:	resb 1
    94 FFFFFFE8 ????                <1> ldClusterSize:	resw 1
    95 FFFFFFEA ????                <1> ldParaPerSector:resw 1
    96                              <1> ldDirCluster:			; dword
    97                              <1> ldLoadingSeg:		; word
    98                              <1> ldQueryPatchValue:	; word
    99                              <1> lsvCommandLine:		; word
   100                              <1> .start:		equ $ - lsvclBufferLength
   101 FFFFFFEC ????                <1> .signature:	resw 1
   102                              <1> ldLoadUntilSeg:		; word
   103                              <1> lsvExtra:		; word
   104 FFFFFFEE ??                  <1> .partition:	resb 1	; byte
   105 FFFFFFEF ??                  <1> .flags:		resb 1	; byte
   106                              <1> 	endstruc
   107                              <1> 
   108                              <1> lsvefNoDataStart	equ 1
   109                              <1> lsvefPartitionNumber	equ 2
   110                              <1> 
   111                              <1> 	struc LOADCMDLINE, LOADDATA - lsvclBufferLength
   112                              <1> ldCommandLine:
   113 FFFFFEE0 <res 100h>          <1> .start:		resb lsvclBufferLength
   114                              <1> 	endstruc
   115                              <1> 
   116                              <1> ldfHasLBA:	equ 1
   117                              <1> ldfFATInvalid:	equ 2
   118                              <1> ldfFATBuffered:	equ 4
   119                              <1> 
   120                              <1> 	struc LOADDATA2, LOADDATA - 10h
   121 FFFFFFD0 ????????            <1> ldRootSector:		resd 1
   122 FFFFFFD4 ????                <1> ldEntriesPerSector:	resw 1
   123 FFFFFFD6 ????                <1> ldLastAvailableSector:	resw 1
   124 FFFFFFD8 ????                <1> ldParasLeft:		resw 1
   125 FFFFFFDA ????                <1> ldParasDone:		resw 1
   126                              <1> 	endstruc
   127                              <1> 
   128                              <1> 	struc LOADDATA3, LOADDATA2 - 10h
   129 FFFFFFC0 ????????            <1> ldMaxCluster:		resd 1
   130 FFFFFFC4 ????????            <1> ldFileSize:		resd 1
   131 FFFFFFC8 ????????            <1> ldCurrentCluster:	resd 1
   132 FFFFFFCC ????????            <1> ldCurrentSeek:		resd 1
   133                              <1> 	endstruc
   134                              <1> 
   135                              <1> 	struc LBAPACKET
   136 00000000 ????                <1> lpSize:		resw 1
   137 00000002 ????                <1> lpCount:	resw 1
   138 00000004 ????????            <1> lpBuffer:	resd 1
   139 00000008 ????????????????    <1> lpSector:	resq 1
   140                              <1> 	endstruc
   141                              <1> 
   142                              <1> 	struc PARTINFO
   143 00000000 ??                  <1> piBoot:		resb 1
   144 00000001 ??????              <1> piStartCHS:	resb 3
   145 00000004 ??                  <1> piType:		resb 1
   146 00000005 ??????              <1> piEndCHS:	resb 3
   147 00000008 ????????            <1> piStart:	resd 1
   148 0000000C ????????            <1> piLength:	resd 1
   149                              <1> 	endstruc
   150                              <1> 
   151                              <1> ptEmpty:		equ 0
   152                              <1> ptFAT12:		equ 1
   153                              <1> ptFAT16_16BIT_CHS:	equ 4
   154                              <1> ptExtendedCHS:		equ 5
   155                              <1> ptFAT16_CHS:		equ 6
   156                              <1> ptFAT32_CHS:		equ 0Bh
   157                              <1> ptFAT32:		equ 0Ch
   158                              <1> ptFAT16:		equ 0Eh
   159                              <1> ptExtended:		equ 0Fh
   160                              <1> ptLinux:		equ 83h
   161                              <1> ptExtendedLinux:	equ 85h
   162                              <1> 
   163                              <1> 
   164                              <1> 		; Flags of load_unit_flags
   165                              <1> lufForceCHS:		equ 1
   166                              <1> lufForceLBA:		equ 2
   167                              <1> lufForceGeometry:	equ 4
   168                              <1> luf_mask_writable equ lufForceCHS | lufForceLBA | lufForceGeometry
    29                                  
    30                                  	numdef BOOTLDR, 1
    31                                  	numdef BOOTLDR_WILD, 1
    32                                  	numdef COMPRESSED, 1
    33                                  	numdef ELDTRAILER, 1
    34                                  
    35                                  	cpu 8086
    36                                  
    37                                  	addsection RELOCATEDDATA, nobits vstart=_ELD_RELOC_VSTART
    38                                  relocateddata:
    39                                  
    40                                  	addsection HEADER, start=0
    41                                  
    42                                  	istruc ELD_HEADERX
    43                                  at eldhxHeader
    44                                  		; ELD executable header
    45                                  	istruc ELD_HEADER
    46 00000000 454C4431                at eldhSignature,	db "ELD1"
    47 00000004 000000                  			db 0,0,0
    48 00000007 1A                      			db 26
    49 00000008 50000000                at eldhCodeOffset,	dd CODEOFFSET
    50 0000000C F01F                    at eldhCodeImageLength,	dw code_size
    51 0000000E 0000                    at eldhCodeAllocLength,	dw 0
    52 00000010 40200000                at eldhDataOffset,	dd DATAOFFSET
    53 00000014 4003                    at eldhDataImageLength,	dw data_size
    54 00000016 A015                    at eldhDataAllocLength,	dw total_data_size - data_size
    55 00000018 9012                    at eldhCodeEntrypoint,	dw linker - code
    56                                  at eldhReserved
    57 0000001A 00<rep 4h>2800          at eldhExtensionSize,	dw header_extension_end - $$
    58                                  	iend
    59 00000020 [30000000]              at eldhxDescriptionOffset,	dd description
    60 00000024 3B220000                at eldhxHelpOffset,		dd DATAOFFSET + msg.help - datastart
    61                                  PUT_ELDHX_DATETIME_OFFSET
    62                                  header_extension_end:
    63 00000028 00<rep 8h>              	iend
    64                                  
    65 00000030 446973706C61792045-     description:		asciz "Display ELD description lines."
    65 00000039 4C4420646573637269-
    65 00000042 7074696F6E206C696E-
    65 0000004B 65732E00           
    66                                  
    67 0000004F 00                      	align 16, db 0
    68                                  
    69                                  	eldstrict on
    70                                  
    71                                  CODEOFFSET equ $ - $$
    72                                  	addsection CODE, follows=HEADER vstart=_ELD_CODE_VSTART
    73                                  %define CODEFIXUP - code + 0
    74                                  code:
    75                                  		; ELD instance header
    76                                  	istruc ELD_INSTANCE
    77                                  at eldiStartCode
    78 00000000 00<rep 2h>              at eldiEndCode
    79 00000002 00<rep 2h>              at eldiStartData
    80 00000004 00<rep 2h>              at eldiEndData
    81 00000006 00<rep 2h>4C495354-     at eldiIdentifier,	fill 8, 32, db "LIST"
    81 0000000C 20<rep 4h>         
    82 00000010 00<rep 2h>6C697374-     at eldiListing,		asciz _ELD_LISTING
    82 00000016 2E6C737400         
    83 0000001B 00<rep 5h>              	iend
    84                                  
    85                                  
    86                                  run:
    87 00000020 16                      	push ss
    88 00000021 07                      	pop es
    89                                  %if _BOOTLDR
    90 00000022 F606[0100]40            reloc	testopt [relocateddata], nodosloaded
    91                                  linkdatarelocation internalflags, -3
    92 00000027 7503E91B02              	jz run_dos
    93                                  .boot:
    94 0000002C E88911                  	extcallcall yy_boot_parse_name2
    95 0000002F E81B03                  	call parse_verbose
    96                                  
    97                                  boot_find:
    98 00000032 891E[4203]              reloc	mov word [boot_parsed], bx
    99                                  internaldatarelocation
   100                                   %if _BOOTLDR_WILD
   101 00000036 53                      	push bx
   102 00000037 89DF                    	mov di, bx
   103 00000039 E8B503                  	call find_dir
   104 0000003C 5B                      	pop bx
   105 0000003D 89FA                    	mov dx, di
   106 0000003F A8                      	db __TEST_IMM8			; (skip inc)
   107                                  @@:
   108 00000040 47                      	inc di
   109 00000041 803D00                  	cmp byte [di], 0
   110 00000044 7503E9E401              	je boot_no_wild
   111 00000049 803D3F                  	cmp byte [di], '?'
   112 0000004C 7405                    	je boot_wild
   113 0000004E 803D2A                  	cmp byte [di], '*'
   114 00000051 75ED                    	jne @B
   115                                  
   116                                  boot_wild:
   117 00000053 8916[4003]              reloc	mov word [wild_pattern], dx
   118                                  internaldatarelocation
   119                                  
   120 00000057 E8[0000]EB020000        	extcall yy_boot_init_dir2
   121 0000005E C606[0000]00            reloc	mov byte [relocateddata], 0
   122                                  linkdatarelocation load_check_dir_attr, -3
   123 00000063 8B36[0000]              reloc	mov si, word [relocateddata]
   124                                  linkdatarelocation load_yyname_input
   125 00000067 803C2F                  	cmp byte [si], '/'
   126 0000006A 7501                    	jne @F
   127 0000006C 46                      	inc si
   128                                  @@:
   129 0000006D 803C00                  	cmp byte [si], 0
   130 00000070 7507                    	jne @F
   131 00000072 E8[0000]EB020000        	extcall ..@yy_filename_empty
   132                                  @@:
   133 00000079 16                      	 push ss
   134 0000007A 07                      	 pop es
   135 0000007B E88200                  	call boot_parse_name
   136 0000007E 3C2F                    	cmp al, '/'
   137 00000080 7509                    	jne @F
   138 00000082 C606[0000]10            reloc	mov byte [relocateddata], ATTR_DIRECTORY
   139                                  linkdatarelocation load_check_dir_attr, -3
   140 00000087 8936[0000]              reloc	mov word [relocateddata], si
   141                                  linkdatarelocation load_yyname_next
   142                                  @@:
   143                                  
   144 0000008B BFFFFF                  	mov di, -1
   145 0000008E 89FE                    	mov si, di
   146 00000090 897EF4                  	mov [bp + lsvFATSector], di
   147 00000093 8976F6                  	mov [bp + lsvFATSector + 2], si
   148                                  
   149 00000096 31C0                    	xor ax, ax
   150 00000098 31D2                    	xor dx, dx
   151                                  
   152                                  scan_dir_yyname_loop:
   153 0000009A 8946EC                  	mov word [bp + ldDirCluster], ax
   154 0000009D 8956EE                  	mov word [bp + ldDirCluster + 2], dx
   155                                  
   156 000000A0 16                      	push ss
   157 000000A1 07                      	pop es
   158 000000A2 BB[0000]                reloc	mov bx, relocateddata
   159                                  linkdatarelocation load_yy_direntry
   160                                  
   161 000000A5 C706[0000][0000]        reloc2	mov word [relocateddata], relocateddata
   162                                  linkdatarelocation handle_scan_dir_not_found, -4
   163                                  ;linkdatarelocation near_transfer_ext_entry
   164                                  linkdatarelocation dmycmd
   165 000000AB E8[0000]EB020000        	extcall scan_dir_aux
   166 000000B2 7303E94B01              	jc end_of_directory
   167                                  
   168 000000B7 803E[0000]10            reloc	cmp byte [relocateddata], ATTR_DIRECTORY
   169                                  linkdatarelocation load_check_dir_attr, -3
   170 000000BC 7403E96701              	jne got_single_yyentry
   171                                  
   172 000000C1 56                      	push si
   173 000000C2 57                      	push di
   174 000000C3 C606[0000]00            reloc	mov byte [relocateddata], 0
   175                                  linkdatarelocation load_check_dir_attr, -3
   176 000000C8 8B36[0000]              reloc	mov si, word [relocateddata]
   177                                  linkdatarelocation load_yyname_next
   178 000000CC 803C00                  	cmp byte [si], 0
   179 000000CF 7507                    	jne @F
   180 000000D1 E8[0000]EB020000        	extcall ..@yy_filename_empty
   181                                  @@:
   182 000000D8 06                      	push es
   183 000000D9 16                      	 push ss
   184 000000DA 07                      	 pop es
   185 000000DB E82200                  	call boot_parse_name
   186 000000DE 07                      	pop es
   187 000000DF 3C2F                    	cmp al, '/'
   188 000000E1 7509                    	jne @F
   189 000000E3 C606[0000]10            reloc	mov byte [relocateddata], ATTR_DIRECTORY
   190                                  linkdatarelocation load_check_dir_attr, -3
   191 000000E8 8936[0000]              reloc	mov word [relocateddata], si
   192                                  linkdatarelocation load_yyname_next
   193                                  @@:
   194 000000EC 5F                      	pop di
   195 000000ED 5E                      	pop si
   196                                  
   197 000000EE 31D2                    	xor dx, dx
   198 000000F0 268B471A                	mov ax, [es:bx + deClusterLow]
   199                                  				; = first cluster (not FAT32)
   200 000000F4 807EE620                	cmp byte [bp + ldFATType], 32
   201 000000F8 7504                    	jne @F
   202 000000FA 268B5714                	mov dx, [es:bx + deClusterHigh]
   203                                  				; dx:ax = first cluster (FAT32)
   204                                  @@:
   205                                  
   206 000000FE EB9A                    	jmp scan_dir_yyname_loop
   207                                  
   208                                  boot_parse_name:
   209 00000100 3936[4003]              reloc	cmp word [wild_pattern], si
   210                                  internaldatarelocation
   211 00000104 740A                    	je @F
   212 00000106 E8B710                  	extcallcall boot_parse_fn	; get next pathname
   213                                  
   214 00000109 C706[0000][0000]        reloc2	mov word [relocateddata], relocateddata
   215                                  linkdatarelocation handle_scan_dir_entry, -4
   216                                  linkdatarelocation scan_dir_entry
   217                                  
   218 0000010F C3                      	retn
   219                                  
   220                                  @@:
   221 00000110 E8AD10                  	extcallcall boot_parse_fn	; get next pathname
   222                                  
   223 00000113 C706[0000][3D01]        reloc2	mov word [relocateddata], match_wildcard
   224                                  linkdatarelocation near_transfer_ext_address, -4
   225                                  internalcoderelocation
   226 00000119 C706[0000][0000]        reloc2	mov word [relocateddata], relocateddata
   227                                  linkdatarelocation handle_scan_dir_entry, -4
   228                                  linkdatarelocation near_transfer_ext_entry
   229                                  
   230 0000011F 50                      	push ax
   231 00000120 BF[0000]                reloc	mov di, relocateddata
   232                                  linkdatarelocation load_kernel_name
   233 00000123 B90800                  	mov cx, 8
   234 00000126 E80700                  	call .handle_asterisk		; handle in basename
   235 00000129 B103                    	mov cl, 3
   236 0000012B E80200                  	call .handle_asterisk		; handle in extension
   237 0000012E 58                      	pop ax
   238 0000012F C3                      	retn
   239                                  
   240                                  .handle_asterisk:
   241 00000130 B02A                    	mov al, '*'
   242 00000132 F2AE                    	repne scasb			; scan for asterisk
   243 00000134 7506                    	jne @F				; not found -->
   244 00000136 B03F                    	mov al, '?'			; fill with question marks
   245 00000138 4F                      	dec di				; -> at the asterisk
   246 00000139 41                      	inc cx				; = how many bytes remain
   247 0000013A F3AA                    	rep stosb			; fill this field
   248                                  @@:
   249 0000013C C3                      	retn
   250                                  
   251                                  
   252                                  		; INP:	es:di -> DIRENTRY
   253                                  		;	dx:ax - 1 = sector
   254                                  		;	cx, si in use
   255                                  		; OUT:	CY if end of directory
   256                                  		;	NC if to continue,
   257                                  		;	 ZR if match
   258                                  		;	 NZ if mismatch
   259                                  		; CHG:	bx
   260                                  match_wildcard:
   261 0000013D 26803D00                	cmp byte [es:di], 0
   262 00000141 F9                      	stc
   263 00000142 7503E9B400              	je .ret
   264 00000147 268A5D0B                	mov bl, byte [es:di + deAttrib]
   265 0000014B F6C308                  	test bl, ATTR_VOLLABEL
   266 0000014E 7403E9A700              	jnz .ret_NC		; skip volume labels (and LFNs) --> (NZ)
   267 00000153 80E310                  	and bl, ATTR_DIRECTORY	; isolate directory bit
   268                                  	; cmp bl, byte [load_check_dir_attr]	; is it what we're searching?
   269                                  	; jne .ret_NC				; no -->
   270 00000156 7403E99F00              	jnz .ret_NC		; must not be directory -->
   271 0000015B 56                      	push si
   272 0000015C 57                      	push di
   273 0000015D 51                      	push cx
   274 0000015E BE[0000]                reloc	mov si, relocateddata	; ds:si-> name to match
   275                                  linkdatarelocation load_kernel_name
   276 00000161 B90B00                  	mov cx, 11		; length of padded 8.3 FAT filename
   277                                  @@:
   278 00000164 F3A6                    	repe cmpsb		; check entry
   279 00000166 7406                    	je @F			; match -->
   280 00000168 807CFF3F                	cmp byte [si - 1], '?'	; wildcard ?
   281 0000016C 74F6                    	je @B			; yes --> (ZR)
   282                                  				; no (NZ)
   283                                  @@:
   284 0000016E 59                      	pop cx
   285 0000016F 5F                      	pop di
   286 00000170 5E                      	pop si
   287 00000171 7403E98400              	jne .ret_NC
   288                                  
   289 00000176 56                      	push si
   290 00000177 06                      	push es
   291 00000178 57                      	push di
   292 00000179 52                      	push dx
   293 0000017A 50                      	push ax
   294 0000017B 51                      	push cx
   295                                  
   296 0000017C B92000                  	mov cx, DIRENTRY_size
   297 0000017F 1E                      	push ds
   298 00000180 06                      	 push es
   299 00000181 1F                      	 pop ds
   300 00000182 89FE                    	mov si, di		; ds:si -> entry in directory buffer
   301 00000184 16                      	push ss
   302 00000185 07                      	pop es
   303 00000186 BF[0000]                reloc	mov di, relocateddata	; es:di -> destination for entry
   304                                  linkdatarelocation load_yy_direntry
   305 00000189 57                      	push di
   306 0000018A F3A4                    	rep movsb
   307 0000018C 5E                      	pop si
   308 0000018D 1F                      	pop ds
   309                                  
   310 0000018E BF[7503]                reloc	mov di, pathnamebuffer - 1
   311                                  internaldatarelocation		; di -> buffer
   312 00000191 B000                    	mov al, 0
   313 00000193 AA                      	stosb
   314 00000194 57                      	push di
   315 00000195 B108                    	mov cl, 8
   316 00000197 803C05                  	cmp byte [si], 05h
   317 0000019A 7505                    	jne @F
   318 0000019C B0E5                    	mov al, 0E5h
   319 0000019E AA                      	stosb
   320 0000019F 49                      	dec cx
   321 000001A0 46                      	inc si
   322                                  @@:
   323 000001A1 F3A4                    	rep movsb
   324 000001A3 B109                    	mov cl, 9
   325 000001A5 A8                      	db __TEST_IMM8
   326                                  @@:
   327 000001A6 4F                      	dec di
   328 000001A7 807DFF20                	cmp byte [di - 1], 32
   329 000001AB E1F9                    	loope @B
   330 000001AD B02E                    	mov al, '.'
   331 000001AF AA                      	stosb
   332 000001B0 B103                    	mov cl, 3
   333 000001B2 F3A4                    	rep movsb
   334 000001B4 B104                    	mov cl, 4
   335 000001B6 A8                      	db __TEST_IMM8
   336                                  @@:
   337 000001B7 4F                      	dec di
   338 000001B8 807DFF20                	cmp byte [di - 1], 32
   339 000001BC E1F9                    	loope @B
   340 000001BE 807DFF2E                	cmp byte [di - 1], '.'
   341 000001C2 7501                    	jne @F
   342 000001C4 4F                      	dec di
   343                                  @@:
   344 000001C5 B000                    	mov al, 0
   345 000001C7 AA                      	stosb
   346                                  
   347 000001C8 E8FD0F                  	extcallcall got_yyentry
   348 000001CB 8026[0300]EF            reloc	clropt [relocateddata], dif3_auxbuff_guarded_1
   349                                  linkdatarelocation internalflags3, -3
   350 000001D0 16                      	 push ss
   351 000001D1 07                      	 pop es
   352 000001D2 5A                      	pop dx
   353 000001D3 B8[0000]                reloc	mov ax, relocateddata
   354                                  linkdatarelocation load_data_lowest	; make yy_boot_get and yy_boot_update no-ops
   355 000001D6 E83802                  	call commonhandle
   356 000001D9 800E[0300]10            reloc	setopt [relocateddata], dif3_auxbuff_guarded_1
   357                                  linkdatarelocation internalflags3, -3
   358 000001DE 59                      	pop cx
   359 000001DF 58                      	pop ax
   360 000001E0 5A                      	pop dx
   361 000001E1 5F                      	pop di
   362 000001E2 07                      	pop es
   363 000001E3 5E                      	pop si			; restore registers
   364                                  
   365 000001E4 83E801                  	sub ax, 1
   366 000001E7 83DA00                  	sbb dx, 0
   367 000001EA 8B1E[0000]              reloc	mov bx, [relocateddata]
   368                                  linkdatarelocation load_adr_dirbuf_segment
   369 000001EE E8[0000]EB020000        	extcall read_sector	; restore sector
   370                                  
   371 000001F5 800E[0500]FF            reloc	or byte [found], -1
   372                                  internaldatarelocation -3	; NZ
   373                                  .ret_NC:
   374 000001FA F8                      	clc
   375                                  .ret:
   376 000001FB E8[0000]EB020000        	extcall near_transfer_ext_return, required ; must NOT be extcallcall
   377                                  
   378                                  
   379                                  end_of_directory:
   380 00000202 D006[0500]              reloc	rol byte [found], 1
   381                                  internaldatarelocation
   382 00000206 721D                    	jc @F
   383                                  
   384                                  	; pushf
   385 00000208 8026[0300]EF            reloc	clropt [relocateddata], dif3_auxbuff_guarded_1
   386                                  linkdatarelocation internalflags3, -3
   387                                  	; popf
   388                                  
   389                                  	houdini
   390                                  ;reloc	mov di, word [relocateddata]
   391                                  ;linkdatarelocation load_yyname_input
   392 0000020D 8B3E[4203]              reloc	mov di, word [boot_parsed]
   393                                  internaldatarelocation
   394 00000211 E8BC0F                  	extcallcall retry_open_scriptspath
   395 00000214 7503E919FE              	jz boot_find
   396                                  
   397 00000219 B8470E                  	mov ax, 0E47h
   398 0000021C E8B90F                  	extcallcall setrc
   399 0000021F BA[2300]                reloc	mov dx, msg.notfound
   400                                  internaldatarelocation
   401 00000222 E8BB0F                  	extcallcall putsz
   402                                  @@:
   403 00000225 E8C00F                  	extcallcall cmd3
   404                                  
   405                                  got_single_yyentry:
   406 00000228 E89D0F                  	extcallcall got_yyentry
   407 0000022B EB03                    	jmp @F
   408                                  
   409                                  boot_no_wild:
   410                                   %endif
   411                                  
   412 0000022D E8C00F                  	extcallcall yy_boot_open_file2
   413                                  @@:
   414 00000230 8026[0300]EF            reloc	clropt [relocateddata], dif3_auxbuff_guarded_1
   415                                  linkdatarelocation internalflags3, -3
   416 00000235 8B3E[0000]              reloc	mov di, word [relocateddata]
   417                                  linkdatarelocation load_yyname_input
   418 00000239 E8B501                  	call find_dir
   419 0000023C 89FA                    	mov dx, di
   420 0000023E B8[0000]                reloc	mov ax, relocateddata
   421                                  linkdatarelocation load_data_lowest	; make yy_boot_get and yy_boot_update no-ops
   422 00000241 E8CD01                  	call commonhandle
   423 00000244 E8A10F                  	extcallcall cmd3
   424                                  %endif
   425                                  
   426                                  run_dos:
   427 00000247 E8AE0F                  	extcallcall InDOS
   428 0000024A E8B30F                  	extcallcall yy_dos_parse_name
   429 0000024D E8FD00                  	call parse_verbose
   430                                  
   431 00000250 53                      	push bx
   432                                  
   433 00000251 B42F                    	mov ah, 2Fh			; get DTA
   434 00000253 E8B20F                  	extcallcall ispm
   435 00000256 750F                    	jnz .rm
   436                                  
   437                                  subcpu 286
   438 00000258 6A00                    	push word 0
   439 0000025A 6A21                    	push word 21h
   440 0000025C E8[0000]EB020000        	extcall intcall_ext_return_es, PM required	; must NOT be extcallcall
   441 00000263 5A                      	pop dx				; discard interrupt number
   442 00000264 5A                      	pop dx				; get es
   443                                  subcpureset
   444 00000265 EB04                    	jmp @F
   445                                  .rm:
   446 00000267 CD21                    	int 21h
   447 00000269 8CC2                    	mov dx, es
   448                                  @@:
   449                                  
   450 0000026B 891E[4003]              reloc	mov word [originaldta], bx
   451                                  internaldatarelocation
   452 0000026F 8916[4203]              reloc	mov word [originaldta + 2], dx
   453                                  internaldatarelocation
   454                                  
   455 00000273 A1[0000]                reloc	mov ax, word [relocateddata]
   456                                  linkdatarelocation ext_inject_handler
   457 00000276 A3[4403]                reloc	mov word [originalinject], ax
   458                                  internaldatarelocation
   459 00000279 C706[0000][9B0C]        reloc2	mov word [relocateddata], inject
   460                                  linkdatarelocation ext_inject_handler, -4
   461                                  internalcoderelocation
   462 0000027F E8E80E                  	call get_es_ext
   463 00000282 26800E[1000]01          reloc	setopt [es:code + eldiFlags], eldifResident
   464                                  internalcoderelocation -3	; mark block as resident
   465 00000288 16                      	 push ss
   466 00000289 07                      	 pop es
   467                                  
   468                                  	houdini
   469 0000028A BA[4A03]                reloc	mov dx, dta
   470                                  internaldatarelocation
   471 0000028D B41A                    	mov ah, 1Ah		; set DTA
   472 0000028F E87E0F                  	extcallcall _doscall
   473                                  
   474 00000292 5A                      	pop dx
   475                                  
   476                                  .find:
   477 00000293 C706[4603]4F71          reloc	mov word [findnext_function_number], 714Fh
   478                                  internaldatarelocation -4
   479 00000299 B84E71                  	mov ax, 714Eh
   480 0000029C B90600                  	mov cx, 6		; find all files, no directories
   481 0000029F BE0100                  	mov si, 1
   482 000002A2 BF[7605]                reloc	mov di, finddata
   483                                  internaldatarelocation
   484 000002A5 D006[0800]              reloc	rol byte [prefersfn], 1
   485                                  internaldatarelocation
   486 000002A9 721C                    	jc .sfn_try
   487 000002AB F9                      	stc
   488 000002AC E8610F                  	extcallcall _doscall
   489 000002AF 730C                    	jnc .lfn_found
   490 000002B1 83F801                  	cmp ax, 1
   491 000002B4 7411                    	je .sfn_try
   492 000002B6 3D0071                  	cmp ax, 7100h
   493 000002B9 740C                    	je .sfn_try
   494 000002BB EB74                    	jmp .notfound
   495                                  
   496                                  .lfn_found:
   497 000002BD A3[4803]                reloc	mov word [findhandle], ax
   498                                  internaldatarelocation
   499 000002C0 C606[0400]FF            reloc	mov byte [findhandle_set], 0FFh
   500                                  internaldatarelocation -3
   501 000002C5 EB11                    	jmp .next
   502                                  
   503                                  .sfn_try:
   504 000002C7 C706[4603]004F          reloc	mov word [findnext_function_number], 4F00h
   505                                  internaldatarelocation -4
   506 000002CD B8004E                  	mov ax, 4E00h
   507 000002D0 B90600                  	mov cx, 6		; find all files, no directories
   508 000002D3 E83A0F                  	extcallcall _doscall
   509 000002D6 7259                    	jc .notfound
   510                                  
   511                                  .next:
   512 000002D8 52                      	push dx
   513 000002D9 89D7                    	mov di, dx
   514 000002DB E81301                  	call find_dir
   515 000002DE 89DE                    	mov si, bx		; si -> path
   516 000002E0 89F9                    	mov cx, di
   517 000002E2 29F1                    	sub cx, si		; cx = length of path
   518 000002E4 BF[7603]                reloc	mov di, pathnamebuffer
   519                                  internaldatarelocation		; di -> buffer
   520 000002E7 89FB                    	mov bx, di		; bx -> buffer
   521 000002E9 F3A4                    	rep movsb
   522 000002EB 89FA                    	mov dx, di		; dx -> where we store filename
   523 000002ED BE[6803]                reloc	mov si, dta.name
   524                                  internaldatarelocation
   525 000002F0 B90D00                  	mov cx, 13
   526                                  
   527 000002F3 803E[4703]71            reloc	cmp byte [findnext_function_number + 1], 71h
   528                                  internaldatarelocation -3
   529 000002F8 7510                    	jne .sfn_copy
   530                                  
   531 000002FA BE[A205]                reloc	mov si, finddata.fullname
   532                                  internaldatarelocation
   533 000002FD 57                      	push di
   534 000002FE B9FFFF                  	mov cx, -1
   535 00000301 B000                    	mov al, 0
   536 00000303 89F7                    	mov di, si
   537 00000305 F2AE                    	repne scasb		; cx = -2, copy 1 byte
   538 00000307 F7D1                    	not cx
   539 00000309 5F                      	pop di
   540                                  
   541                                  .sfn_copy:
   542 0000030A F3A4                    	rep movsb
   543                                  
   544 0000030C 52                      	push dx
   545 0000030D E8080F                  	extcallcall yy_open_file
   546 00000310 5A                      	pop dx
   547 00000311 A3[0000]                reloc	mov word [relocateddata], ax
   548                                  linkdatarelocation ext_handle
   549                                  @@:
   550 00000314 E8FA00                  	call commonhandle
   551 00000317 E8060F                  	extcallcall close_ext
   552 0000031A 5A                      	pop dx
   553 0000031B A1[4603]                reloc	mov ax, word [findnext_function_number]
   554                                  internaldatarelocation
   555 0000031E 8B1E[4803]              reloc	mov bx, word [findhandle]
   556                                  internaldatarelocation
   557 00000322 BE0100                  	mov si, 1
   558 00000325 BF[7605]                reloc	mov di, finddata
   559                                  internaldatarelocation
   560 00000328 F9                      	stc
   561 00000329 E8E40E                  	extcallcall _doscall
   562 0000032C 73AA                    	jnc .next
   563                                  
   564 0000032E E8B70E                  	extcallcall cmd3
   565                                  
   566                                  
   567                                  .notfound:
   568 00000331 89D7                    	mov di, dx
   569 00000333 E89A0E                  	extcallcall retry_open_scriptspath
   570 00000336 89DA                    	mov dx, bx
   571 00000338 7503E956FF              	jz .find
   572                                  
   573 0000033D B8480E                  	mov ax, 0E48h
   574 00000340 E8950E                  	extcallcall setrc
   575 00000343 BA[2300]                reloc	mov dx, msg.notfound
   576                                  internaldatarelocation
   577 00000346 E8970E                  	extcallcall putsz
   578 00000349 E89C0E                  	extcallcall cmd3
   579                                  
   580                                  
   581                                  parse_verbose.loop:
   582 0000034C AC                      	lodsb
   583                                  parse_verbose:
   584 0000034D E8D80E                  	extcallcall skipcomm0
   585 00000350 E8DD0E                  	extcallcall iseol?
   586 00000353 7501                    	jne @F
   587 00000355 C3                      	retn
   588                                  
   589                                  @@:
   590 00000356 4E                      	dec si
   591 00000357 BA[0B00]                reloc	mov dx, msg.verbose
   592                                  internaldatarelocation
   593 0000035A E8DB0E                  	extcallcall isstring?
   594 0000035D 7507                    	jne @F
   595 0000035F C606[0600]FF            reloc	mov byte [verbose], 0FFh
   596                                  internaldatarelocation -3
   597 00000364 EBE6                    	jmp .loop
   598                                  
   599                                  @@:
   600 00000366 BA[1300]                reloc	mov dx, msg.string_help
   601                                  internaldatarelocation
   602 00000369 E8CC0E                  	extcallcall isstring?
   603 0000036C 7507                    	jne @F
   604 0000036E C606[0700]FF            reloc	mov byte [do_help], 0FFh
   605                                  internaldatarelocation -3
   606 00000373 EBD7                    	jmp .loop
   607                                  
   608                                  @@:
   609 00000375 BA[1800]                reloc	mov dx, msg.string_sfn
   610                                  internaldatarelocation
   611 00000378 E8BD0E                  	extcallcall isstring?
   612 0000037B 7507                    	jne @F
   613 0000037D C606[0800]FF            reloc	mov byte [prefersfn], 0FFh
   614                                  internaldatarelocation -3
   615 00000382 EBC8                    	jmp .loop
   616                                  
   617                                  @@:
   618 00000384 BA[1C00]                reloc	mov dx, msg.string_lib
   619                                  internaldatarelocation
   620 00000387 E8AE0E                  	extcallcall isstring?
   621 0000038A 750A                    	jne @F
   622 0000038C C606[0900]FF            reloc	mov byte [lib], 0FFh
   623                                  internaldatarelocation -3
   624 00000391 EBB9                    	jmp .loop
   625                                  
   626                                  .error:
   627 00000393 E9EA0E                  	jmp error
   628                                  
   629                                  @@:
   630 00000396 AC                      	lodsb
   631 00000397 3C2F                    	cmp al, '/'
   632 00000399 75F8                    	jne .error
   633 0000039B BF[3803]                reloc	mov di, libnamebuffer
   634                                  internaldatarelocation
   635 0000039E B82020                  	mov ax, 2020h
   636 000003A1 57                      	push di
   637 000003A2 AB<rep 4h>              	times 4 stosw
   638 000003A6 5F                      	pop di
   639 000003A7 D006[0A00]              reloc	rol byte [libname], 1
   640                                  internaldatarelocation
   641 000003AB 72E6                    	jc .error
   642 000003AD F616[0A00]              reloc	not byte [libname]
   643                                  internaldatarelocation
   644                                  @@:
   645 000003B1 AC                      	lodsb
   646 000003B2 E87B0E                  	extcallcall iseol?
   647 000003B5 7436                    	je .nameend
   648 000003B7 3C20                    	cmp al, 32
   649 000003B9 7432                    	je .nameend
   650 000003BB 3C09                    	cmp al, 9
   651 000003BD 742E                    	je .nameend
   652 000003BF 3C2C                    	cmp al, ','
   653 000003C1 742A                    	je .nameend
   654 000003C3 81FF[4003]              reloc	cmp di, strict word libnamebuffer + 8
   655                                  internaldatarelocation
   656 000003C7 73CA                    	jae .error
   657 000003C9 E8740E                  	extcallcall uppercase
   658 000003CC AA                      	stosb
   659 000003CD 3C2A                    	cmp al, '*'
   660 000003CF 75E0                    	jne @B
   661 000003D1 4F                      	dec di
   662 000003D2 B03F                    	mov al, '?'
   663                                  @@:
   664 000003D4 AA                      	stosb
   665 000003D5 81FF[4003]              reloc	cmp di, strict word libnamebuffer + 8
   666                                  internaldatarelocation
   667 000003D9 72F9                    	jb @B
   668 000003DB AC                      	lodsb
   669 000003DC E8510E                  	extcallcall iseol?
   670 000003DF 740C                    	je .nameend
   671 000003E1 3C20                    	cmp al, 32
   672 000003E3 7408                    	je .nameend
   673 000003E5 3C09                    	cmp al, 9
   674 000003E7 7404                    	je .nameend
   675 000003E9 3C2C                    	cmp al, ','
   676 000003EB 75A6                    	jne .error
   677                                  .nameend:
   678 000003ED 4E                      	dec si
   679 000003EE E95BFF                  	jmp .loop
   680                                  
   681                                  
   682                                  find_dir:
   683 000003F1 89FB                    	mov bx, di		; bx -> start of path
   684 000003F3 B9FFFF                  	mov cx, -1
   685 000003F6 B000                    	mov al, 0
   686 000003F8 F2AE                    	repne scasb
   687 000003FA 4F                      	dec di
   688                                  @@:
   689 000003FB 39DF                    	cmp di, bx
   690 000003FD 7611                    	jbe .di
   691 000003FF 4F                      	dec di
   692 00000400 803D2F                  	cmp byte [di], '/'
   693 00000403 740A                    	je .di_plus_one
   694 00000405 803D5C                  	cmp byte [di], '\'
   695 00000408 7405                    	je .di_plus_one
   696 0000040A 803D3A                  	cmp byte [di], ':'
   697 0000040D 75EC                    	jne @B
   698                                  .di_plus_one:
   699 0000040F 47                      	inc di
   700                                  .di:				; di -> end of path
   701 00000410 C3                      	retn
   702                                  
   703                                  
   704                                  		; INP:	file is opened
   705                                  		;	file seek is at ELD/SLD header
   706                                  		;	ax = file handle or bootloaded file structure offset
   707                                  		;	 (write to bx for file access functions)
   708                                  		;	dx -> ASCIZ name of matched file
   709                                  commonhandle:
   710                                  %if _COMPRESSED
   711 00000411 F9                      	stc
   712                                  %endif
   713 00000412 B300                    	mov bl, 0
   714                                  .lib:
   715                                  		; INP:	CY, bl = 0 if top level file (SLD or ELD),
   716                                  		;	 file seek is zero
   717                                  		;	CY, bl = 1 if uncompressed library's ELD,
   718                                  		;	 file seek is at ELD header
   719                                  		;	NC, bl = 1 if compressed library's ELD,
   720                                  		;	 cx:di = offset within compressed library
   721                                  	lframe
   722                                  	lvar word, more_help
   723                                  	lvar dword, liboffset
   724                                  	lvar dword, libnext
   725                                  	lvar word, libamount
   726                                  	lvar 12 + 2, libentry
   727                                  	lequ ?libentry, state
   728                                  	lequ ?libentry + 2, tail
   729                                  	lequ ?libentry + 4, next
   730                                  	lequ ?libentry + 6, helpstarted
   731 00000414 5589E58D66E6            	lenter
   732                                  	lvar word, not_sld_bit_0
   733 0000041A 53                      	 push bx
   734                                  %if _COMPRESSED
   735                                  	lvar word, uncompressed_bit_0
   736 0000041B 9C                      	 pushf
   737 0000041C 893E[C006]              reloc	mov word [depackskip], di
   738                                  internaldatarelocation
   739 00000420 890E[C206]              reloc	mov word [depackskip + 2], cx
   740                                  internaldatarelocation
   741                                  %endif
   742                                  	lvar word, handle
   743 00000424 50                      	 push ax
   744 00000425 93                      	xchg bx, ax		; bx = handle
   745 00000426 E8B70D                  	extcallcall putsz
   746 00000429 89D7                    	mov di, dx
   747                                  
   748 0000042B 31C9                    	xor cx, cx
   749 0000042D 31D2                    	xor dx, dx
   750 0000042F B80142                  	mov ax, 4201h
   751 00000432 E8B808                  	call seek_compressed_or_dos_or_boot_io
   752 00000435 7303E9E204              	jc .io_error
   753                                  	lvar dword, eldheader
   754 0000043A 52                      	 push dx
   755 0000043B 50                      	 push ax
   756                                  
   757 0000043C BA[2000]                reloc	mov dx, msg.colon
   758                                  internaldatarelocation
   759 0000043F E89E0D                  	extcallcall putsz
   760                                  
   761 00000442 B000                    	mov al, 0
   762 00000444 B9FFFF                  	mov cx, -1
   763 00000447 F2AE                    	repne scasb		; cx = -2 means 0 bytes, -3 means 1 bytes
   764                                  %if 0
   765                                  	not cx			; cx = 1 means 0 bytes
   766                                  	cmp cx, 8 + 1 + 3 + 1
   767                                  	jae @FF
   768                                  	neg cx
   769                                  	add cx, 8 + 1 + 3 + 1
   770                                  %else
   771                                  		; I give up, it's magic
   772 00000449 83C10E                  	add cx, (8 + 1 + 3 + 1) + 1
   773 0000044C 7309                    	jnc @FF
   774 0000044E 7407                    	jz @FF
   775                                  %endif
   776                                  @@:
   777 00000450 B020                    	mov al, 32
   778 00000452 E8F30D                  	extcallcall putc
   779 00000455 E2F9                    	loop @B
   780                                  @@:
   781                                  
   782                                  %if _ELDTRAILER
   783 00000457 F646E401                	testopt [bp + ?not_sld_bit_0], 1
   784 0000045B 7403E99000              	jnz .no_trailer_no_seek
   785 00000460 B80242                  	mov ax, 4202h
   786 00000463 31C9                    	xor cx, cx
   787 00000465 31D2                    	xor dx, dx
   788 00000467 E88308                  	call seek_compressed_or_dos_or_boot_io
   789 0000046A 7303E9AD04              	jc .io_error
   790                                  
   791 0000046F 85D2                    	test dx, dx
   792 00000471 7505                    	jnz @F
   793 00000473 83F830                  	cmp ax, ELD_HEADER_size + ELD_TRAILER_HEADER_size
   794 00000476 7267                    	jb .no_trailer
   795                                  @@:
   796                                  
   797 00000478 B80142                  	mov ax, 4201h
   798 0000047B B9FFFF                  	mov cx, -1
   799 0000047E BAF0FF                  	mov dx, - ELD_TRAILER_HEADER_size
   800 00000481 E86908                  	call seek_compressed_or_dos_or_boot_io
   801 00000484 7303E99304              	jc .io_error
   802                                  
   803 00000489 52                      	push dx
   804 0000048A 50                      	push ax
   805                                  
   806 0000048B B91000                  	mov cx, fromwords(ELD_TRAILER_HEADER_size_w)
   807 0000048E 29CC                    	sub sp, cx
   808 00000490 89E2                    	mov dx, sp
   809                                  
   810 00000492 B43F                    	mov ah, 3Fh
   811 00000494 E87C08                  	call read_compressed_or_dos_or_boot_io
   812 00000497 7303E98004              	jc .io_error
   813 0000049C 89E7                    	mov di, sp
   814 0000049E 89E6                    	mov si, sp
   815                                  
   816 000004A0 39C8                    	cmp ax, cx
   817 000004A2 7538                    	jne .no_trailer_pop
   818                                  
   819 000004A4 31D2                    	xor dx, dx
   820 000004A6 D1E9                    	shr cx, 1
   821                                  @@:
   822 000004A8 AD                      	lodsw
   823 000004A9 01C2                    	add dx, ax
   824 000004AB E2FB                    	loop @B
   825 000004AD 752D                    	jnz .no_trailer_pop
   826                                  
   827 000004AF 58                      	pop ax
   828 000004B0 3D454C                  	cmp ax, "EL"
   829 000004B3 7527                    	jne .no_trailer_pop
   830 000004B5 58                      	pop ax
   831 000004B6 3D4431                  	cmp ax, "D1"
   832 000004B9 7521                    	jne .no_trailer_pop
   833 000004BB 58                      	pop ax
   834 000004BC 3D5441                  	cmp ax, "TA"
   835 000004BF 751B                    	jne .no_trailer_pop
   836 000004C1 58                      	pop ax
   837 000004C2 3D494C                  	cmp ax, "IL"
   838 000004C5 7515                    	jne .no_trailer_pop
   839                                  
   840 000004C7 5E                      	pop si
   841 000004C8 59                      	pop cx			; cx:si = displacement to subtract
   842 000004C9 58                      	pop ax			; reserved
   843 000004CA 58                      	pop ax			; checksum
   844                                  
   845 000004CB 58                      	pop ax
   846 000004CC 5A                      	pop dx			; dx:ax = offset of trailer header
   847 000004CD 01F0                    	add ax, si
   848 000004CF 11CA                    	adc dx, cx		; dx:ax = offset of header
   849 000004D1 7203E94604              	jnc .io_error
   850                                  
   851 000004D6 8946DC                  	mov word [bp + ?eldheader], ax
   852 000004D9 8956DE                  	mov word [bp + ?eldheader + 2], dx
   853                                  
   854                                  .no_trailer_pop:
   855 000004DC 8D6514                  	lea sp, [di + fromwords(ELD_TRAILER_HEADER_size_w) + 4]
   856                                  
   857                                  .no_trailer:
   858 000004DF B80042                  	mov ax, 4200h
   859 000004E2 8B56DC                  	mov dx, word [bp + ?eldheader]
   860 000004E5 8B4EDE                  	mov cx, word [bp + ?eldheader + 2]
   861 000004E8 E80208                  	call seek_compressed_or_dos_or_boot_io
   862 000004EB 7303E92C04              	jc .io_error
   863                                  
   864                                  .no_trailer_no_seek:
   865                                  %endif
   866                                  
   867 000004F0 B43F                    	mov ah, 3Fh
   868 000004F2 B92000                  	mov cx, fromwords(ELD_HEADER_size_w)
   869                                  	lvar fromwords(ELD_HEADER_size_w), header
   870 000004F5 29CC                    	sub sp, cx
   871 000004F7 89E2                    	mov dx, sp
   872 000004F9 E81708                  	call read_compressed_or_dos_or_boot_io
   873 000004FC 7303E91B04              	jc .io_error
   874 00000501 39C8                    	cmp ax, cx
   875 00000503 750C                    	jne .invalid_check_sld_NZ
   876 00000505 817EBC454C              	cmp word [bp + ?header + eldhSignature], "EL"
   877 0000050A 7505                    	jne .invalid_check_sld_NZ
   878 0000050C 817EBE4431              	cmp word [bp + ?header + eldhSignature + 2], "D1"
   879                                  .invalid_check_sld_NZ:
   880 00000511 7403E92804              	jne .invalid_check_sld
   881                                  	houdini
   882 00000516 837EDA24                	cmp word [bp + ?header + eldhExtensionSize], eldhxDescriptionOffset + 4
   883 0000051A 7303E9EE03              	jb .nodesc
   884 0000051F 83EC04                  	sub sp, 4
   885                                  %if eldhxDescriptionOffset - ELD_HEADER_size
   886                                  	mov dx, eldhxDescriptionOffset - ELD_HEADER_size
   887                                  	xor cx, cx
   888                                  	mov ax, 4201h
   889                                  	call seek_compressed_or_dos_or_boot_io
   890                                  	jc .io_error
   891                                  %endif
   892 00000522 89E2                    	mov dx, sp
   893 00000524 B90400                  	mov cx, 4
   894 00000527 B43F                    	mov ah, 3Fh
   895 00000529 E8E707                  	call read_compressed_or_dos_or_boot_io
   896 0000052C 7303E9EB03              	jc .io_error
   897 00000531 39C8                    	cmp ax, cx
   898 00000533 7403E92D04              	jne .invalid
   899 00000538 5A                      	pop dx
   900 00000539 59                      	pop cx
   901 0000053A 89D0                    	mov ax, dx
   902 0000053C 09C8                    	or ax, cx
   903 0000053E 7503E9CA03              	jz .nodesc
   904 00000543 0356DC                  	add dx, word [bp + ?eldheader]
   905 00000546 134EDE                  	adc cx, word [bp + ?eldheader + 2]
   906 00000549 B80042                  	mov ax, 4200h
   907 0000054C E89E07                  	call seek_compressed_or_dos_or_boot_io
   908 0000054F 7303E9C803              	jc .io_error
   909                                  
   910 00000554 BF[0000]                reloc	mov di, relocateddata
   911                                  linkdatarelocation line_out
   912 00000557 B94000                  	mov cx, words(128)
   913 0000055A 31C0                    	xor ax, ax
   914 0000055C 89FA                    	mov dx, di
   915 0000055E F3AB                    	rep stosw
   916 00000560 B43F                    	mov ah, 3Fh
   917 00000562 B97F00                  	mov cx, 127
   918 00000565 E8AB07                  	call read_compressed_or_dos_or_boot_io
   919 00000568 7303E9AF03              	jc .io_error
   920 0000056D E8700C                  	extcallcall putsz
   921 00000570 BA[0301]                reloc	mov dx, msg.linebreak
   922                                  internaldatarelocation
   923                                  .putsz_desc_done:
   924 00000573 E86A0C                  	extcallcall putsz
   925                                  
   926 00000576 D006[0600]              reloc	rol byte [verbose], 1
   927                                  internaldatarelocation
   928 0000057A 7203E9AE00              	jnc .help
   929 0000057F BF[0000]                reloc	mov di, relocateddata
   930                                  linkdatarelocation line_out
   931 00000582 BE[3A01]                reloc	mov si, msg.verbose.1
   932                                  internaldatarelocation
   933 00000585 E8C80C                  	extcallcall copy_single_counted_string
   934                                  
   935 00000588 8D76BC                  	lea si, [bp + ?header]
   936 0000058B A5                      	movsw
   937 0000058C A5                      	movsw
   938                                  
   939 0000058D 83EC08                  	sub sp, 8
   940 00000590 B80042                  	mov ax, 4200h
   941 00000593 8B4EC6                  	mov cx, word [bp + ?header + eldhCodeOffset + 2]
   942 00000596 8B56C4                  	mov dx, word [bp + ?header + eldhCodeOffset]
   943 00000599 0356DC                  	add dx, word [bp + ?eldheader]
   944 0000059C 134EDE                  	adc cx, word [bp + ?eldheader + 2]
   945                                  		; ELD header is at seek 0
   946 0000059F 83C208                  	add dx, eldiIdentifier
   947 000005A2 83D100                  	adc cx, 0
   948 000005A5 7303E98803              	jc .invalid_instance
   949 000005AA E84007                  	call seek_compressed_or_dos_or_boot_io
   950 000005AD 7303E96A03              	jc .io_error
   951 000005B2 89E2                    	mov dx, sp
   952 000005B4 B43F                    	mov ah, 3Fh
   953 000005B6 B90800                  	mov cx, 8
   954 000005B9 E85707                  	call read_compressed_or_dos_or_boot_io
   955 000005BC 7303E95B03              	jc .io_error
   956 000005C1 39C8                    	cmp ax, cx
   957 000005C3 7403E96A03              	jne .invalid_instance
   958                                  
   959 000005C8 BE[4601]                reloc	mov si, msg.verbose.2
   960                                  internaldatarelocation
   961 000005CB 51                      	push cx
   962 000005CC E8810C                  	extcallcall copy_single_counted_string
   963 000005CF 59                      	pop cx
   964                                  
   965 000005D0 89E6                    	mov si, sp
   966 000005D2 F3A4                    	rep movsb
   967 000005D4 A8                      	db __TEST_IMM8		; (skip dec)
   968                                  @@:
   969 000005D5 4F                      	dec di
   970 000005D6 807DFF20                	cmp byte [di - 1], 32
   971 000005DA 74F9                    	je @B
   972                                  
   973 000005DC 83C408                  	add sp, 8
   974                                  
   975 000005DF B022                    	mov al, '"'
   976 000005E1 AA                      	stosb
   977                                  
   978                                  .after_invalid_instance:
   979 000005E2 53                      	push bx
   980 000005E3 E8720C                  	extcallcall putsline_crlf
   981 000005E6 5B                      	pop bx
   982 000005E7 BF[0000]                reloc	mov di, relocateddata
   983                                  linkdatarelocation line_out
   984                                  
   985 000005EA B82020                  	mov ax, 2020h
   986 000005ED AB                      	stosw
   987                                  
   988 000005EE 8B46C8                  	mov ax, word [bp + ?header + eldhCodeImageLength]
   989 000005F1 E86C0C                  	extcallcall decword
   990                                  
   991 000005F4 BE[5501]                reloc	mov si, msg.verbose.3
   992                                  internaldatarelocation
   993 000005F7 E8560C                  	extcallcall copy_single_counted_string
   994                                  
   995 000005FA 0346CA                  	add ax, word [bp + ?header + eldhCodeAllocLength]
   996 000005FD 83C00F                  	add ax, 15
   997 00000600 24F0                    	and al, ~15
   998 00000602 E85B0C                  	extcallcall decword
   999                                  
  1000 00000605 BE[5D01]                reloc	mov si, msg.verbose.4
  1001                                  internaldatarelocation
  1002 00000608 E8450C                  	extcallcall copy_single_counted_string
  1003                                  
  1004 0000060B 8B46D0                  	mov ax, word [bp + ?header + eldhDataImageLength]
  1005 0000060E E84F0C                  	extcallcall decword
  1006                                  
  1007 00000611 BE[6601]                reloc	mov si, msg.verbose.5
  1008                                  internaldatarelocation
  1009 00000614 E8390C                  	extcallcall copy_single_counted_string
  1010                                  
  1011 00000617 0346D2                  	add ax, word [bp + ?header + eldhDataAllocLength]
  1012 0000061A 83C00F                  	add ax, 15
  1013 0000061D 24F0                    	and al, ~15
  1014 0000061F E83E0C                  	extcallcall decword
  1015                                  
  1016 00000622 BE[6E01]                reloc	mov si, msg.verbose.6
  1017                                  internaldatarelocation
  1018 00000625 E8280C                  	extcallcall copy_single_counted_string
  1019                                  
  1020 00000628 53                      	push bx
  1021 00000629 E82C0C                  	extcallcall putsline_crlf
  1022 0000062C 5B                      	pop bx
  1023                                  
  1024                                  .help:
  1025 0000062D D006[0700]              reloc	rol byte [do_help], 1
  1026                                  internaldatarelocation
  1027 00000631 7203E9B600              	jnc .help_done
  1028                                  
  1029 00000636 837EDA28                	cmp word [bp + ?header + eldhExtensionSize], eldhxHelpOffset + 4
  1030 0000063A 7303E9D402              	jb .nohelp
  1031 0000063F 83EC04                  	sub sp, 4
  1032 00000642 BA2400                  	mov dx, eldhxHelpOffset
  1033 00000645 31C9                    	xor cx, cx
  1034 00000647 0356DC                  	add dx, word [bp + ?eldheader]
  1035 0000064A 134EDE                  	adc cx, word [bp + ?eldheader + 2]
  1036 0000064D B80042                  	mov ax, 4200h
  1037 00000650 E89A06                  	call seek_compressed_or_dos_or_boot_io
  1038 00000653 7303E9C402              	jc .io_error
  1039 00000658 89E2                    	mov dx, sp
  1040 0000065A B90400                  	mov cx, 4
  1041 0000065D B43F                    	mov ah, 3Fh
  1042 0000065F E8B106                  	call read_compressed_or_dos_or_boot_io
  1043 00000662 7303E9B502              	jc .io_error
  1044 00000667 39C8                    	cmp ax, cx
  1045 00000669 7403E9F702              	jne .invalid
  1046 0000066E 5A                      	pop dx
  1047 0000066F 59                      	pop cx
  1048 00000670 89D0                    	mov ax, dx
  1049 00000672 09C8                    	or ax, cx
  1050 00000674 7503E99A02              	jz .nohelp
  1051 00000679 0356DC                  	add dx, word [bp + ?eldheader]
  1052 0000067C 134EDE                  	adc cx, word [bp + ?eldheader + 2]
  1053 0000067F B80042                  	mov ax, 4200h
  1054 00000682 E86806                  	call seek_compressed_or_dos_or_boot_io
  1055 00000685 7303E99202              	jc .io_error
  1056                                  
  1057 0000068A BF[0000]                reloc	mov di, relocateddata
  1058                                  linkdatarelocation line_out
  1059 0000068D C646FEFF                	mov byte [bp + ?more_help], 0FFh
  1060                                  
  1061                                  .loop:
  1062 00000691 89F8                    	mov ax, di
  1063 00000693 2D[0000]                reloc	sub ax, strict word relocateddata
  1064                                  linkdatarelocation line_out	; ax = how much already buffered
  1065                                  
  1066 00000696 50                      	push ax
  1067 00000697 89FA                    	mov dx, di		; dx -> buffer tail
  1068 00000699 B43F                    	mov ah, 3Fh		; read
  1069 0000069B B9[0001]                reloc	mov cx, 256 + relocateddata
  1070                                  linkdatarelocation line_out
  1071 0000069E 29D1                    	sub cx, dx		; cx = how much space in buffer
  1072 000006A0 E87006                  	call read_compressed_or_dos_or_boot_io
  1073 000006A3 7303E97402              	jc .io_error
  1074                                  %if 0
  1075                                  	mov si, dx
  1076                                  	add si, ax		; -> behind read data
  1077                                  	mov byte [si], 0	; may write byte [line_out + 256]
  1078                                  %endif
  1079 000006A8 59                      	pop cx
  1080 000006A9 01C1                    	add cx, ax		; = how much data we have now
  1081 000006AB 743F                    	jz .help_done		; if done -->
  1082                                  
  1083 000006AD BF[0000]                reloc	mov di, relocateddata
  1084                                  linkdatarelocation line_out
  1085                                  
  1086 000006B0 57                      	push di
  1087 000006B1 51                      	push cx			; cx = 8 if 8 bytes
  1088 000006B2 B000                    	mov al, 0
  1089 000006B4 F2AE                    	repne scasb		; if cx was = 8 and second byte is NUL, cx = 6
  1090 000006B6 91                      	xchg ax, cx		; ax = 6
  1091 000006B7 59                      	pop cx
  1092 000006B8 5F                      	pop di
  1093 000006B9 7506                    	jne @F
  1094 000006BB F656FE                  	not byte [bp + ?more_help]
  1095 000006BE 29C1                    	sub cx, ax		; cx = 8 - 6 = 2
  1096 000006C0 49                      	dec cx			; cx = 1 (one data byte)
  1097                                  @@:
  1098                                  
  1099 000006C1 B00A                    	mov al, 10
  1100 000006C3 01CF                    	add di, cx		; di -> behind data
  1101 000006C5 51                      	push cx
  1102 000006C6 4F                      	dec di			; NZ, di -> last data byte
  1103 000006C7 FD                      	std
  1104 000006C8 F2AE                    	repne scasb		; scan for last LF
  1105 000006CA FC                      	cld
  1106 000006CB 59                      	pop cx
  1107 000006CC 7405                    	je .partial		; found an LF -->
  1108                                  .full:
  1109 000006CE BF[FEFF]                reloc	mov di, relocateddata - 2
  1110                                  linkdatarelocation line_out	; minus 2 to counteract inc inc
  1111 000006D1 01CF                    	add di, cx		; -> behind last data byte (minus 2)
  1112                                  .partial:
  1113 000006D3 47                      	inc di			; -> at LF
  1114 000006D4 47                      	inc di			; -> behind LF
  1115 000006D5 51                      	push cx
  1116 000006D6 53                      	push bx
  1117 000006D7 E88E0B                  	extcallcall putsline	; display line_out .. di-1
  1118 000006DA 5B                      	pop bx
  1119 000006DB 59                      	pop cx
  1120 000006DC 89FE                    	mov si, di		; -> behind data displayed
  1121 000006DE BF[0000]                reloc	mov di, relocateddata
  1122                                  linkdatarelocation line_out
  1123                                  		; cx = cx - (si - di)
  1124 000006E1 01F9                    	add cx, di
  1125 000006E3 29F1                    	sub cx, si		; cx = how much data remains
  1126 000006E5 F3A4                    	rep movsb		; move data to start of line_out
  1127                                  				; di -> where to write
  1128 000006E7 D046FE                  	rol byte [bp + ?more_help], 1
  1129 000006EA 72A5                    	jc .loop
  1130                                  
  1131                                  .help_done:
  1132 000006EC 837EDA2C                	cmp word [bp + ?header + eldhExtensionSize], eldhxLibTable + 4
  1133 000006F0 7303E97C02              	jb .nolib
  1134 000006F5 83EC04                  	sub sp, 4
  1135 000006F8 BA2800                  	mov dx, eldhxLibTable
  1136 000006FB 31C9                    	xor cx, cx
  1137 000006FD 0356DC                  	add dx, word [bp + ?eldheader]
  1138 00000700 134EDE                  	adc cx, word [bp + ?eldheader + 2]
  1139 00000703 B80042                  	mov ax, 4200h
  1140 00000706 E8E405                  	call seek_compressed_or_dos_or_boot_io
  1141 00000709 7303E90E02              	jc .io_error
  1142 0000070E 89E2                    	mov dx, sp
  1143 00000710 B90400                  	mov cx, 4
  1144 00000713 B43F                    	mov ah, 3Fh
  1145 00000715 E8FB05                  	call read_compressed_or_dos_or_boot_io
  1146 00000718 7303E9FF01              	jc .io_error
  1147 0000071D 39C8                    	cmp ax, cx
  1148 0000071F 7403E94102              	jne .invalid
  1149 00000724 5A                      	pop dx
  1150 00000725 59                      	pop cx
  1151 00000726 89D0                    	mov ax, dx
  1152 00000728 09C8                    	or ax, cx
  1153 0000072A 7503E94202              	jz .nolib
  1154 0000072F 0356DC                  	add dx, word [bp + ?eldheader]
  1155 00000732 134EDE                  	adc cx, word [bp + ?eldheader + 2]
  1156 00000735 B80042                  	mov ax, 4200h
  1157 00000738 E8B205                  	call seek_compressed_or_dos_or_boot_io
  1158 0000073B 7303E9DC01              	jc .io_error
  1159                                  
  1160 00000740 B90800                  	mov cx, fromwords(ELD_LIBTABLE_size_w)
  1161 00000743 29CC                    	sub sp, cx
  1162 00000745 89E2                    	mov dx, sp
  1163 00000747 B43F                    	mov ah, 3Fh
  1164 00000749 E8C705                  	call read_compressed_or_dos_or_boot_io
  1165 0000074C 7303E9CB01              	jc .io_error
  1166 00000751 39C8                    	cmp ax, cx
  1167 00000753 7403E90D02              	jne .invalid
  1168 00000758 89E7                    	mov di, sp
  1169                                  %ifn _COMPRESSED
  1170                                  	cmp word [di + eldltFormat], 0
  1171                                  	jne .invalid
  1172                                  %else
  1173 0000075A 31D2                    	xor dx, dx		; init to zero compression layers
  1174 0000075C 8B05                    	mov ax, word [di + eldltFormat]
  1175                                  		; 0 = uncompressed
  1176                                  		; 2 = compressed heatshrink
  1177                                  		; 3 = compressed lzexedat -4
  1178                                  		; 4 = compressed lzexedat -4 -l
  1179 0000075E 83F804                  	cmp ax, 4
  1180 00000761 7603E9FF01              	ja .invalid
  1181 00000766 3C01                    	cmp al, 1
  1182 00000768 7503E9F801              	je .invalid
  1183 0000076D 721D                    	jb @F
  1184 0000076F A2[0300]                reloc	mov byte [depack_format], al
  1185                                  internaldatarelocation
  1186                                  
  1187 00000772 B90400                  	mov cx, 4
  1188 00000775 BA[B406]                reloc	mov dx, libtab_compressed_length
  1189                                  internaldatarelocation
  1190 00000778 B43F                    	mov ah, 3Fh
  1191 0000077A E89605                  	call read_compressed_or_dos_or_boot_io
  1192 0000077D 7303E99A01              	jc .io_error
  1193 00000782 39C8                    	cmp ax, cx
  1194 00000784 7403E9DC01              	jne .invalid
  1195                                  
  1196 00000789 BA0100                  	mov dx, 1
  1197                                  @@:
  1198 0000078C F646E201                	testopt [bp + ?uncompressed_bit_0], 1
  1199                                   %if 0
  1200                                  	jnz @F
  1201                                  	inc dx			; count compression layers
  1202                                  	inc dh			; was already compressed
  1203                                  @@:
  1204                                  	cmp dl, 2		; compressed within compressed ?
  1205                                  	jae .doublepacked	; yes -->
  1206                                   %else
  1207 00000790 7503E99201              	jz .doublepacked	; lib inside compressed is invalid -->
  1208                                   %endif
  1209                                  %endif
  1210 00000795 8B4D02                  	mov cx, word [di + eldltAmount]
  1211 00000798 85C9                    	test cx, cx
  1212 0000079A 7503E9D201              	jz .nolib
  1213 0000079F 894EF4                  	mov word [bp + ?libamount], cx
  1214 000007A2 8B4504                  	mov ax, word [di + eldltOffset]
  1215 000007A5 0346DC                  	add ax, word [bp + ?eldheader]
  1216 000007A8 8946FA                  	mov word [bp + ?liboffset], ax
  1217 000007AB 8B4506                  	mov ax, word [di + eldltOffset + 2]
  1218 000007AE 1346DE                  	adc ax, word [bp + ?eldheader + 2]
  1219 000007B1 8946FC                  	mov word [bp + ?liboffset + 2], ax
  1220                                  
  1221                                  %if _COMPRESSED
  1222 000007B4 52                      	push dx			; on stack: ah = was compressed,
  1223                                  				;  al = next is compressed
  1224                                  %endif
  1225 000007B5 D006[0600]              reloc	rol byte [verbose], 1
  1226                                  internaldatarelocation
  1227 000007B9 7350                    	jnc .lib_verbose_done
  1228                                  
  1229 000007BB 53                      	push bx
  1230 000007BC 89FB                    	mov bx, di
  1231 000007BE BF[0000]                reloc	mov di, relocateddata
  1232                                  linkdatarelocation line_out
  1233                                  
  1234                                  ;	mov ax, 2020h
  1235                                  ;	stosw
  1236                                  
  1237 000007C1 BE[8A01]                reloc	mov si, msg.verbose.lib.1
  1238                                  internaldatarelocation
  1239 000007C4 E8890A                  	extcallcall copy_single_counted_string
  1240                                  
  1241 000007C7 8B4702                  	mov ax, word [bx + eldltAmount]
  1242 000007CA E8930A                  	extcallcall decword
  1243                                  
  1244 000007CD BE[9E01]                reloc	mov si, msg.verbose.lib.2
  1245                                  internaldatarelocation
  1246 000007D0 E87D0A                  	extcallcall copy_single_counted_string
  1247                                  
  1248 000007D3 8B07                    	mov ax, word [bx + eldltFormat]
  1249 000007D5 E8880A                  	extcallcall decword
  1250                                  
  1251 000007D8 BE[AD01]                reloc	mov si, msg.verbose.lib.3.un
  1252                                  internaldatarelocation
  1253 000007DB 3C00                    	cmp al, 0
  1254 000007DD 7411                    	je @F
  1255 000007DF BE[BD01]                reloc	mov si, msg.verbose.lib.3.hs
  1256                                  internaldatarelocation
  1257 000007E2 3C02                    	cmp al, 2
  1258 000007E4 740A                    	je @F
  1259 000007E6 BE[CB01]                reloc	mov si, msg.verbose.lib.3.lze
  1260                                  internaldatarelocation
  1261 000007E9 3C03                    	cmp al, 3
  1262 000007EB 7403                    	je @F
  1263 000007ED BE[DA01]                reloc	mov si, msg.verbose.lib.3.lzel
  1264                                  internaldatarelocation
  1265                                  @@:
  1266 000007F0 E85D0A                  	extcallcall copy_single_counted_string
  1267                                  
  1268 000007F3 3C00                    	cmp al, 0
  1269 000007F5 7410                    	je @F
  1270 000007F7 BE[EC01]                reloc	mov si, msg.verbose.lib.4
  1271                                  internaldatarelocation
  1272 000007FA E8530A                  	extcallcall copy_single_counted_string
  1273                                  
  1274 000007FD 8B16[B606]              reloc	mov dx, [libtab_compressed_length + 2]
  1275                                  internaldatarelocation
  1276 00000801 A1[B406]                reloc	mov ax, [libtab_compressed_length]
  1277                                  internaldatarelocation
  1278 00000804 E8690A                  	extcallcall decdword
  1279                                  @@:
  1280                                  
  1281 00000807 E84E0A                  	extcallcall putsline_crlf
  1282 0000080A 5B                      	pop bx
  1283                                  
  1284                                  .lib_verbose_done:
  1285                                  %if _COMPRESSED
  1286 0000080B 5A                      	pop dx
  1287                                  %endif
  1288 0000080C 83C408                  	add sp, fromwords(ELD_LIBTABLE_size_w)
  1289                                  %if _COMPRESSED
  1290 0000080F 52                      	push dx			; on stack: ah = was compressed,
  1291                                  				;  al = next is compressed
  1292                                  %endif
  1293                                  
  1294 00000810 D006[0900]              reloc	rol byte [lib], 1
  1295                                  internaldatarelocation
  1296 00000814 7203E95801              	jnc .lib_done
  1297                                  
  1298                                   %if _COMPRESSED
  1299 00000819 31D2                    	xor dx, dx
  1300 0000081B 52                      	push dx
  1301 0000081C 52                      	push dx
  1302                                   %endif
  1303                                  
  1304                                  .looplib:
  1305 0000081D 8D56E6                  	lea dx, [bp + ?libentry]
  1306 00000820 B90C00                  	mov cx, 12
  1307 00000823 B43F                    	mov ah, 3Fh
  1308 00000825 E8EB04                  	call read_compressed_or_dos_or_boot_io
  1309 00000828 7303E9EF00              	jc .io_error
  1310 0000082D 39C8                    	cmp ax, cx
  1311 0000082F 7403E93101              	jne .invalid
  1312                                  
  1313 00000834 31C9                    	xor cx, cx
  1314 00000836 31D2                    	xor dx, dx
  1315 00000838 B80142                  	mov ax, 4201h
  1316 0000083B E8AF04                  	call seek_compressed_or_dos_or_boot_io
  1317 0000083E 7303E9D900              	jc .io_error
  1318 00000843 8946F6                  	mov word [bp + ?libnext], ax
  1319 00000846 8956F8                  	mov word [bp + ?libnext + 2], dx
  1320                                  
  1321                                  .libname:
  1322                                  %if _ELDTRAILER
  1323 00000849 F646E401                	testopt [bp + ?not_sld_bit_0], 1
  1324 0000084D 7521                    	jnz .nolibname
  1325                                  %else
  1326                                  	cmp word [bp + ?eldheader], 0
  1327                                  	jne .nolibname
  1328                                  	cmp word [bp + ?eldheader + 2], 0
  1329                                  	jne .nolibname
  1330                                  %endif
  1331 0000084F D006[0A00]              reloc	rol byte [libname], 1
  1332                                  internaldatarelocation
  1333 00000853 731B                    	jnc .nolibname
  1334 00000855 8D76EA                  	lea si, [bp + ?libentry + 4]
  1335 00000858 BF[3803]                reloc	mov di, libnamebuffer
  1336                                  internaldatarelocation
  1337 0000085B B90800                  	mov cx, 8
  1338                                  @@:
  1339 0000085E AC                      	lodsb
  1340 0000085F E8DE09                  	extcallcall uppercase
  1341 00000862 AE                      	scasb
  1342 00000863 7404                    	je @F
  1343 00000865 807DFF3F                	cmp byte [di - 1], '?'
  1344                                  @@:
  1345 00000869 E1F3                    	loope @BB
  1346 0000086B 7403E98500              	jne .libskip
  1347                                  .nolibname:
  1348                                  
  1349                                  %if _COMPRESSED
  1350 00000870 B80042                  	mov ax, 4200h
  1351 00000873 5A                      	pop dx
  1352 00000874 59                      	pop cx
  1353 00000875 E8AC04                  	call dos_or_boot_io
  1354                                  
  1355 00000878 58                      	pop ax
  1356 00000879 50                      	push ax
  1357 0000087A 3C01                    	cmp al, 1		; CY if uncompressed
  1358 0000087C 7208                    	jb .uncomp_seek
  1359                                  
  1360 0000087E 8B7EE6                  	mov di, word [bp + ?libentry]
  1361 00000881 8B4EE8                  	mov cx, word [bp + ?libentry + 2]
  1362                                  
  1363                                   %if 0
  1364                                  	test ah, ah
  1365                                  	jz .comp_in_uncomp_seek
  1366                                  .uncomp_in_comp_seek:
  1367                                  	add di, word [bp + ?eldheader]
  1368                                  	adc cx, word [bp + ?eldheader]
  1369                                   %endif
  1370                                  
  1371                                  .comp_in_uncomp_seek:
  1372 00000884 EB1B                    	jmp .seek_done
  1373                                  %endif
  1374                                  .uncomp_seek:
  1375 00000886 8B56FA                  	mov dx, word [bp + ?liboffset]
  1376 00000889 8B4EFC                  	mov cx, word [bp + ?liboffset + 2]
  1377 0000088C 0356E6                  	add dx, word [bp + ?libentry]
  1378 0000088F 134EE8                  	adc cx, word [bp + ?libentry + 2]
  1379 00000892 B80042                  	mov ax, 4200h
  1380 00000895 E85504                  	call seek_compressed_or_dos_or_boot_io
  1381 00000898 7303E97F00              	jc .io_error
  1382                                  %if _COMPRESSED
  1383 0000089D 31C9                    	xor cx, cx
  1384 0000089F 31FF                    	xor di, di
  1385                                  
  1386                                  .seek_done:
  1387 000008A1 57                      	push di
  1388                                  %endif
  1389                                  
  1390 000008A2 8D7EF3                  	lea di, [bp + ?libentry + 12 + 1]
  1391 000008A5 8D56EA                  	lea dx, [bp + ?libentry + 4]
  1392                                  @@:
  1393 000008A8 4F                      	dec di
  1394 000008A9 39D7                    	cmp di, dx
  1395 000008AB 7606                    	jbe @F
  1396 000008AD 807DFF20                	cmp byte [di - 1], 32
  1397 000008B1 74F5                    	je @B
  1398                                  @@:
  1399 000008B3 C60500                  	mov byte [di], 0
  1400                                  
  1401 000008B6 B020                    	mov al, 32
  1402 000008B8 E88D09                  	extcallcall putc
  1403                                  
  1404                                  %if _COMPRESSED
  1405 000008BB 5F                      	pop di
  1406                                  
  1407 000008BC 58                      	pop ax
  1408 000008BD 50                      	push ax
  1409                                  
  1410 000008BE FF36[BA06]              reloc	push word [libseek + 2]
  1411                                  internaldatarelocation
  1412 000008C2 FF36[B806]              reloc	push word [libseek]
  1413                                  internaldatarelocation
  1414                                  
  1415                                  %if 0
  1416                                  	test ah, ah		; already was compressed ?
  1417                                  	jnz @F			; yes, leave libseek as is -->
  1418                                  %endif
  1419 000008C6 FF76FC                  	push word [bp + ?liboffset + 2]
  1420 000008C9 8F06[BA06]              reloc	pop word [libseek + 2]
  1421                                  internaldatarelocation
  1422 000008CD FF76FA                  	push word [bp + ?liboffset]
  1423 000008D0 8F06[B806]              reloc	pop word [libseek]
  1424                                  internaldatarelocation
  1425                                  @@:
  1426                                  
  1427 000008D4 3C01                    	cmp al, 1		; CY if uncompressed
  1428                                  %endif
  1429 000008D6 8B46E0                  	mov ax, word [bp + ?handle]
  1430 000008D9 B301                    	mov bl, 1
  1431 000008DB E836FB                  	call commonhandle.lib
  1432 000008DE 8B5EE0                  	mov bx, word [bp + ?handle]
  1433                                  
  1434                                  %if _COMPRESSED
  1435 000008E1 B80142                  	mov ax, 4201h
  1436 000008E4 31C9                    	xor cx, cx
  1437 000008E6 31D2                    	xor dx, dx
  1438 000008E8 E83904                  	call dos_or_boot_io
  1439                                  
  1440 000008EB 8F06[B806]              reloc	pop word [libseek]
  1441                                  internaldatarelocation
  1442 000008EF 8F06[BA06]              reloc	pop word [libseek + 2]
  1443                                  internaldatarelocation
  1444                                  
  1445 000008F3 52                      	push dx
  1446 000008F4 50                      	push ax
  1447                                  %endif
  1448                                  
  1449                                  .libskip:
  1450 000008F5 8B56F6                  	mov dx, word [bp + ?libnext]
  1451 000008F8 8B4EF8                  	mov cx, word [bp + ?libnext + 2]
  1452 000008FB B80042                  	mov ax, 4200h
  1453 000008FE E8EC03                  	call seek_compressed_or_dos_or_boot_io
  1454 00000901 7219                    	jc .io_error
  1455 00000903 FF4EF4                  	dec word [bp + ?libamount]
  1456 00000906 7403E912FF              	jnz .looplib
  1457 0000090B EB64                    	jmp .lib_done
  1458                                  
  1459                                  .nodesc:
  1460 0000090D BA[3500]                reloc	mov dx, msg.nodesc
  1461                                  internaldatarelocation
  1462 00000910 E960FC                  	jmp .putsz_desc_done
  1463                                  
  1464                                  .nohelp:
  1465 00000913 BA[4700]                reloc	mov dx, msg.nohelp
  1466                                  internaldatarelocation
  1467 00000916 E8C708                  	extcallcall putsz
  1468 00000919 E9D0FD                  	jmp .help_done
  1469                                  
  1470                                  .io_error:
  1471 0000091C B8490E                  	mov ax, 0E49h
  1472 0000091F E8B608                  	extcallcall setrc
  1473 00000922 BA[6400]                reloc	mov dx, msg.io_error
  1474                                  internaldatarelocation
  1475 00000925 EB47                    	jmp .error
  1476                                  
  1477                                  %if _COMPRESSED
  1478                                  .doublepacked:
  1479 00000927 B84A0E                  	mov ax, 0E4Ah
  1480 0000092A E8AB08                  	extcallcall setrc
  1481 0000092D BA[7E00]                reloc	mov dx, msg.doublepacked_error
  1482                                  internaldatarelocation
  1483 00000930 EB3C                    	jmp .error
  1484                                  %endif
  1485                                  
  1486                                  .invalid_instance:
  1487 00000932 BE[BD00]                reloc	mov si, msg.invalid_instance
  1488                                  internaldatarelocation
  1489 00000935 E81809                  	extcallcall copy_single_counted_string
  1490                                  
  1491 00000938 83C408                  	add sp, 8
  1492 0000093B E9A4FC                  	jmp .after_invalid_instance
  1493                                  
  1494                                  .invalid_check_sld:
  1495 0000093E F646E401                	test byte [bp + ?not_sld_bit_0], 1
  1496 00000942 7521                    	jnz .invalid			; in a lib -->
  1497 00000944 83F806                  	cmp ax, 6			; "@;SLD0"
  1498 00000947 7217                    	jb @F
  1499 00000949 817EBC403B              	cmp word [bp + ?header], "@;"
  1500 0000094E 7510                    	jne @F
  1501 00000950 817EBE534C              	cmp word [bp + ?header + 2], "SL"
  1502 00000955 7509                    	jne @F
  1503 00000957 817EC04430              	cmp word [bp + ?header + 4], "D0"
  1504 0000095C 7502                    	jne @F
  1505 0000095E EB15                    	jmp .sld
  1506                                  
  1507                                  @@:
  1508 00000960 BA[0601]                reloc	mov dx, msg.invalid_sld
  1509                                  internaldatarelocation
  1510 00000963 EB09                    	jmp .error
  1511                                  
  1512                                  .invalid:
  1513 00000965 B84B0E                  	mov ax, 0E4Bh
  1514 00000968 E86D08                  	extcallcall setrc
  1515 0000096B BA[D900]                reloc	mov dx, msg.invalid
  1516                                  internaldatarelocation
  1517                                  .error:
  1518                                  .putsz_ret:
  1519 0000096E E86F08                  	extcallcall putsz
  1520                                  .ret:
  1521                                  .lib_done:
  1522                                  .nolib:
  1523 00000971 89EC5D                  	lleave code, forcerestoresp
  1524 00000974 C3                      	retn
  1525                                  
  1526                                  
  1527                                  .sld:
  1528                                  %if 0
  1529                                  	mov cx, word [bp + ?eldheader + 2]
  1530                                  	mov dx, word [bp + ?eldheader]
  1531                                  	add dx, 6
  1532                                  	adc cx, 0
  1533                                  %else
  1534 00000975 31C9                    	xor cx, cx
  1535 00000977 BA0600                  	mov dx, 6
  1536                                  %endif
  1537 0000097A B80042                  	mov ax, 4200h
  1538                                  	; call seek_compressed_or_dos_or_boot_io
  1539 0000097D E8A403                  	call dos_or_boot_io
  1540 00000980 729A                    	jc .io_error
  1541                                  
  1542 00000982 B9[B709]                reloc	mov cx, .check_d
  1543                                  internalcoderelocation
  1544                                  
  1545                                  .sldreload:
  1546 00000985 BA[0000]                reloc	mov dx, relocateddata
  1547                                  linkdatarelocation line_out
  1548 00000988 8956EA                  	mov word [bp + ?next], dx	; reset ?next
  1549 0000098B 51                      	push cx				; ! preserve state
  1550 0000098C B90001                  	mov cx, 256
  1551 0000098F B43F                    	mov ah, 3Fh
  1552 00000991 E89003                  	call dos_or_boot_io		; fill buffer
  1553 00000994 59                      	pop cx				; ! preserve state
  1554 00000995 7285                    	jc .io_error
  1555 00000997 85C0                    	test ax, ax			; no more data ?
  1556 00000999 7413                    	jz .sld_no_desc			; yes -->
  1557 0000099B 01D0                    	add ax, dx
  1558 0000099D 8946E8                  	mov word [bp + ?tail], ax	; set ?tail
  1559                                  
  1560                                  .sldloop:
  1561 000009A0 8B76EA                  	mov si, word [bp + ?next]	; -> next data
  1562 000009A3 3B76E8                  	cmp si, word [bp + ?tail]	; have one more byte ?
  1563 000009A6 74DD                    	je .sldreload			; no -->
  1564                                  
  1565 000009A8 AC                      	lodsb				; get the byte
  1566 000009A9 8976EA                  	mov word [bp + ?next], si	; update ?next
  1567 000009AC FFE1                    	jmp cx				; jump to state
  1568                                  
  1569                                  .sldnext: equ .sldloop			; get next byte -->
  1570                                  
  1571                                  .sld_no_desc:
  1572 000009AE BA[3500]                reloc	mov dx, msg.nodesc
  1573                                  internaldatarelocation
  1574 000009B1 E82C08                  	extcallcall putsz
  1575 000009B4 E9C800                  	jmp .sld_desc_done
  1576                                  
  1577                                  .check_d:				; D may be prepended by blanks,
  1578                                  					;  commas, or semicolons
  1579                                  				; state unchanged
  1580 000009B7 3C2C                    	cmp al, ','			; skip any commas
  1581 000009B9 74E5                    	je .sldnext
  1582 000009BB 3C3B                    	cmp al, ';'			; or semicolons
  1583 000009BD 74E1                    	je .sldnext
  1584 000009BF 3C20                    	cmp al, 32
  1585 000009C1 74DD                    	je .sldnext
  1586 000009C3 3C09                    	cmp al, 9			; or blanks
  1587 000009C5 74D9                    	je .sldnext
  1588 000009C7 E87608                  	extcallcall uppercase
  1589 000009CA B9[FB09]                reloc	mov cx, .check_e 	; change state if D found
  1590                                  internalcoderelocation
  1591 000009CD 3C44                    	cmp al, 'D'			; is it a D ?
  1592                                  .sldnext_ZR_else_skip_to_eol:
  1593 000009CF 74CF                    	je .sldnext			; yes -->
  1594                                  				; skip to next line
  1595                                  .skip_to_eol:
  1596 000009D1 B9[E509]                reloc	mov cx, .check_at	; change state if EOL found
  1597                                  internalcoderelocation
  1598 000009D4 3C0D                    	cmp al, 13			; EOL ?
  1599 000009D6 74C8                    	je .sldnext
  1600 000009D8 3C0A                    	cmp al, 10
  1601 000009DA 74C4                    	je .sldnext
  1602 000009DC 3C00                    	cmp al, 0
  1603 000009DE 74C0                    	je .sldnext			; yes -->
  1604 000009E0 B9[D109]                reloc	mov cx, .skip_to_eol		; loop back to this state
  1605                                  internalcoderelocation
  1606 000009E3 EBBB                    	jmp .sldnext
  1607                                  
  1608                                  .check_at:				; @ must be in first column
  1609 000009E5 B9[EC09]                reloc	mov cx, .check_semicolon
  1610                                  internalcoderelocation
  1611 000009E8 3C40                    	cmp al, '@'
  1612 000009EA EBE3                    	jmp .sldnext_ZR_else_skip_to_eol
  1613                                  
  1614                                  .check_semicolon:			; semicolon may be prepended by blanks
  1615 000009EC 3C20                    	cmp al, 32
  1616 000009EE 74B0                    	je .sldnext
  1617 000009F0 3C09                    	cmp al, 9
  1618                                  .sldnext_ZR_j1:
  1619 000009F2 74AC                    	je .sldnext
  1620 000009F4 B9[B709]                reloc	mov cx, .check_d
  1621                                  internalcoderelocation
  1622 000009F7 3C3B                    	cmp al, ';'
  1623 000009F9 EBD4                    	jmp .sldnext_ZR_else_skip_to_eol
  1624                                  
  1625                                  .check_e:				; E must be immediately after D
  1626 000009FB E84208                  	extcallcall uppercase
  1627 000009FE B9[050A]                reloc	mov cx, .check_s
  1628                                  internalcoderelocation
  1629 00000A01 3C45                    	cmp al, 'E'
  1630 00000A03 EBCA                    	jmp .sldnext_ZR_else_skip_to_eol
  1631                                  
  1632                                  .check_s:				; S must be immediately after E
  1633 00000A05 E83808                  	extcallcall uppercase
  1634 00000A08 B9[0F0A]                reloc	mov cx, .check_c
  1635                                  internalcoderelocation
  1636 00000A0B 3C53                    	cmp al, 'S'
  1637 00000A0D EBC0                    	jmp .sldnext_ZR_else_skip_to_eol
  1638                                  
  1639                                  .check_c:				; C must be immediately after S
  1640 00000A0F E82E08                  	extcallcall uppercase
  1641 00000A12 B9[190A]                reloc	mov cx, .check_equals_sign
  1642                                  internalcoderelocation
  1643 00000A15 3C43                    	cmp al, 'C'
  1644 00000A17 EBB6                    	jmp .sldnext_ZR_else_skip_to_eol
  1645                                  
  1646                                  .check_equals_sign:			; = or : may be prepended by blanks
  1647 00000A19 3C20                    	cmp al, 32
  1648 00000A1B 74D5                    	je .sldnext_ZR_j1
  1649 00000A1D 3C09                    	cmp al, 9
  1650 00000A1F 74D1                    	je .sldnext_ZR_j1
  1651 00000A21 B9[2C0A]                reloc	mov cx, .skip_blanks
  1652                                  internalcoderelocation
  1653 00000A24 3C3D                    	cmp al, '='
  1654 00000A26 74CA                    	je .sldnext_ZR_j1
  1655 00000A28 3C3A                    	cmp al, ':'
  1656 00000A2A EBA3                    	jmp .sldnext_ZR_else_skip_to_eol
  1657                                  
  1658                                  .skip_blanks:				; description may be prepended by blanks
  1659 00000A2C 3C20                    	cmp al, 32
  1660 00000A2E 74C2                    	je .sldnext_ZR_j1
  1661 00000A30 3C09                    	cmp al, 9
  1662 00000A32 74BE                    	je .sldnext_ZR_j1
  1663                                  
  1664 00000A34 BF[0000]                reloc	mov di, relocateddata
  1665                                  linkdatarelocation line_out		; -> start of buffer
  1666 00000A37 8B76EA                  	mov si, word [bp + ?next]
  1667 00000A3A 4E                      	dec si				; -> first nonblank (at least 1 byte)
  1668 00000A3B 8B4EE8                  	mov cx, word [bp + ?tail]	; -> after last buffered byte
  1669 00000A3E 29F1                    	sub cx, si			; = length of buffered data
  1670 00000A40 F3A4                    	rep movsb			; move down in buffer
  1671 00000A42 89FA                    	mov dx, di			; -> after buffered data
  1672 00000A44 B9[7F00]                reloc	mov cx, relocateddata + 127
  1673                                  linkdatarelocation line_out		; -> after last byte we want to read
  1674 00000A47 89CF                    	mov di, cx			; -> where to place terminator
  1675 00000A49 29D1                    	sub cx, dx			; = length to read after buffered data
  1676 00000A4B 760E                    	jbe @F				; if below-or-equal zero, none to read -->
  1677 00000A4D B43F                    	mov ah, 3Fh
  1678 00000A4F E8D202                  	call dos_or_boot_io		; read it
  1679 00000A52 7303E9C5FE              	jc .io_error			; on error -->
  1680                                  					; (valid to read 0 up to 126 Bytes)
  1681 00000A57 89C7                    	mov di, ax
  1682 00000A59 01D7                    	add di, dx			; -> after last read byte
  1683                                  @@:
  1684 00000A5B C60500                  	mov byte [di], 0		; store a terminator
  1685                                  
  1686 00000A5E BA[0000]                reloc	mov dx, relocateddata
  1687                                  linkdatarelocation line_out		; -> message data
  1688 00000A61 89D6                    	mov si, dx			; -> text to scan
  1689                                  @@:
  1690 00000A63 AC                      	lodsb				; get a text byte
  1691 00000A64 3C00                    	cmp al, 0			; EOL ?
  1692 00000A66 7408                    	je @F
  1693 00000A68 3C0D                    	cmp al, 13
  1694 00000A6A 7404                    	je @F
  1695 00000A6C 3C0A                    	cmp al, 10
  1696 00000A6E 75F3                    	jne @B				; not yet -->
  1697                                  @@:
  1698 00000A70 46                      	inc si				; (si - 2) -> behind message data
  1699 00000A71 C744FE0D0A              	mov word [si - 2], 13 | (10 << 8)
  1700                                  					; append a linebreak
  1701 00000A76 89F1                    	mov cx, si
  1702 00000A78 29D1                    	sub cx, dx			; cx = message data length including CR LF
  1703 00000A7A 53                      	push bx
  1704 00000A7B E8FA07                  	extcallcall puts		; display message
  1705 00000A7E 5B                      	pop bx
  1706                                  
  1707                                  .sld_desc_done:
  1708 00000A7F D006[0600]              reloc	rol byte [verbose], 1
  1709                                  internaldatarelocation
  1710 00000A83 7341                    	jnc .sld_verbose_done
  1711 00000A85 BF[0000]                reloc	mov di, relocateddata
  1712                                  linkdatarelocation line_out
  1713 00000A88 BE[3A01]                reloc	mov si, msg.verbose.1
  1714                                  internaldatarelocation
  1715 00000A8B E8C207                  	extcallcall copy_single_counted_string
  1716                                  
  1717 00000A8E 8D76BE                  	lea si, [bp + ?header + 2]
  1718 00000A91 A5                      	movsw
  1719 00000A92 A5                      	movsw
  1720                                  
  1721 00000A93 BE[7501]                reloc	mov si, msg.verbose.2.sld
  1722                                  internaldatarelocation
  1723 00000A96 E8B707                  	extcallcall copy_single_counted_string
  1724                                  
  1725 00000A99 31D2                    	xor dx, dx
  1726 00000A9B 31C9                    	xor cx, cx
  1727 00000A9D B80242                  	mov ax, 4202h
  1728                                  %if 0
  1729                                  	call dos_or_boot_io
  1730                                  	jc .io_error
  1731                                  %else
  1732                                   %if _BOOTLDR
  1733 00000AA0 F606[0100]40            reloc	testopt [relocateddata], nodosloaded
  1734                                  linkdatarelocation internalflags, -3
  1735 00000AA5 7409                    	jz @F
  1736 00000AA7 A1[F4FF]                reloc	mov ax, word [relocateddata - LOADDATA2 + ldFileSize]
  1737                                  linkdatarelocation load_data
  1738 00000AAA 8B16[F6FF]              reloc	mov dx, word [relocateddata - LOADDATA2 + ldFileSize + 2]
  1739                                  linkdatarelocation load_data
  1740 00000AAE EB08                    	jmp @FF
  1741                                  @@:
  1742                                   %endif
  1743 00000AB0 E87802                  	call dos_or_boot_io.dos
  1744 00000AB3 7303E964FE              	jc .io_error
  1745                                  @@:
  1746                                  %endif
  1747 00000AB8 E8B507                  	extcallcall decdword
  1748                                  
  1749 00000ABB BE[8301]                reloc	mov si, msg.verbose.3.sld
  1750                                  internaldatarelocation
  1751 00000ABE E88F07                  	extcallcall copy_single_counted_string
  1752                                  
  1753 00000AC1 53                      	push bx
  1754 00000AC2 E89307                  	extcallcall putsline_crlf
  1755 00000AC5 5B                      	pop bx
  1756                                  
  1757                                  .sld_verbose_done:
  1758                                  sld_help:
  1759 00000AC6 D006[0700]              reloc	rol byte [do_help], 1
  1760                                  internaldatarelocation
  1761 00000ACA 734C                    	jnc .done
  1762                                  
  1763 00000ACC 31D2                    	xor dx, dx
  1764 00000ACE 31C9                    	xor cx, cx
  1765 00000AD0 894EEC                  	mov word [bp + ?helpstarted], cx
  1766 00000AD3 B80042                  	mov ax, 4200h
  1767 00000AD6 E84B02                  	call dos_or_boot_io
  1768 00000AD9 7303E93EFE              	jc commonhandle.io_error
  1769                                  
  1770 00000ADE B9[1B0B]                reloc	mov cx, .check_at_or_semicolon
  1771                                  internalcoderelocation
  1772                                  
  1773                                  .reload:
  1774 00000AE1 BA[0000]                reloc	mov dx, relocateddata
  1775                                  linkdatarelocation line_out
  1776 00000AE4 8956EA                  	mov word [bp + ?next], dx	; reset ?next
  1777 00000AE7 51                      	push cx				; ! preserve state
  1778 00000AE8 B90001                  	mov cx, 256
  1779 00000AEB B43F                    	mov ah, 3Fh
  1780 00000AED E83402                  	call dos_or_boot_io		; fill buffer
  1781 00000AF0 59                      	pop cx				; ! preserve state
  1782 00000AF1 7303E926FE              	jc commonhandle.io_error
  1783 00000AF6 85C0                    	test ax, ax			; no more data ?
  1784 00000AF8 7413                    	jz .eof				; yes -->
  1785 00000AFA 01D0                    	add ax, dx
  1786 00000AFC 8946E8                  	mov word [bp + ?tail], ax	; set ?tail
  1787                                  
  1788                                  .loop:
  1789 00000AFF 8B76EA                  	mov si, word [bp + ?next]	; -> next data
  1790 00000B02 3B76E8                  	cmp si, word [bp + ?tail]	; have one more byte ?
  1791 00000B05 74DA                    	je .reload			; no -->
  1792                                  
  1793 00000B07 AC                      	lodsb				; get the byte
  1794 00000B08 8976EA                  	mov word [bp + ?next], si	; update ?next
  1795 00000B0B FFE1                    	jmp cx				; jump to state
  1796                                  
  1797                                  .next: equ .loop			; get next byte -->
  1798                                  
  1799                                  .eof:
  1800 00000B0D D046EC                  	rol byte [bp + ?helpstarted], 1
  1801 00000B10 7206                    	jc .done
  1802                                  
  1803                                  .no_help:
  1804 00000B12 BA[4700]                reloc	mov dx, msg.nohelp
  1805                                  internaldatarelocation
  1806 00000B15 E8C806                  	extcallcall putsz
  1807                                  .done:
  1808 00000B18 E956FE                  	jmp commonhandle.ret
  1809                                  
  1810                                  .check_at_or_semicolon:
  1811 00000B1B B9[220B]                reloc	mov cx, .check_semicolon
  1812                                  internalcoderelocation
  1813 00000B1E 3C40                    	cmp al, '@'			; is it an @ ?
  1814 00000B20 74DD                    	je .next
  1815                                  .check_semicolon:
  1816 00000B22 3C20                    	cmp al, 32			; blanks
  1817 00000B24 74D9                    	je .next
  1818 00000B26 3C09                    	cmp al, 9			; or tabs
  1819 00000B28 74D5                    	je .next
  1820 00000B2A B9[450B]                reloc	mov cx, .check_h
  1821                                  internalcoderelocation
  1822 00000B2D 3C3B                    	cmp al, ';'			; semicolon ?
  1823                                  .next_ZR_else_skip_to_eol:
  1824 00000B2F 74CE                    	je .next			; yes -->
  1825                                  				; skip to next line
  1826                                  .skip_to_eol:
  1827 00000B31 B9[1B0B]                reloc	mov cx, .check_at_or_semicolon	; change state if EOL found
  1828                                  internalcoderelocation
  1829 00000B34 3C0D                    	cmp al, 13			; EOL ?
  1830 00000B36 74C7                    	je .next
  1831 00000B38 3C0A                    	cmp al, 10
  1832 00000B3A 74C3                    	je .next
  1833 00000B3C 3C00                    	cmp al, 0
  1834 00000B3E 74BF                    	je .next			; yes -->
  1835                                  .next_skip_to_eol:
  1836 00000B40 B9[310B]                reloc	mov cx, .skip_to_eol		; loop back to this state
  1837                                  internalcoderelocation
  1838 00000B43 EBBA                    	jmp .next
  1839                                  
  1840                                  .check_h:
  1841 00000B45 3C20                    	cmp al, 32			; blanks
  1842 00000B47 74B6                    	je .next
  1843 00000B49 3C09                    	cmp al, 9			; or tabs
  1844 00000B4B 74B2                    	je .next
  1845 00000B4D E8F006                  	extcallcall uppercase
  1846 00000B50 3C48                    	cmp al, 'H'
  1847 00000B52 75DD                    	jne .skip_to_eol
  1848 00000B54 E81701                  	call .fill
  1849 00000B57 81FA[0A00]              reloc	cmp dx, relocateddata + msg.helpstart.length + 1
  1850                                  linkdatarelocation line_out
  1851 00000B5B 72B5                    	jb .no_help
  1852 00000B5D A0[0900]                reloc	mov al, byte [relocateddata + msg.helpstart.length]
  1853                                  linkdatarelocation line_out
  1854 00000B60 3C20                    	cmp al, 32			; blank ?
  1855 00000B62 7415                    	je @F
  1856 00000B64 3C09                    	cmp al, 9
  1857 00000B66 7411                    	je @F
  1858 00000B68 3C0D                    	cmp al, 13			; CR ?
  1859 00000B6A 740D                    	je @F
  1860 00000B6C 3C00                    	cmp al, 0			; NUL ?
  1861 00000B6E 7409                    	je @F
  1862 00000B70 3C0A                    	cmp al, 10			; LF ?
  1863                                  .next_skip_to_eol_NZ:
  1864 00000B72 75CC                    	jne .next_skip_to_eol
  1865 00000B74 C606[0900]0D            reloc	mov byte [relocateddata + msg.helpstart.length], 13
  1866                                  linkdatarelocation line_out, -3		; insert CR for isstring?
  1867                                  		; Modifying the buffered data!
  1868                                  @@:
  1869 00000B79 BE[0000]                reloc	mov si, relocateddata
  1870                                  linkdatarelocation line_out
  1871 00000B7C BA[5200]                reloc	mov dx, msg.helpstart
  1872                                  internaldatarelocation
  1873 00000B7F E8B606                  	extcallcall isstring?
  1874 00000B82 75EE                    	jne .next_skip_to_eol_NZ
  1875                                  
  1876 00000B84 8976EA                  	mov word [bp + ?next], si
  1877 00000B87 B9[8D0B]                reloc	mov cx, .check_eol
  1878                                  internalcoderelocation
  1879                                  .next_j:
  1880 00000B8A E972FF                  	jmp .next
  1881                                  
  1882                                  .check_eol:
  1883 00000B8D 3C20                    	cmp al, 32
  1884 00000B8F 74F9                    	je .next_j
  1885 00000B91 3C09                    	cmp al, 9
  1886 00000B93 74F5                    	je .next_j
  1887 00000B95 3C0D                    	cmp al, 13
  1888 00000B97 7408                    	je @F
  1889 00000B99 3C0A                    	cmp al, 10
  1890 00000B9B 7404                    	je @F
  1891 00000B9D 3C00                    	cmp al, 0
  1892 00000B9F 75D1                    	jne .next_skip_to_eol_NZ
  1893                                  @@:
  1894 00000BA1 B9[A90B]                reloc	mov cx, .check_help_at_or_semicolon
  1895                                  internalcoderelocation
  1896 00000BA4 F656EC                  	not byte [bp + ?helpstarted]
  1897                                  .next_j2:
  1898 00000BA7 EBE1                    	jmp .next_j
  1899                                  
  1900                                  .check_help_at_or_semicolon:
  1901 00000BA9 B9[B00B]                reloc	mov cx, .check_help_semicolon
  1902                                  internalcoderelocation
  1903 00000BAC 3C40                    	cmp al, '@'			; is it an @ ?
  1904 00000BAE 74F7                    	je .next_j2
  1905                                  .check_help_semicolon:
  1906 00000BB0 3C20                    	cmp al, 32			; blanks
  1907 00000BB2 74F3                    	je .next_j2
  1908 00000BB4 3C09                    	cmp al, 9			; or tabs
  1909 00000BB6 74EF                    	je .next_j2
  1910 00000BB8 B9[D30B]                reloc	mov cx, .display_help
  1911                                  internalcoderelocation
  1912 00000BBB 3C3B                    	cmp al, ';'			; semicolon ?
  1913                                  ;.next_ZR_else_skip_to_eol:
  1914 00000BBD 74E8                    	je .next_j2			; yes -->
  1915                                  				; skip to next line
  1916                                  .help_skip_to_eol:
  1917 00000BBF B9[A90B]                reloc	mov cx, .check_help_at_or_semicolon
  1918                                  internalcoderelocation			; change state if EOL found
  1919 00000BC2 3C0D                    	cmp al, 13			; EOL ?
  1920 00000BC4 74E1                    	je .next_j2
  1921 00000BC6 3C0A                    	cmp al, 10
  1922 00000BC8 74DD                    	je .next_j2
  1923 00000BCA 3C00                    	cmp al, 0
  1924 00000BCC 74D9                    	je .next_j2			; yes -->
  1925                                  .next_help_skip_to_eol:
  1926 00000BCE B9[BF0B]                reloc	mov cx, .help_skip_to_eol	; loop back to this state
  1927                                  internalcoderelocation
  1928 00000BD1 EBD4                    	jmp .next_j2
  1929                                  
  1930                                  .display_help:
  1931 00000BD3 E89800                  	call .fill
  1932 00000BD6 FF4EEA                  	dec word [bp + ?next]
  1933 00000BD9 BE[0000]                reloc	mov si, relocateddata
  1934                                  linkdatarelocation line_out		; -> buffer
  1935                                  @@:
  1936 00000BDC 39D6                    	cmp si, dx
  1937 00000BDE 7365                    	jae .do_display_help
  1938 00000BE0 AC                      	lodsb
  1939 00000BE1 3C20                    	cmp al, 32
  1940 00000BE3 74F7                    	je @B
  1941 00000BE5 3C09                    	cmp al, 9
  1942 00000BE7 74F3                    	je @B
  1943 00000BE9 E85406                  	extcallcall uppercase
  1944 00000BEC 3C48                    	cmp al, 'H'
  1945 00000BEE 7555                    	jne .do_display_help
  1946                                  
  1947 00000BF0 4E                      	dec si				; -> at the H
  1948 00000BF1 8D7C07                  	lea di, [si + msg.helpend.length]
  1949                                  					; -> at candidate separator
  1950 00000BF4 39FA                    	cmp dx, di			; string is in buffer ?
  1951 00000BF6 724D                    	jb .do_display_help		; no -->
  1952 00000BF8 7703                    	ja .havesep			; yes, separator too -->
  1953 00000BFA C60500                  	mov byte [di], 0		; store a separator here
  1954                                  					;  (can overflow line_out+256)
  1955                                  .havesep:
  1956 00000BFD 8A05                    	mov al, byte [di]		; get separator
  1957 00000BFF 3C20                    	cmp al, 32			; one of the valid separators ?
  1958 00000C01 7413                    	je @F
  1959 00000C03 3C09                    	cmp al, 9
  1960 00000C05 740F                    	je @F
  1961 00000C07 3C0D                    	cmp al, 13
  1962 00000C09 740B                    	je @F
  1963 00000C0B 3C00                    	cmp al, 0
  1964 00000C0D 7407                    	je @F
  1965 00000C0F 3C0A                    	cmp al, 10			; LF ?
  1966 00000C11 7532                    	jne .do_display_help		; no -->
  1967 00000C13 C6050D                  	mov byte [di], 13		; insert CR for isstring?
  1968                                  		; Modifying the buffered data!
  1969                                  @@:
  1970 00000C16 52                      	push dx
  1971 00000C17 BA[5C00]                reloc	mov dx, msg.helpend
  1972                                  internaldatarelocation
  1973 00000C1A E81B06                  	extcallcall isstring?		; is it "helpend" ?
  1974 00000C1D 5A                      	pop dx
  1975 00000C1E 7525                    	jne .do_display_help		; no -->
  1976                                  @@:
  1977 00000C20 39D6                    	cmp si, dx			; reached EOL ?
  1978 00000C22 7203E9F1FE              	jae .done			; then it was helpend
  1979 00000C27 AC                      	lodsb
  1980 00000C28 3C20                    	cmp al, 32			; blank ?
  1981 00000C2A 74F4                    	je @B
  1982 00000C2C 3C09                    	cmp al, 9
  1983 00000C2E 74F0                    	je @B				; yes, loop here -->
  1984 00000C30 3C0D                    	cmp al, 13			; linebreak ?
  1985 00000C32 7503E9E1FE              	je .done
  1986 00000C37 3C0A                    	cmp al, 10
  1987 00000C39 7503E9DAFE              	je .done
  1988 00000C3E 3C00                    	cmp al, 0
  1989 00000C40 7503E9D3FE              	je .done			; yes, it was helpend -->
  1990                                  
  1991                                  		; Not "helpend". Display this line.
  1992                                  .do_display_help:
  1993 00000C45 BE[0000]                reloc	mov si, relocateddata
  1994                                  linkdatarelocation line_out		; -> buffer
  1995 00000C48 56                      	push si				; -> buffer
  1996                                  @@:
  1997 00000C49 39D6                    	cmp si, dx			; reached end ?
  1998 00000C4B 730E                    	jae .si				; yes, si -> end
  1999 00000C4D AC                      	lodsb				; get next byte
  2000 00000C4E 3C0D                    	cmp al, 13			; linebreak ?
  2001 00000C50 7408                    	je .si_minus_1
  2002 00000C52 3C0A                    	cmp al, 10
  2003 00000C54 7404                    	je .si_minus_1
  2004 00000C56 3C00                    	cmp al, 0
  2005 00000C58 75EF                    	jne @B				; no, loop -->
  2006                                  .si_minus_1:
  2007 00000C5A 4E                      	dec si				; -> end of text
  2008                                  .si:
  2009 00000C5B 89F1                    	mov cx, si			; -> end of text
  2010 00000C5D 5A                      	pop dx
  2011 00000C5E 29D1                    	sub cx, dx			; = length
  2012 00000C60 53                      	push bx
  2013 00000C61 E81406                  	extcallcall puts
  2014 00000C64 5B                      	pop bx
  2015 00000C65 BA[0301]                reloc	mov dx, msg.linebreak		; display a linebreak
  2016                                  internaldatarelocation
  2017 00000C68 E87505                  	extcallcall putsz
  2018 00000C6B E960FF                  	jmp .next_help_skip_to_eol	; skip to next line
  2019                                  
  2020                                  
  2021                                  		; INP:	?next, ?tail
  2022                                  		;	?next - 1 -> buffered data, at least 1 byte
  2023                                  		; OUT:	line_out -> buffered data, at least 1 byte
  2024                                  		;	?next = line_out + 1
  2025                                  		;	dx = ?tail -> behind buffered data
  2026                                  		;	 (up to EOF or == line_out + 256)
  2027                                  		;	branches to commonhandle.io_error on I/O error
  2028                                  		; CHG:	di, si, ax, cx
  2029                                  .fill:
  2030 00000C6E BF[0000]                reloc	mov di, relocateddata
  2031                                  linkdatarelocation line_out		; -> buffer
  2032 00000C71 8B76EA                  	mov si, word [bp + ?next]
  2033 00000C74 4E                      	dec si				; -> H in buffer
  2034 00000C75 8B4EE8                  	mov cx, word [bp + ?tail]	; -> behind last buffered text
  2035 00000C78 29F1                    	sub cx, si			; length of buffered data
  2036 00000C7A 8D5501                  	lea dx, [di + 1]		; -> behind the H's destination
  2037 00000C7D F3A4                    	rep movsb			; move down buffered data
  2038 00000C7F 8956EA                  	mov word [bp + ?next], dx	; -> behind the H
  2039                                  	; mov word [bp + ?tail], di
  2040 00000C82 89FA                    	mov dx, di
  2041 00000C84 B9[0001]                reloc	mov cx, relocateddata + 256
  2042                                  linkdatarelocation line_out
  2043 00000C87 29D1                    	sub cx, dx
  2044 00000C89 7434                    	jz @F
  2045 00000C8B B43F                    	mov ah, 3Fh
  2046 00000C8D E89400                  	call dos_or_boot_io		; fill buffer
  2047 00000C90 7303E987FC              	jc commonhandle.io_error
  2048 00000C95 01C2                    	add dx, ax
  2049 00000C97 8956E8                  	mov word [bp + ?tail], dx
  2050 00000C9A C3                      	retn
  2051                                  
  2052                                  
  2053                                  inject:
  2054 00000C9B 8B16[4003]              reloc	mov dx, word [originaldta]	; dx -> original DTA
  2055                                  internaldatarelocation
  2056 00000C9F B41A                    	mov ah, 1Ah			; set DTA (restoring)
  2057 00000CA1 E86405                  	extcallcall ispm
  2058 00000CA4 7511                    	jnz .rm
  2059                                  
  2060                                  subcpu 286
  2061 00000CA6 FF36[4203]              reloc	push word [originaldta + 2]
  2062                                  internaldatarelocation			; ds => original DTA (86M segment)
  2063 00000CAA 6A21                    	push word 21h
  2064 00000CAC E8[0000]EB020000        	extcall intcall_ext_return_es, PM required	; must NOT be extcallcall
  2065 00000CB3 5A                      	pop dx				; discard interrupt number
  2066 00000CB4 5A                      	pop dx				; discard es
  2067                                  subcpureset
  2068 00000CB5 EB08                    	jmp @F
  2069                                  .rm:
  2070 00000CB7 8E1E[4203]              reloc	mov ds, word [originaldta + 2]	; ds => original DTA
  2071                                  internaldatarelocation
  2072 00000CBB CD21                    	int 21h
  2073 00000CBD 16                      	 push ss
  2074 00000CBE 1F                      	 pop ds
  2075                                  @@:
  2076                                  
  2077 00000CBF 8B1E[4803]              reloc	mov bx, word [findhandle]	; bx = find handle, if any
  2078                                  internaldatarelocation
  2079 00000CC3 D006[0400]              reloc	rol byte [findhandle_set], 1	; find handle set ?
  2080                                  internaldatarelocation
  2081 00000CC7 730A                    	jnc @F				; no -->
  2082 00000CC9 F616[0400]              reloc	not byte [findhandle_set]
  2083                                  internaldatarelocation
  2084 00000CCD B8A171                  	mov ax, 71A1h
  2085 00000CD0 E83D05                  	extcallcall _doscall		; LFN find close
  2086                                  @@:
  2087                                  
  2088 00000CD3 8B0E[4403]              reloc	mov cx, word [originalinject]
  2089                                  internaldatarelocation
  2090 00000CD7 E89004                  	call get_es_ext
  2091 00000CDA 268026[1000]FE          reloc	clropt [es:code + eldiFlags], eldifResident
  2092                                  internalcoderelocation -3		; mark block as no longer resident
  2093 00000CE0 16                      	 push ss
  2094 00000CE1 07                      	 pop es
  2095 00000CE2 E302                    	jcxz @F
  2096 00000CE4 FFE1                    	jmp cx
  2097                                  
  2098                                  @@:
  2099 00000CE6 E8[0000]EB020000        	extcall cmd3_not_inject
  2100                                  
  2101                                  
  2102                                  %if _COMPRESSED
  2103                                  seek_compressed_or_dos_or_boot_io:
  2104 00000CED F646E201                	testopt [bp + ?uncompressed_bit_0], 1
  2105 00000CF1 7531                    	jnz dos_or_boot_io
  2106 00000CF3 80FC42                  	cmp ah, 42h
  2107 00000CF6 7529                    	jne @F
  2108 00000CF8 3C01                    	cmp al, 1
  2109 00000CFA 7725                    	ja @F
  2110 00000CFC 7208                    	jb .abs
  2111 00000CFE 0316[C006]              reloc	add dx, word [depackskip]
  2112                                  internaldatarelocation
  2113 00000D02 130E[C206]              reloc	adc cx, word [depackskip + 2]
  2114                                  internaldatarelocation
  2115                                  .abs:
  2116 00000D06 8916[C006]              reloc	mov word [depackskip], dx
  2117                                  internaldatarelocation
  2118 00000D0A 890E[C206]              reloc	mov word [depackskip + 2], cx
  2119                                  internaldatarelocation
  2120 00000D0E 89C8                    	mov ax, cx
  2121 00000D10 92                      	xchg ax, dx
  2122 00000D11 F8                      	clc
  2123 00000D12 C3                      	retn
  2124                                  
  2125                                  
  2126                                  read_compressed_or_dos_or_boot_io:
  2127 00000D13 F646E201                	testopt [bp + ?uncompressed_bit_0], 1
  2128 00000D17 750B                    	jnz dos_or_boot_io
  2129 00000D19 80FC3F                  	cmp ah, 3Fh
  2130 00000D1C 7503                    	jne @F
  2131 00000D1E E9A402                  	jmp read_and_depack
  2132                                  
  2133                                  @@:
  2134 00000D21 E85C05                  	extcallcall error
  2135                                  %else
  2136                                   seek_compressed_or_dos_or_boot_io equ dos_or_boot_io
  2137                                   read_compressed_or_dos_or_boot_io equ dos_or_boot_io
  2138                                  %endif
  2139                                  
  2140                                  	lleave ctx
  2141                                  
  2142                                  
  2143                                  dos_or_boot_io:
  2144                                  %if _BOOTLDR
  2145 00000D24 F606[0100]40            reloc	testopt [relocateddata], nodosloaded
  2146                                  linkdatarelocation internalflags, -3
  2147 00000D29 7508                    	jnz .boot
  2148                                  %endif
  2149                                  .dos:
  2150 00000D2B E8[0000]EB020000        	extcall _doscall
  2151 00000D32 C3                      	retn
  2152                                  
  2153                                  %if _BOOTLDR
  2154                                  .boot:
  2155 00000D33 80FC3F                  	cmp ah, 3Fh
  2156 00000D36 7508                    	jne @F
  2157 00000D38 E8[0000]EB020000        	extcall yy_boot_read.bx
  2158 00000D3F C3                      	retn
  2159                                  
  2160                                  @@:
  2161 00000D40 3D0042                  	cmp ax, 4200h
  2162 00000D43 7517                    	jne @F
  2163                                  .boot_seek_absolute:
  2164 00000D45 2B16[FCFF]              reloc	sub dx, word [relocateddata - LOADDATA2 + ldCurrentSeek]
  2165                                  linkdatarelocation load_data
  2166 00000D49 1B0E[FEFF]              reloc	sbb cx, word [relocateddata - LOADDATA2 + ldCurrentSeek + 2]
  2167                                  linkdatarelocation load_data
  2168                                  
  2169                                  .boot_seek_current:
  2170 00000D4D E8[0000]EB020000        	extcall yy_boot_seek_current.bx
  2171 00000D54 A1[FCFF]                reloc	mov ax, word [relocateddata - LOADDATA2 + ldCurrentSeek]
  2172                                  linkdatarelocation load_data
  2173 00000D57 8B16[FEFF]              reloc	mov dx, word [relocateddata - LOADDATA2 + ldCurrentSeek + 2]
  2174                                  linkdatarelocation load_data
  2175 00000D5B C3                      	retn
  2176                                  
  2177                                  @@:
  2178 00000D5C 3D0142                  	cmp ax, 4201h
  2179 00000D5F 74EC                    	je .boot_seek_current
  2180                                   %if _ELDTRAILER
  2181 00000D61 3D0242                  	cmp ax, 4202h
  2182 00000D64 750A                    	jne @F
  2183                                  .boot_seek_eof:
  2184 00000D66 0316[F4FF]              reloc	add dx, word [relocateddata - LOADDATA2 + ldFileSize]
  2185                                  linkdatarelocation load_data
  2186 00000D6A 130E[F6FF]              reloc	adc cx, word [relocateddata - LOADDATA2 + ldFileSize + 2]
  2187                                  linkdatarelocation load_data
  2188 00000D6E EBD5                    	jmp .boot_seek_absolute
  2189                                   %endif
  2190                                  @@:
  2191 00000D70 E80D05                  	extcallcall error
  2192                                  %endif
  2193                                  
  2194                                  
  2195                                  %if _COMPRESSED
  2196                                   %assign _STANDALONE 0
  2197                                   %assign _MULTI 1
  2198                                   %include "depack.asm"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> lDebug heatshrink/lzexedat depacker
     4                              <1> 
     5                              <1> Copyright (C) 2008-2025 E. C. Masloch
     6                              <1> 
     7                              <1> Usage of the works is permitted provided that this
     8                              <1> instrument is retained with the works, so that any entity
     9                              <1> that uses the works is notified of this instrument.
    10                              <1> 
    11                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <1> 
    13                              <1> %endif
    14                              <1> 
    15                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
    16                              <1> 
    17                              <1> 
    18                              <1> 	numdef LZEXEDAT,	0
    19                              <1> 	numdef DEPACKINLINELITERAL,	1
    20                              <1> 	numdef DXTAG,		1
    21                              <1> 	numdef LONGLITERAL,	0
    22                              <1> 	numdef MULTI,		0
    23                              <1> 	numdef STANDALONE,	1
    24                              <1> 	numdef DATEXE,		0
    25                              <1> 
    26                              <1> %ifn _STANDALONE
    27                              <1> 	overridedef DEBUG0,	0
    28                              <1> 	overridedef COUNTER,	0
    29                              <1> %else
    30                              <1>  %ifn _DATEXE
    31                              <1> 	overridedef MULTI,	0
    32                              <1>  %endif
    33                              <1> 	numdef DEBUG0,		0
    34                              <1> 	numdef COUNTER,		0, 32
    35                              <1> %if (_COUNTER - 1) & _COUNTER
    36                              <1>  %error COUNTER must be a power of two
    37                              <1> %endif
    38                              <1> 	numdef OUTBUFFER,	1
    39                              <1> 
    40                              <1> 
    41                              <1> %ifn _DATEXE
    42                              <1> 	cpu 8086
    43                              <1> 	org 256
    44                              <1> 	addsection CODE, start=256
    45                              <1> testprogram:
    46                              <1> 	mov si, 81h
    47                              <1> 
    48                              <1> 	cmp sp, stack.top
    49                              <1> 	jae @F
    50                              <1> error:
    51                              <1> 	mov dx, msg.error
    52                              <1> 	mov ah, 09h
    53                              <1> 	int 21h
    54                              <1> 	mov ax, 4CFFh
    55                              <1> 	int 21h
    56                              <1> 	int 20h
    57                              <1> 
    58                              <1> @@:
    59                              <1> 	lodsb
    60                              <1> 	cmp al, 9
    61                              <1> 	je @B
    62                              <1> 	cmp al, 32
    63                              <1> 	je @B
    64                              <1> 	cmp al, 13
    65                              <1> 	je error
    66                              <1> 	mov dx, si
    67                              <1> 	dec dx
    68                              <1> 
    69                              <1> @@:
    70                              <1> 	lodsb
    71                              <1> 	cmp al, 9
    72                              <1> 	je @F
    73                              <1> 	cmp al, 32
    74                              <1> 	je @F
    75                              <1> 	cmp al, 13
    76                              <1> 	jne @B
    77                              <1> @@:
    78                              <1> 	mov byte [si - 1], 0
    79                              <1> 
    80                              <1> 	mov ax, 3D00h | 1_010_0_000b	; RO, DENY WRITE, No inherit
    81                              <1> 	int 21h
    82                              <1> 	jc error
    83                              <1> 	mov word [handle], ax
    84                              <1> 
    85                              <1> 	xchg bx, ax
    86                              <1> 	mov ax, 4202h
    87                              <1> 	xor cx, cx
    88                              <1> 	xor dx, dx
    89                              <1> 	int 21h
    90                              <1> 	jc error
    91                              <1> 
    92                              <1> 	push dx
    93                              <1> 	push ax
    94                              <1> 	mov ax, 4200h
    95                              <1> 	xor cx, cx
    96                              <1> 	xor dx, dx
    97                              <1> 	int 21h
    98                              <1> 	jc error
    99                              <1> 
   100                              <1> 	mov ax, 3C00h
   101                              <1> 	xor cx, cx
   102                              <1> 	mov dx, msg.outname
   103                              <1> 	int 21h
   104                              <1> 	jc error
   105                              <1> 	mov word [handle2], ax
   106                              <1> 
   107                              <1> 	pop dx
   108                              <1> 	pop cx				; = file size
   109                              <1> %else	; _DATEXE
   110                              <1> 	usesection CODE
   111                              <1> datexe_depack:
   112                              <1> 	mov cx, word [insize + 2]
   113                              <1> 	mov dx, word [insize]
   114                              <1> %endif
   115                              <1> 	mov word [filebuffer.next], filebuffer
   116                              <1> 	mov word [filebuffer.tail], filebuffer
   117                              <1> %if _OUTBUFFER
   118                              <1> 	mov word [outbuffer.next], outbuffer
   119                              <1> %endif
   120                              <1> 
   121                              <1> %if _DATEXE
   122                              <1> 	mov ax, BUFFER
   123                              <1> 	mov es, ax
   124                              <1> %endif
   125                              <1> 	mov di, resultbuffer
   126                              <1> 	push di
   127                              <1> 	push cx
   128                              <1> 	mov ax, 0CCCCh
   129                              <1> 	mov cx, words(resultbuffer.end - resultbuffer)
   130                              <1> 	rep stosw
   131                              <1> 	pop cx
   132                              <1> 	pop di
   133                              <1> 	mov si, resultbuffer.end
   134                              <1> 
   135                              <1> %if _DATEXE
   136                              <1> 	mov ax, [format]
   137                              <1> ..@breakpoint_d:
   138                              <1> 	nop
   139                              <1> %endif
   140                              <1> 
   141                              <1> 	call depack
   142                              <1> %if _DATEXE
   143                              <1> 	mov dx, DATA
   144                              <1> 	mov ds, dx
   145                              <1> 
   146                              <1> 	sbb ax, ax
   147                              <1> 	jz @F
   148                              <1> 	mov dx, msg.decompresserror
   149                              <1> 	call disp_msg_counted
   150                              <1> 	mov ax, 4C0Bh
   151                              <1> 	int 21h
   152                              <1> @@:
   153                              <1> %if _OUTBUFFER
   154                              <1> 	mov di, [outbuffer.next]
   155                              <1> 	call dump_outbuffer
   156                              <1> %endif
   157                              <1> 
   158                              <1> 	mov bx, word [outhandle]
   159                              <1> 	mov ax, 4202h
   160                              <1> 	xor cx, cx
   161                              <1> 	xor dx, dx
   162                              <1> 	int 21h
   163                              <1> 	jc openoutfile.error
   164                              <1> 	mov word [outsize], ax
   165                              <1> 	mov word [outsize + 2], dx
   166                              <1> 
   167                              <1> 	rol byte [verbose], 1
   168                              <1> 	jc display_table_d
   169                              <1> display_short_d:
   170                              <1> 	mov dx, msg.short.1
   171                              <1> 	call disp_msg_counted
   172                              <1> 	mov ax, word [insize]
   173                              <1> 	mov dx, word [insize + 2]
   174                              <1> 	call disp_dxax_dec
   175                              <1> 	mov dx, msg.short.2
   176                              <1> 	call disp_msg_counted
   177                              <1> 	mov ax, word [outsize]
   178                              <1> 	mov dx, word [outsize + 2]
   179                              <1> 	call disp_dxax_dec
   180                              <1> 	mov dx, msg.short.3
   181                              <1> 	call disp_msg_counted
   182                              <1> 	call disp_percentage_swapped
   183                              <1> 	mov ax, 4C00h
   184                              <1> 	int 21h
   185                              <1> 
   186                              <1> 
   187                              <1> display_table_d:
   188                              <1> 	mov si, table_d
   189                              <1> .loop:
   190                              <1> 	lodsw
   191                              <1> 	test ax, ax
   192                              <1> 	jz .done
   193                              <1> 	xchg dx, ax
   194                              <1> 	call disp_msg_counted
   195                              <1> 	lodsw
   196                              <1> 	xchg bx, ax
   197                              <1> 	mov cx, [bx]
   198                              <1> 	mov dx, [bx + 2]
   199                              <1> 	lodsw
   200                              <1> 	xchg cx, ax
   201                              <1> 	call cx
   202                              <1> 	xchg cx, ax
   203                              <1> 	mov al, 32
   204                              <1> 	call disp_al
   205                              <1> 	lodsw
   206                              <1> 	xchg cx, ax
   207                              <1> 	call cx
   208                              <1> 	mov dx, msg.linebreak
   209                              <1> 	call disp_msg_counted
   210                              <1> 	jmp .loop
   211                              <1> 
   212                              <1> .done:
   213                              <1> 	mov dx, msg.done.6
   214                              <1> 	call disp_msg_counted
   215                              <1> 	call disp_percentage_swapped
   216                              <1> 	mov dx, msg.done
   217                              <1> 	call disp_msg_counted
   218                              <1> 	mov ax, 4C00h
   219                              <1> 	int 21h
   220                              <1> %else	; _DATEXE
   221                              <1> 	jc error
   222                              <1> 
   223                              <1> %if _OUTBUFFER
   224                              <1> 	mov di, [outbuffer.next]
   225                              <1> 	call dump_outbuffer
   226                              <1> %endif
   227                              <1> 
   228                              <1> 	push ss
   229                              <1> 	pop ds
   230                              <1> 	push ss
   231                              <1> 	pop es
   232                              <1> 
   233                              <1> 	mov ah, 3Eh
   234                              <1> 	mov bx, [handle]
   235                              <1> 	int 21h
   236                              <1> 
   237                              <1> 	mov ah, 3Eh
   238                              <1> 	mov bx, [handle2]
   239                              <1> 	int 21h
   240                              <1> 
   241                              <1> 	mov ax, 4C00h
   242                              <1> 	int 21h
   243                              <1> 	int 20h
   244                              <1> 
   245                              <1> 
   246                              <1> %if _COUNTER
   247                              <1> disp_al:
   248                              <1> 	push dx
   249                              <1> 	push ax
   250                              <1> 	xchg ax, dx
   251                              <1> 	mov ah, 02h
   252                              <1> 	int 21h
   253                              <1> 	pop ax
   254                              <1> 	pop dx
   255                              <1> 	retn
   256                              <1> %endif
   257                              <1> %endif	; _DATEXE
   258                              <1> 
   259                              <1> 
   260                              <1> 		; INP:	-
   261                              <1> 		; OUT:	Does not return if error (in this example)
   262                              <1> 		;	CY if error
   263                              <1> 		;	NC if success,
   264                              <1> 		;	 al = byte read from file
   265                              <1> 		; CHG:	si
   266                              <1> 		; REM:	In this example program we assume ds = es = ss.
   267                              <1> get_file_byte:
   268                              <1> %if _DATEXE
   269                              <1> 	push ds
   270                              <1> 	mov si, DATA
   271                              <1> 	mov ds, si
   272                              <1> %endif
   273                              <1> 	mov si, [filebuffer.next]
   274                              <1> 	cmp si, [filebuffer.tail]
   275                              <1> 	jb .buffered
   276                              <1> 
   277                              <1> 	push ax
   278                              <1> 	push bx
   279                              <1> 	push cx
   280                              <1> 	push dx
   281                              <1> 	mov dx, filebuffer
   282                              <1> 	mov [filebuffer.next], dx
   283                              <1> 	mov [filebuffer.tail], dx
   284                              <1> 	mov ah, 3Fh
   285                              <1> 	mov bx, [handle]
   286                              <1>         mov cx, filebuffer.end - filebuffer
   287                              <1> 
   288                              <1> 	int 21h
   289                              <1> %if _DATEXE
   290                              <1> 	jc getbuf.errorread
   291                              <1> 	test ax, ax
   292                              <1> 	jz getbuf.shortread
   293                              <1> %else
   294                              <1> 	jc error
   295                              <1> 	test ax, ax
   296                              <1> 	jz error
   297                              <1> %endif
   298                              <1> 	add ax, dx
   299                              <1> 	mov word [filebuffer.tail], ax
   300                              <1>         mov si, dx
   301                              <1> 	pop dx
   302                              <1> 	pop cx
   303                              <1> 	pop bx
   304                              <1> 	pop ax
   305                              <1> 
   306                              <1> .buffered:
   307                              <1> 	lodsb
   308                              <1> 	mov [filebuffer.next], si
   309                              <1> 	clc
   310                              <1> %if _DATEXE
   311                              <1> 	pop ds
   312                              <1> %endif
   313                              <1> 	retn
   314                              <1> 
   315                              <1> 
   316                              <1> %if _OUTBUFFER
   317                              <1> 		; INP:	ds:si -> data to write
   318                              <1> 		;	cx = length of data (may be zero)
   319                              <1> 		; OUT:	Does not return if error
   320                              <1> 		; CHG:	-
   321                              <1> 		; REM:	In this example program we assume ds = es = ss.
   322                              <1> put_file_data:
   323                              <1> 	push ax
   324                              <1> 	push bx
   325                              <1> 	push dx
   326                              <1> 	push di
   327                              <1> 	push si
   328                              <1> 	push cx
   329                              <1> %if _DATEXE
   330                              <1> 	push es
   331                              <1> 	mov di, DATA
   332                              <1> 	mov es, di
   333                              <1> 	es
   334                              <1> %endif
   335                              <1> 	mov di, [outbuffer.next]
   336                              <1> 	jcxz .end
   337                              <1> @@:
   338                              <1> 	cmp di, outbuffer.end
   339                              <1> 	jne @F
   340                              <1> 
   341                              <1> 	call dump_outbuffer
   342                              <1> 
   343                              <1> @@:
   344                              <1> 	movsb
   345                              <1> 	loop @BB
   346                              <1> %if _DATEXE
   347                              <1> 	es
   348                              <1> %endif
   349                              <1> 	mov [outbuffer.next], di
   350                              <1> .end:
   351                              <1> %if _DATEXE
   352                              <1> 	pop es
   353                              <1> %endif
   354                              <1> 	pop cx
   355                              <1> 	pop si
   356                              <1> 	pop di
   357                              <1> 	pop dx
   358                              <1> 	pop bx
   359                              <1> 	pop ax
   360                              <1> 	retn
   361                              <1> 
   362                              <1> dump_outbuffer:
   363                              <1> 	push cx
   364                              <1> %if _DATEXE
   365                              <1> 	push ds
   366                              <1> 	mov cx, DATA
   367                              <1> 	mov ds, cx
   368                              <1> %endif
   369                              <1> 	mov cx, di
   370                              <1> 	mov dx, outbuffer
   371                              <1> 	sub cx, dx
   372                              <1> 	jz @F
   373                              <1> 	mov bx, word [handle2]
   374                              <1> 	mov ah, 40h
   375                              <1> 	int 21h
   376                              <1> %if _DATEXE
   377                              <1> 	jc putbuf.errorwrite
   378                              <1> 	cmp ax, cx
   379                              <1> 	jne putbuf.shortwrite
   380                              <1> %else
   381                              <1> 	jc error
   382                              <1> 	cmp ax, cx
   383                              <1> 	jne error
   384                              <1> %endif
   385                              <1> @@:
   386                              <1> 	mov di, dx
   387                              <1> %if _DATEXE
   388                              <1> 	pop ds
   389                              <1> %endif
   390                              <1> 	pop cx
   391                              <1> 	retn
   392                              <1> %else
   393                              <1> 		; INP:	ds:si -> data to write
   394                              <1> 		;	cx = length of data (may be zero)
   395                              <1> 		; OUT:	Does not return if error
   396                              <1> 		; CHG:	-
   397                              <1> 		; REM:	In this example program we assume ds = es = ss.
   398                              <1> put_file_data:
   399                              <1> 	push ax
   400                              <1> 	push bx
   401                              <1> 	push dx
   402                              <1> 	mov dx, si
   403                              <1> 	mov ah, 40h
   404                              <1> %if _DATEXE
   405                              <1> 	push ds
   406                              <1> 	mov di, DATA
   407                              <1> 	mov ds, di
   408                              <1> %endif
   409                              <1> 	mov bx, [handle2]
   410                              <1> %if _DATEXE
   411                              <1> 	pop ds
   412                              <1> %endif
   413                              <1> 	jcxz @F
   414                              <1> 	int 21h
   415                              <1> %if _DATEXE
   416                              <1> 	jc putbuf.errorwrite
   417                              <1> 	cmp ax, cx
   418                              <1> 	jne putbuf.shortwrite
   419                              <1> %else
   420                              <1> 	jc error
   421                              <1> 	cmp ax, cx
   422                              <1> 	jne error
   423                              <1> %endif
   424                              <1> @@:
   425                              <1> 	pop dx
   426                              <1> 	pop bx
   427                              <1> 	pop ax
   428                              <1> 	retn
   429                              <1> %endif
   430                              <1> 
   431                              <1> 
   432                              <1> %ifn _DATEXE
   433                              <1> 	addsection DATA, align=1 follows=CODE
   434                              <1> msg:
   435                              <1> .error:		ascic "Error!",13,10
   436                              <1> .outname:	asciz "output.bin"
   437                              <1> 
   438                              <1> 
   439                              <1> 	addsection BSSDATA, align=16 nobits follows=DATA
   440                              <1> 	alignb 16
   441                              <1> resultbuffer:
   442                              <1> .size equ 4096
   443                              <1> 		resb .size
   444                              <1> .end:
   445                              <1> 
   446                              <1> %else
   447                              <1> 	usesection DATA
   448                              <1> %endif
   449                              <1> 	alignb 2
   450                              <1> filebuffer:	resb 256
   451                              <1> .end:
   452                              <1> 	alignb 2
   453                              <1> .next:		resw 1
   454                              <1> .tail:		resw 1
   455                              <1> %if _DATEXE
   456                              <1> handle equ inhandle
   457                              <1> handle2 equ outhandle
   458                              <1> %else
   459                              <1> handle:		resw 1
   460                              <1> handle2:	resw 1
   461                              <1> %endif
   462                              <1> 
   463                              <1> %if _OUTBUFFER
   464                              <1> outbuffer:	resb 256
   465                              <1> .end:
   466                              <1> .next:		resw 1
   467                              <1> %endif
   468                              <1> 
   469                              <1> %ifn _DATEXE
   470                              <1> stack:		resb 512
   471                              <1> .top:
   472                              <1> %endif
   473                              <1> 
   474                              <1> 
   475                              <1> 	usesection CODE
   476                              <1> %endif	; _STANDALONE
   477                              <1> 
   478                              <1> %if _MULTI
   479                              <1> 	overridedef LZEXEDAT, 1
   480                              <1> 	overridedef LONGLITERAL, 1
   481                              <1> %endif
   482                              <1> 
   483                              <1> 		; INP:	cx:dx = length of source
   484                              <1> 		;	es:di -> destination
   485                              <1> 		;	si -> behind end of destination (si > di)
   486                              <1> 		;	(al = format, 2 = heatshrink, 3 = lzexedat -4)
   487                              <1> 		;	(ah = 0FFh for switch4k on, 00h for off)
   488                              <1> 		; OUT:	NC if success
   489                              <1> 		;	CY if error,
   490                              <1> 		;	 bx = ?errordata (if _DEBUG0)
   491                              <1> 		; CHG:	ax, (bx), cx, dx, es, ds, si, di
   492                              <1> 		; STT:	UP
   493                              <1> depack:
   494                              <1> 	lframe near
   495 00000D73 5589E5              <1> 	lenter
   496                              <1>  %if _DEBUG0 || _COUNTER
   497                              <1> 	xor bx, bx
   498                              <1>  %endif
   499                              <1>  %if _DEBUG0
   500                              <1> 	lvar word,	errordata
   501                              <1> 	 push bx
   502                              <1>  %endif
   503                              <1> %if _MULTI
   504 00000D76 88C3                <1> 	mov bl, al
   505                              <1> %endif
   506                              <1> %if _COUNTER || _MULTI
   507                              <1> 	lvar word,	format_and_counter
   508                              <1> 	lequ ?format_and_counter + 1, counter
   509                              <1> 	lequ ?format_and_counter, format
   510 00000D78 53                  <1> 	 push bx		; initialise counter (high byte) to zero
   511                              <1> 				; and format (low byte)
   512                              <1> %endif
   513                              <1> %if _DATEXE
   514                              <1> 	lvar word,	empty_and_switch4k
   515                              <1> 	lequ ?empty_and_switch4k + 1, switch4k
   516                              <1> 	 push ax
   517                              <1> %endif
   518                              <1> 
   519                              <1> 	lvar dword,	original_dst
   520 00000D79 06                  <1> 	 push es
   521 00000D7A 57                  <1> 	 push di
   522                              <1> 	lvar dword,	dst
   523 00000D7B 06                  <1> 	 push es
   524 00000D7C 57                  <1> 	 push di
   525                              <1> 	lvar dword,	src_remaining
   526 00000D7D 51                  <1> 	 push cx
   527 00000D7E 52                  <1> 	 push dx
   528                              <1> 
   529 00000D7F 89F1                <1> 	mov cx, si
   530 00000D81 29F9                <1> 	sub cx, di		; same flags as cmp si, di
   531 00000D83 7703E9E900          <1> 	jbe .error
   532                              <1> 
   533                              <1> %if _DXTAG
   534                              <1> 	lvar word,	dst_end
   535 00000D88 56                  <1> 	 push si		; push into [bp + ?dst_end]
   536                              <1> %else
   537                              <1> 	mov dx, si
   538                              <1> %endif
   539                              <1> 
   540 00000D89 31C0                <1> 	xor ax, ax
   541 00000D8B F3AA                <1> 	rep stosb		; prepare for matches before first data byte
   542                              <1> %if _LZEXEDAT || _MULTI
   543 00000D8D 40                  <1> 	inc ax			; = 1
   544                              <1> %endif
   545                              <1> %if _MULTI
   546                              <1> 	lvar word,	word1
   547                              <1> 	lvar word,	word2
   548                              <1> 	lvar word,	word3
   549                              <1> 
   550 00000D8E 807EFE02            <1> 	cmp byte [bp + ?format], 2
   551 00000D92 7303E9DA00          <1> 	jb .error
   552 00000D97 806EFE03            <1> 	sub byte [bp + ?format], 3
   553                              <1> 		; -1 = heatshrink, 0 = lzexedat -4, 1 = lzexedat -4 -l
   554 00000D9B 7303E98E00          <1> 	jb .hs_init
   555 00000DA0 3846FE              <1> 	cmp byte [bp + ?format], al
   556 00000DA3 7603E9C900          <1> 	ja .error
   557                              <1> %endif
   558                              <1> %if _LZEXEDAT
   559                              <1> .lze_init:
   560                              <1> %if _MULTI
   561                              <1> 	lequ ?word1,	tagbitscycle
   562                              <1> %else
   563                              <1> 	lvar word,	tagbitscycle
   564                              <1> %endif
   565 00000DA8 50                  <1> 	 push ax		; = 1
   566                              <1> 
   567                              <1> %ifn _DXTAG
   568                              <1>  %if _MULTI
   569                              <1> 	lequ ?word2,	tagword
   570                              <1>  %else
   571                              <1> 	lvar word,	tagword
   572                              <1>  %endif
   573                              <1> 	 push ax
   574                              <1> %endif
   575 00000DA9 E8B601              <1> 	call get_bit			; ?tagbitscycle init to 1, ror sets CY
   576                              <1> 					;  (bogus result in CF is ignored)
   577                              <1> 
   578 00000DAC EB26                <1> 	jmp .lze_loop
   579                              <1> 
   580                              <1> .lze_literal:
   581                              <1> %if _LONGLITERAL
   582 00000DAE 41                  <1> 	inc cx
   583                              <1> .loop_literal:
   584                              <1> %endif
   585                              <1> 
   586 00000DAF E8CA01              <1> 	call load_byte
   587                              <1> %if _LONGLITERAL
   588 00000DB2 51                  <1> 	push cx
   589                              <1> %endif
   590                              <1> %if _DEPACKINLINELITERAL
   591                              <1> %if _LONGLITERAL
   592 00000DB3 B90100              <1> 	mov cx, 1
   593                              <1> %else
   594                              <1> 	inc cx				; cx = 1
   595                              <1> %endif
   596 00000DB6 C47EF6              <1> 	les di, [bp + ?dst]		; -> destination
   597                              <1> %if _DXTAG
   598 00000DB9 3B7EF0              <1> 	cmp di, [bp + ?dst_end]		; at end of circular buffer ?
   599                              <1> %else
   600                              <1> 	cmp di, dx
   601                              <1> %endif
   602 00000DBC 7603E9B000          <1> 	ja .error			; invalid -->
   603 00000DC1 7203                <1> 	jb @F				; no -->
   604 00000DC3 8B7EFA              <1> 	mov di, word [bp + ?original_dst]	; yes, reset
   605                              <1> @@:
   606 00000DC6 06                  <1> 	push es
   607 00000DC7 1F                  <1> 	pop ds
   608 00000DC8 89FE                <1> 	mov si, di			; ds:si -> where to store
   609 00000DCA AA                  <1> 	stosb				; store it
   610 00000DCB 897EF6              <1> 	mov word [bp + ?dst], di	; update ?dst
   611 00000DCE E80E03              <1> 	call put_file_data		; ds:si ->, length cx
   612                              <1> %else
   613                              <1> 	push ax				; on stack: the literal
   614                              <1> 	 push ss
   615                              <1> 	 pop ds
   616                              <1> 	mov si, sp			; ds:si -> data on stack
   617                              <1> %if _LONGLITERAL
   618                              <1> 	xor ax, ax
   619                              <1> %else
   620                              <1> 	xchg ax, cx			; ax = 0
   621                              <1> %endif
   622                              <1> 	inc ax				; length = 1
   623                              <1> 	mov bx, ax			; bx NZ
   624                              <1> 	call copy_data.bx
   625                              <1> 	pop ax				; (discard)
   626                              <1> d0	mov byte [bp + ?errordata], 75h
   627                              <1> 	jc .error
   628                              <1> %endif
   629                              <1> 
   630                              <1> %if _LONGLITERAL
   631 00000DD1 59                  <1> 	pop cx
   632 00000DD2 E2DB                <1> 	loop .loop_literal
   633                              <1> %endif
   634                              <1> 
   635                              <1> %assign LENGTHOFLITERAL $ - .lze_literal
   636                              <1> %warning length of lze literal = LENGTHOFLITERAL
   636          ******************  <1>  warning: length of lze literal = 38 [-w+user]
   637                              <1> 
   638                              <1> .lze_loop:
   639 00000DD4 31C9                <1> 	xor cx, cx			; ! ch = 0, cx = 0
   640 00000DD6 E88901              <1> 	call get_bit
   641 00000DD9 72D3                <1> 	jc .lze_literal
   642                              <1> 
   643                              <1> .lze_notliteral:
   644                              <1> %if _COUNTER
   645                              <1> 	inc byte [bp + ?counter]
   646                              <1> 	test byte [bp + ?counter], _COUNTER - 1
   647                              <1> 	jnz @F
   648                              <1> 	mov al, '.'
   649                              <1> 	call disp_al_counter
   650                              <1> @@:
   651                              <1> %endif
   652                              <1> 
   653 00000DDB E88401              <1> 	call get_bit
   654 00000DDE 7219                <1> 	jc .lze_combined
   655                              <1> 
   656                              <1> .lze_shortmatch:
   657                              <1> 		; cx = 0
   658 00000DE0 E87F01              <1> 	call get_bit
   659 00000DE3 D1D1                <1> 	rcl cx, 1
   660 00000DE5 E87A01              <1> 	call get_bit
   661 00000DE8 D1D1                <1> 	rcl cx, 1			; cx = 0..3
   662                              <1> 
   663 00000DEA E88F01              <1> 	call load_byte			; load displacement
   664                              <1> 
   665 00000DED B4FF                <1> 	mov ah, -1			; sign extend for negative number
   666 00000DEF 93                  <1> 	xchg bx, ax			; bx = displacement (-1 to -256)
   667                              <1> 
   668                              <1> .lze_match_cx_plus_2:
   669 00000DF0 41                  <1> 	inc cx
   670                              <1> .lze_match_cx_plus_1:
   671 00000DF1 41                  <1> 	inc cx
   672                              <1> 
   673                              <1> 		; INP:	bx = match displacement (-1 to -4096)
   674                              <1> 		;	cx = match count (2 to 256)
   675 00000DF2 93                  <1> 	xchg ax, bx			; ax = displacement, cx = count
   676 00000DF3 91                  <1> 	xchg ax, cx			; cx = displacement, ax = length of match
   677 00000DF4 F7D9                <1> 	neg cx				; cx = index
   678 00000DF6 E9BC00              <1> 	jmp .lze_match
   679                              <1> .lze_loop_j1: equ .lze_loop
   680                              <1> 
   681                              <1> .lze_combined:
   682 00000DF9 E87501              <1> 	call load_word			; load combined word
   683                              <1> 
   684 00000DFC 89C3                <1> 	mov bx, ax
   685 00000DFE F9                  <1> 	stc				; CY
   686 00000DFF D0DF                <1> 	rcr bh, 1			; rotate in a 1
   687 00000E01 D0FF                <1> 	sar bh, 1
   688 00000E03 D0FF                <1> 	sar bh, 1			; fill top three bits with 1s
   689                              <1> %if _DATEXE
   690                              <1> 	rol byte [bp + ?switch4k], 1
   691                              <1> 	jnc .8k
   692                              <1> .4k:
   693                              <1> 	sar bh, 1			; fill top *four* bits with 1s
   694                              <1> 	and ah, 15
   695                              <1> 	jmp @F
   696                              <1> .8k:
   697                              <1> 	and ah, 7
   698                              <1> @@:
   699                              <1> %else
   700                              <1>  %if 1	; _4
   701 00000E05 D0FF                <1> 	sar bh, 1			; fill top *four* bits with 1s
   702 00000E07 80E40F              <1> 	and ah, 15
   703                              <1>  %else
   704                              <1> 	and ah, 7
   705                              <1>  %endif
   706                              <1> %endif
   707 00000E0A 88E1                <1> 	mov cl, ah			; ch already = 0
   708 00000E0C 75E2                <1> 	jnz .lze_match_cx_plus_2	; length = cx + 2, bx = displacement
   709                              <1> 
   710                              <1> .lze_escape:
   711 00000E0E E86B01              <1> 	call load_byte			; ah = 0
   712 00000E11 3C01                <1> 	cmp al, 1
   713 00000E13 724F                <1> 	jb .end_check
   714 00000E15 91                  <1> 	xchg cx, ax			; cx = length
   715 00000E16 77D9                <1> 	ja .lze_match_cx_plus_1		; length = cx + 1, bx = displacement
   716                              <1> 
   717                              <1> %if _LONGLITERAL
   718                              <1>  %if _MULTI
   719 00000E18 807EFE01            <1> 	cmp byte [bp + ?format], 1
   720 00000E1C 750E                <1> 	jne .lze_normalise		; not lzexedat -4 -l -->
   721                              <1>  %endif
   722 00000E1E 87CB                <1> 	xchg cx, bx			; cx = displacement, top 4 or 3 bits sets
   723                              <1>  %if _DATEXE
   724                              <1> 	and ch, ~ 1110_0000b		; isolate 13-bit displacement
   725                              <1> 	rol byte [bp + ?switch4k], 1
   726                              <1> 	jnc @F
   727                              <1> 	and ch, ~ 1111_0000b		; isolate 12-bit displacement
   728                              <1> @@:
   729                              <1>  %else
   730                              <1>   %if 1 ; _4
   731 00000E20 80E50F              <1> 	and ch, ~ 1111_0000b		; isolate 12-bit displacement
   732                              <1>   %else
   733                              <1> 	and ch, ~ 1110_0000b		; isolate 13-bit displacement
   734                              <1>   %endif
   735                              <1>  %endif
   736 00000E23 E307                <1>  	jcxz .lze_normalise		; displacement 0 means segment change -->
   737 00000E25 83F91A              <1>  	cmp cx, 26			; long literals command needs >= 26 bytes
   738 00000E28 7247                <1>  	jb .error			; (reserved for future expansion)
   739 00000E2A EB83                <1>  	jmp .loop_literal		; process the literals -->
   740                              <1> %endif
   741                              <1> .lze_normalise:
   742 00000E2C EBA6                <1> 	jmp .lze_loop_j1
   743                              <1> 
   744                              <1> %if !_MULTI
   745                              <1> .end_check:
   746                              <1> d0	mov byte [bp + ?errordata], 7Dh
   747                              <1> 	xor cx, cx
   748                              <1> 	cmp word [bp + ?src_remaining + 2], cx
   749                              <1> 	jne .error
   750                              <1> 	cmp word [bp + ?src_remaining], cx
   751                              <1> 	jne .error
   752                              <1> 
   753                              <1> .end:
   754                              <1> 	db __TEST_IMM8			; (NC)
   755                              <1> .error:
   756                              <1> 	stc
   757                              <1> 
   758                              <1> %if _COUNTER
   759                              <1> 	lahf
   760                              <1> 	mov al, 13
   761                              <1> 	call disp_al_for_progress
   762                              <1> 	mov al, 10
   763                              <1> 	call disp_al_for_progress
   764                              <1> 	sahf
   765                              <1> %endif
   766                              <1> d0	mov bx, word [bp + ?errordata]
   767                              <1> 	lleave code
   768                              <1> 	lret
   769                              <1> %endif
   770                              <1> %endif
   771                              <1> 
   772                              <1> %if _MULTI || !_LZEXEDAT
   773                              <1> .hs_init:
   774                              <1> @@:
   775 00000E2E E87C01              <1> 	call read_byte
   776                              <1> d0	mov byte [bp + ?errordata], 70h
   777 00000E31 723E                <1> 	jc .error
   778                              <1> 
   779 00000E33 B400                <1> 	mov ah, 0
   780 00000E35 85C0                <1> 	test ax, ax
   781                              <1> d0	mov byte [bp + ?errordata], 71h
   782 00000E37 7438                <1> 	jz .error
   783 00000E39 3C0F                <1> 	cmp al, 15
   784 00000E3B 7734                <1> 	ja .error
   785                              <1> 
   786                              <1> %if _MULTI
   787                              <1> 	lequ ?word1,	window_size_bits
   788                              <1> %else
   789                              <1> 	lvar word,	window_size_bits
   790                              <1> %endif
   791 00000E3D 50                  <1> 	 push ax
   792                              <1> 
   793 00000E3E 91                  <1> 	xchg cx, ax
   794 00000E3F B80100              <1> 	mov ax, 1
   795 00000E42 D3E0                <1> 	shl ax, cl
   796 00000E44 3D0010              <1> 	cmp ax, resultbuffer.size
   797 00000E47 7728                <1> 	ja .error
   798                              <1> 
   799 00000E49 E86101              <1> 	call read_byte
   800                              <1> d0	mov byte [bp + ?errordata], 72h
   801 00000E4C 7223                <1> 	jc .error
   802                              <1> 
   803 00000E4E B400                <1> 	mov ah, 0
   804 00000E50 85C0                <1> 	test ax, ax
   805                              <1> d0	mov byte [bp + ?errordata], 73h
   806 00000E52 741D                <1> 	jz .error
   807 00000E54 3B46EE              <1> 	cmp ax, word [bp + ?window_size_bits]
   808 00000E57 7318                <1> 	jae .error
   809                              <1> 
   810                              <1> %if _MULTI
   811                              <1> 	lequ ?word2,	lookahead_size_bits
   812                              <1> %else
   813                              <1> 	lvar word,	lookahead_size_bits
   814                              <1> %endif
   815 00000E59 50                  <1> 	 push ax
   816                              <1> 
   817                              <1> %if _DXTAG
   818 00000E5A 31D2                <1> 	xor dx, dx			; dl = bit index, dh = current byte
   819                              <1> %else
   820                              <1> 	xor cx, cx
   821                              <1>  %if _MULTI
   822                              <1> 	lequ ?word3,	low_bit_index_and_high_current_byte
   823                              <1>  %else
   824                              <1> 	lvar word,	low_bit_index_and_high_current_byte
   825                              <1>  %endif
   826                              <1> 	 push cx
   827                              <1> %endif
   828                              <1> 
   829                              <1> .loop:
   830                              <1> %if _COUNTER
   831                              <1> 	inc byte [bp + ?counter]
   832                              <1> 	test byte [bp + ?counter], _COUNTER - 1
   833                              <1> 	jnz @F
   834                              <1> 	mov al, '.'
   835                              <1> 	call disp_al
   836                              <1> @@:
   837                              <1> %endif
   838                              <1> 
   839 00000E5C B90100              <1> 	mov cx, 1
   840 00000E5F E82301              <1> 	call get_bits
   841 00000E62 7312                <1> 	jnc .notend			; (cx = 0 if jumping)
   842                              <1> 
   843                              <1> d0	mov byte [bp + ?errordata], 7Dh
   844                              <1> .end_check:
   845 00000E64 31C0                <1> 	xor ax, ax
   846 00000E66 3946F2              <1> 	cmp word [bp + ?src_remaining], ax
   847 00000E69 7506                <1> 	jne .error
   848 00000E6B 3946F4              <1> 	cmp word [bp + ?src_remaining + 2], ax
   849 00000E6E 7501                <1> 	jne .error
   850                              <1> 
   851 00000E70 A8                  <1> 	db __TEST_IMM8			; (NC)
   852                              <1> .error:
   853 00000E71 F9                  <1> 	stc
   854                              <1> 
   855                              <1> %if _COUNTER
   856                              <1> 	lahf
   857                              <1> 	mov al, 13
   858                              <1> 	call disp_al
   859                              <1> 	mov al, 10
   860                              <1> 	call disp_al
   861                              <1> 	sahf
   862                              <1> %endif
   863                              <1> d0	mov bx, word [bp + ?errordata]
   864 00000E72 89EC5D              <1> 	lleave code
   865 00000E75 C3                  <1> 	lret
   866                              <1> 
   867                              <1> .notend:				; (cx = 0)
   868 00000E76 84C0                <1> 	test al, al
   869 00000E78 7422                <1> 	jz .notliteral
   870                              <1> 
   871                              <1> .hs_literal:
   872 00000E7A B108                <1> 	mov cl, 8
   873 00000E7C E80601              <1> 	call get_bits			; cx = 0
   874                              <1> d0	mov byte [bp + ?errordata], 74h
   875 00000E7F 72E3                <1> 	jc .end_check
   876                              <1> %if _DEPACKINLINELITERAL
   877 00000E81 41                  <1> 	inc cx				; cx = 1
   878 00000E82 C47EF6              <1> 	les di, [bp + ?dst]		; -> destination
   879                              <1> %if _DXTAG
   880 00000E85 3B7EF0              <1> 	cmp di, [bp + ?dst_end]		; at end of circular buffer ?
   881                              <1> %else
   882                              <1> 	cmp di, dx
   883                              <1> %endif
   884 00000E88 77E7                <1> 	ja .error			; invalid -->
   885 00000E8A 7203                <1> 	jb @F				; no -->
   886 00000E8C 8B7EFA              <1> 	mov di, word [bp + ?original_dst]	; yes, reset
   887                              <1> @@:
   888 00000E8F 06                  <1> 	push es
   889 00000E90 1F                  <1> 	pop ds
   890 00000E91 89FE                <1> 	mov si, di			; ds:si -> where to store
   891 00000E93 AA                  <1> 	stosb				; store it
   892 00000E94 897EF6              <1> 	mov word [bp + ?dst], di	; update ?dst
   893 00000E97 E84502              <1> 	call put_file_data		; ds:si ->, length cx
   894                              <1> %else
   895                              <1> 	push ax				; on stack: the literal
   896                              <1> 	 push ss
   897                              <1> 	 pop ds
   898                              <1> 	mov si, sp			; ds:si -> data on stack
   899                              <1> 	xchg ax, cx			; ax = 0
   900                              <1> 	inc ax				; length = 1
   901                              <1> 	mov bx, ax			; bx NZ
   902                              <1> 	call copy_data.bx
   903                              <1> 	pop ax				; (discard)
   904                              <1> d0	mov byte [bp + ?errordata], 75h
   905                              <1> 	jc .error
   906                              <1> %endif
   907                              <1> %assign LENGTHOFLITERAL $ - .hs_literal
   908                              <1> %warning length of hs literal = LENGTHOFLITERAL
   908          ******************  <1>  warning: length of hs literal = 32 [-w+user]
   909 00000E9A EBC0                <1> 	jmp .loop
   910                              <1> 
   911                              <1> .notliteral:				; (cx = 0)
   912                              <1> 
   913 00000E9C 8A4EEE              <1> 	mov cl, byte [bp + ?window_size_bits]
   914                              <1> 					; cx = -w parameter
   915 00000E9F E8E300              <1> 	call get_bits
   916                              <1> d0	mov byte [bp + ?errordata], 76h
   917 00000EA2 72C0                <1> 	jc .end_check
   918                              <1> 		; ax = output index
   919                              <1> 		; cx = 0
   920 00000EA4 93                  <1> 	xchg bx, ax
   921 00000EA5 8A4EEC              <1> 	mov cl, byte [bp + ?lookahead_size_bits]
   922                              <1> 					; cx = -l parameter
   923 00000EA8 E8DA00              <1> 	call get_bits
   924                              <1> d0	mov byte [bp + ?errordata], 77h
   925 00000EAB 72B7                <1> 	jc .end_check
   926                              <1> 		; bx = output index less 1
   927                              <1> 		; ax = output count less 1
   928 00000EAD 43                  <1> 	inc bx				; = output index
   929                              <1> d0	mov byte [bp + ?errordata], 78h
   930 00000EAE 74C1                <1> 	jz .error
   931                              <1> 
   932                              <1> 					; ax = length of match less one
   933 00000EB0 40                  <1> 	inc ax				; = length of match
   934 00000EB1 74BE                <1> 	jz .error
   935                              <1> 
   936 00000EB3 89D9                <1> 	mov cx, bx			; 1 .. 65535
   937                              <1> %endif
   938                              <1> 
   939                              <1> %if _LZEXEDAT
   940                              <1> .lze_match:
   941                              <1> %endif
   942                              <1> 
   943                              <1> 		; cx = index, ax = length
   944 00000EB5 C576F6              <1> 	lds si, [bp + ?dst]
   945 00000EB8 8B5EFA              <1> 	mov bx, word [bp + ?original_dst]
   946 00000EBB F7DB                <1> 	neg bx
   947 00000EBD 01F3                <1> 	add bx, si			; dst - original = length at start
   948 00000EBF 29CB                <1> 	sub bx, cx			; length start - match distance
   949 00000EC1 7324                <1> 	jae @F				; length start >= match distance -->
   950                              <1> 		; bx = negative length of matchable at end of buffer
   951                              <1> 
   952                              <1> %if _DXTAG
   953 00000EC3 8B76F0              <1> 	mov si, [bp + ?dst_end]
   954                              <1> %else
   955                              <1> 	mov si, dx
   956                              <1> %endif
   957 00000EC6 01DE                <1> 	add si, bx			; si -> match data
   958 00000EC8 89F3                <1> 	mov bx, si
   959 00000ECA 01C3                <1> 	add bx, ax			; -> behind match data (if fits)
   960 00000ECC 7205                <1> 	jc .full			; if doesn't fit, copy full -->
   961                              <1> %if _DXTAG
   962 00000ECE 3B5EF0              <1> 	cmp bx, [bp + ?dst_end]		; -> behind is above-or-equal end ?
   963                              <1> %else
   964                              <1> 	cmp bx, dx
   965                              <1> %endif
   966                              <1> 	; jae .full			; yes -->
   967 00000ED1 7216                <1> 	jb .copy_data			; ax has full length from tail of buffer -->
   968                              <1> 
   969                              <1> 		; if we branch to here,
   970                              <1> 		;  si + ax >= (word [bp + ?dst_end] or dx)
   971                              <1> 		;  therefore  ax >= (word [bp + ?dst_end] or dx) - si
   972                              <1> .full:
   973 00000ED3 50                  <1> 	push ax				; save original length
   974                              <1> 		; calculate word [bp + ?dst_end] - si
   975                              <1> %if _DXTAG
   976 00000ED4 8B46F0              <1> 	mov ax, [bp + ?dst_end]
   977                              <1> %else
   978                              <1> 	mov ax, dx
   979                              <1> %endif
   980 00000ED7 29F0                <1> 	sub ax, si			; -> end minus -> match data
   981 00000ED9 50                  <1> 	push ax				; save length
   982 00000EDA E82200              <1> 	call copy_data
   983                              <1> d0	mov byte [bp + ?errordata], 1
   984 00000EDD 7292                <1> 	jc .error
   985 00000EDF 5B                  <1> 	pop bx				; = done length
   986 00000EE0 58                  <1> 	pop ax				; = entire length
   987 00000EE1 29D8                <1> 	sub ax, bx			; entire length minus done length
   988 00000EE3 8B76FA              <1> 	mov si, word [bp + ?original_dst]	; -> start of buffer
   989 00000EE6 A9                  <1> 	db __TEST_IMM16			; skip sub
   990                              <1> @@:
   991 00000EE7 29CE                <1> 	sub si, cx			; -> into buffer
   992                              <1> 
   993                              <1> .copy_data:
   994 00000EE9 E81300              <1> 	call copy_data			; give ?dst -> dest, ds:si -> source
   995                              <1> 		; returns: ?dst incremented, ds:si -> after match source
   996                              <1> d0	mov byte [bp + ?errordata], 7Bh
   997 00000EEC 7283                <1> 	jc .error
   998                              <1> 
   999                              <1> %if _MULTI
  1000                              <1> 		; end of common code, dispatch back to main loop
  1001 00000EEE 807EFE01            <1> 	cmp byte [bp + ?format], 1
  1002 00000EF2 7408                <1> 	je @F				; lzexedat -4 -l -->
  1003 00000EF4 D046FE              <1> 	rol byte [bp + ?format], 1
  1004 00000EF7 7303E960FF          <1> 	jc .loop
  1005                              <1> @@:
  1006 00000EFC E9D5FE              <1> 	jmp .lze_loop
  1007                              <1> %elif _LZEXEDAT
  1008                              <1> 	jmp .lze_loop
  1009                              <1> %else
  1010                              <1> 	jmp .loop
  1011                              <1> %endif
  1012                              <1> 
  1013                              <1> 
  1014                              <1> 		; INP:	?dst -> destination,
  1015                              <1> 		;	 destination may overlap the circular buffer boundary.
  1016                              <1> 		;	ds:si -> source
  1017                              <1> 		;	ax = how long the data is (0 is valid),
  1018                              <1> 		;	 always 1 for literals.
  1019                              <1> 		;	 source must fit in circular buffer, except if
  1020                              <1> 		;	 source and destination overlap. in this case the
  1021                              <1> 		;	 source starts in the buffer but may extend past
  1022                              <1> 		;	 the circular buffer boundary.
  1023                              <1> 		;	word [?dst_end] or dx -> end of circular buffer
  1024                              <1> 		;	word [?original_dst] -> start of circular buffer
  1025                              <1> 		; OUT:	?dst incremented
  1026                              <1> 		;	CY if error (buffer too small)
  1027                              <1> 		;	NC if success
  1028                              <1> 		; CHG:	cx, bx, ax, es, di, ds, si
  1029                              <1> copy_data:
  1030                              <1> %ifn _DEPACKINLINELITERAL
  1031                              <1> 	xor bx, bx
  1032                              <1> .bx:
  1033                              <1> 		; bx = nonzero if literal
  1034                              <1> %endif
  1035                              <1> 
  1036                              <1> %if 0
  1037                              <1> 	push ax
  1038                              <1> 	push bx
  1039                              <1> 	push cx
  1040                              <1> 	push dx
  1041                              <1> 	mov ax, 4201h
  1042                              <1> 	mov cx, 0
  1043                              <1> 	mov dx, 0
  1044                              <1> 	mov bx, word [handle2]
  1045                              <1> 	int 21h
  1046                              <1> 	nop
  1047                              <1> 	pop dx
  1048                              <1> 	pop cx
  1049                              <1> 	pop bx
  1050                              <1> 	pop ax
  1051                              <1> %endif
  1052                              <1> 
  1053                              <1> d0	inc byte [bp + ?errordata + 1]
  1054                              <1> 
  1055 00000EFF C47EF6              <1> 	les di, [bp + ?dst]
  1056                              <1> 
  1057 00000F02 91                  <1> 	xchg cx, ax			; cx = remaining length
  1058 00000F03 E344                <1> 	jcxz .end
  1059                              <1> 
  1060                              <1> %if _DXTAG
  1061 00000F05 3B7EF0              <1> 	cmp di, [bp + ?dst_end]
  1062                              <1> %else
  1063                              <1> 	cmp di, dx
  1064                              <1> %endif
  1065 00000F08 7744                <1> 	ja .ret_CY			; error
  1066                              <1> 		; literals may branch to .start_maybe_part
  1067 00000F0A 741D                <1> 	je .start_maybe_part		; ?dst -> at end (put whole data at start)
  1068 00000F0C 01CF                <1> 	add di, cx			; -> behind data chunk (if fits)
  1069 00000F0E 720A                <1> 	jc .fill			; doesn't fit -->
  1070                              <1> %if _DXTAG
  1071 00000F10 3B7EF0              <1> 	cmp di, [bp + ?dst_end]		; fits ?
  1072                              <1> %else
  1073                              <1> 	cmp di, dx
  1074                              <1> %endif
  1075                              <1> 		; literals never branch to .fill
  1076 00000F13 7705                <1> 	ja .fill			; doesn't fit -->
  1077 00000F15 8B7EF6              <1> 	mov di, word [bp + ?dst]	; restore -> destination
  1078                              <1> 		; ds:si l cx fits in circular buffer
  1079 00000F18 EB2C                <1> 	jmp .mov			; store full up to below-or-equal -> end
  1080                              <1> 
  1081                              <1> .fill:
  1082 00000F1A 8B7EF6              <1> 	mov di, word [bp + ?dst]	; restore -> destination
  1083                              <1> %if _DXTAG
  1084 00000F1D 8B46F0              <1> 	mov ax, [bp + ?dst_end]		; -> behind buffer
  1085                              <1> %else
  1086                              <1> 	mov ax, dx
  1087                              <1> %endif
  1088 00000F20 29F8                <1> 	sub ax, di			; -> behind buffer minus -> destination
  1089                              <1> 					; = length fitting at end
  1090 00000F22 29C1                <1> 	sub cx, ax			; cx -= length fitting at end
  1091                              <1> 					; = remaining length to store at start
  1092 00000F24 91                  <1> 	xchg cx, ax			; cx = length fitting at end
  1093 00000F25 E82800              <1> 	call .mov_and_put		; store at end
  1094 00000F28 91                  <1> 	xchg cx, ax			; cx = remaining length to store at start
  1095                              <1> 
  1096                              <1> .start_maybe_part:
  1097 00000F29 8B7EFA              <1> 	mov di, word [bp + ?original_dst]
  1098                              <1> %ifn _DEPACKINLINELITERAL
  1099                              <1> 	test bx, bx			; literal ?
  1100                              <1> 	jnz .mov			; yes -->
  1101                              <1> %endif
  1102                              <1> 		; literals never go here
  1103                              <1> 		; the following handles source overlapping destination
  1104                              <1> 		;  s.t. source crosses the circular buffer boundary.
  1105 00000F2C 89F0                <1> 	mov ax, si
  1106 00000F2E 01C8                <1> 	add ax, cx			; -> behind source
  1107 00000F30 7205                <1> 	jc .part			; CY, must copy part -->
  1108                              <1> %if _DXTAG
  1109 00000F32 3B46F0              <1> 	cmp ax, [bp + ?dst_end]		; below-or-equal end of buffer ?
  1110                              <1> %else
  1111                              <1> 	cmp ax, dx
  1112                              <1> %endif
  1113 00000F35 760F                <1> 	jbe .mov			; yes -->
  1114                              <1> .part:
  1115                              <1> %if _DXTAG
  1116 00000F37 8B46F0              <1> 	mov ax, [bp + ?dst_end]
  1117                              <1> %else
  1118                              <1> 	mov ax, dx
  1119                              <1> %endif
  1120 00000F3A 29F0                <1> 	sub ax, si			; ax = how much source data remains
  1121 00000F3C 29C1                <1> 	sub cx, ax			; cx = how much to copy after
  1122 00000F3E 91                  <1> 	xchg cx, ax			; cx = part length (source data remains)
  1123 00000F3F E80E00              <1> 	call .mov_and_put		; put from end
  1124 00000F42 91                  <1> 	xchg cx, ax			; cx = how much to copy from buffer start
  1125 00000F43 8B76FA              <1> 	mov si, word [bp + ?original_dst]	; -> start of buffer
  1126                              <1> 					; continue with di -> near start of buffer
  1127                              <1> .mov:
  1128 00000F46 E80700              <1> 	call .mov_and_put
  1129                              <1> 
  1130                              <1> .end:
  1131 00000F49 897EF6              <1> 	mov word [bp + ?dst], di
  1132 00000F4C F8                  <1> 	clc
  1133                              <1> .ret:
  1134 00000F4D C3                  <1> 	retn
  1135                              <1> 
  1136                              <1> .ret_CY:
  1137 00000F4E F9                  <1> 	stc
  1138 00000F4F C3                  <1> 	retn
  1139                              <1> 
  1140                              <1> .mov_and_put:
  1141 00000F50 1E                  <1> 	 push ds
  1142 00000F51 56                  <1> 	 push si
  1143 00000F52 06                  <1> 	push es
  1144 00000F53 57                  <1> 	push di
  1145 00000F54 51                  <1> 	push cx
  1146 00000F55 F3A4                <1> 	rep movsb
  1147 00000F57 59                  <1> 	pop cx
  1148 00000F58 5E                  <1> 	pop si
  1149 00000F59 1F                  <1> 	pop ds
  1150 00000F5A E88201              <1> 	call put_file_data
  1151 00000F5D 5E                  <1> 	 pop si
  1152 00000F5E 1F                  <1> 	 pop ds
  1153 00000F5F 01CE                <1> 	add si, cx
  1154 00000F61 C3                  <1> 	retn
  1155                              <1> 
  1156                              <1> 
  1157                              <1> %if _LZEXEDAT
  1158                              <1> 		; INP:	?src_remaining
  1159                              <1> 		;	dx / word [?tagword] = tag word
  1160                              <1> 		;	word [?tagbitscycle] = circular tag bits indicator
  1161                              <1> 		;	 (there's always a single bit set in this word.
  1162                              <1> 		;	 if this word is equal to 1 on INP then the tag
  1163                              <1> 		;	 word must be reloaded, and the last bit shifted
  1164                              <1> 		;	 out of the INP prior tag word.)
  1165                              <1> 		; OUT:	NC if read a zero,
  1166                              <1> 		;	CY if read a one,
  1167                              <1> 		;	 ?src_remaining decremented
  1168                              <1> 		;	 dx / word [?tagword] updated
  1169                              <1> 		;	 word [?tagbitscycle] updated
  1170                              <1> 		;	branches to depack.error on error
  1171                              <1> 		; CHG:	ds, si, ax
  1172                              <1> get_bit:
  1173 00000F62 D14EEE              <1> 	ror word [bp + ?tagbitscycle], 1
  1174 00000F65 7307                <1> 	jnc .left
  1175                              <1> 		; after this branch not taken, the cycle word
  1176                              <1> 		;  wraps around to be equal to 8000h. this
  1177                              <1> 		;  will wrap around again after 15 more ror.
  1178 00000F67 E80700              <1> 	call load_word
  1179                              <1> %if _DXTAG
  1180 00000F6A D1EA                <1> 	shr dx, 1
  1181 00000F6C 92                  <1> 	xchg dx, ax
  1182 00000F6D C3                  <1> 	retn
  1183                              <1> 
  1184                              <1> .left:
  1185 00000F6E D1EA                <1> 	shr dx, 1
  1186 00000F70 C3                  <1> 	retn
  1187                              <1> %else
  1188                              <1> 	shr word [bp + ?tagword], 1
  1189                              <1> 	mov word [bp + ?tagword], ax
  1190                              <1> 	retn
  1191                              <1> 
  1192                              <1> .left:
  1193                              <1> 	shr word [bp + ?tagword], 1
  1194                              <1> 	retn
  1195                              <1> %endif
  1196                              <1> 
  1197                              <1> 		; lodsw with ?src_remaining check
  1198                              <1> load_word:
  1199 00000F71 E80800              <1> 	call load_byte
  1200 00000F74 86C4                <1> 	xchg al, ah
  1201 00000F76 E80300              <1> 	call load_byte
  1202 00000F79 86C4                <1> 	xchg al, ah
  1203 00000F7B C3                  <1> 	retn
  1204                              <1> 
  1205                              <1> 		; lodsb with ?src_remaining check
  1206                              <1> load_byte:
  1207 00000F7C E82E00              <1> 	call read_byte
  1208                              <1> d0	mov byte [bp + ?errordata], 84h
  1209 00000F7F 7303E9EDFE          <1> 	jc depack.error
  1210 00000F84 C3                  <1> 	retn
  1211                              <1> %endif
  1212                              <1> 
  1213                              <1> %if _MULTI || !_LZEXEDAT
  1214                              <1> 		; INP:	cx = 0..15
  1215                              <1> 		;	dl = bit index, dh = current byte
  1216                              <1> 		; OUT:	NC if successful,
  1217                              <1> 		;	 ax = value read
  1218                              <1> 		;	 cx = 0
  1219                              <1> 		;	 dx updated
  1220                              <1> 		;	CY if error
  1221                              <1> 		; CHG:	ds, si
  1222                              <1> get_bits:
  1223                              <1> %ifn _DXTAG
  1224                              <1> 	push dx
  1225                              <1> 	mov dx, word [bp + ?low_bit_index_and_high_current_byte]
  1226                              <1> %endif
  1227 00000F85 83F90F              <1> 	cmp cx, 15
  1228 00000F88 7721                <1> 	ja .error
  1229 00000F8A 85C9                <1> 	test cx, cx
  1230 00000F8C 741D                <1> 	jz .error
  1231 00000F8E 31C0                <1> 	xor ax, ax
  1232                              <1> .loop:
  1233 00000F90 84D2                <1> 	test dl, dl
  1234 00000F92 750B                <1> 	jnz .havebit
  1235 00000F94 50                  <1> 	push ax
  1236 00000F95 E81500              <1> 	call read_byte
  1237 00000F98 88C6                <1> 	mov dh, al
  1238 00000F9A B280                <1> 	mov dl, 80h
  1239 00000F9C 58                  <1> 	pop ax
  1240 00000F9D 720C                <1> 	jc .error
  1241                              <1> .havebit:
  1242 00000F9F D1E0                <1> 	shl ax, 1
  1243 00000FA1 84D6                <1> 	test dh, dl
  1244 00000FA3 7401                <1> 	jz @F
  1245 00000FA5 40                  <1> 	inc ax
  1246                              <1> @@:
  1247 00000FA6 D0EA                <1> 	shr dl, 1
  1248 00000FA8 E2E6                <1> 	loop .loop
  1249                              <1> .end:
  1250 00000FAA A8                  <1> 	db __TEST_IMM8		; skip stc, NC
  1251                              <1> .error:
  1252 00000FAB F9                  <1> 	stc
  1253                              <1> %ifn _DXTAG
  1254                              <1> 	mov word [bp + ?low_bit_index_and_high_current_byte], dx
  1255                              <1> 	pop dx
  1256                              <1> %endif
  1257 00000FAC C3                  <1> 	retn
  1258                              <1> %endif
  1259                              <1> 
  1260                              <1> 
  1261                              <1> 		; INP:	?src_remaining
  1262                              <1> 		; OUT:	NC if success,
  1263                              <1> 		;	 al = value read
  1264                              <1> 		;	 ?src_remaining decremented
  1265                              <1> 		;	CY if error (source buffer too small),
  1266                              <1> 		;	 ?src_remaining = 0
  1267                              <1> 		; CHG:	ds, si
  1268                              <1> read_byte:
  1269 00000FAD 836EF201            <1> 	sub word [bp + ?src_remaining], 1
  1270 00000FB1 835EF400            <1> 	sbb word [bp + ?src_remaining + 2], 0
  1271 00000FB5 7204                <1> 	jb .empty
  1272                              <1> 
  1273 00000FB7 E8D800              <1> 	call get_file_byte
  1274 00000FBA C3                  <1> 	retn
  1275                              <1> 
  1276                              <1> .empty:
  1277 00000FBB 8366F200            <1> 	and word [bp + ?src_remaining], 0
  1278 00000FBF 8366F400            <1> 	and word [bp + ?src_remaining + 2], 0
  1279 00000FC3 F9                  <1> 	stc
  1280 00000FC4 C3                  <1> 	retn
  1281                              <1> 
  1282                              <1> 	lleave ctx
  1283                              <1> 
  1284                              <1> %if _MULTI
  1285                              <1> 	resetdef LONGLITERAL
  1286                              <1> 	resetdef LZEXEDAT
  1287                              <1> %endif
  1288                              <1> 
  1289                              <1> %ifn _STANDALONE
  1290                              <1> 	resetdef COUNTER
  1291                              <1> 	resetdef DEBUG0
  1292                              <1> 
  1293                              <1> 
  1294                              <1> read_and_depack:
  1295                              <1> 	houdini
  1296                              <1> 
  1297                              <1> 		; common setup for depacking
  1298 00000FC5 891E[D808]          <1> reloc	mov word [handle], bx
  1299                              <1> internaldatarelocation
  1300                              <1> 
  1301 00000FC9 8916[C806]          <1> reloc	mov word [depacked_buffer], dx
  1302                              <1> internaldatarelocation
  1303 00000FCD 8C06[CA06]          <1> reloc	mov word [depacked_buffer + 2], es
  1304                              <1> internaldatarelocation
  1305 00000FD1 890E[D006]          <1> reloc	mov word [depacked_length], cx
  1306                              <1> internaldatarelocation
  1307                              <1> 
  1308 00000FD5 D006[0200]          <1> reloc	rol byte [partialdepack], 1
  1309                              <1> internaldatarelocation
  1310 00000FD9 7335                <1> 	jnc .new
  1311                              <1> 		; did we save a prior partial depack ?
  1312 00000FDB 833E[0000]FF        <1> reloc	cmp word [depack_saved_sp], strict byte 0FFFFh
  1313                              <1> internaldatarelocation -3
  1314 00000FE0 742E                <1> 	je .new				; no -->
  1315 00000FE2 A1[C606]            <1> reloc	mov ax, word [depackseek + 2]
  1316                              <1> internaldatarelocation
  1317 00000FE5 3B06[C206]          <1> reloc	cmp ax, word [depackskip + 2]
  1318                              <1> internaldatarelocation
  1319 00000FE9 7507                <1> 	jne @F
  1320 00000FEB A1[C406]            <1> reloc	mov ax, word [depackseek]
  1321                              <1> internaldatarelocation
  1322 00000FEE 3B06[C006]          <1> reloc	cmp ax, word [depackskip]
  1323                              <1> internaldatarelocation
  1324                              <1> @@:
  1325 00000FF2 771C                <1> 	ja .new				; seek is > skip, must rewind -->
  1326                              <1> 
  1327 00000FF4 A1[C406]            <1> reloc	mov ax, word [depackseek]
  1328                              <1> internaldatarelocation
  1329 00000FF7 2906[C006]          <1> reloc	sub word [depackskip], ax
  1330                              <1> internaldatarelocation
  1331 00000FFB A1[C606]            <1> reloc	mov ax, word [depackseek + 2]
  1332                              <1> internaldatarelocation
  1333 00000FFE 1906[C206]          <1> reloc	sbb word [depackskip + 2], ax	; skip -= seek
  1334                              <1> internaldatarelocation
  1335                              <1> 
  1336 00001002 52                  <1> 	push dx
  1337 00001003 53                  <1> 	push bx
  1338 00001004 57                  <1> 	push di
  1339 00001005 56                  <1> 	push si
  1340 00001006 06                  <1> 	push es
  1341 00001007 55                  <1> 	push bp
  1342 00001008 51                  <1> 	push cx				; stack frame must match what .read expects
  1343                              <1> 
  1344 00001009 8926[D206]          <1> reloc	mov word [depack_prior_sp], sp
  1345                              <1> internaldatarelocation			; store our sp
  1346 0000100D E92F01              <1> 	jmp put_file_data.entry		; continue depacking
  1347                              <1> 
  1348                              <1> 
  1349                              <1> .new:
  1350 00001010 52                  <1> 	push dx
  1351 00001011 51                  <1> 	push cx
  1352 00001012 06                  <1> 	push es
  1353 00001013 8B16[B806]          <1> reloc	mov dx, word [libseek]
  1354                              <1> internaldatarelocation
  1355 00001017 8B0E[BA06]          <1> reloc	mov cx, word [libseek + 2]
  1356                              <1> internaldatarelocation
  1357 0000101B B80042              <1> 	mov ax, 4200h
  1358 0000101E E803FD              <1> 	call dos_or_boot_io
  1359 00001021 07                  <1> 	pop es
  1360 00001022 7269                <1> 	jc .io_error
  1361                              <1> 
  1362 00001024 C706[D408][D406]    <1> reloc2	mov word [filebuffer.next], filebuffer
  1363                              <1> internaldatarelocation -4
  1364                              <1> internaldatarelocation
  1365 0000102A C706[D608][D406]    <1> reloc2	mov word [filebuffer.tail], filebuffer
  1366                              <1> internaldatarelocation -4
  1367                              <1> internaldatarelocation
  1368                              <1> 
  1369 00001030 59                  <1> 	pop cx
  1370 00001031 5A                  <1> 	pop dx
  1371                              <1> 
  1372 00001032 31C0                <1> 	xor ax, ax
  1373 00001034 A3[C406]            <1> reloc	mov word [depackseek], ax
  1374                              <1> internaldatarelocation
  1375 00001037 A3[C606]            <1> reloc	mov word [depackseek + 2], ax
  1376                              <1> internaldatarelocation
  1377                              <1> 
  1378 0000103A 52                  <1> 	push dx
  1379 0000103B 53                  <1> 	push bx
  1380 0000103C 57                  <1> 	push di
  1381 0000103D 56                  <1> 	push si
  1382 0000103E 06                  <1> 	push es
  1383 0000103F 55                  <1> 	push bp
  1384 00001040 51                  <1> 	push cx
  1385 00001041 16                  <1> 	 push ss
  1386 00001042 07                  <1> 	 pop es
  1387 00001043 BF[E008]            <1> reloc	mov di, resultbuffer
  1388                              <1> internaldatarelocation
  1389 00001046 BE[E018]            <1> reloc	mov si, resultbuffer.end
  1390                              <1> internaldatarelocation
  1391                              <1> 
  1392 00001049 8B0E[B606]          <1> reloc	mov cx, word [libtab_compressed_length + 2]
  1393                              <1> internaldatarelocation
  1394 0000104D 8B16[B406]          <1> reloc	mov dx, word [libtab_compressed_length]
  1395                              <1> internaldatarelocation
  1396                              <1> 
  1397 00001051 8926[D206]          <1> reloc	mov word [depack_prior_sp], sp
  1398                              <1> internaldatarelocation
  1399 00001055 BC[FC02]            <1> reloc	mov sp, depack_stack.top
  1400                              <1> internaldatarelocation
  1401                              <1> %if _MULTI
  1402 00001058 A0[0300]            <1> reloc	mov al, byte [depack_format]
  1403                              <1> internaldatarelocation
  1404                              <1> %endif
  1405 0000105B E815FD              <1> 	call depack
  1406 0000105E C706[0000]FFFF      <1> reloc	mov word [depack_saved_sp], 0FFFFh
  1407                              <1> internaldatarelocation -4
  1408                              <1> .read:
  1409 00001064 16                  <1> 	 push ss
  1410 00001065 1F                  <1> 	 pop ds
  1411                              <1> 
  1412 00001066 FF36[C406]          <1> reloc	push word [depackseek]
  1413                              <1> internaldatarelocation
  1414 0000106A FF36[C606]          <1> reloc	push word [depackseek + 2]
  1415                              <1> internaldatarelocation
  1416 0000106E 8F06[C206]          <1> reloc	pop word [depackskip + 2]
  1417                              <1> internaldatarelocation
  1418 00001072 8F06[C006]          <1> reloc	pop word [depackskip]
  1419                              <1> internaldatarelocation
  1420                              <1> 
  1421 00001076 8B26[D206]          <1> reloc	mov sp, word [depack_prior_sp]
  1422                              <1> internaldatarelocation
  1423 0000107A 7209                <1> 	jc @F
  1424 0000107C A1[D006]            <1> reloc	mov ax, word [depacked_length]
  1425                              <1> internaldatarelocation
  1426 0000107F F7D8                <1> 	neg ax			; - remain
  1427 00001081 59                  <1> 	pop cx
  1428 00001082 01C8                <1> 	add ax, cx		; requested - remain = how much read
  1429 00001084 A8                  <1> 	db __TEST_IMM8		; skip pop, NC
  1430                              <1> @@:
  1431 00001085 59                  <1> 	pop cx
  1432 00001086 5D                  <1> 	pop bp
  1433 00001087 07                  <1> 	pop es
  1434 00001088 5E                  <1> 	pop si
  1435 00001089 5F                  <1> 	pop di
  1436 0000108A 5B                  <1> 	pop bx
  1437 0000108B 5A                  <1> 	pop dx
  1438 0000108C C3                  <1> 	retn
  1439                              <1> 
  1440                              <1> .io_error:
  1441 0000108D 83C404              <1> 	add sp, 4
  1442 00001090 F9                  <1> 	stc
  1443 00001091 C3                  <1> 	retn
  1444                              <1> 
  1445                              <1> 
  1446                              <1> get_file_byte:
  1447 00001092 368B36[D408]        <1> reloc	mov si, [ss:filebuffer.next]
  1448                              <1> internaldatarelocation
  1449 00001097 363B36[D608]        <1> reloc	cmp si, [ss:filebuffer.tail]
  1450                              <1> internaldatarelocation
  1451 0000109C 7238                <1> 	jb .buffered
  1452                              <1> 
  1453 0000109E 50                  <1> 	push ax
  1454 0000109F 53                  <1> 	push bx
  1455 000010A0 51                  <1> 	push cx
  1456 000010A1 52                  <1> 	push dx
  1457 000010A2 06                  <1> 	push es
  1458 000010A3 1E                  <1> 	push ds
  1459                              <1> 
  1460 000010A4 16                  <1> 	 push ss
  1461 000010A5 1F                  <1> 	 pop ds
  1462 000010A6 16                  <1> 	 push ss
  1463 000010A7 07                  <1> 	 pop es
  1464 000010A8 BA[D406]            <1> reloc	mov dx, filebuffer
  1465                              <1> internaldatarelocation
  1466 000010AB 8916[D408]          <1> reloc	mov [filebuffer.next], dx
  1467                              <1> internaldatarelocation
  1468 000010AF 8916[D608]          <1> reloc	mov [filebuffer.tail], dx
  1469                              <1> internaldatarelocation
  1470 000010B3 B8003F              <1> 	mov ax, 3F00h
  1471 000010B6 8B1E[D808]          <1> reloc	mov bx, [handle]
  1472                              <1> internaldatarelocation
  1473 000010BA B90002              <1> 	mov cx, filebuffer.end - filebuffer
  1474 000010BD E864FC              <1> 	call dos_or_boot_io
  1475 000010C0 720C                <1> 	jc @F			; CY -->
  1476 000010C2 85C0                <1> 	test ax, ax
  1477 000010C4 F9                  <1> 	stc			; CY
  1478 000010C5 7407                <1> 	jz @F
  1479 000010C7 01D0                <1> 	add ax, dx		; NC
  1480 000010C9 A3[D608]            <1> reloc	mov word [filebuffer.tail], ax
  1481                              <1> internaldatarelocation
  1482 000010CC 89D6                <1> 	mov si, dx
  1483                              <1> @@:
  1484 000010CE 1F                  <1> 	pop ds
  1485 000010CF 07                  <1> 	pop es
  1486 000010D0 5A                  <1> 	pop dx
  1487 000010D1 59                  <1> 	pop cx
  1488 000010D2 5B                  <1> 	pop bx
  1489 000010D3 58                  <1> 	pop ax
  1490 000010D4 7208                <1> 	jc .ret
  1491                              <1> .buffered:
  1492 000010D6 36AC                <1> 	ss lodsb
  1493 000010D8 368936[D408]        <1> reloc	mov [ss:filebuffer.next], si
  1494                              <1> internaldatarelocation
  1495 000010DD F8                  <1> 	clc
  1496                              <1> .ret:
  1497 000010DE C3                  <1> 	retn
  1498                              <1> 
  1499                              <1> 
  1500                              <1> 		; INP:	ds:si -> data to write
  1501                              <1> 		;	cx = length of data (may be zero)
  1502                              <1> 		; OUT:	Does not return if error
  1503                              <1> 		; CHG:	-
  1504                              <1> put_file_data:
  1505 000010DF 50                  <1> 	push ax
  1506 000010E0 53                  <1> 	push bx
  1507 000010E1 51                  <1> 	push cx
  1508 000010E2 52                  <1> 	push dx
  1509 000010E3 1E                  <1> 	push ds
  1510 000010E4 56                  <1> 	push si
  1511 000010E5 06                  <1> 	push es
  1512 000010E6 57                  <1> 	push di
  1513 000010E7 16                  <1> 	 push ss
  1514 000010E8 1F                  <1> 	 pop ds
  1515                              <1> .entry2:
  1516                              <1> %if 0
  1517                              <1> reloc	cmp word [depackseek], strict word 0AFh
  1518                              <1> internaldatarelocation -4
  1519                              <1> 	jne @F
  1520                              <1> reloc	cmp word [depackseek + 2], strict byte 0
  1521                              <1> internaldatarelocation -3
  1522                              <1> 	jne @F
  1523                              <1> 	houdini
  1524                              <1> @@:
  1525                              <1> %endif
  1526 000010E9 51                  <1> 	push cx			; put data length, add to depackseek maybe
  1527 000010EA 833E[C206]00        <1> reloc	cmp word [depackskip + 2], strict byte 0
  1528                              <1> internaldatarelocation -3
  1529 000010EF 755D                <1> 	jne .skip
  1530 000010F1 390E[C006]          <1> reloc	cmp word [depackskip], cx
  1531                              <1> internaldatarelocation
  1532 000010F5 7357                <1> 	jae .skip		; still have to skip -->
  1533 000010F7 31D2                <1> 	xor dx, dx
  1534 000010F9 8716[C006]          <1> reloc	xchg dx, word [depackskip]
  1535                              <1> internaldatarelocation		; how much to skip in this step
  1536                              <1> 				; dx = how many bytes skipped
  1537 000010FD 01D6                <1> 	add si, dx		; -> data to copy (part of put data)
  1538 000010FF 29D1                <1> 	sub cx, dx		; data - skip = length of data to copy, at least 1
  1539 00001101 7454                <1> 	jz .ret_cx		; (not needed ?)
  1540 00001103 51                  <1> 	push cx			; = how many bytes left at si
  1541 00001104 C43E[C806]          <1> reloc	les di, [depacked_buffer]
  1542                              <1> internaldatarelocation
  1543 00001108 A1[D006]            <1> reloc	mov ax, word [depacked_length]
  1544                              <1> internaldatarelocation		; how much we want to read
  1545 0000110B 39C8                <1> 	cmp ax, cx
  1546 0000110D 7302                <1> 	jae @F
  1547 0000110F 89C1                <1> 	mov cx, ax		; cx = min(ax, cx) lesser of requested, available
  1548                              <1> @@:
  1549 00001111 89C8                <1> 	mov ax, cx		; how much we want to copy
  1550 00001113 F3A4                <1> 	rep movsb		; copy to user buffer, si -> data left if any
  1551                              <1> 
  1552 00001115 893E[C806]          <1> reloc	mov word [depacked_buffer], di
  1553                              <1> internaldatarelocation		; -> past copied data
  1554 00001119 2906[D006]          <1> reloc	sub word [depacked_length], ax
  1555                              <1> internaldatarelocation		; decrement count of how much still wanted
  1556                              <1> 		; this is NZ only if available < requested
  1557 0000111D 59                  <1> 	pop cx			; = how many bytes left at prior si -> data just copied
  1558 0000111E 7537                <1> 	jnz .ret_cx		; go add full length of put data to depackseek
  1559 00001120 01C2                <1> 	add dx, ax		; how many bytes processed (skipped + copied)
  1560 00001122 0116[C406]          <1> reloc	add word [depackseek], dx
  1561                              <1> internaldatarelocation
  1562 00001126 8316[C606]00        <1> reloc	adc word [depackseek + 2], strict byte 0
  1563                              <1> internaldatarelocation -3	; add to seek the last bit processed
  1564 0000112B 5A                  <1> 	pop dx			; discard cx on stack
  1565 0000112C 29C1                <1> 	sub cx, ax		; = how many bytes left after new si ->
  1566 0000112E 890E[CC06]          <1> reloc	mov word [depack_left_length], cx
  1567                              <1> internaldatarelocation		; = amount data left after new si ->
  1568 00001132 8936[CE06]          <1> reloc	mov word [depack_left_address], si
  1569                              <1> internaldatarelocation		; at current depackseek -> data left if any
  1570 00001136 55                  <1> 	push bp
  1571 00001137 8926[0000]          <1> reloc	mov word [depack_saved_sp], sp
  1572                              <1> internaldatarelocation
  1573 0000113B F8                  <1> 	clc
  1574 0000113C E925FF              <1> 	jmp read_and_depack.read
  1575                              <1> 
  1576                              <1> .entry:
  1577 0000113F 8B26[0000]          <1> reloc	mov sp, word [depack_saved_sp]
  1578                              <1> internaldatarelocation
  1579 00001143 5D                  <1> 	pop bp
  1580 00001144 8B0E[CC06]          <1> reloc	mov cx, word [depack_left_length]
  1581                              <1> internaldatarelocation
  1582 00001148 8B36[CE06]          <1> reloc	mov si, word [depack_left_address]
  1583                              <1> internaldatarelocation
  1584 0000114C EB9B                <1> 	jmp .entry2
  1585                              <1> 
  1586                              <1> .skip:
  1587 0000114E 290E[C006]          <1> reloc	sub word [depackskip], cx
  1588                              <1> internaldatarelocation
  1589 00001152 831E[C206]00        <1> reloc	sbb word [depackskip + 2], strict byte 0
  1590                              <1> internaldatarelocation -3
  1591                              <1> 
  1592                              <1> .ret_cx:
  1593 00001157 59                  <1> 	pop cx
  1594 00001158 010E[C406]          <1> reloc	add word [depackseek], cx
  1595                              <1> internaldatarelocation
  1596 0000115C 8316[C606]00        <1> reloc	adc word [depackseek + 2], strict byte 0
  1597                              <1> internaldatarelocation -3
  1598                              <1> 
  1599                              <1> .ret:
  1600 00001161 5F                  <1> 	pop di
  1601 00001162 07                  <1> 	pop es
  1602 00001163 5E                  <1> 	pop si
  1603 00001164 1F                  <1> 	pop ds
  1604 00001165 5A                  <1> 	pop dx
  1605 00001166 59                  <1> 	pop cx
  1606 00001167 5B                  <1> 	pop bx
  1607 00001168 58                  <1> 	pop ax
  1608 00001169 C3                  <1> 	retn
  1609                              <1> %endif
  2199                                  %endif
  2200                                  
  2201                                  
  2202                                  get_es_ext:
  2203 0000116A 8E06[0000]              reloc	mov es, word [relocateddata]
  2204                                  linkdatarelocation extdssel
  2205 0000116E E89700                  	extcallcall ispm
  2206 00001171 7404                    	jz @F
  2207 00001173 8E06[0000]              reloc	mov es, word [relocateddata]
  2208                                  linkdatarelocation extseg
  2209                                  @@:
  2210 00001177 C3                      	retn
  2211                                  
  2212                                  
  2213                                  start:
  2214 00001178 8CC3                    	mov bx, es
  2215 0000117A 16                      	 push ss
  2216 0000117B 07                      	 pop es
  2217 0000117C E80901                  	extcallcall skipcomma
  2218 0000117F E8AE00                  	extcallcall iseol?
  2219 00001182 7409                    	je .help
  2220 00001184 E899EE                  	call run
  2221                                  @@:
  2222 00001187 E80B00                  	call uninstall_oneshot
  2223 0000118A 31C0                    	xor ax, ax
  2224 0000118C CB                      	retf
  2225                                  
  2226                                  .help:
  2227 0000118D BA[FB01]                reloc	mov dx, msg.help
  2228                                  internaldatarelocation
  2229 00001190 E84D00                  	extcallcall putsz
  2230 00001193 EBF2                    	jmp @B
  2231                                  
  2232                                  
  2233                                  uninstall_oneshot:
  2234 00001195 36F606[0000]01          reloc	testopt [ss:relocateddata], 1
  2235                                  linkdatarelocation options7, -3
  2236 0000119B 751A                    	jnz @F
  2237                                  
  2238 0000119D 2EA1[0200]              reloc	mov ax, word [cs:code + eldiEndCode]
  2239                                  internalcoderelocation
  2240 000011A1 2E2B06[0000]            reloc	sub ax, word [cs:code + eldiStartCode]
  2241                                  internalcoderelocation
  2242 000011A6 2906[0000]              reloc	sub word [relocateddata], ax
  2243                                  linkdatarelocation extseg_used
  2244                                  
  2245 000011AA 2EA1[0600]              reloc	mov ax, word [cs:code + eldiEndData]
  2246                                  internalcoderelocation
  2247 000011AE 2E2B06[0400]            reloc	sub ax, word [cs:code + eldiStartData]
  2248                                  internalcoderelocation
  2249 000011B3 2906[0000]              reloc	sub word [relocateddata], ax
  2250                                  linkdatarelocation extdata_used
  2251                                  @@:
  2252 000011B7 C3                      	retn
  2253                                  
  2254                                  
  2255                                  DATAOFFSET equ CODEOFFSET + code_size
  2256                                  	addsection DATA, follows=CODE vstart=_ELD_DATA_VSTART
  2257                                  %define DATAFIXUP - datastart + 0
  2258                                  datastart:
  2259                                  PUT_ELD_DATETIME
  2260                                  
  2261                                  %if _COMPRESSED
  2262                                  	align 2, db 0
  2263 00000000 FFFF                    depack_saved_sp:	dw 0FFFFh
  2264 00000002 FF                      partialdepack:		db 0FFh
  2265 00000003 00                      depack_format:		db 0
  2266                                  %endif
  2267                                  
  2268 00000004 00                      findhandle_set:		db 0
  2269 00000005 00                      found:			db 0
  2270 00000006 00                      verbose:		db 0
  2271 00000007 00                      do_help:		db 0
  2272 00000008 00                      prefersfn:		db 0
  2273 00000009 00                      lib:			db 0
  2274 0000000A 00                      libname:		db 0
  2275                                  
  2276                                  msg:
  2277 0000000B 564552424F534500        .verbose:		asciz "VERBOSE"
  2278 00000013 48454C5000              .string_help:		asciz "HELP"
  2279 00000018 53464E00                .string_sfn:		asciz "SFN"
  2280 0000001C 4C494200                .string_lib:		asciz "LIB"
  2281 00000020 3A2000                  .colon:			asciz ": "
  2282 00000023 46696C65206E6F7420-     .notfound:		asciz "File not found.",13,10
  2282 0000002C 666F756E642E0D0A00 
  2283 00000035 4E6F20646573637269-     .nodesc:		asciz "No description.",13,10
  2283 0000003E 7074696F6E2E0D0A00 
  2284 00000047 4E6F2068656C702E0D-     .nohelp:		asciz "No help.",13,10
  2284 00000050 0A00               
  2285 00000052 48454C505354415254-     .helpstart:		asciz "HELPSTART"
  2285 0000005B 00                 
  2286                                  .helpstart.length equ $ - 1 - .helpstart
  2287 0000005C 48454C50454E4400        .helpend:		asciz "HELPEND"
  2288                                  .helpend.length equ $ - 1 - .helpend
  2289 00000064 4C49535420454C4420-     .io_error:		asciz "LIST ELD got I/O error.",13,10
  2289 0000006D 676F7420492F4F2065-
  2289 00000076 72726F722E0D0A00   
  2290                                  %if _COMPRESSED
  2291 0000007E 4C49535420454C4420-     .doublepacked_error:	asciz "LIST ELD cannot recurse into nested compressed library ELDs.",13,10
  2291 00000087 63616E6E6F74207265-
  2291 00000090 637572736520696E74-
  2291 00000099 6F206E657374656420-
  2291 000000A2 636F6D707265737365-
  2291 000000AB 64206C696272617279-
  2291 000000B4 20454C44732E0D0A00 
  2292                                  %endif
  2293 000000BD 1B222E20496E76616C-     .invalid_instance:	counted '". Invalid instance header.'
  2293 000000C6 696420696E7374616E-
  2293 000000CF 636520686561646572-
  2293 000000D8 2E                 
  2294 000000D9 4E6F206F7220696E76-     .invalid:		db "No or invalid Extension for lDebug header."
  2294 000000E2 616C69642045787465-
  2294 000000EB 6E73696F6E20666F72-
  2294 000000F4 206C44656275672068-
  2294 000000FD 65616465722E       
  2295 00000103 0D0A00                  .linebreak:		asciz 13,10
  2296 00000106 4E6F206F7220696E76-     .invalid_sld:		asciz "No or invalid Script/Extension for lDebug header.",13,10
  2296 0000010F 616C69642053637269-
  2296 00000118 70742F457874656E73-
  2296 00000121 696F6E20666F72206C-
  2296 0000012A 446562756720686561-
  2296 00000133 6465722E0D0A00     
  2297 0000013A 0B2020466F726D6174-     .verbose.1:	counted "  Format: ",'"'
  2297 00000143 3A2022             
  2298 00000146 0E222C20454C44206E-     .verbose.2:	counted '", ELD name: "'
  2298 0000014F 616D653A2022       
  2299 00000155 0720636F64652C20        .verbose.3:	counted " code, "
  2300 0000015D 0820616C6C6F632C20      .verbose.4:	counted " alloc, "
  2301 00000166 0720646174612C20        .verbose.5:	counted " data, "
  2302 0000016E 0620616C6C6F63          .verbose.6:	counted " alloc"
  2303 00000175 0D222C2066696C6520-     .verbose.2.sld:	counted '", file size '
  2303 0000017E 73697A6520         
  2304 00000183 06206279746573          .verbose.3.sld:	counted " bytes"
  2305 0000018A 1320204C6962726172-     .verbose.lib.1:	counted "  Library contains "
  2305 00000193 7920636F6E7461696E-
  2305 0000019C 7320               
  2306 0000019E 0E20454C44732C2066-     .verbose.lib.2:	counted " ELDs, format "
  2306 000001A7 6F726D617420       
  2307 000001AD 0F2028756E636F6D70-     .verbose.lib.3.un:	counted " (uncompressed)"
  2307 000001B6 72657373656429     
  2308 000001BD 0D2028686561747368-     .verbose.lib.3.hs:	counted " (heatshrink)"
  2308 000001C6 72696E6B29         
  2309 000001CB 0E20286C7A65786564-     .verbose.lib.3.lze:	counted " (lzexedat -4)"
  2309 000001D4 6174202D3429       
  2310 000001DA 1120286C7A65786564-     .verbose.lib.3.lzel:	counted " (lzexedat -4 -l)"
  2310 000001E3 6174202D34202D6C29 
  2311 000001EC 0E2C207061636B6564-     .verbose.lib.4:	counted ", packed size "
  2311 000001F5 2073697A6520       
  2312                                  
  2313                                  depack_stack: equ $
  2314                                  
  2315 000001FB 52756E207769746820-     .help:		db "Run with a pathname as parameter.",13,10
  2315 00000204 6120706174686E616D-
  2315 0000020D 652061732070617261-
  2315 00000216 6D657465722E0D0A   
  2316 0000021E 4C61737420636F6D70-     		db "Last component may include wildcards.",13,10
  2316 00000227 6F6E656E74206D6179-
  2316 00000230 20696E636C75646520-
  2316 00000239 77696C646361726473-
  2316 00000242 2E0D0A             
  2317 00000245 0D0A                    		db 13,10
  2318 00000247 416674657220746865-     		db "After the pathname, keywords may follow:",13,10
  2318 00000250 20706174686E616D65-
  2318 00000259 2C206B6579776F7264-
  2318 00000262 73206D617920666F6C-
  2318 0000026B 6C6F773A0D0A       
  2319 00000271 09564552424F534509-     		db 9,"VERBOSE",9,"Display ELD format, name, sizes",13,10
  2319 0000027A 446973706C61792045-
  2319 00000283 4C4420666F726D6174-
  2319 0000028C 2C206E616D652C2073-
  2319 00000295 697A65730D0A       
  2320 0000029B 0948454C5009446973-     		db 9,"HELP",9,"Display ELD help",13,10
  2320 000002A4 706C617920454C4420-
  2320 000002AD 68656C700D0A       
  2321 000002B3 0953464E0955736520-     		db 9,"SFN",9,"Use DOS SFN search even if LFN available",13,10
  2321 000002BC 444F532053464E2073-
  2321 000002C5 656172636820657665-
  2321 000002CE 6E206966204C464E20-
  2321 000002D7 617661696C61626C65-
  2321 000002E0 0D0A               
  2322 000002E2 094C49420952656375-     		db 9,"LIB",9,"Recurse into library ELDs",13,10
  2322 000002EB 72736520696E746F20-
  2322 000002F4 6C6962726172792045-
  2322 000002FD 4C44730D0A         
  2323 00000302 092F6E616D65094F6E-     		db 9,"/name",9,"Only display library ELDs matching the name",13,10
  2323 0000030B 6C7920646973706C61-
  2323 00000314 79206C696272617279-
  2323 0000031D 20454C4473206D6174-
  2323 00000326 6368696E6720746865-
  2323 0000032F 206E616D650D0A     
  2324 00000336 00                      		asciz
  2325                                  
  2326                                  uinit_data: equ $
  2327                                  
  2328 00000337 00<rep 9h>              	align 16, db 0
  2329                                  init_data_end:
  2330                                  data_size equ $ - datastart
  2331                                  transient_data_size equ data_size
  2332                                  
  2333                                  %if _COMPRESSED
  2334                                  	absolute depack_stack
  2335 000001FB ??                      	alignb 2
  2336 000001FC <res 100h>              		resb 256
  2337                                  depack_stack.top:
  2338                                  
  2339                                   %if uinit_data > depack_stack.top
  2340                                  	absolute uinit_data
  2341                                   %endif
  2342                                  %else
  2343                                  	absolute uinit_data
  2344                                  %endif
  2345                                  
  2346 00000337 ??                      	alignb 2
  2347 00000338 ????????????????        libnamebuffer:	resb 8
  2348                                  wild_pattern:		; overlaps next variable
  2349                                  boot_parsed:	equ $+2	; overlaps next variable
  2350 00000340 ????????                originaldta:	resd 1
  2351 00000344 ????                    originalinject:	resw 1
  2352                                  findnext_function_number:
  2353 00000346 ????                    		resw 1
  2354 00000348 ????                    findhandle:	resw 1
  2355 0000034A <res 1Eh>               dta:		resb 1Eh
  2356 00000368 <res Dh>                .name:		resb 13
  2357                                  
  2358 00000375 ??                      	alignb 2
  2359 00000376 <res 200h>              pathnamebuffer:	resb 512
  2360                                  
  2361 00000576 <res 2Ch>               finddata:	resb 2Ch
  2362 000005A2 <res 104h>              .fullname:	resb 260
  2363 000006A6 <res Eh>                .shortname:	resb 14
  2364                                  
  2365                                  %if _COMPRESSED
  2366                                  	alignb 2
  2367                                  libtab_compressed_length:
  2368 000006B4 ????????                		resd 1
  2369 000006B8 ????????                libseek:	resd 1
  2370 000006BC ????????                eldheader:	resd 1
  2371 000006C0 ????????                depackskip:	resd 1
  2372 000006C4 ????????                depackseek:	resd 1
  2373 000006C8 ????????                depacked_buffer:resd 1
  2374 000006CC ????                    depack_left_length:	resw 1
  2375 000006CE ????                    depack_left_address:	resw 1
  2376 000006D0 ????                    depacked_length:resw 1
  2377 000006D2 ????                    depack_prior_sp:resw 1
  2378                                  	alignb 2
  2379 000006D4 <res 200h>              filebuffer:	resb 512
  2380                                  .end:
  2381                                  	alignb 2
  2382 000008D4 ????                    .next:		resw 1
  2383 000008D6 ????                    .tail:		resw 1
  2384 000008D8 ????                    handle:		resw 1
  2385                                  
  2386 000008DA ????????????            	alignb 16
  2387                                  resultbuffer:
  2388                                  .size equ 4096
  2389 000008E0 <res 1000h>             		resb .size
  2390                                  .end:
  2391                                  %endif
  2392                                  
  2393                                  	alignb 16
  2394                                  uinit_data_end:
  2395                                  
  2396                                  total_data_size equ $ - datastart
  2397                                  %assign _DATA_SIZE total_data_size
  2398                                  
  2399                                  	usesection CODE
  2400                                  
  2401                                  %include "eldlink.asm"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> Extensions for lDebug linker
     4                              <1> 
     5                              <1> Copyright (C) 2008-2025 E. C. Masloch
     6                              <1> 
     7                              <1> Usage of the works is permitted provided that this
     8                              <1> instrument is retained with the works, so that any entity
     9                              <1> that uses the works is notified of this instrument.
    10                              <1> 
    11                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <1> 
    13                              <1> %endif
    14                              <1> 
    15                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
    16                              <1> %include "eld.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2025 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELD_MAC
    16                              <2> %define ELD_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
    19                              <2> 
    20                              <2> 		; ELD executable header
    21                              <2> 	struc ELD_HEADER
    22                              <2> eldhSignature:		resb 4	; "ELD1"
    23                              <2> 			resb 3	; reserved
    24                              <2> 			resb 1	; 26 (Ctrl-Z)
    25                              <2> eldhCodeOffset:		resd 1	; position displacement from eldhSignature
    26                              <2> eldhCodeImageLength:	resw 1	; amount bytes, at least 32
    27                              <2> eldhCodeAllocLength:	resw 1	; amount bytes, added to prior. sum < 64 KiB
    28                              <2> eldhDataOffset:		resd 1
    29                              <2> eldhDataImageLength:	resw 1	; (zero allowed)
    30                              <2> eldhDataAllocLength:	resw 1	; (zero allowed)
    31                              <2> eldhCodeEntrypoint:	resw 1	; within code section, used as displacement
    32                              <2> eldhReserved:		resb 4	; reserved
    33                              <2> eldhExtensionSize:	resw 1	; from eldhSignature, -> past eldhx fields in use
    34                              <2> 	endstruc
    35                              <2> 	endarea ELD_HEADER, 1
    36                              <2> 
    37                              <2> 	struc ELD_HEADERX
    38                              <2> eldhxHeader:		resb ELD_HEADER_size
    39                              <2> eldhxDescriptionOffset:	resd 1	; zero if none, from eldhxHeader. <= 128 Bytes
    40                              <2> eldhxHelpOffset:	resd 1	; zero if none, from eldhxHeader
    41                              <2> eldhxLibTable:		resd 1	; zero if none, from eldhxHeader
    42                              <2> eldhxDateTimeOffset:	resd 1	; zero if none, from eldhxHeader
    43                              <2> 	alignb 16
    44                              <2> 	endstruc
    45                              <2> 
    46                              <2> 	struc ELD_TRAILER_HEADER
    47                              <2> eldthSignature:		resb 8	; "ELD1TAIL"
    48                              <2> eldthHeaderOffset:	resd 1	; negative displacement from eldthSignature,
    49                              <2> 				;  add this dword to the seek offset
    50                              <2> eldthReserved:		resw 1	; reserved, must be initialised to zero
    51                              <2> eldthChecksum:		resw 1	; sum of all words in trailer header = 0
    52                              <2> 	endstruc
    53                              <2> 	endarea ELD_TRAILER_HEADER, 1
    54                              <2> 
    55                              <2> 	struc ELD_LIBTABLE
    56                              <2> eldltFormat:		resw 1
    57                              <2> 	; 0 = uncompressed
    58                              <2> 	; 2 = heatshrink compressed
    59                              <2> 	; 3 = lzexedat -4 compressed
    60                              <2> 	; 4 = lzexedat -4 -l compressed
    61                              <2> eldltAmount:		resw 1
    62                              <2> eldltOffset:		resd 1	; from eldhxHeader
    63                              <2> eldltCompressedLength:		; (dword, only present if format 2, 3, or 4)
    64                              <2> 	endstruc
    65                              <2> 	endarea ELD_LIBTABLE, 1
    66                              <2> 
    67                              <2> 		; ELD instance header
    68                              <2> 	struc ELD_INSTANCE
    69                              <2> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    70                              <2> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    71                              <2> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    72                              <2> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    73                              <2> eldiIdentifier:		resb 8	; blank-filled text
    74                              <2> eldiFlags:		resw 1	; flags
    75                              <2> eldiListing_size equ 14
    76                              <2> eldiListing:		resb eldiListing_size
    77                              <2> 				; ASCIZ listing file name
    78                              <2> 	endstruc
    79                              <2> 		; flags for eldiFlags:
    80                              <2> eldifResident:		equ 1
    81                              <2> 
    82                              <2> 		; ELD link info header
    83                              <2> 	struc ELD_LINKINFO
    84                              <2> eldlSignature:		resw 1	; 0E1D1h
    85                              <2> eldlReserved:		resw 2
    86                              <2> eldlUseLinkHash:	resw 1
    87                              <2> eldlDataAmount:		resw 1
    88                              <2> eldlDataPrefixes:	resw 1
    89                              <2> eldlDataEntries:	resw 1
    90                              <2> eldlDataAddresses:	resw 1
    91                              <2> eldlCodeAmount:		resw 1
    92                              <2> eldlCodePrefixes:	resw 1
    93                              <2> eldlCodeEntries:	resw 1
    94                              <2> eldlCodeAddresses:	resw 1
    95                              <2> 	endstruc
    96                              <2> 
    97                              <2> 	numdef ELD_CODE_VSTART, 9001h
    98                              <2> 	numdef ELD_DATA_VSTART, 8000h
    99                              <2> 	numdef ELD_RELOC_VSTART, 8000h
   100                              <2> 
   101                              <2> 	numdef ELD_RECLAIM_HINT, 0
   102                              <2> 	strdef ELD_LISTING, ""
   103                              <2> 	numdef ELD_DATETIME, 0
   104                              <2> 
   105                              <2> %if _ELD_DATETIME
   106                              <2>  %define PUT_ELDHX_DATETIME_OFFSET at eldhxDateTimeOffset, dd DATAOFFSET + datetime - datastart
   107                              <2>  %macro PUT_ELD_DATETIME 0.nolist
   108                              <2> datetime:	asciz __UTC_DATE__,'T',__UTC_TIME__,'Z'
   109                              <2> 		asciz		; for future extension
   110                              <2>  %endmacro
   111                              <2> %else
   112                              <2>  %define PUT_ELDHX_DATETIME_OFFSET
   113                              <2>  %define PUT_ELD_DATETIME
   114                              <2> %endif
   115                              <2> 
   116                              <2> %endif
    17                              <1> 
    18                              <1> 	cpu 8086
    19                              <1> 
    20                              <1> %if ELDSTRICT
    21                              <1>  %if ELDSTRICTCOUNTER
    22                              <1>   %error Missing relocation
    23                              <1>  %endif
    24                              <1> %endif
    25                              <1> 	eldstrict off		; linker does some relocations
    26                              <1> 
    27                              <1> %ifn ELDCALLCALL_DUMPED
    28 000011B8 E8[0000]EB020000C3- <1> 	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
    28 000011C0 E8[0000]EB020000C3- <1>
    28 000011C8 E8[0000]EB020000C3- <1>
    28 000011D0 E8[0000]EB020000C3- <1>
    28 000011D8 E8[0000]EB020000C3- <1>
    28 000011E0 E8[0000]EB020000C3- <1>
    28 000011E8 E8[0000]EB020000C3- <1>
    28 000011F0 E8[0000]EB020000C3- <1>
    28 000011F8 E8[0000]EB020000C3- <1>
    28 00001200 E8[0000]EB020000C3- <1>
    28 00001208 E8[0000]EB020000C3- <1>
    28 00001210 E8[0000]EB020000C3- <1>
    28 00001218 E8[0000]EB020000C3- <1>
    28 00001220 E8[0000]EB020000C3- <1>
    28 00001228 E8[0000]EB020000C3- <1>
    28 00001230 E8[0000]EB020000C3- <1>
    28 00001238 E8[0000]EB020000C3- <1>
    28 00001240 E8[0000]EB020000C3- <1>
    28 00001248 E8[0000]EB020000C3- <1>
    28 00001250 E8[0000]EB020000C3- <1>
    28 00001258 E8[0000]EB020000C3- <1>
    28 00001260 E8[0000]EB020000C3- <1>
    28 00001268 E8[0000]EB020000C3- <1>
    28 00001270 E8[0000]EB020000C3- <1>
    28 00001278 E8[0000]EB020000C3- <1>
    28 00001280 E8[0000]EB020000C3- <1>
    28 00001288 E8[0000]EB020000C3  <1>
    29                              <1> %endif
    30                              <1> 
    31                              <1> 	numdef ELD_IDENTICALISE, 0
    32                              <1> 	numdef ELD_DEBUG, 0
    33                              <1> 	numdef ELD_LINKER_PASSES, 1
    34                              <1> 	strdef LISTING, _ELD_LISTING
    35                              <1> 	numdef ELDCALL_OPTIONAL, ELDCALL_OPTIONAL_STATUS
    36                              <1> 	numdef ELDDATA_OPTIONAL, ELDDATA_OPTIONAL_STATUS
    37                              <1> %if _ELD_IDENTICALISE
    38                              <1>  ;%assign _ELDCALL_OPTIONAL 1
    39                              <1> %endif
    40                              <1> %ifn _ELDCALL_OPTIONAL
    41                              <1> %assign ELDCALL_OPTIONAL_STATUS 2		; not allowed
    42                              <1> %endif
    43                              <1> ;%ifn _ELDDATA_OPTIONAL
    44                              <1> ;%assign ELDDATA_OPTIONAL_STATUS 2		; not allowed
    45                              <1> ;%endif
    46                              <1> 	gendef MAP, ""
    47                              <1> 
    48                              <1> %ifnidni _MAP, ""
    49                              <1>  [map all _MAP]
    50                              <1> %endif
    51                              <1> 
    52                              <1> 
    53                              <1> endresident: equ ($ + _CURRENT_SECTION %+ FIXUP + 15) & ~15
    54                              <1> 
    55                              <1> %if _ELD_LINKER_PASSES
    56                              <1> %assign ELDLINKER 1
    57                              <1> 
    58                              <1> 	struc LINKTABLE
    59 00000000 ????????            <1> ltCodeToCode:	resw 2
    60 00000004 ????????            <1> ltCodeToData:	resw 2
    61 00000008 ????????            <1> ltDataToCode:	resw 2
    62 0000000C ????????            <1> ltDataToData:	resw 2
    63 00000010 ????????            <1> ltLinkData:	resw 2
    64 00000014 ????????            <1> ltLinkCode:	resw 2
    65                              <1> 	endstruc
    66                              <1> %endif
    67                              <1> 
    68                              <1> 
    69                              <1> linker:
    70                              <1> 		; The first 15 Bytes of the linker should be
    71                              <1> 		;  the same regardless of the linker options
    72                              <1> 		;  used (debug, passes, vstart). This allows
    73                              <1> 		;  the eldcomp ELD to match even if up to 15
    74                              <1> 		;  Bytes of the linker are trailing in the
    75                              <1> 		;  resident part of the ELD.
    76                              <1> 	lframe
    77                              <1>  %if ELDOTHER
    78                              <1> 	lvar dword, linkinfo_other
    79                              <1> 	lvar word, use_hash_other
    80                              <1>  %endif
    81 00001290 5589E5              <1> 	lenter
    82                              <1> 	lvar dword, instance
    83 00001293 06                  <1> 	 push es
    84 00001294 52                  <1> 	 push dx
    85                              <1> 	lvar word, targetsection_low_optional_high
    86 00001295 50                  <1> 	 push ax
    87                              <1> 	lequ ?targetsection_low_optional_high, targetsection
    88                              <1> 	lequ ?targetsection_low_optional_high + 1, optional
    89                              <1> 	lvar dword, linkinfo
    90 00001296 1E                  <1> 	 push ds
    91 00001297 57                  <1> 	 push di
    92                              <1> 	lvar dword, nextreloc
    93 00001298 06                  <1> 	 push es
    94 00001299 52                  <1> 	 push dx
    95                              <1> 	lvar dword, entry
    96 0000129A 06                  <1> 	 push es
    97 0000129B 50                  <1> 	 push ax		; placeholder
    98 0000129C 31C0                <1> 	xor ax, ax
    99 0000129E 813DD1E1            <1> 	cmp word [di + eldlSignature], 0E1D1h
   100                              <1> %if ($ - linker) < 16
   101                              <1>  %error Expected invariant first paragraph of linker
   102                              <1> %endif
   103 000012A2 7403E98C02          <1> 	jne .error_j
   104 000012A7 837D0601            <1> 	cmp word [di + eldlUseLinkHash], 1
   105 000012AB 7603E98302          <1> 	ja .error_j
   106 000012B0 7201                <1> 	jb @F
   107 000012B2 48                  <1> 	dec ax
   108                              <1> @@:
   109                              <1> 	lvar word, use_hash
   110 000012B3 50                  <1> 	 push ax
   111                              <1> %if _ELD_IDENTICALISE && _ELD_LINKER_PASSES
   112                              <1> 	mov ax, linktable - code
   113                              <1> 	lvar word, lt
   114                              <1> 	 push ax
   115                              <1> %endif
   116                              <1> %if _ELD_LINKER_PASSES || ELDOTHER
   117 000012B4 31C0                <1> 	xor ax, ax
   118                              <1>  %if _ELD_LINKER_PASSES
   119                              <1> 	lvar word, pass
   120 000012B6 50                  <1> 	 push ax
   121                              <1> 	lvar word, amounterrors
   122 000012B7 50                  <1> 	 push ax
   123                              <1> 	lvar word, name
   124 000012B8 50                  <1> 	 push ax
   125                              <1>  %endif
   126                              <1>  %if ELDOTHER
   127                              <1> 	lvar word, other
   128                              <1> 	 push ax
   129                              <1>  %endif
   130                              <1> %endif
   131 000012B9 56                  <1> 	push si
   132 000012BA 53                  <1> 	push bx
   133                              <1> 
   134                              <1> 			; simple: add instance base (dx) to code
   135 000012BB 06                  <1> 	push es
   136 000012BC 1F                  <1> 	pop ds
   137                              <1> %if _ELD_LINKER_PASSES
   138                              <1> .pass:
   139 000012BD 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   140 000012C0 01D3                <1> 	add bx, dx
   141                              <1>  %if _ELD_IDENTICALISE
   142                              <1> 	add bx, word [bp + ?lt]
   143                              <1> 	mov si, word [ltCodeToCode + bx]
   144                              <1>  %else
   145 000012C2 8BB72417            <1> 	mov si, word [linktable - code + ltCodeToCode + bx]
   146                              <1>  %endif
   147                              <1> %else
   148                              <1> 	mov si, internalcodetocoderelocations - code
   149                              <1> %endif
   150 000012C6 01D6                <1> 	add si, dx
   151                              <1> @@:
   152 000012C8 AD                  <1> 	lodsw
   153 000012C9 85C0                <1> 	test ax, ax		; was last ?
   154 000012CB 740B                <1> 	jz @F			; yes -->
   155 000012CD 93                  <1> 	xchg bx, ax		; bx = entry
   156 000012CE 01D3                <1> 	add bx, dx		; relocate the entry itself
   157                              <1> %if _ELD_CODE_VSTART
   158 000012D0 812F[0000]          <1> 	sub word [bx], code	; undo adjustment
   159                              <1> %endif
   160 000012D4 0117                <1> 	add word [bx], dx	; relocate word referenced by entry
   161 000012D6 EBF0                <1> 	jmp @B
   162                              <1> 
   163                              <1> @@:
   164                              <1> 			; next, add heap data base (on stack) to code
   165                              <1> %if _ELD_LINKER_PASSES
   166 000012D8 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   167 000012DB 01D3                <1> 	add bx, dx
   168                              <1>  %if _ELD_IDENTICALISE
   169                              <1> 	add bx, word [bp + ?lt]
   170                              <1> 	mov si, word [ltCodeToData + bx]
   171                              <1>  %else
   172 000012DD 8BB72817            <1> 	mov si, word [linktable - code + ltCodeToData + bx]
   173                              <1>  %endif
   174                              <1> %else
   175                              <1> 	mov si, internalcodetodatarelocations - code
   176                              <1> %endif
   177 000012E1 01D6                <1> 	add si, dx
   178                              <1> @@:
   179 000012E3 AD                  <1> 	lodsw
   180 000012E4 85C0                <1> 	test ax, ax		; was last ?
   181 000012E6 740C                <1> 	jz @F			; yes -->
   182 000012E8 93                  <1> 	xchg bx, ax		; bx = entry
   183 000012E9 01D3                <1> 	add bx, dx		; relocate the entry itself
   184 000012EB 58                  <1> 	pop ax			; ax -> heap data
   185 000012EC 50                  <1> 	push ax
   186                              <1> %if _ELD_DATA_VSTART
   187 000012ED 2D[0000]            <1> 	sub ax, datastart	; undo adjustment
   188                              <1> %endif
   189 000012F0 0107                <1> 	add word [bx], ax	; relocate word referenced by entry
   190 000012F2 EBEF                <1> 	jmp @B
   191                              <1> 
   192                              <1> @@:
   193                              <1> 
   194                              <1> 			; add instance base (dx) to data
   195                              <1> %if _ELD_LINKER_PASSES
   196 000012F4 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   197 000012F7 01D3                <1> 	add bx, dx
   198                              <1>  %if _ELD_IDENTICALISE
   199                              <1> 	add bx, word [bp + ?lt]
   200                              <1> 	mov si, word [ltDataToCode + bx]
   201                              <1>  %else
   202 000012F9 8BB72C17            <1> 	mov si, word [linktable - code + ltDataToCode + bx]
   203                              <1>  %endif
   204                              <1> %else
   205                              <1> 	mov si, internaldatatocoderelocations - code
   206                              <1> %endif
   207 000012FD 01D6                <1> 	add si, dx
   208                              <1> @@:
   209 000012FF AD                  <1> 	lodsw
   210 00001300 83F8FF              <1> 	cmp ax, -1		; was last ?
   211 00001303 740F                <1> 	je @F			; yes -->
   212 00001305 93                  <1> 	xchg bx, ax		; bx = entry
   213 00001306 58                  <1> 	pop ax
   214 00001307 50                  <1> 	push ax
   215 00001308 01C3                <1> 	add bx, ax		; relocate the entry itself
   216                              <1> %if _ELD_CODE_VSTART
   217 0000130A 36812F[0000]        <1> 	sub word [ss:bx], code	; undo adjustment
   218                              <1> %endif
   219 0000130F 360117              <1> 	add word [ss:bx], dx	; relocate word referenced by entry
   220 00001312 EBEB                <1> 	jmp @B
   221                              <1> 
   222                              <1> @@:
   223                              <1> 			; next, add heap data base (on stack) to data
   224                              <1> %if _ELD_LINKER_PASSES
   225 00001314 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   226 00001317 01D3                <1> 	add bx, dx
   227                              <1>  %if _ELD_IDENTICALISE
   228                              <1> 	add bx, word [bp + ?lt]
   229                              <1> 	mov si, word [ltDataToData + bx]
   230                              <1>  %else
   231 00001319 8BB73017            <1> 	mov si, word [linktable - code + ltDataToData + bx]
   232                              <1>  %endif
   233                              <1> %else
   234                              <1> 	mov si, internaldatatodatarelocations - code
   235                              <1> %endif
   236 0000131D 01D6                <1> 	add si, dx
   237                              <1> @@:
   238 0000131F AD                  <1> 	lodsw
   239 00001320 83F8FF              <1> 	cmp ax, -1		; was last ?
   240 00001323 740D                <1> 	je @F			; yes -->
   241 00001325 93                  <1> 	xchg bx, ax		; bx = entry
   242 00001326 58                  <1> 	pop ax			; ax -> heap data
   243 00001327 50                  <1> 	push ax
   244 00001328 01C3                <1> 	add bx, ax		; relocate the entry itself
   245                              <1> %if _ELD_DATA_VSTART
   246 0000132A 2D[0000]            <1> 	sub ax, datastart	; undo adjustment
   247                              <1> %endif
   248 0000132D 360107              <1> 	add word [ss:bx], ax	; relocate word referenced by entry
   249 00001330 EBED                <1> 	jmp @B
   250                              <1> 
   251                              <1> @@:
   252 00001332 8B56FC              <1> 	mov dx, word [bp + ?instance]
   253                              <1> %if _ELD_LINKER_PASSES
   254 00001335 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   255 00001338 01D3                <1> 	add bx, dx
   256                              <1>  %if _ELD_IDENTICALISE
   257                              <1> 	add bx, word [bp + ?lt]
   258                              <1> 	add dx, word [ltLinkData + bx]
   259                              <1>  %else
   260 0000133A 03973417            <1> 	add dx, word [linktable - code + ltLinkData + bx]
   261                              <1>  %endif
   262                              <1> %else
   263                              <1> 	add dx, linkerdatarelocations - code
   264                              <1> %endif
   265                              <1> .otherloop:
   266 0000133E 8956F2              <1> 	mov word [bp + ?nextreloc], dx
   267                              <1> 
   268                              <1> .datarelocloop:		; must be done before further relocs
   269 00001341 C576F2              <1> 	lds si, [bp + ?nextreloc]
   270 00001344 AD                  <1> 	lodsw			; ax = section indicator
   271 00001345 85C0                <1> 	test ax, ax		; end of table ?
   272 00001347 7503E95401          <1> 	jz .donedatareloc
   273 0000134C 48                  <1> 	dec ax			; al = 1 if data, 0 if code
   274 0000134D 5B                  <1> 	pop bx
   275 0000134E 53                  <1> 	push bx			; bx -> ELD data block
   276 0000134F 8946FA              <1> 	mov word [bp + ?targetsection_low_optional_high], ax
   277 00001352 84C0                <1> 	test al, al		; data ?
   278 00001354 AD                  <1> 	lodsw
   279 00001355 7504                <1> 	jnz @F			; yes -->
   280 00001357 0346FC              <1> 	add ax, word [bp + ?instance]
   281                              <1> 				; relocate entry into code
   282 0000135A A9                  <1> 	db __TEST_IMM16		; (skip add)
   283                              <1> @@:
   284 0000135B 01D8                <1> 	add ax, bx		; relocate entry into data
   285 0000135D 8946EE              <1> 	mov word [bp + ?entry], ax
   286 00001360 AD                  <1> 	lodsw
   287 00001361 8976F2              <1> 	mov word [bp + ?nextreloc], si
   288 00001364 E80D01              <1> 	call .build_match
   289                              <1> %if _ELD_LINKER_PASSES
   290 00001367 73D8                <1> 	jnc .datarelocloop
   291                              <1> %endif
   292 00001369 C45EF6              <1> 	les bx, [bp + ?linkinfo]
   293                              <1> %if ELDOTHER
   294                              <1> 	rol byte [bp + ?other], 1
   295                              <1> 	jnc @F
   296                              <1> 	les bx, [bp + ?linkinfo_other]
   297                              <1> @@:
   298                              <1> %endif
   299 0000136C 268B4F08            <1> 	mov cx, word [es:bx + eldlDataAmount]	; amount data link info
   300 00001370 268B7F0A            <1> 	mov di, word [es:bx + eldlDataPrefixes]	; -> prefixes or hashes
   301                              <1> .datarelocfind:
   302 00001374 F2AF                <1> 	repne scasw			; scan initial
   303 00001376 7541                <1> 	jne .datarelocnotfound
   304 00001378 57                  <1> 	push di
   305 00001379 51                  <1> 	push cx
   306 0000137A 56                  <1> 	push si
   307 0000137B 262B7F0A            <1> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   308 0000137F 4F                  <1> 	dec di
   309 00001380 4F                  <1> 	dec di				; 0-based
   310 00001381 26037F0C            <1> 	add di, word [es:bx + eldlDataEntries]	; -> entry
   311 00001385 268B3D              <1> 	mov di, [es:di]			; -> counted suffix/string
   312 00001388 B500                <1> 	mov ch, 0
   313 0000138A 8A0C                <1> 	mov cl, byte [si]		; cx = length
   314 0000138C 41                  <1> 	inc cx
   315                              <1> 	; cmp al, al			; ZR if length is zero
   316 0000138D F3A6                <1> 	repe cmpsb			; match ?
   317 0000138F 5E                  <1> 	pop si
   318 00001390 59                  <1> 	pop cx
   319 00001391 5F                  <1> 	pop di
   320 00001392 75E0                <1> 	jne .datarelocfind
   321 00001394 8814                <1> 	mov byte [si], dl
   322 00001396 262B7F0A            <1> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   323 0000139A 4F                  <1> 	dec di
   324 0000139B 4F                  <1> 	dec di				; 0-based
   325 0000139C 26037F0E            <1> 	add di, word [es:bx + eldlDataAddresses]	; -> address (offset)
   326 000013A0 268B05              <1> 	mov ax, word [es:di]
   327 000013A3 E80700              <1> 	call .address_data_reloc
   328                              <1> %if _ELD_RELOC_VSTART
   329 000013A6 2D[0000]            <1> 	sub ax, relocateddata		; *not* a relocation
   330                              <1> %endif
   331 000013A9 0104                <1> 	add word [si], ax		; relocate
   332 000013AB EB94                <1> 	jmp .datarelocloop
   333                              <1> 
   334                              <1> .address_data_reloc:
   335 000013AD C576EE              <1> 	lds si, [bp + ?entry]		; -> entry if in ELD code instance
   336 000013B0 807EFA00            <1> 	cmp byte [bp + ?targetsection], 0
   337                              <1> 					; relocation in code ?
   338 000013B4 7402                <1> 	je @F				; yes -->
   339 000013B6 16                  <1> 	push ss
   340 000013B7 1F                  <1> 	pop ds				; => our ELD data block
   341                              <1> @@:
   342 000013B8 C3                  <1> 	retn
   343                              <1> 
   344                              <1> .datarelocnotfound:
   345 000013B9 8814                <1> 	mov byte [si], dl
   346 000013BB 807EFB00            <1> 	cmp byte [bp + ?optional], 0
   347                              <1> %if _ELD_DEBUG
   348                              <1> 	jne @F
   349                              <1>  %ifn _ELD_LINKER_PASSES
   350                              <1> 	mov si, 0			; (invalid link)
   351                              <1> linkdatarelocation internalflags6
   352                              <1> 	test si, si
   353                              <1> 	jz .datanotfound
   354                              <1> 	mov si, 0			; (invalid link)
   355                              <1> linkdatarelocation options7
   356                              <1> 	test si, si
   357                              <1> 	jz .datanotfound
   358                              <1>  %else
   359                              <1> 	cmp byte [bp + ?pass], 0
   360                              <1> 	je .datanotfound
   361                              <1>  %endif
   362                              <1> 	houdini
   363                              <1> 	jmp .datanotfound
   364                              <1> @@:
   365                              <1> %else
   366 000013BF 7448                <1> 	je .datanotfound
   367                              <1> %endif
   368                              <1> 
   369                              <1> %if ELDDATA_PMREQUIRED_STATUS
   370                              <1> 	mov si, relocateddata
   371                              <1> linkdatarelocation build_option_PM
   372                              <1> 	test si, si
   373                              <1> 	jz @F
   374                              <1> 	test byte [bp + ?optional], 2
   375                              <1> 	jnz .datanotfound
   376                              <1> @@:
   377                              <1> %endif
   378                              <1> 
   379                              <1> %if _ELD_LINKER_PASSES
   380 000013C1 36F606[0000]02      <1> 	testopt [ss:relocateddata], 2
   381                              <1> linkdatarelocation options7, -3
   382 000013C7 7406                <1> 	jz @F
   383 000013C9 BE[831F]            <1> 	mov si, lmsg.warning_data_optional
   384                              <1> internalcoderelocation
   385 000013CC E85C00              <1> 	call .notfound
   386                              <1> @@:
   387                              <1> %endif
   388 000013CF E8DBFF              <1> 	call .address_data_reloc
   389 000013D2 832400              <1> 	and word [si], 0		; indicate optional data link failed
   390 000013D5 E969FF              <1> 	jmp .datarelocloop
   391                              <1> 
   392                              <1> 
   393                              <1> %if _ELDCALL_OPTIONAL
   394                              <1> .coderelocnotfound:
   395 000013D8 8814                <1> 	mov byte [si], dl
   396 000013DA 807EFB00            <1> 	cmp byte [bp + ?optional], 0
   397                              <1> %if _ELD_DEBUG
   398                              <1> 	jne @F
   399                              <1>  %ifn _ELD_LINKER_PASSES
   400                              <1> 	mov si, 0			; (invalid link)
   401                              <1> linkdatarelocation internalflags6
   402                              <1> 	test si, si
   403                              <1> 	jz .codenotfound
   404                              <1> 	mov si, 0			; (invalid link)
   405                              <1> linkdatarelocation options7
   406                              <1> 	test si, si
   407                              <1> 	jz .codenotfound
   408                              <1>  %else
   409                              <1> 	cmp byte [bp + ?pass], 0
   410                              <1> 	je .codenotfound
   411                              <1>  %endif
   412                              <1> 	houdini
   413                              <1> 	jmp .codenotfound
   414                              <1> @@:
   415                              <1> %else
   416 000013DE 743A                <1> 	je .codenotfound
   417                              <1> %endif
   418                              <1> 
   419                              <1> %if ELDCALL_PMREQUIRED_STATUS
   420                              <1>  %if _ELD_LINKER_PASSES
   421                              <1>   %assign ELDLINKER 0
   422                              <1>  %endif
   423 000013E0 BE[0000]            <1> 	mov si, relocateddata
   424                              <1> linkdatarelocation build_option_PM
   425                              <1>  %if _ELD_LINKER_PASSES
   426                              <1>   %assign ELDLINKER 1
   427                              <1>  %endif
   428 000013E3 85F6                <1> 	test si, si
   429 000013E5 7406                <1> 	jz @F
   430 000013E7 F646FB02            <1> 	test byte [bp + ?optional], 2
   431 000013EB 752D                <1> 	jnz .codenotfound
   432                              <1> @@:
   433                              <1> %endif
   434                              <1> 
   435                              <1> %if _ELD_LINKER_PASSES
   436 000013ED 36F606[0000]02      <1> 	testopt [ss:relocateddata], 2
   437                              <1> linkdatarelocation options7, -3
   438 000013F3 7406                <1> 	jz @F
   439 000013F5 BE[611F]            <1> 	mov si, lmsg.warning_code_optional
   440                              <1> internalcoderelocation
   441 000013F8 E83000              <1> 	call .notfound
   442                              <1> @@:
   443                              <1> %endif
   444 000013FB C576EE              <1> 	lds si, [bp + ?entry]
   445 000013FE C7049090            <1> 	mov word [si], 9090h
   446 00001402 C6440290            <1> 	mov byte [si + 2], 90h		; indicate optional code link failed
   447 00001406 E9A600              <1> 	jmp .coderelocloop
   448                              <1> %endif
   449                              <1> 
   450                              <1> 
   451                              <1> %if _ELD_LINKER_PASSES
   452                              <1> .datanotfound:
   453 00001409 BE[A51F]            <1> 	mov si, lmsg.error_data
   454                              <1> internalcoderelocation
   455 0000140C E81C00              <1> 	call .notfound
   456 0000140F 7203E91F01          <1> 	jnc .error_j
   457 00001414 FF46E8              <1> 	inc word [bp + ?amounterrors]
   458 00001417 E927FF              <1> 	jmp .datarelocloop
   459                              <1> 
   460                              <1> .codenotfound:
   461 0000141A BE[BE1F]            <1> 	mov si, lmsg.error_code
   462                              <1> internalcoderelocation
   463 0000141D E80B00              <1> 	call .notfound
   464 00001420 7203E90E01          <1> 	jnc .error_j
   465 00001425 FF46E8              <1> 	inc word [bp + ?amounterrors]
   466 00001428 E98400              <1> 	jmp .coderelocloop
   467                              <1> 
   468                              <1> .notfound:
   469 0000142B 807EEA00            <1> 	cmp byte [bp + ?pass], 0
   470 0000142F 743A                <1> 	je @F				; --> (NC)
   471 00001431 16                  <1> 	 push ss
   472 00001432 07                  <1> 	 pop es
   473 00001433 BF[0000]            <1> 	mov di, relocateddata
   474                              <1> linkdatarelocation line_out
   475 00001436 E83300              <1> 	call .copy
   476 00001439 8B76E6              <1> 	mov si, word [bp + ?name]
   477 0000143C AD                  <1> 	lodsw
   478 0000143D E8[0000]EB020000    <1> 	extcall hexword
   479 00001444 56                  <1> 	push si
   480 00001445 BE[D71F]            <1> 	mov si, lmsg.error.2
   481                              <1> internalcoderelocation
   482 00001448 E82100              <1> 	call .copy
   483 0000144B 5E                  <1> 	pop si
   484                              <1> %if _ELD_LINKER_PASSES
   485 0000144C 56                  <1> 	push si
   486 0000144D E81C00              <1> 	call .copy
   487 00001450 5E                  <1> 	pop si
   488 00001451 C60400              <1> 	mov byte [si], 0		; mark as failed
   489                              <1> %else
   490                              <1> 	call .copy
   491                              <1> %endif
   492 00001454 B022                <1> 	mov al, '"'
   493 00001456 AA                  <1> 	stosb
   494 00001457 16                  <1> 	 push ss
   495 00001458 1F                  <1> 	 pop ds
   496 00001459 E8[0000]EB020000    <1> 	extcall putsline_crlf
   497 00001460 B8350E              <1> 	mov ax, 0E35h
   498 00001463 E8[0000]EB020000    <1> 	extcall setrc
   499 0000146A F9                  <1> 	stc				; CY, diagnostic displayed
   500                              <1> @@:
   501 0000146B C3                  <1> 	retn
   502                              <1> 
   503                              <1> .copy:
   504 0000146C E8[0000]EB020000    <1> 	extcall copy_single_counted_string
   505 00001473 C3                  <1> 	retn
   506                              <1> %else
   507                              <1> .datanotfound: equ .error_j
   508                              <1> .codenotfound: equ .error_j
   509                              <1> %endif
   510                              <1> 
   511                              <1> .build_match:
   512                              <1> %if _ELD_CODE_VSTART
   513 00001474 2D[0000]            <1> 	sub ax, code
   514                              <1> %endif
   515 00001477 0346FC              <1> 	add ax, word [bp + ?instance]
   516 0000147A 96                  <1> 	xchg si, ax
   517                              <1> %if _ELD_LINKER_PASSES
   518 0000147B 8976E6              <1> 	mov word [bp + ?name], si
   519                              <1> %endif
   520 0000147E AD                  <1> 	lodsw			; = hash, si -> counted string
   521 0000147F 8A14                <1> 	mov dl, byte [si]
   522                              <1> %if _ELD_LINKER_PASSES
   523 00001481 84D2                <1> 	test dl, dl		; marked as already failed ?
   524 00001483 750A                <1> 	jnz @F
   525 00001485 837EE800            <1> 	cmp word [bp + ?amounterrors], 0
   526 00001489 7503E9A500          <1> 	je .error_j
   527 0000148E C3                  <1> 	retn			; (NC)
   528                              <1> 
   529                              <1> @@:
   530                              <1> %endif
   531                              <1> %if ELDOTHER
   532                              <1> 	rol byte [bp + ?other], 1
   533                              <1> 	jnc @F
   534                              <1> 	rol byte [bp + ?use_hash_other], 1
   535                              <1> 	jmp @FF
   536                              <1> 
   537                              <1> @@:
   538                              <1> %endif
   539 0000148F D046EC              <1> 	rol byte [bp + ?use_hash], 1
   540                              <1> @@:
   541 00001492 720A                <1> 	jc @F
   542 00001494 AC                  <1> 	lodsb
   543 00001495 91                  <1> 	xchg cx, ax		; cl = length
   544 00001496 AD                  <1> 	lodsw			; ax = prefix
   545 00001497 49                  <1> 	dec cx
   546 00001498 49                  <1> 	dec cx
   547 00001499 4E                  <1> 	dec si
   548 0000149A 8A14                <1> 	mov dl, byte [si]
   549 0000149C 880C                <1> 	mov byte [si], cl	; si -> counted string suffix
   550                              <1> @@:
   551                              <1> %if _ELD_LINKER_PASSES
   552 0000149E F9                  <1> 	stc			; CY
   553                              <1> %endif
   554 0000149F C3                  <1> 	retn
   555                              <1> 
   556                              <1> 
   557                              <1> .donedatareloc:
   558                              <1> %if ELDOTHER
   559                              <1> 	rol byte [bp + ?other], 1
   560                              <1> 	jc .otherdone
   561                              <1> %endif
   562                              <1> 
   563 000014A0 8B56FC              <1> 	mov dx, word [bp + ?instance]
   564                              <1> %if _ELD_LINKER_PASSES
   565 000014A3 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   566 000014A6 01D3                <1> 	add bx, dx
   567                              <1>  %if _ELD_IDENTICALISE
   568                              <1> 	add bx, word [bp + ?lt]
   569                              <1> 	add dx, word [ltLinkCode + bx]
   570                              <1>  %else
   571 000014A8 03973817            <1> 	add dx, word [linktable - code + ltLinkCode + bx]
   572                              <1>  %endif
   573                              <1> %else
   574                              <1> 	add dx, linkercoderelocations - code
   575                              <1> %endif
   576 000014AC 8956F2              <1> 	mov word [bp + ?nextreloc], dx
   577                              <1> 
   578                              <1> .coderelocloop:
   579 000014AF C576F2              <1> 	lds si, [bp + ?nextreloc]
   580 000014B2 AD                  <1> 	lodsw
   581                              <1> %if _ELDCALL_OPTIONAL
   582 000014B3 48                  <1> 	dec ax
   583 000014B4 7903E98C00          <1> 	js .donecodereloc
   584 000014B9 8946FA              <1> 	mov word [bp + ?targetsection_low_optional_high], ax
   585 000014BC AD                  <1> 	lodsw
   586                              <1> %endif
   587 000014BD 0346FC              <1> 	add ax, word [bp + ?instance]
   588 000014C0 8946EE              <1> 	mov word [bp + ?entry], ax
   589 000014C3 AD                  <1> 	lodsw
   590 000014C4 8976F2              <1> 	mov word [bp + ?nextreloc], si
   591                              <1> %ifn _ELDCALL_OPTIONAL
   592                              <1> 	test ax, ax
   593                              <1> 	jz .donecodereloc
   594                              <1> %endif
   595 000014C7 E8AAFF              <1> 	call .build_match
   596                              <1> %if _ELD_LINKER_PASSES
   597 000014CA 73E3                <1> 	jnc .coderelocloop
   598                              <1> %endif
   599 000014CC C45EF6              <1> 	les bx, [bp + ?linkinfo]
   600 000014CF 268B4F10            <1> 	mov cx, word [es:bx + eldlCodeAmount]	; amount code link info
   601 000014D3 268B7F12            <1> 	mov di, word [es:bx + eldlCodePrefixes]	; -> prefixes or hashes
   602                              <1> .coderelocfind:
   603 000014D7 F2AF                <1> 	repne scasw			; scan initial
   604                              <1> %if _ELDCALL_OPTIONAL
   605 000014D9 7403E9FAFE          <1> 	jne .coderelocnotfound
   606                              <1> %else
   607                              <1>  %if _ELD_DEBUG
   608                              <1> 	je @F
   609                              <1> 	houdini
   610                              <1> 	jmp .codenotfound
   611                              <1> @@:
   612                              <1>  %else
   613                              <1> 	jne .codenotfound
   614                              <1>  %endif
   615                              <1> %endif
   616 000014DE 57                  <1> 	push di
   617 000014DF 51                  <1> 	push cx
   618 000014E0 56                  <1> 	push si
   619 000014E1 262B7F12            <1> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   620 000014E5 4F                  <1> 	dec di
   621 000014E6 4F                  <1> 	dec di				; 0-based
   622 000014E7 26037F14            <1> 	add di, word [es:bx + eldlCodeEntries]	; -> entry
   623 000014EB 268B3D              <1> 	mov di, [es:di]			; -> counted suffix/string
   624 000014EE B500                <1> 	mov ch, 0
   625 000014F0 8A0C                <1> 	mov cl, byte [si]		; cx = length
   626 000014F2 41                  <1> 	inc cx
   627                              <1> 	; cmp al, al			; ZR if length is zero
   628 000014F3 F3A6                <1> 	repe cmpsb			; match ?
   629 000014F5 5E                  <1> 	pop si
   630 000014F6 59                  <1> 	pop cx
   631 000014F7 5F                  <1> 	pop di
   632 000014F8 75DD                <1> 	jne .coderelocfind
   633 000014FA 8814                <1> 	mov byte [si], dl
   634 000014FC 262B7F12            <1> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   635 00001500 4F                  <1> 	dec di
   636 00001501 4F                  <1> 	dec di				; 0-based
   637 00001502 01FF                <1> 	add di, di			; quadruple index
   638 00001504 26037F16            <1> 	add di, word [es:bx + eldlCodeAddresses]	; -> address (offset, segment)
   639 00001508 26FF35              <1> 	push word [es:di]
   640 0000150B C576EE              <1> 	lds si, [bp + ?entry]
   641 0000150E 8F4405              <1> 	pop word [si + 3 + 2]		; call near imm (3), jmp short (2)
   642                              <1> 					;  patch the destination address
   643 00001511 803CE8              <1> 	cmp byte [si], 0E8h		; is it as expected ?
   644 00001514 751D                <1> 	jne .error_j
   645 00001516 268B7D02            <1> 	mov di, word [es:di + 2]
   646 0000151A BB[0000]            <1> 	mov bx, relocateddata
   647                              <1> linkdatarelocation linkcall_table	; ss:bx -> link call table
   648 0000151D 36833F01            <1> 	cmp word [ss:bx], 1		; is it initialised to format 1 ?
   649 00001521 7510                <1> 	jne .error_j			; no -->
   650 00001523 368B4F02            <1> 	mov cx, word [ss:bx + 2]	; get amount of segments
   651 00001527 E30A                <1> 	jcxz .error_j			; none -->
   652                              <1> @@:
   653 00001529 83C304              <1> 	add bx, 4			; -> next segment
   654 0000152C 36393F              <1> 	cmp word [ss:bx], di		; value matches ?
   655 0000152F 7405                <1> 	je @F				; yes, found -->
   656 00001531 E2F6                <1> 	loop @B				; try remaining segments
   657                              <1> .error_j:
   658 00001533 E98A00              <1> 	jmp .error
   659                              <1> 
   660                              <1> @@:
   661 00001536 368B5F02            <1> 	mov bx, word [ss:bx + 2]	; -> call destination offset
   662                              <1> 		; si + 3 + delta = bx
   663                              <1> 		; delta = bx - si - 3
   664 0000153A 29F3                <1> 	sub bx, si
   665 0000153C 83EB03              <1> 	sub bx, 3
   666 0000153F 895C01              <1> 	mov word [si + 1], bx		; patch the call instruction
   667 00001542 E96AFF              <1> 	jmp .coderelocloop
   668                              <1> 
   669                              <1> .donecodereloc:
   670                              <1> %if _ELD_LINKER_PASSES
   671 00001545 8B46E8              <1> 	mov ax, word [bp + ?amounterrors]
   672 00001548 85C0                <1> 	test ax, ax
   673 0000154A 75E7                <1> 	jnz .error_j
   674 0000154C 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   675 0000154F 85DB                <1> 	test bx, bx
   676 00001551 750B                <1> 	jnz @F
   677 00001553 43                  <1> 	inc bx
   678 00001554 43                  <1> 	inc bx
   679 00001555 895EEA              <1> 	mov word [bp + ?pass], bx
   680 00001558 8B56FC              <1> 	mov dx, word [bp + ?instance]
   681 0000155B E95FFD              <1> 	jmp .pass
   682                              <1> 
   683                              <1> @@:
   684                              <1> %endif
   685                              <1> 
   686                              <1> %ifnidni _LISTING, ""
   687                              <1> %assign ELDLINKER 0
   688                              <1> .hint:
   689 0000155E 16                  <1> 	push ss
   690 0000155F 1F                  <1> 	pop ds
   691 00001560 B02D                <1> 	mov al, 2Dh
   692 00001562 E8[0000]EB020000    <1> 	extcall intchk			; ZR if offset = -1 or segment = 0
   693                              <1> 					; CHG: ax, dx, bx
   694 00001569 7437                <1> 	jz .no_hint
   695                              <1> 
   696 0000156B 8A26[0000]          <1> 	mov ah, byte [relocateddata]
   697                              <1> linkdatarelocation try_debugger_amis_multiplex_number
   698 0000156F E85500              <1> 	call plex_check
   699 00001572 7305                <1> 	jnc @F
   700                              <1> 
   701 00001574 B4FF                <1> 	mov ah, 0FFh		; start with multiplex number 0FFh
   702                              <1> .loop_hint:
   703 00001576 E84E00              <1> 	call plex_check
   704                              <1> @@:
   705 00001579 7307                <1> 	jnc .end_hint		; if found --> (NC)
   706 0000157B 80EC01              <1> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   707 0000157E 73F6                <1> 	jnc .loop_hint		; try next if we didn't check all yet -->
   708 00001580 EB20                <1> 	jmp .no_hint
   709                              <1> 
   710                              <1> .end_hint:
   711 00001582 50                  <1> 	push ax
   712 00001583 C446FC              <1> 	les ax, [bp + ?instance]
   713 00001586 BF[FC1A]            <1> 	mov di, listmsg.hint.offset
   714                              <1> internalcoderelocation
   715 00001589 E8[0000]EB020000    <1> 	extcall hexword
   716 00001590 BB[DE1A]            <1> 	mov bx, listmsg.hint
   717                              <1> internalcoderelocation
   718 00001593 368B16[0000]        <1> 	mov dx, [ss:relocateddata]
   719                              <1> linkdatarelocation extseg	; must be 86 Mode segment even in PM
   720 00001598 58                  <1> 	pop ax
   721 00001599 B040                <1> 	mov al, 40h		; AMIS message display service
   722 0000159B E8[0000]EB020000    <1> 	extcall call_int2D
   723                              <1> .no_hint:
   724                              <1> %endif
   725                              <1> 
   726                              <1> %if ELDOTHER
   727                              <1> %assign ELDLINKER 0
   728                              <1> 	not byte [bp + ?other]
   729                              <1> 
   730                              <1> 	push ss
   731                              <1> 	pop ds
   732                              <1> 	mov al, 2Dh
   733                              <1> 	extcall intchk			; ZR if offset = -1 or segment = 0
   734                              <1> 					; CHG: ax, dx, bx
   735                              <1> 	jz .no_other
   736                              <1> 
   737                              <1> 	mov ah, byte [relocateddata]
   738                              <1> linkdatarelocation try_debugger_amis_multiplex_number
   739                              <1> 	call plex_check
   740                              <1> 	jnc @F
   741                              <1> 
   742                              <1> 	mov ah, 0FFh		; start with multiplex number 0FFh
   743                              <1> .loop_other:
   744                              <1> 	call plex_check
   745                              <1> @@:
   746                              <1> 	jnc .end_other		; if found --> (NC)
   747                              <1> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   748                              <1> 	jnc .loop_other		; try next if we didn't check all yet -->
   749                              <1> 	jmp .no_other
   750                              <1> 
   751                              <1> .end_other:
   752                              <1> 	mov al, 42h		; AMIS get other link info service
   753                              <1> 	extcall call_int2D
   754                              <1> 	cmp al, 0FFh
   755                              <1> 	jne .no_other
   756                              <1> 
   757                              <1> 	mov ax, si		; selector => PSP
   758                              <1> 	extcall ispm
   759                              <1> 	jz @F
   760                              <1> 	mov ax, dx		; segment => PSP
   761                              <1> @@:
   762                              <1> 	 push ss
   763                              <1> 	 pop ds
   764                              <1> 	mov word [otherds], ax
   765                              <1> internaldatarelocation		; current mode sel/seg
   766                              <1> 	mov word [otherseg], dx
   767                              <1> internaldatarelocation		; remember segment
   768                              <1> 
   769                              <1> 	mov ax, cx		; selector => link info
   770                              <1> 	extcall ispm
   771                              <1> 	jz @F
   772                              <1> 	mov ax, bx		; segment => link info
   773                              <1> @@:
   774                              <1> 	mov word [bp + ?linkinfo_other], di
   775                              <1> 	mov word [bp + ?linkinfo_other + 2], ax
   776                              <1> 
   777                              <1> 	mov ds, ax		; => link info
   778                              <1> 	xor ax, ax
   779                              <1> 	cmp word [di + eldlSignature], 0E1D1h
   780                              <1> 	jne .error_other
   781                              <1> 	cmp word [di + eldlUseLinkHash], 1
   782                              <1> 	ja .error_other
   783                              <1> 	jb @F
   784                              <1> 	dec ax
   785                              <1> @@:
   786                              <1> 	mov word [bp + ?use_hash_other], ax
   787                              <1> 
   788                              <1> 	mov dx, word [bp + ?instance]
   789                              <1> 	add dx, linkerotherdatarelocations - code
   790                              <1> 	jmp .otherloop
   791                              <1> 
   792                              <1> .error_other:
   793                              <1> 	push cs
   794                              <1> 	pop ds
   795                              <1> 	mov ax, 0E33h
   796                              <1> 	extcall setrc
   797                              <1> 	mov dx, lmsg.error_other
   798                              <1> internalcoderelocation
   799                              <1> 	jmp @F
   800                              <1> 
   801                              <1> .no_other:
   802                              <1> 	push cs
   803                              <1> 	pop ds
   804                              <1> 	mov ax, 0E34h
   805                              <1> 	extcall setrc
   806                              <1> 	mov dx, lmsg.no_other
   807                              <1> internalcoderelocation
   808                              <1> @@:
   809                              <1> 	extcall putsz
   810                              <1> 	jmp .error
   811                              <1> 
   812                              <1> .otherdone:
   813                              <1> %endif
   814                              <1> 
   815 000015A2 5B                  <1> 	pop bx				; -> our heap data
   816 000015A3 5E                  <1> 	pop si				; -> our command line tail
   817 000015A4 16                  <1> 	 push ss
   818 000015A5 1F                  <1> 	 pop ds
   819 000015A6 C47EFC              <1> 	les di, [bp + ?instance]
   820 000015A9 268B4502            <1> 	mov ax, word [es:di + eldiEndCode]
   821                              <1> houdini
   822 000015AD 2D[9012]            <1> 	sub ax, strict word endresident + code
   823                              <1> internalcoderelocation
   824 000015B0 26C74502[9012]      <1> 	mov word [es:di + eldiEndCode], endresident + code
   825                              <1> internalcoderelocation
   826 000015B6 2906[0000]          <1> 	sub word [relocateddata], ax
   827                              <1> linkdatarelocation extseg_used
   828                              <1> %if _DATA_SIZE == 0
   829                              <1> 	xor ax, ax
   830                              <1> 	mov word [es:di + eldiStartData], ax
   831                              <1> 	mov word [es:di + eldiEndData], ax
   832                              <1> %endif
   833 000015BA 89EC5D              <1> 	lleave code
   834                              <1> 		; INP:	es => ELD code segment
   835                              <1> 		;	ds:si -> command line tail
   836                              <1> 		;	ds:bx -> ELD data block
   837                              <1> 		;	ss:sp -> far return address for current mode
   838                              <1> 		; STT:	ds = ss, UP, EI
   839 000015BD E9B8FB              <1> 	jmp start
   840                              <1> 
   841                              <1> .error:
   842 000015C0 89EC5D              <1> 	lleave
   843 000015C3 B8FFFF              <1> 	mov ax, -1
   844 000015C6 CB                  <1> 	retf
   845                              <1> 
   846                              <1> 
   847                              <1> %ifnidni _LISTING, ""
   848                              <1>  %assign ELDHINT 1
   849                              <1> %else
   850                              <1>  %assign ELDHINT 0
   851                              <1> %endif
   852                              <1> 
   853                              <1> %if ELDOTHER || ELDHINT
   854                              <1> 		; INP:	ah = multiplex number to check
   855                              <1> 		; OUT:	CY if multiplex number unused or no signature match,
   856                              <1> 		;	 bp, ah, ds unmodified
   857                              <1> 		;	NC if match found,
   858                              <1> 		;	 ah = multiplex number (unmodified)
   859                              <1> 		; CHG:	si, di, es, cx, dx
   860                              <1> plex_check:
   861 000015C7 16                  <1> 	push ss
   862 000015C8 1F                  <1> 	pop ds
   863 000015C9 F606[0000]08        <1> 	testopt [relocateddata], 8
   864                              <1> linkdatarelocation internalflags4, -3
   865 000015CE 740B                <1> 	jz @F
   866 000015D0 BE[0000]            <1> 	mov si, relocateddata
   867                              <1> linkdatarelocation amis_multiplex_number, -2, optional
   868 000015D3 85F6                <1> 	test si, si
   869 000015D5 7404                <1> 	jz @F
   870 000015D7 3A24                <1> 	cmp ah, byte [si]
   871 000015D9 7420                <1> 	je .notfound		; do not use our own multiplexer -->
   872                              <1> @@:
   873 000015DB B000                <1> 	mov al, 00h		; AMIS installation check
   874 000015DD E8[0000]EB020000    <1> 	extcall call_int2D	; AMIS (or "DOS reserved" = iret if no AMIS present)
   875 000015E4 3CFF                <1> 	cmp al, 0FFh
   876 000015E6 7513                <1> 	jne .notfound
   877 000015E8 0E                  <1> 	push cs
   878 000015E9 1F                  <1> 	pop ds
   879 000015EA BE[CE1A]            <1> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
   880                              <1> internalcoderelocation
   881 000015ED E8[0000]EB020000    <1> 	extcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
   882 000015F4 B90800              <1> 	mov cx, 8		; Ignore description, only compare vendor and program name
   883 000015F7 F3A7                <1> 	repe cmpsw
   884 000015F9 7401                <1> 	je .checkret		; ZR, NC = match -->
   885                              <1> .notfound:
   886 000015FB F9                  <1> 	stc			; CY no match
   887                              <1> .checkret:
   888 000015FC C3                  <1> 	retn
   889                              <1> %endif
   890                              <1> 
   891                              <1> 
   892 000015FD 00<rep 3h>          <1> 	align 4, db 0
   893                              <1> linkercoderelocations:
   894                              <1> %if _ELDCALL_OPTIONAL
   895 00001600 01005700[041B]0100- <1> 	dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
   895 00001608 7200[181B]0100AB00- <1>
   895 00001610 [2F1B]0100D100-     <1>
   895 00001616 [181B]0100EE01-     <1>
   895 0000161C [3E1B]0100FB01-     <1>
   895 00001622 [4C1B]01035C02-     <1>
   895 00001628 [671B]0103AC0C-     <1>
   895 0000162E [671B]0100E60C-     <1>
   895 00001634 [7F1B]01002B0D-     <1>
   895 0000163A [911B]0100380D-     <1>
   895 00001640 [9C1B]01004D0D-     <1>
   895 00001646 [AE1B]0100B811-     <1>
   895 0000164C [C81B]0100C011-     <1>
   895 00001652 [DE1B]0100C811-     <1>
   895 00001658 [EE1B]0100D011-     <1>
   895 0000165E [FC1B]0100D811-     <1>
   895 00001664 [151C]0100E011-     <1>
   895 0000166A [1D1C]0100E811-     <1>
   895 00001670 [251C]0100F011-     <1>
   895 00001676 [2C1C]0100F811-     <1>
   895 0000167C [411C]01000012-     <1>
   895 00001682 [491C]01000812-     <1>
   895 00001688 [5D1C]01001012-     <1>
   895 0000168E [911B]01001812-     <1>
   895 00001694 [641C]01002012-     <1>
   895 0000169A [731C]01002812-     <1>
   895 000016A0 [7F1C]01003012-     <1>
   895 000016A6 [8B1C]01003812-     <1>
   895 000016AC [941C]01004012-     <1>
   895 000016B2 [A01C]01004812-     <1>
   895 000016B8 [AC1C]01005012-     <1>
   895 000016BE [B31C]01005812-     <1>
   895 000016C4 [D01C]01006012-     <1>
   895 000016CA [E01C]01006812-     <1>
   895 000016D0 [EA1C]01007012-     <1>
   895 000016D6 [F51C]01007812-     <1>
   895 000016DC [001D]01008012-     <1>
   895 000016E2 [071D]01008812-     <1>
   895 000016E8 [0F1D]01006215-     <1>
   895 000016EE [251D]01008915-     <1>
   895 000016F4 [1B1D]01009B15-     <1>
   895 000016FA [2E1D]0100DD15-     <1>
   895 00001700 [2E1D]0100ED15-     <1>
   895 00001706 [3B1D]0000          <1>
   896                              <1> %else
   897                              <1> 	dw ELDCALL_CODE_RELOCATIONS, 0, 0
   898                              <1> %endif
   899                              <1> 
   900                              <1> %if _ELD_LINKER_PASSES
   901                              <1> linkerlinkercoderelocations:
   902                              <1> %if _ELDCALL_OPTIONAL
   903 0000170A 01003D14[1B1D]0100- <1> 	dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
   903 00001712 5914[D01C]01006314- <1>
   903 0000171A [151C]01006C14-     <1>
   903 00001720 [B31C]0000          <1>
   904                              <1> %else
   905                              <1> 	dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
   906                              <1> %endif
   907                              <1> 
   908                              <1> 	align 2, db 0
   909                              <1> linktable:
   910                              <1> 	istruc LINKTABLE
   911                              <1> at ltCodeToCode
   912 00001724 BC1A                <1> 	dw internallinkercodetocoderelocations - code
   913 00001726 0C19                <1> 	dw internalcodetocoderelocations - code
   914                              <1> at ltCodeToData
   915 00001728 C81A                <1> 	dw internallinkercodetodatarelocations - code
   916 0000172A 5219                <1> 	dw internalcodetodatarelocations - code
   917                              <1> at ltDataToCode
   918 0000172C CA1A                <1> 	dw internallinkerdatatocoderelocations - code
   919 0000172E 9E1A                <1> 	dw internaldatatocoderelocations - code
   920                              <1> at ltDataToData
   921 00001730 CC1A                <1> 	dw internallinkerdatatodatarelocations - code
   922 00001732 A01A                <1> 	dw internaldatatodatarelocations - code
   923                              <1> at ltLinkData
   924 00001734 A21A                <1> 	dw linkerlinkerdatarelocations - code
   925 00001736 3C17                <1> 	dw linkerdatarelocations - code
   926                              <1> at ltLinkCode
   927 00001738 0A17                <1> 	dw linkerlinkercoderelocations - code
   928 0000173A 0016                <1> 	dw linkercoderelocations - code
   929                              <1> 	iend
   930                              <1> %endif
   931                              <1> 
   932                              <1> 	align 2, db 0
   933                              <1> linkerdatarelocations:
   934 0000173C 01002400[461D]0100- <1> 	dw LINK_DATA_RELOCATIONS, 0
   934 00001744 6000[561D]01006500- <1>
   934 0000174C [6C1D]01008400-     <1>
   934 00001752 [561D]01008900-     <1>
   934 00001758 [801D]0100A300-     <1>
   934 0000175E [931D]0100A700-     <1>
   934 00001764 [A61D]0100A900-     <1>
   934 0000176A [C21D]0100B900-     <1>
   934 00001770 [561D]0100C500-     <1>
   934 00001776 [561D]0100CA00-     <1>
   934 0000177C [801D]0100E500-     <1>
   934 00001782 [561D]0100EA00-     <1>
   934 00001788 [801D]01000B01-     <1>
   934 0000178E [CB1D]01000D01-     <1>
   934 00001794 [E31D]01001501-     <1>
   934 0000179A [F41D]01001B01-     <1>
   934 000017A0 [CB1D]01001D01-     <1>
   934 000017A6 [101E]01002101-     <1>
   934 000017AC [2A1E]01005F01-     <1>
   934 000017B2 [2A1E]01008701-     <1>
   934 000017B8 [931D]0100CD01-     <1>
   934 000017BE [3D1E]0100D401-     <1>
   934 000017C4 [4E1E]0100DB01-     <1>
   934 000017CA [3D1E]0100EC01-     <1>
   934 000017D0 [611E]01000A02-     <1>
   934 000017D6 [3D1E]01003202-     <1>
   934 000017DC [3D1E]01003702-     <1>
   934 000017E2 [6C1D]01003F02-     <1>
   934 000017E8 [4E1E]01007402-     <1>
   934 000017EE [7B1E]01007B02-     <1>
   934 000017F4 [7B1E]01001203-     <1>
   934 000017FA [901E]01005505-     <1>
   934 00001800 [9D1E]01008005-     <1>
   934 00001806 [9D1E]0100E805-     <1>
   934 0000180C [9D1E]01008B06-     <1>
   934 00001812 [9D1E]01009406-     <1>
   934 00001818 [9D1E]01009C06-     <1>
   934 0000181E [9D1E]0100AE06-     <1>
   934 00001824 [9D1E]0100CF06-     <1>
   934 0000182A [9D1E]0100DF06-     <1>
   934 00001830 [9D1E]0100BF07-     <1>
   934 00001836 [9D1E]01008609-     <1>
   934 0000183C [9D1E]0100350A-     <1>
   934 00001842 [9D1E]0100450A-     <1>
   934 00001848 [9D1E]01005F0A-     <1>
   934 0000184E [9D1E]0100860A-     <1>
   934 00001854 [9D1E]0100A20A-     <1>
   934 0000185A [461D]0100A80A-     <1>
   934 00001860 [A81E]0100AC0A-     <1>
   934 00001866 [A81E]0100E20A-     <1>
   934 0000186C [9D1E]0100590B-     <1>
   934 00001872 [9D1E]01005E0B-     <1>
   934 00001878 [9D1E]0100760B-     <1>
   934 0000187E [9D1E]01007A0B-     <1>
   934 00001884 [9D1E]0100DA0B-     <1>
   934 0000188A [9D1E]0100460C-     <1>
   934 00001890 [9D1E]01006F0C-     <1>
   934 00001896 [9D1E]0100850C-     <1>
   934 0000189C [9D1E]0100260D-     <1>
   934 000018A2 [461D]0100470D-     <1>
   934 000018A8 [A81E]01004B0D-     <1>
   934 000018AE [A81E]0100550D-     <1>
   934 000018B4 [A81E]0100590D-     <1>
   934 000018BA [A81E]0100680D-     <1>
   934 000018C0 [A81E]01006C0D-     <1>
   934 000018C6 [A81E]01006C11-     <1>
   934 000018CC [B41E]01007511-     <1>
   934 000018D2 [BF1E]01009811-     <1>
   934 000018D8 [C81E]0100A811-     <1>
   934 000018DE [D31E]0100B511-     <1>
   934 000018E4 [E11E]0100E113-     <1>
   934 000018EA [F01E]01006D15-     <1>
   934 000018F0 [131F]01009615-     <1>
   934 000018F6 [BF1E]0100B815-     <1>
   934 000018FC [D31E]0100CB15-     <1>
   934 00001902 [381F]0101D115-     <1>
   934 00001908 [491F]0000          <1>
   935                              <1> 
   936                              <1> 	align 2, db 0
   937                              <1> internalcodetocoderelocations:
   938 0000190C 17017D0285028309CB- <1> 	dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
   938 00001915 09D209E109E609F509- <1>
   938 0000191E FF09090A130A220ADF- <1>
   938 00001927 0A1C0B2B0B320B410B- <1>
   938 00001930 880BA20BAA0BB90BC0- <1>
   938 00001939 0BCF0BDD0C9F11A411- <1>
   938 00001942 AC11B11187159115AE- <1>
   938 0000194B 15B415EB150000      <1>
   939                              <1> 
   940                              <1> 	align 2, db 0
   941                              <1> internalcodetodatarelocations:
   942 00001952 3400550002018F01F7- <1> 	dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
   942 0000195B 0104020F0220026D02- <1>
   942 00001964 710277028B029502A3- <1>
   942 0000196D 02A702BE02C202C902- <1>
   942 00001976 E502EE02F502FB021C- <1>
   942 0000197F 032003260344035803- <1>
   942 00001988 61036703700376037F- <1>
   942 00001991 0385038E039C03A903- <1>
   942 0000199A AF03C503D7031E0422- <1>
   942 000019A3 043D04710578058305- <1>
   942 000019AC C905F5050606120623- <1>
   942 000019B5 062F0670077607B707- <1>
   942 000019BE C207CE07D907E007E7- <1>
   942 000019C7 07EE07F807FF070208- <1>
   942 000019D0 120851085908C008C4- <1>
   942 000019D9 08CB08D208ED08F108- <1>
   942 000019E2 0E09140923092E0933- <1>
   942 000019EB 0961096C09AF09810A- <1>
   942 000019F4 890A940ABC0AC80A13- <1>
   942 000019FD 0B7D0B180C660C9D0C- <1>
   942 00001A06 A80CB90CC10CC50CCB- <1>
   942 00001A0F 0CD50C000D040D080D- <1>
   942 00001A18 0C0DC70FCB0FCF0FD3- <1>
   942 00001A21 0FD70FDD0FE30FE70F- <1>
   942 00001A2A EC0FF00FF50FF90FFC- <1>
   942 00001A33 0F00100B1015101910- <1>
   942 00001A3C 261028102C102E1035- <1>
   942 00001A45 103810441047104B10- <1>
   942 00001A4E 4F1053105610591060- <1>
   942 00001A57 1068106C1070107410- <1>
   942 00001A60 78107D1095109A10A9- <1>
   942 00001A69 10AD10B110B810CA10- <1>
   942 00001A72 DB10EC10F310FB1006- <1>
   942 00001A7B 11091117111B112411- <1>
   942 00001A84 281130113411391141- <1>
   942 00001A8D 1146114A1150115411- <1>
   942 00001A96 5A115E118E110000    <1>
   943                              <1> 
   944                              <1> 	align 2, db 0
   945                              <1> internaldatatocoderelocations:
   946 00001A9E FFFF                <1> 	dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
   947                              <1> 
   948                              <1> 	align 2, db 0
   949                              <1> internaldatatodatarelocations:
   950 00001AA0 FFFF                <1> 	dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
   951                              <1> 
   952                              <1> %if _ELD_LINKER_PASSES
   953                              <1> 	align 2, db 0
   954                              <1> linkerlinkerdatarelocations:
   955 00001AA2 0100C413[C81E]0100- <1> 	dw LINK_LINKER_DATA_RELOCATIONS, 0
   955 00001AAA F013[C81E]01003414- <1>
   955 00001AB2 [9D1E]01001B15-     <1>
   955 00001AB8 [021F]0000          <1>
   956                              <1> 
   957                              <1> 	align 2, db 0
   958                              <1> internallinkercodetocoderelocations:
   959 00001ABC CA13F6130A141B1446- <1> 	dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
   959 00001AC5 140000              <1>
   960                              <1> 
   961                              <1> 	align 2, db 0
   962                              <1> internallinkercodetodatarelocations:
   963 00001AC8 0000                <1> 	dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
   964                              <1> 
   965                              <1> 	align 2, db 0
   966                              <1> internallinkerdatatocoderelocations:
   967 00001ACA FFFF                <1> 	dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
   968                              <1> 
   969                              <1> 	align 2, db 0
   970                              <1> internallinkerdatatodatarelocations:
   971 00001ACC FFFF                <1> 	dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
   972                              <1> %endif
   973                              <1> 
   974                              <1> %if ELDOTHER
   975                              <1> 	align 2, db 0
   976                              <1> linkerotherdatarelocations:
   977                              <1> 	dw LINK_OTHER_DATA_RELOCATIONS, 0
   978                              <1> 
   979                              <1>  %ifnidn LINK_OTHER_LINKER_DATA_RELOCATIONS, ""
   980                              <1>   %error Other linker data links not supported
   981                              <1>  %endif
   982                              <1> %endif
   983                              <1> 
   984                              <1> %if ELDOTHER || ELDHINT
   985                              <1> 	align 2, db 0
   986                              <1> debuggeramissig:
   987 00001ACE 65636D20<rep 5h>    <1> 		fill 8, 32, db "ecm"
   988 00001AD6 6C446562756720-     <1> 		fill 8, 32, db "lDebug"
   988 00001AD6 <rep 2h>            <1>
   989                              <1> %endif
   990                              <1> 
   991                              <1> %ifnidni _LISTING, ""
   992                              <1> listmsg:
   993 00001ADE 547261634C6973742D- <1> .hint:		db "TracList-add-offset=",_LISTING,"::"
   993 00001AE7 6164642D6F66667365- <1>
   993 00001AF0 743D6C6973742E6C73- <1>
   993 00001AF9 743A3A              <1>
   994 00001AFC 2D2D2D2D680D0A00    <1> .hint.offset:	asciz "----h",13,10
   995                              <1> %endif
   996                              <1> 
   997 00001B04 25D71179795F626F6F- <1> 	eldcall_dump_names ELDCALL_CODE_NAMES
   997 00001B0D 745F696E69745F6469- <1>
   997 00001B16 72321527142E2E4079- <1>
   997 00001B1F 795F66696C656E616D- <1>
   997 00001B28 655F656D707479D1C6- <1>
   997 00001B31 0C7363616E5F646972- <1>
   997 00001B3A 5F6175788ECB0B7265- <1>
   997 00001B43 61645F736563746F72- <1>
   997 00001B4C 4C04186E6561725F74- <1>
   997 00001B55 72616E736665725F65- <1>
   997 00001B5E 78745F72657475726E- <1>
   997 00001B67 2C9A15696E7463616C- <1>
   997 00001B70 6C5F6578745F726574- <1>
   997 00001B79 75726E5F657322580F- <1>
   997 00001B82 636D64335F6E6F745F- <1>
   997 00001B8B 696E6A656374683108- <1>
   997 00001B94 5F646F7363616C6CFF- <1>
   997 00001B9D 8B0F79795F626F6F74- <1>
   997 00001BA6 5F726561642E627863- <1>
   997 00001BAF E41779795F626F6F74- <1>
   997 00001BB8 5F7365656B5F637572- <1>
   997 00001BC1 72656E742E62784C4E- <1>
   997 00001BCA 1379795F626F6F745F- <1>
   997 00001BD3 70617273655F6E616D- <1>
   997 00001BDC 653220660D626F6F74- <1>
   997 00001BE5 5F70617273655F666E- <1>
   997 00001BEE FEFD0B676F745F7979- <1>
   997 00001BF7 656E747279B0CC1672- <1>
   997 00001C00 657472795F6F70656E- <1>
   997 00001C09 5F7363726970747370- <1>
   997 00001C12 617468B21205736574- <1>
   997 00001C1B 726355120570757473- <1>
   997 00001C24 7ABABD04636D643310- <1>
   997 00001C2D 9A1279795F626F6F74- <1>
   997 00001C36 5F6F70656E5F66696C- <1>
   997 00001C3F 6532629605496E444F- <1>
   997 00001C48 530C211179795F646F- <1>
   997 00001C51 735F70617273655F6E- <1>
   997 00001C5A 616D65289004697370- <1>
   997 00001C63 6D738E0C79795F6F70- <1>
   997 00001C6C 656E5F66696C65794C- <1>
   997 00001C75 09636C6F73655F6578- <1>
   997 00001C7E 74A45509736B697063- <1>
   997 00001C87 6F6D6D30E83A066973- <1>
   997 00001C90 656F6C3F03C3096973- <1>
   997 00001C99 737472696E673FF123- <1>
   997 00001CA2 097570706572636173- <1>
   997 00001CAB 65B5C60470757463D0- <1>
   997 00001CB4 BB1A636F70795F7369- <1>
   997 00001CBD 6E676C655F636F756E- <1>
   997 00001CC6 7465645F737472696E- <1>
   997 00001CCF 676FA20D707574736C- <1>
   997 00001CD8 696E655F63726C66EB- <1>
   997 00001CE1 A607646563776F7264- <1>
   997 00001CEA 398C08707574736C69- <1>
   997 00001CF3 6E65AD110864656364- <1>
   997 00001CFC 776F7264C5C6047075- <1>
   997 00001D05 7473A7AA056572726F- <1>
   997 00001D0E 72D55509736B697063- <1>
   997 00001D17 6F6D6D618481076865- <1>
   997 00001D20 78776F726498690669- <1>
   997 00001D29 6E7463686B21300A63- <1>
   997 00001D32 616C6C5F696E743244- <1>
   997 00001D3B B77408736574657332- <1>
   997 00001D44 6478                <1>
   998 00001D46 899F0D696E7465726E- <1> 	link_data_dump_names LINK_DATA_NAMES
   998 00001D4F 616C666C61677392AA- <1>
   998 00001D58 136C6F61645F636865- <1>
   998 00001D61 636B5F6469725F6174- <1>
   998 00001D6A 74720EB5116C6F6164- <1>
   998 00001D73 5F79796E616D655F69- <1>
   998 00001D7C 6E7075742F75106C6F- <1>
   998 00001D85 61645F79796E616D65- <1>
   998 00001D8E 5F6E6578746C52106C- <1>
   998 00001D97 6F61645F79795F6469- <1>
   998 00001DA0 72656E74727938D219- <1>
   998 00001DA9 68616E646C655F7363- <1>
   998 00001DB2 616E5F6469725F6E6F- <1>
   998 00001DBB 745F666F756E646B5D- <1>
   998 00001DC4 06646D79636D6494C0- <1>
   998 00001DCD 1568616E646C655F73- <1>
   998 00001DD6 63616E5F6469725F65- <1>
   998 00001DDF 6E7472793F850E7363- <1>
   998 00001DE8 616E5F6469725F656E- <1>
   998 00001DF1 74727958B8196E6561- <1>
   998 00001DFA 725F7472616E736665- <1>
   998 00001E03 725F6578745F616464- <1>
   998 00001E0C 72657373D6ED176E65- <1>
   998 00001E15 61725F7472616E7366- <1>
   998 00001E1E 65725F6578745F656E- <1>
   998 00001E27 74727975DD106C6F61- <1>
   998 00001E30 645F6B65726E656C5F- <1>
   998 00001E39 6E616D65CA510E696E- <1>
   998 00001E42 7465726E616C666C61- <1>
   998 00001E4B 6773330F08106C6F61- <1>
   998 00001E54 645F646174615F6C6F- <1>
   998 00001E5D 77657374227F176C6F- <1>
   998 00001E66 61645F6164725F6469- <1>
   998 00001E6F 726275665F7365676D- <1>
   998 00001E78 656E743B2612657874- <1>
   998 00001E81 5F696E6A6563745F68- <1>
   998 00001E8A 616E646C6572C71C0A- <1>
   998 00001E93 6578745F68616E646C- <1>
   998 00001E9C 6584E3086C696E655F- <1>
   998 00001EA5 6F75748274096C6F61- <1>
   998 00001EAE 645F64617461EB4208- <1>
   998 00001EB7 657874647373656CD5- <1>
   998 00001EC0 2D066578747365675A- <1>
   998 00001EC9 BC086F7074696F6E73- <1>
   998 00001ED2 37E7D30B6578747365- <1>
   998 00001EDB 675F75736564B2400C- <1>
   998 00001EE4 657874646174615F75- <1>
   998 00001EED 73656455030F627569- <1>
   998 00001EF6 6C645F6F7074696F6E- <1>
   998 00001EFF 5F504D68440E6C696E- <1>
   998 00001F08 6B63616C6C5F746162- <1>
   998 00001F11 6C65F09E227472795F- <1>
   998 00001F1A 64656275676765725F- <1>
   998 00001F23 616D69735F6D756C74- <1>
   998 00001F2C 69706C65785F6E756D- <1>
   998 00001F35 626572CB510E696E74- <1>
   998 00001F3E 65726E616C666C6167- <1>
   998 00001F47 7334688C15616D6973- <1>
   998 00001F50 5F6D756C7469706C65- <1>
   998 00001F59 785F6E756D626572    <1>
   999                              <1> %if ELDOTHER
  1000                              <1> 	link_data_dump_names LINK_OTHER_DATA_NAMES
  1001                              <1> %endif
  1002                              <1> 
  1003                              <1> lmsg:
  1004                              <1> %if _ELD_LINKER_PASSES
  1005                              <1> %if _ELDCALL_OPTIONAL
  1006 00001F61 214F7074696F6E616C- <1> .warning_code_optional:		counted "Optional code link missing, hash="
  1006 00001F6A 20636F6465206C696E- <1>
  1006 00001F73 6B206D697373696E67- <1>
  1006 00001F7C 2C20686173683D      <1>
  1007                              <1> %endif
  1008 00001F83 214F7074696F6E616C- <1> .warning_data_optional:		counted "Optional data link missing, hash="
  1008 00001F8C 2064617461206C696E- <1>
  1008 00001F95 6B206D697373696E67- <1>
  1008 00001F9E 2C20686173683D      <1>
  1009 00001FA5 1844617461206C696E- <1> .error_data:			counted "Data link missing, hash="
  1009 00001FAE 6B206D697373696E67- <1>
  1009 00001FB7 2C20686173683D      <1>
  1010 00001FBE 18436F6465206C696E- <1> .error_code:			counted "Code link missing, hash="
  1010 00001FC7 6B206D697373696E67- <1>
  1010 00001FD0 2C20686173683D      <1>
  1011 00001FD7 0A682C206C6162656C- <1> .error.2:			counted "h, label ",'"'
  1011 00001FE0 2022                <1>
  1012                              <1> %endif
  1013                              <1> %if ELDOTHER
  1014                              <1> .no_other:		asciz "ELD linker: No other link info found!",13,10
  1015                              <1> .error_other:		asciz "ELD linker: Other link info unknown format!",13,10
  1016                              <1> %endif
  1017                              <1> 
  1018 00001FE2 00<rep Eh>          <1> 	align 16, db 0
  2402                                  
  2403                                  	align 16
  2404                                  code_size equ $ - code
