     1                                  
     2                                  ; Public Domain
     3                                  
     4                                  ; test run command: ; .; .
     5                                  
     6                                  %include "lmacros3.mac"
     1                              <1> [list -]
    14                              <2> [list -]
    14                              <1> [list -]
     7                                  
     8                                  %assign _COMPRESSED 1
     9                                  
    10                                  %include "extlib.asm"
     1                              <1> 
     2                              <1> ; Public Domain
     3                              <1> 
     4                              <1> ; test run command: ; .; .
     5                              <1> 
     6                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
     7                              <1> %include "eld.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2025 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELD_MAC
    16                              <2> %define ELD_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
     1                              <3> [list -]
    19                              <2> 
    20                              <2> 		; ELD executable header
    21                              <2> 	struc ELD_HEADER
    22 00000000 ????????            <2> eldhSignature:		resb 4	; "ELD1"
    23 00000004 ??????              <2> 			resb 3	; reserved
    24 00000007 ??                  <2> 			resb 1	; 26 (Ctrl-Z)
    25 00000008 ????????            <2> eldhCodeOffset:		resd 1	; position displacement from eldhSignature
    26 0000000C ????                <2> eldhCodeImageLength:	resw 1	; amount bytes, at least 32
    27 0000000E ????                <2> eldhCodeAllocLength:	resw 1	; amount bytes, added to prior. sum < 64 KiB
    28 00000010 ????????            <2> eldhDataOffset:		resd 1
    29 00000014 ????                <2> eldhDataImageLength:	resw 1	; (zero allowed)
    30 00000016 ????                <2> eldhDataAllocLength:	resw 1	; (zero allowed)
    31 00000018 ????                <2> eldhCodeEntrypoint:	resw 1	; within code section, used as displacement
    32 0000001A ????????            <2> eldhReserved:		resb 4	; reserved
    33 0000001E ????                <2> eldhExtensionSize:	resw 1	; from eldhSignature, -> past eldhx fields in use
    34                              <2> 	endstruc
    35                              <2> 	endarea ELD_HEADER, 1
    36                              <2> 
    37                              <2> 	struc ELD_HEADERX
    38 00000000 <res 20h>           <2> eldhxHeader:		resb ELD_HEADER_size
    39 00000020 ????????            <2> eldhxDescriptionOffset:	resd 1	; zero if none, from eldhxHeader. <= 128 Bytes
    40 00000024 ????????            <2> eldhxHelpOffset:	resd 1	; zero if none, from eldhxHeader
    41 00000028 ????????            <2> eldhxLibTable:		resd 1	; zero if none, from eldhxHeader
    42 0000002C ????????            <2> eldhxDateTimeOffset:	resd 1	; zero if none, from eldhxHeader
    43                              <2> 	alignb 16
    44                              <2> 	endstruc
    45                              <2> 
    46                              <2> 	struc ELD_TRAILER_HEADER
    47 00000000 ????????????????    <2> eldthSignature:		resb 8	; "ELD1TAIL"
    48 00000008 ????????            <2> eldthHeaderOffset:	resd 1	; negative displacement from eldthSignature,
    49                              <2> 				;  add this dword to the seek offset
    50 0000000C ????                <2> eldthReserved:		resw 1	; reserved, must be initialised to zero
    51 0000000E ????                <2> eldthChecksum:		resw 1	; sum of all words in trailer header = 0
    52                              <2> 	endstruc
    53                              <2> 	endarea ELD_TRAILER_HEADER, 1
    54                              <2> 
    55                              <2> 	struc ELD_LIBTABLE
    56 00000000 ????                <2> eldltFormat:		resw 1
    57                              <2> 	; 0 = uncompressed
    58                              <2> 	; 2 = heatshrink compressed
    59                              <2> 	; 3 = lzexedat -4 compressed
    60                              <2> 	; 4 = lzexedat -4 -l compressed
    61 00000002 ????                <2> eldltAmount:		resw 1
    62 00000004 ????????            <2> eldltOffset:		resd 1	; from eldhxHeader
    63                              <2> eldltCompressedLength:		; (dword, only present if format 2, 3, or 4)
    64                              <2> 	endstruc
    65                              <2> 	endarea ELD_LIBTABLE, 1
    66                              <2> 
    67                              <2> 		; ELD instance header
    68                              <2> 	struc ELD_INSTANCE
    69 00000000 ????                <2> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    70 00000002 ????                <2> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    71 00000004 ????                <2> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    72 00000006 ????                <2> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    73 00000008 ????????????????    <2> eldiIdentifier:		resb 8	; blank-filled text
    74 00000010 ????                <2> eldiFlags:		resw 1	; flags
    75                              <2> eldiListing_size equ 14
    76 00000012 <res Eh>            <2> eldiListing:		resb eldiListing_size
    77                              <2> 				; ASCIZ listing file name
    78                              <2> 	endstruc
    79                              <2> 		; flags for eldiFlags:
    80                              <2> eldifResident:		equ 1
    81                              <2> 
    82                              <2> 		; ELD link info header
    83                              <2> 	struc ELD_LINKINFO
    84 00000000 ????                <2> eldlSignature:		resw 1	; 0E1D1h
    85 00000002 ????????            <2> eldlReserved:		resw 2
    86 00000006 ????                <2> eldlUseLinkHash:	resw 1
    87 00000008 ????                <2> eldlDataAmount:		resw 1
    88 0000000A ????                <2> eldlDataPrefixes:	resw 1
    89 0000000C ????                <2> eldlDataEntries:	resw 1
    90 0000000E ????                <2> eldlDataAddresses:	resw 1
    91 00000010 ????                <2> eldlCodeAmount:		resw 1
    92 00000012 ????                <2> eldlCodePrefixes:	resw 1
    93 00000014 ????                <2> eldlCodeEntries:	resw 1
    94 00000016 ????                <2> eldlCodeAddresses:	resw 1
    95                              <2> 	endstruc
    96                              <2> 
    97                              <2> 	numdef ELD_CODE_VSTART, 9001h
    98                              <2> 	numdef ELD_DATA_VSTART, 8000h
    99                              <2> 	numdef ELD_RELOC_VSTART, 8000h
   100                              <2> 
   101                              <2> 	numdef ELD_RECLAIM_HINT, 0
   102                              <2> 	strdef ELD_LISTING, ""
   103                              <2> 	numdef ELD_DATETIME, 0
   104                              <2> 
   105                              <2> %if _ELD_DATETIME
   106                              <2>  %define PUT_ELDHX_DATETIME_OFFSET at eldhxDateTimeOffset, dd DATAOFFSET + datetime - datastart
   107                              <2>  %macro PUT_ELD_DATETIME 0.nolist
   108                              <2> datetime:	asciz __UTC_DATE__,'T',__UTC_TIME__,'Z'
   109                              <2> 		asciz		; for future extension
   110                              <2>  %endmacro
   111                              <2> %else
   112                              <2>  %define PUT_ELDHX_DATETIME_OFFSET
   113                              <2>  %define PUT_ELD_DATETIME
   114                              <2> %endif
   115                              <2> 
   116                              <2> %endif
     8                              <1> %include "eldcall.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug call macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2024 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELDCALL_MAC
    16                              <2> %define ELDCALL_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
     1                              <3> [list -]
    19                              <2> %include "nasmhash.mac"
     1                              <3> 
     2                              <3> %if 0
     3                              <3> 
     4                              <3> Hashing macros
     5                              <3>  by E. C. Masloch, 2019
     6                              <3> 
     7                              <3> Usage of the works is permitted provided that this
     8                              <3> instrument is retained with the works, so that any entity
     9                              <3> that uses the works is notified of this instrument.
    10                              <3> 
    11                              <3> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <3> 
    13                              <3> %endif
    14                              <3> 
    15                              <3> %ifndef __NASMHASH_MAC__
    16                              <3> %assign __NASMHASH_MAC__ 1
    17                              <3> 
    18                              <3> 
    19                              <3> 	%macro hashdef 2+.nolist
    20                              <3> %ifempty %2
    21                              <3>  %assign _%1 1
    22                              <3> %else
    23                              <3> %ifstr %2
    24                              <3>  %define %%string %2
    25                              <3> %elifid %2
    26                              <3>  %defstr %%string %2
    27                              <3> %elifnum %2
    28                              <3>  %defstr %%string %2
    29                              <3> %eliftok %2
    30                              <3>  %defstr %%string %2
    31                              <3> %else
    32                              <3>  %error Unknown input
    33                              <3> %endif
    34                              <3> %strlen %%length %%string
    35                              <3> %assign %%hash 1
    36                              <3> %assign %%index 1
    37                              <3> %rep %%length
    38                              <3>  %substr %%char %%string %%index
    39                              <3>  %assign %%hash (%%hash * 31 + %%char) & 0FFFFh
    40                              <3>  %assign %%index %%index + 1
    41                              <3> %endrep
    42                              <3> %assign _%1 %%hash
    43                              <3> %endif
    44                              <3> 	%endmacro
    45                              <3> 
    46                              <3> 
    47                              <3> %endif
    20                              <2> %include "elddata.mac"
     1                              <3> %if 0
     2                              <3> 
     3                              <3> Extensions for lDebug data relocation macros
     4                              <3> 
     5                              <3> Copyright (C) 2008-2024 E. C. Masloch
     6                              <3> 
     7                              <3> Usage of the works is permitted provided that this
     8                              <3> instrument is retained with the works, so that any entity
     9                              <3> that uses the works is notified of this instrument.
    10                              <3> 
    11                              <3> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <3> 
    13                              <3> %endif
    14                              <3> 
    15                              <3> %ifndef ELDDATA_MAC
    16                              <3> %define ELDDATA_MAC 1
    17                              <3> 
    18                              <3> %include "lmacros3.mac"
     1                              <4> [list -]
    19                              <3> %include "nasmhash.mac"
     1                              <4> 
     2                              <4> %if 0
     3                              <4> 
     4                              <4> Hashing macros
     5                              <4>  by E. C. Masloch, 2019
     6                              <4> 
     7                              <4> Usage of the works is permitted provided that this
     8                              <4> instrument is retained with the works, so that any entity
     9                              <4> that uses the works is notified of this instrument.
    10                              <4> 
    11                              <4> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <4> 
    13                              <4> %endif
    14                              <4> 
    15                              <4> %ifndef __NASMHASH_MAC__
    16                              <4> %assign __NASMHASH_MAC__ 1
    17                              <4> 
    18                              <4> 
    19                              <4> 	%macro hashdef 2+.nolist
    20                              <4> %ifempty %2
    21                              <4>  %assign _%1 1
    22                              <4> %else
    23                              <4> %ifstr %2
    24                              <4>  %define %%string %2
    25                              <4> %elifid %2
    26                              <4>  %defstr %%string %2
    27                              <4> %elifnum %2
    28                              <4>  %defstr %%string %2
    29                              <4> %eliftok %2
    30                              <4>  %defstr %%string %2
    31                              <4> %else
    32                              <4>  %error Unknown input
    33                              <4> %endif
    34                              <4> %strlen %%length %%string
    35                              <4> %assign %%hash 1
    36                              <4> %assign %%index 1
    37                              <4> %rep %%length
    38                              <4>  %substr %%char %%string %%index
    39                              <4>  %assign %%hash (%%hash * 31 + %%char) & 0FFFFh
    40                              <4>  %assign %%index %%index + 1
    41                              <4> %endrep
    42                              <4> %assign _%1 %%hash
    43                              <4> %endif
    44                              <4> 	%endmacro
    45                              <4> 
    46                              <4> 
    47                              <4> %endif
    20                              <3> %include "eldcheck.mac"
     1                              <4> %if 0
     2                              <4> 
     3                              <4> Extensions for lDebug relocation check macros
     4                              <4> 
     5                              <4> Copyright (C) 2008-2023 E. C. Masloch
     6                              <4> 
     7                              <4> Usage of the works is permitted provided that this
     8                              <4> instrument is retained with the works, so that any entity
     9                              <4> that uses the works is notified of this instrument.
    10                              <4> 
    11                              <4> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <4> 
    13                              <4> %endif
    14                              <4> 
    15                              <4> %ifndef ELDCHECK_MAC
    16                              <4> %define ELDCHECK_MAC 1
    17                              <4> 
    18                              <4> %assign ELDSTRICT 0
    19                              <4> %assign ELDSTRICTCOUNTER 0
    20                              <4> 
    21                              <4> 	%imacro eldstrict 1.nolist
    22                              <4> %ifidni %1, on
    23                              <4>  %assign ELDSTRICT 1
    24                              <4>  [warning +error=reloc-abs]
    25                              <4>  [warning +reloc-abs]
    26                              <4> %elifidni %1, off
    27                              <4>  %assign ELDSTRICT 0
    28                              <4>  [warning -reloc-abs]
    29                              <4> %else
    30                              <4>  %error Unknown keyword
    31                              <4> %endif
    32                              <4> 	%endmacro
    33                              <4> 
    34                              <4> 	%imacro reloc 1+.nolist
    35                              <4> %if ELDSTRICT
    36                              <4>  %if ELDSTRICTCOUNTER
    37                              <4>   %error Missing relocation
    38                              <4>  %endif
    39                              <4>  [warning -reloc-abs]
    40                              <4>  %assign ELDSTRICTCOUNTER 1
    41                              <4> %endif
    42                              <4> %1
    43                              <4> 	%endmacro
    44                              <4> 
    45                              <4> 	%imacro reloc2 1+.nolist
    46                              <4> %if ELDSTRICT
    47                              <4>  %if ELDSTRICTCOUNTER
    48                              <4>   %error Missing relocation
    49                              <4>  %endif
    50                              <4>  [warning -reloc-abs]
    51                              <4>  %assign ELDSTRICTCOUNTER 2
    52                              <4> %endif
    53                              <4> %1
    54                              <4> 	%endmacro
    55                              <4> 
    56                              <4> 	%imacro eldstrictcheck 0.nolist
    57                              <4> %if ELDSTRICT
    58                              <4>  %ifn ELDSTRICTCOUNTER
    59                              <4>   %error Unexpected relocation
    60                              <4>  %else
    61                              <4>   %assign ELDSTRICTCOUNTER ELDSTRICTCOUNTER - 1
    62                              <4>   %ifn ELDSTRICTCOUNTER
    63                              <4>    [warning +reloc-abs]
    64                              <4>   %endif
    65                              <4>  %endif
    66                              <4> %endif
    67                              <4> 	%endmacro
    68                              <4> 
    69                              <4> %endif
    70                              <4> 
    21                              <3> 
    22                              <3> 
    23                              <3> %assign ELDLINKER 0
    24                              <3> 
    25                              <3> %define INTERNAL_CODE_TO_CODE_RELOCATIONS ""
    26                              <3> %define INTERNAL_CODE_TO_DATA_RELOCATIONS ""
    27                              <3> %define INTERNAL_DATA_TO_CODE_RELOCATIONS ""
    28                              <3> %define INTERNAL_DATA_TO_DATA_RELOCATIONS ""
    29                              <3> %define INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS ""
    30                              <3> %define INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS ""
    31                              <3> %define INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS ""
    32                              <3> %define INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS ""
    33                              <3> %assign ELDDATA_OPTIONAL_STATUS 0		; not any seen yet
    34                              <3> %assign ELDDATA_PMREQUIRED_STATUS 0		; not any seen yet
    35                              <3> %assign ELDDATA_NEXT_STATUS 0			; not any seen yet
    36                              <3> %assign ELDDATA_NEXT_ENTRY -1
    37                              <3> %assign ELDDATA_NEXT_SECTION -1
    38                              <3> %assign ELDDATA_NEXT_OTHER -1
    39                              <3> 
    40                              <3> 	%imacro internalcoderelocation 0-1.nolist -2
    41                              <3> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    42                              <3> %if ELDLINKER
    43                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    44                              <3>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    45                              <3>  %else
    46                              <3>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    47                              <3>  %endif
    48                              <3> %else
    49                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    50                              <3>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    51                              <3>  %else
    52                              <3>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    53                              <3>  %endif
    54                              <3> %endif
    55                              <3> 	eldstrictcheck
    56                              <3> 	%endmacro
    57                              <3> 
    58                              <3> 	%imacro internaldatarelocation 0-1.nolist -2
    59                              <3> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    60                              <3> %if ELDLINKER
    61                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    62                              <3>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    63                              <3>  %else
    64                              <3>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    65                              <3>  %endif
    66                              <3> %else
    67                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    68                              <3>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    69                              <3>  %else
    70                              <3>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    71                              <3>  %endif
    72                              <3> %endif
    73                              <3> 	eldstrictcheck
    74                              <3> 	%endmacro
    75                              <3> 
    76                              <3> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    77                              <3> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    78                              <3> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    79                              <3> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    80                              <3> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    81                              <3> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    82                              <3> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    83                              <3> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    84                              <3> 
    85                              <3> 
    86                              <3> %define LINK_DATA_RELOCATIONS ""
    87                              <3> %define LINK_LINKER_DATA_RELOCATIONS ""
    88                              <3> %define LINK_DATA_NAMES db ""
    89                              <3> %define LINK_DATA_DETECTION none, none
    90                              <3> 
    91                              <3> %define LINK_OTHER_DATA_RELOCATIONS ""
    92                              <3> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    93                              <3> %define LINK_OTHER_DATA_NAMES db ""
    94                              <3> %define LINK_OTHER_DATA_DETECTION none, none
    95                              <3> 
    96                              <3> %ifndef ELDOTHER
    97                              <3>  %assign ELDOTHER 0
    98                              <3> %endif
    99                              <3> %assign ELDOTHERLINK 0
   100                              <3> 
   101                              <3> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
   102                              <3> %if ELDOTHER
   103                              <3>  %assign ELDOTHERLINK 1
   104                              <3> %endif
   105                              <3> 	linkdatarelocation %1, %2, %3
   106                              <3> %assign ELDOTHERLINK 0
   107                              <3> 	%endmacro
   108                              <3> 
   109                              <3> 	%imacro linkdatarelocation 1-4.nolist -2, required, single
   110                              <3> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   111                              <3> %ifidni %3, required
   112                              <3>  %assign %%optional 0
   113                              <3> %elifidni %3, optional
   114                              <3>  %assign %%optional 100h
   115                              <3>  %if ELDDATA_OPTIONAL_STATUS == 0
   116                              <3>   %assign ELDDATA_OPTIONAL_STATUS 1
   117                              <3>  %elif ELDDATA_OPTIONAL_STATUS == 1
   118                              <3>  %else
   119                              <3>   %error Optional data link not allowed here
   120                              <3>  %endif
   121                              <3> %elifidni %3, PM required
   122                              <3>  %assign %%optional 300h
   123                              <3>  %assign ELDDATA_PMREQUIRED_STATUS 1
   124                              <3>  %if ELDDATA_OPTIONAL_STATUS == 0
   125                              <3>   %assign ELDDATA_OPTIONAL_STATUS 1
   126                              <3>  %elif ELDDATA_OPTIONAL_STATUS == 1
   127                              <3>  %else
   128                              <3>   %error Optional data link not allowed here
   129                              <3>  %endif
   130                              <3> %else
   131                              <3>  %fatal Unknown optional keyword
   132                              <3> %endif
   133                              <3> %ifidni _CURRENT_SECTION_TYPE, DATA
   134                              <3>  %assign %%DATASECTION 1
   135                              <3> %else
   136                              <3>  %assign %%DATASECTION 0
   137                              <3> %endif
   138                              <3> %ifidni %4, single
   139                              <3>  %if ELDDATA_NEXT_STATUS == 1		; after next ?
   140                              <3>   %error Unexpected single data link after next data link
   141                              <3>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   142                              <3>   %assign ELDDATA_NEXT_STATUS 3		; note single with next/last present
   143                              <3>  %endif
   144                              <3>  %assign %%next 0
   145                              <3> %elifidni %4, next
   146                              <3>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   147                              <3>   %assign ELDDATA_NEXT_STATUS 1		; in next
   148                              <3>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   149                              <3>   %assign ELDDATA_NEXT_STATUS 1		; in next
   150                              <3>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   151                              <3>   %assign ELDDATA_NEXT_STATUS 1		; in next
   152                              <3>  %elif ELDDATA_NEXT_STATUS == 1		; repeated next ?
   153                              <3>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   156                              <3>    %error Unexpected next data link
   157                              <3>   %endif
   158                              <3>  %else
   159                              <3>   %error Next data link not allowed here
   160                              <3>  %endif
   161                              <3>  %ifn %%optional
   162                              <3>   %error Next data link only valid as optional or PM required
   163                              <3>  %endif
   164                              <3>  %assign %%next 400h
   165                              <3>  %assign ELDDATA_NEXT_ENTRY %%entry
   166                              <3>  %assign ELDDATA_NEXT_SECTION %%DATASECTION
   167                              <3>  %assign ELDDATA_NEXT_OTHER ELDOTHERLINK
   168                              <3> %elifidni %4, last
   169                              <3>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   170                              <3>   %error Next last data link not allowed here
   171                              <3>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   172                              <3>   %error Next last data link not allowed here
   173                              <3>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   174                              <3>   %error Next last data link not allowed here
   175                              <3>  %elif ELDDATA_NEXT_STATUS == 1		; after next ?
   176                              <3>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   179                              <3>    %error Unexpected next data link
   180                              <3>   %endif
   181                              <3>   %assign ELDDATA_NEXT_STATUS 2		; note now after last
   182                              <3>  %else
   183                              <3>   %error Next data link not allowed here
   184                              <3>  %endif
   185                              <3>  %assign %%next 800h
   186                              <3>  %assign ELDDATA_NEXT_ENTRY -1
   187                              <3>  %assign ELDDATA_NEXT_SECTION -1
   188                              <3> %else
   189                              <3>  %fatal Unknown next keyword
   190                              <3> %endif
   191                              <3> 	%if ELDOTHERLINK
   192                              <3> %if ELDLINKER
   193                              <3>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   194                              <3> %else
   195                              <3>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   196                              <3> %endif
   197                              <3> 	%else
   198                              <3> %if ELDLINKER
   199                              <3>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   200                              <3> %else
   201                              <3>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   202                              <3> %endif
   203                              <3> 	%endif
   204                              <3> %defstr %%string %1
   205                              <3> %strlen %%length %%string
   206                              <3> %if %%length > 64
   207                              <3> 	; Could be increased, but mustn't exceed 127 bytes
   208                              <3> 	;  because flag 80h is used to mark optional links
   209                              <3> 	;  that failed to be matched.
   210                              <3>  %error Too long link name: %1
   211                              <3> %endif
   212                              <3> %define LINK_DATA_CHECK %1
   213                              <3> 	%if ELDOTHERLINK
   214                              <3> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   215                              <3> %if LINK_DATA_NEW
   216                              <3>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   217                              <3> 	hashdef HASH, %%string
   218                              <3>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   220                              <3> %else
   221                              <3>  %%name equ LINK_DATA_DUPLICATE
   222                              <3> %endif
   223                              <3> 	%else
   224                              <3> 	linkdata_detect LINK_DATA_DETECTION
   225                              <3> %if LINK_DATA_NEW
   226                              <3>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   227                              <3> 	hashdef HASH, %%string
   228                              <3>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   230                              <3> %else
   231                              <3>  %%name equ LINK_DATA_DUPLICATE
   232                              <3> %endif
   233                              <3> 	%endif
   234                              <3> 	eldstrictcheck
   235                              <3> 	%endmacro
   236                              <3> 
   237                              <3> 	%imacro linkdata_detect 2-*.nolist
   238                              <3> %assign LINK_DATA_NEW 1
   239                              <3> %rep (%0 - 2) / 2
   240                              <3>  %rotate 2
   241                              <3>  %ifidni %1, LINK_DATA_CHECK
   242                              <3>   %assign LINK_DATA_NEW 0
   243                              <3>   %xdefine LINK_DATA_DUPLICATE %2
   244                              <3>   %exitrep
   245                              <3>  %endif
   246                              <3> %endrep
   247                              <3> 	%endmacro
   248                              <3> 
   249                              <3> 	%imacro link_data_dump_names 1-*.nolist
   250                              <3> %rep %0
   251                              <3> 	%1
   252                              <3>  %rotate 1
   253                              <3> %endrep
   254                              <3> 	%endmacro
   255                              <3> 
   256                              <3> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   257                              <3> ; dw LINK_DATA_RELOCATIONS, 0, 0
   258                              <3> ; link_data_dump_names ELDCALL_CODE_NAMES
   259                              <3> 
   260                              <3> %endif
    21                              <2> 
    22                              <2> %assign ELDLINKER 0
    23                              <2> 
    24                              <2> [section relocatedzero nobits vstart=0]
    25                              <2> relocatedzero:
    26                              <2> __SECT__
    27                              <2> 
    28                              <2> 	numdef HOUDINI, 1
    29                              <2> 	numdef HOUDINI_CONDITIONAL, 1
    30                              <2> 
    31                              <2> %imacro houdini 0.nolist
    32                              <2> %if _HOUDINI
    33                              <2>  %if _HOUDINI_CONDITIONAL
    34                              <2> reloc	testopt [ss:relocateddata], 100h
    35                              <2> linkdatarelocation options7, -3
    36                              <2> 	jz %%skip
    37                              <2>  %endif
    38                              <2> reloc	testopt [ss:relocateddata], 100h
    39                              <2> linkdatarelocation internalflags6, -3
    40                              <2> 	jz %%skip
    41                              <2> 	int3
    42                              <2> %%skip:
    43                              <2> %endif
    44                              <2> %endmacro
    45                              <2> 
    46                              <2> %define ELDCALL_CODE_RELOCATIONS ""
    47                              <2> %define ELDCALL_LINKER_CODE_RELOCATIONS ""
    48                              <2> %define ELDCALL_CODE_RELOCATIONS_OPTIONAL ""
    49                              <2> %define ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ""
    50                              <2> %define ELDCALL_CODE_NAMES db ""
    51                              <2> %define ELDCALL_CODE_DETECTION none, none
    52                              <2> %assign ELDCALL_OPTIONAL_STATUS 0		; not any seen yet
    53                              <2> %assign ELDCALL_PMREQUIRED_STATUS 0		; not any seen yet
    54                              <2> %assign ELDCALL_NEXT_STATUS 0			; not any seen yet
    55                              <2> %assign ELDCALL_NEXT_ENTRY -1
    56                              <2> 
    57                              <2> 	%imacro extcall 1-3.nolist required, single
    58                              <2> %ifidni _CURRENT_SECTION_TYPE, DATA
    59                              <2>  %error "ELD call cannot be used in ELD data block"
    60                              <2> %endif
    61                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP
    62                              <2> %ifidni %2, required
    63                              <2>  %assign %%optional 0
    64                              <2> %elifidni %2, optional
    65                              <2>  %assign %%optional 100h
    66                              <2>  %if ELDCALL_OPTIONAL_STATUS == 0
    67                              <2>   %assign ELDCALL_OPTIONAL_STATUS 1
    68                              <2>  %elif ELDCALL_OPTIONAL_STATUS == 1
    69                              <2>  %else
    70                              <2>   %error Optional code link not allowed here
    71                              <2>  %endif
    72                              <2> %elifidni %2, PM required
    73                              <2>  %assign %%optional 300h
    74                              <2>  %assign ELDCALL_PMREQUIRED_STATUS 1
    75                              <2>  %if ELDCALL_OPTIONAL_STATUS == 0
    76                              <2>   %assign ELDCALL_OPTIONAL_STATUS 1
    77                              <2>  %elif ELDCALL_OPTIONAL_STATUS == 1
    78                              <2>  %else
    79                              <2>   %error Optional code link not allowed here
    80                              <2>  %endif
    81                              <2> %else
    82                              <2>  %fatal Unknown optional keyword
    83                              <2> %endif
    84                              <2> %ifidni %3, single
    85                              <2>  %if ELDCALL_NEXT_STATUS == 1		; after next ?
    86                              <2>   %error Unexpected single code link after next code link
    87                              <2>  %elif ELDCALL_NEXT_STATUS == 2		; after last ?
    88                              <2>   %assign ELDCALL_NEXT_STATUS 3		; note single with next/last present
    89                              <2>  %endif
    90                              <2>  %assign %%next 0
    91                              <2> %elifidni %3, next
    92                              <2>  %if ELDCALL_NEXT_STATUS == 0		; no next/last yet ?
    93                              <2>   %assign ELDCALL_NEXT_STATUS 1		; in next
    94                              <2>  %elif ELDCALL_NEXT_STATUS == 2		; after last ?
    95                              <2>   %assign ELDCALL_NEXT_STATUS 1		; in next
    96                              <2>  %elif ELDCALL_NEXT_STATUS == 3		; after single ?
    97                              <2>   %assign ELDCALL_NEXT_STATUS 1		; in next
    98                              <2>  %elif ELDCALL_NEXT_STATUS == 1		; repeated next ?
    99                              <2>   %if ELDCALL_NEXT_ENTRY != %%entry
   100                              <2>    %error Unexpected next code link
   101                              <2>   %endif
   102                              <2>  %else
   103                              <2>   %error Next code link not allowed here
   104                              <2>  %endif
   105                              <2>  %ifn %%optional
   106                              <2>   %error Next code link only valid as optional or PM required
   107                              <2>  %endif
   108                              <2>  %assign %%next 400h
   109                              <2>  %assign ELDCALL_NEXT_ENTRY %%entry
   110                              <2> %elifidni %3, last
   111                              <2>  %if ELDCALL_NEXT_STATUS == 0		; no next/last yet ?
   112                              <2>   %error Next last code link not allowed here
   113                              <2>  %elif ELDCALL_NEXT_STATUS == 2		; after last ?
   114                              <2>   %error Next last code link not allowed here
   115                              <2>  %elif ELDCALL_NEXT_STATUS == 3		; after single ?
   116                              <2>   %error Next last code link not allowed here
   117                              <2>  %elif ELDCALL_NEXT_STATUS == 1		; after next ?
   118                              <2>   %if ELDCALL_NEXT_ENTRY != %%entry
   119                              <2>    %error Unexpected next code link
   120                              <2>   %endif
   121                              <2>   %assign ELDCALL_NEXT_STATUS 2		; note now after last
   122                              <2>  %else
   123                              <2>   %error Next code link not allowed here
   124                              <2>  %endif
   125                              <2>  %assign %%next 800h
   126                              <2>  %assign ELDCALL_NEXT_ENTRY -1
   127                              <2>  %assign ELDCALL_NEXT_SECTION -1
   128                              <2> %else
   129                              <2>  %fatal Unknown next keyword
   130                              <2> %endif
   131                              <2> %if %%next != 400h
   132                              <2> %if 0
   133                              <2> [warning -reloc-rel-word]
   134                              <2> 	call near relocatedzero
   135                              <2> [warning +reloc-rel-word]
   136                              <2> %else
   137                              <2> 	db 0E8h
   138                              <2> reloc	dw relocatedzero
   139                              <2> 	eldstrictcheck
   140                              <2> %endif
   141                              <2> 	jmp strict short %%skipparameter
   142                              <2> 	dw 0
   143                              <2> %%skipparameter:
   144                              <2> %endif
   145                              <2> %if ELDLINKER
   146                              <2>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS ELDCALL_LINKER_CODE_RELOCATIONS, %%entry, %%name
   147                              <2>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional + %%next, %%entry, %%name
   148                              <2> %else
   149                              <2>  %xdefine ELDCALL_CODE_RELOCATIONS ELDCALL_CODE_RELOCATIONS, %%entry, %%name
   150                              <2>  %xdefine ELDCALL_CODE_RELOCATIONS_OPTIONAL ELDCALL_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional + %%next, %%entry, %%name
   151                              <2> %endif
   152                              <2> %defstr %%string %1
   153                              <2> %strlen %%length %%string
   154                              <2> %if %%length > 64
   155                              <2> 	; Could be increased, but mustn't exceed 127 bytes
   156                              <2> 	;  because flag 80h is used to mark optional links
   157                              <2> 	;  that failed to be matched.
   158                              <2>  %error Too long link name: %1
   159                              <2> %endif
   160                              <2> %define ELDCALL_CODE_CHECK %1
   161                              <2> 	linkcode_detect ELDCALL_CODE_DETECTION
   162                              <2> %if ELDCALL_CODE_NEW
   163                              <2>  %xdefine ELDCALL_CODE_DETECTION ELDCALL_CODE_DETECTION, %1, %%name
   164                              <2> 	hashdef HASH, %%string
   165                              <2> %xdefine ELDCALL_CODE_NAMES 	ELDCALL_CODE_NAMES, %%name:, dw _HASH, {counted %%string}
   167                              <2> %else
   168                              <2>  %%name equ ELDCALL_CODE_DUPLICATE
   169                              <2> %endif
   170                              <2> 	%endmacro
   171                              <2> 
   172                              <2> 	%imacro linkcode_detect 2-*.nolist
   173                              <2> %assign ELDCALL_CODE_NEW 1
   174                              <2> %rep (%0 - 2) / 2
   175                              <2>  %rotate 2
   176                              <2>  %ifidni %1, ELDCALL_CODE_CHECK
   177                              <2>   %assign ELDCALL_CODE_NEW 0
   178                              <2>   %xdefine ELDCALL_CODE_DUPLICATE %2
   179                              <2>   %exitrep
   180                              <2>  %endif
   181                              <2> %endrep
   182                              <2> 	%endmacro
   183                              <2> 
   184                              <2> 
   185                              <2> %define ELDCALL_CALLCALL_LIST none
   186                              <2> %define ELDCALL_CALLCALL_PROCESSED_PRIOR ""
   187                              <2> 
   188                              <2> 	%imacro extcallcall 1.nolist
   189                              <2> 	call %1
   190                              <2> %xdefine ELDCALL_CALLCALL_LIST ELDCALL_CALLCALL_LIST, %1
   191                              <2> 	%endmacro
   192                              <2> 
   193                              <2> %assign ELDCALLCALL_DUMPED 0
   194                              <2> 
   195                              <2> 	%imacro eldcall_dump_callcall 1-*.nolist
   196                              <2> %xdefine ELDCALL_CALLCALL_PROCESSED ELDCALL_CALLCALL_PROCESSED_PRIOR
   197                              <2>  %rep %0 - 1
   198                              <2>   %rotate 1
   199                              <2>   %define ELDCALL_CHECK %1
   200                              <2> 	eldcall_callcall_detect ELDCALL_CALLCALL_PROCESSED
   201                              <2>   %if ELDCALL_NEW
   202                              <2>    %xdefine ELDCALL_CALLCALL_PROCESSED ELDCALL_CALLCALL_PROCESSED, %1
   203                              <2> 	align 8, nop
   204                              <2> %1:
   205                              <2> 	extcall %1
   206                              <2> 	retn
   207                              <2>   %endif
   208                              <2>  %endrep
   209                              <2> %assign ELDCALLCALL_DUMPED 1
   210                              <2> %define ELDCALL_CALLCALL_LIST none
   211                              <2> 	%endmacro
   212                              <2> 
   213                              <2> 	%imacro eldcall_new_callcall 0.nolist
   214                              <2> %if ELDCALLCALL_DUMPED
   215                              <2>  %xdefine ELDCALL_CALLCALL_PROCESSED_PRIOR   ELDCALL_CALLCALL_PROCESSED_PRIOR, ELDCALL_CALLCALL_PROCESSED
   217                              <2>  %assign ELDCALLCALL_DUMPED 0
   218                              <2>  %define ELDCALL_CALLCALL_LIST none
   219                              <2> %endif
   220                              <2> 	%endmacro
   221                              <2> 
   222                              <2> 	%imacro eldcall_callcall_detect 1-*.nolist
   223                              <2> %assign ELDCALL_NEW 1
   224                              <2> %rep %0
   225                              <2>  %ifidni %1, ELDCALL_CHECK
   226                              <2>   %assign ELDCALL_NEW 0
   227                              <2>   %exitrep
   228                              <2>  %endif
   229                              <2>  %rotate 1
   230                              <2> %endrep
   231                              <2> 	%endmacro
   232                              <2> 
   233                              <2> 	%imacro eldcall_dump_names 1-*.nolist
   234                              <2> %rep %0
   235                              <2> 	%1
   236                              <2>  %rotate 1
   237                              <2> %endrep
   238                              <2> 	%endmacro
   239                              <2> 
   240                              <2> ; eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   241                              <2> ; if using optional code links:
   242                              <2> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
   243                              <2> ;  dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
   244                              <2> ; if not using optional code links:
   245                              <2> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
   246                              <2> ;  dw ELDCALL_CODE_RELOCATIONS, 0, 0
   247                              <2> ; eldcall_dump_names ELDCALL_CODE_NAMES
   248                              <2> 
   249                              <2> %endif
     9                              <1> %include "elddata.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug data relocation macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2024 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELDDATA_MAC
    16                              <2> %define ELDDATA_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
    19                              <2> %include "nasmhash.mac"
    20                              <2> %include "eldcheck.mac"
    21                              <2> 
    22                              <2> 
    23                              <2> %assign ELDLINKER 0
    24                              <2> 
    25                              <2> %define INTERNAL_CODE_TO_CODE_RELOCATIONS ""
    26                              <2> %define INTERNAL_CODE_TO_DATA_RELOCATIONS ""
    27                              <2> %define INTERNAL_DATA_TO_CODE_RELOCATIONS ""
    28                              <2> %define INTERNAL_DATA_TO_DATA_RELOCATIONS ""
    29                              <2> %define INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS ""
    30                              <2> %define INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS ""
    31                              <2> %define INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS ""
    32                              <2> %define INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS ""
    33                              <2> %assign ELDDATA_OPTIONAL_STATUS 0		; not any seen yet
    34                              <2> %assign ELDDATA_PMREQUIRED_STATUS 0		; not any seen yet
    35                              <2> %assign ELDDATA_NEXT_STATUS 0			; not any seen yet
    36                              <2> %assign ELDDATA_NEXT_ENTRY -1
    37                              <2> %assign ELDDATA_NEXT_SECTION -1
    38                              <2> %assign ELDDATA_NEXT_OTHER -1
    39                              <2> 
    40                              <2> 	%imacro internalcoderelocation 0-1.nolist -2
    41                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    42                              <2> %if ELDLINKER
    43                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    44                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    45                              <2>  %else
    46                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    47                              <2>  %endif
    48                              <2> %else
    49                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    50                              <2>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    51                              <2>  %else
    52                              <2>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    53                              <2>  %endif
    54                              <2> %endif
    55                              <2> 	eldstrictcheck
    56                              <2> 	%endmacro
    57                              <2> 
    58                              <2> 	%imacro internaldatarelocation 0-1.nolist -2
    59                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    60                              <2> %if ELDLINKER
    61                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    62                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    63                              <2>  %else
    64                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    65                              <2>  %endif
    66                              <2> %else
    67                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    68                              <2>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    69                              <2>  %else
    70                              <2>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    71                              <2>  %endif
    72                              <2> %endif
    73                              <2> 	eldstrictcheck
    74                              <2> 	%endmacro
    75                              <2> 
    76                              <2> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    77                              <2> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    78                              <2> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    79                              <2> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    80                              <2> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    81                              <2> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    82                              <2> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    83                              <2> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    84                              <2> 
    85                              <2> 
    86                              <2> %define LINK_DATA_RELOCATIONS ""
    87                              <2> %define LINK_LINKER_DATA_RELOCATIONS ""
    88                              <2> %define LINK_DATA_NAMES db ""
    89                              <2> %define LINK_DATA_DETECTION none, none
    90                              <2> 
    91                              <2> %define LINK_OTHER_DATA_RELOCATIONS ""
    92                              <2> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    93                              <2> %define LINK_OTHER_DATA_NAMES db ""
    94                              <2> %define LINK_OTHER_DATA_DETECTION none, none
    95                              <2> 
    96                              <2> %ifndef ELDOTHER
    97                              <2>  %assign ELDOTHER 0
    98                              <2> %endif
    99                              <2> %assign ELDOTHERLINK 0
   100                              <2> 
   101                              <2> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
   102                              <2> %if ELDOTHER
   103                              <2>  %assign ELDOTHERLINK 1
   104                              <2> %endif
   105                              <2> 	linkdatarelocation %1, %2, %3
   106                              <2> %assign ELDOTHERLINK 0
   107                              <2> 	%endmacro
   108                              <2> 
   109                              <2> 	%imacro linkdatarelocation 1-4.nolist -2, required, single
   110                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   111                              <2> %ifidni %3, required
   112                              <2>  %assign %%optional 0
   113                              <2> %elifidni %3, optional
   114                              <2>  %assign %%optional 100h
   115                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   116                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   117                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   118                              <2>  %else
   119                              <2>   %error Optional data link not allowed here
   120                              <2>  %endif
   121                              <2> %elifidni %3, PM required
   122                              <2>  %assign %%optional 300h
   123                              <2>  %assign ELDDATA_PMREQUIRED_STATUS 1
   124                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   125                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   126                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   127                              <2>  %else
   128                              <2>   %error Optional data link not allowed here
   129                              <2>  %endif
   130                              <2> %else
   131                              <2>  %fatal Unknown optional keyword
   132                              <2> %endif
   133                              <2> %ifidni _CURRENT_SECTION_TYPE, DATA
   134                              <2>  %assign %%DATASECTION 1
   135                              <2> %else
   136                              <2>  %assign %%DATASECTION 0
   137                              <2> %endif
   138                              <2> %ifidni %4, single
   139                              <2>  %if ELDDATA_NEXT_STATUS == 1		; after next ?
   140                              <2>   %error Unexpected single data link after next data link
   141                              <2>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   142                              <2>   %assign ELDDATA_NEXT_STATUS 3		; note single with next/last present
   143                              <2>  %endif
   144                              <2>  %assign %%next 0
   145                              <2> %elifidni %4, next
   146                              <2>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   147                              <2>   %assign ELDDATA_NEXT_STATUS 1		; in next
   148                              <2>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   149                              <2>   %assign ELDDATA_NEXT_STATUS 1		; in next
   150                              <2>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   151                              <2>   %assign ELDDATA_NEXT_STATUS 1		; in next
   152                              <2>  %elif ELDDATA_NEXT_STATUS == 1		; repeated next ?
   153                              <2>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   156                              <2>    %error Unexpected next data link
   157                              <2>   %endif
   158                              <2>  %else
   159                              <2>   %error Next data link not allowed here
   160                              <2>  %endif
   161                              <2>  %ifn %%optional
   162                              <2>   %error Next data link only valid as optional or PM required
   163                              <2>  %endif
   164                              <2>  %assign %%next 400h
   165                              <2>  %assign ELDDATA_NEXT_ENTRY %%entry
   166                              <2>  %assign ELDDATA_NEXT_SECTION %%DATASECTION
   167                              <2>  %assign ELDDATA_NEXT_OTHER ELDOTHERLINK
   168                              <2> %elifidni %4, last
   169                              <2>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   170                              <2>   %error Next last data link not allowed here
   171                              <2>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   172                              <2>   %error Next last data link not allowed here
   173                              <2>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   174                              <2>   %error Next last data link not allowed here
   175                              <2>  %elif ELDDATA_NEXT_STATUS == 1		; after next ?
   176                              <2>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   179                              <2>    %error Unexpected next data link
   180                              <2>   %endif
   181                              <2>   %assign ELDDATA_NEXT_STATUS 2		; note now after last
   182                              <2>  %else
   183                              <2>   %error Next data link not allowed here
   184                              <2>  %endif
   185                              <2>  %assign %%next 800h
   186                              <2>  %assign ELDDATA_NEXT_ENTRY -1
   187                              <2>  %assign ELDDATA_NEXT_SECTION -1
   188                              <2> %else
   189                              <2>  %fatal Unknown next keyword
   190                              <2> %endif
   191                              <2> 	%if ELDOTHERLINK
   192                              <2> %if ELDLINKER
   193                              <2>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   194                              <2> %else
   195                              <2>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   196                              <2> %endif
   197                              <2> 	%else
   198                              <2> %if ELDLINKER
   199                              <2>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   200                              <2> %else
   201                              <2>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   202                              <2> %endif
   203                              <2> 	%endif
   204                              <2> %defstr %%string %1
   205                              <2> %strlen %%length %%string
   206                              <2> %if %%length > 64
   207                              <2> 	; Could be increased, but mustn't exceed 127 bytes
   208                              <2> 	;  because flag 80h is used to mark optional links
   209                              <2> 	;  that failed to be matched.
   210                              <2>  %error Too long link name: %1
   211                              <2> %endif
   212                              <2> %define LINK_DATA_CHECK %1
   213                              <2> 	%if ELDOTHERLINK
   214                              <2> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   215                              <2> %if LINK_DATA_NEW
   216                              <2>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   217                              <2> 	hashdef HASH, %%string
   218                              <2>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   220                              <2> %else
   221                              <2>  %%name equ LINK_DATA_DUPLICATE
   222                              <2> %endif
   223                              <2> 	%else
   224                              <2> 	linkdata_detect LINK_DATA_DETECTION
   225                              <2> %if LINK_DATA_NEW
   226                              <2>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   227                              <2> 	hashdef HASH, %%string
   228                              <2>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   230                              <2> %else
   231                              <2>  %%name equ LINK_DATA_DUPLICATE
   232                              <2> %endif
   233                              <2> 	%endif
   234                              <2> 	eldstrictcheck
   235                              <2> 	%endmacro
   236                              <2> 
   237                              <2> 	%imacro linkdata_detect 2-*.nolist
   238                              <2> %assign LINK_DATA_NEW 1
   239                              <2> %rep (%0 - 2) / 2
   240                              <2>  %rotate 2
   241                              <2>  %ifidni %1, LINK_DATA_CHECK
   242                              <2>   %assign LINK_DATA_NEW 0
   243                              <2>   %xdefine LINK_DATA_DUPLICATE %2
   244                              <2>   %exitrep
   245                              <2>  %endif
   246                              <2> %endrep
   247                              <2> 	%endmacro
   248                              <2> 
   249                              <2> 	%imacro link_data_dump_names 1-*.nolist
   250                              <2> %rep %0
   251                              <2> 	%1
   252                              <2>  %rotate 1
   253                              <2> %endrep
   254                              <2> 	%endmacro
   255                              <2> 
   256                              <2> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   257                              <2> ; dw LINK_DATA_RELOCATIONS, 0, 0
   258                              <2> ; link_data_dump_names ELDCALL_CODE_NAMES
   259                              <2> 
   260                              <2> %endif
    10                              <1> 
    11                              <1> 	numdef MCP, 0
    12                              <1> 	numdef COMPRESSED, 0
    13                              <1> 	numdef COMPRESSLIB, 0
    14                              <1> %assign _ELDCOMPRESSED _COMPRESSED
    15                              <1> 	numdef ALIGNPAGE, 1
    16                              <1> 	excdef !_COMPRESSED, ALIGNPAGE
    17                              <1> 	numdef DATABUFFER, 1
    18                              <1> 	numdef ELD_TEST_LIB, 0
    19                              <1> 	numdef ELD_TEST_DESCRIBEX, 0
    20                              <1>  	numdef ELD_ZERO_OFFSETS, 0
    21                              <1> 
    22                              <1> %assign _DEBUG 1
    23                              <1> %assign _CATCHINT0C 0
    24                              <1> %assign _CATCHINT0D 0
    25                              <1> %assign _CATCHINTFAULTCOND 0
    26                              <1> %assign _LOADER 0
    27                              <1> %assign _DEBUG_COND 1
    28                              <1> %assign _DELAY_BEFORE_BP 0
    29                              <1> %assign _DHIGHLIGHT 0
    30                              <1> %assign _GETLINEHIGHLIGHT 0
    31                              <1> %assign _IMMASM 0
    32                              <1> %assign _INPUT_FILE_BOOT 0
    33                              <1> %assign _INPUT_FILE_HANDLES 0
    34                              <1> %assign _MS_0RANGE_COMPAT 0
    35                              <1> %assign _PM 0
    36                              <1> %assign _RH 0
    37                              <1> %assign _SYMBOLIC 0
    38                              <1> %assign _VXCHG 0
    39                              <1> %include "options.mac"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> lDebug options and internal flags
     5                              <2> 
     6                              <2> Copyright (C) 2008-2025 E. C. Masloch
     7                              <2> 
     8                              <2> Usage of the works is permitted provided that this
     9                              <2> instrument is retained with the works, so that any entity
    10                              <2> that uses the works is notified of this instrument.
    11                              <2> 
    12                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                              <2> 
    14                              <2> %endif
    15                              <2> 
    16                              <2> 
    17                              <2> dispregs32	equ	  1	; RX: 32-bit register display (R, T/P/G)
    18                              <2> traceints	equ	  2	; TM: trace into interrupts (T)
    19                              <2> cpdepchars	equ	  4	; allow dumping of CP-dependent characters (D, DX)
    20                              <2> fakeindos	equ	  8	; always assume InDOS flag non-zero (all)
    21                              <2> nonpagingdevice	equ	 10h	; disallow paged output with [more] prompt (all exc. P, T)
    22                              <2> 	; This option was never used anywhere:
    23                              <2> ; pagingdevice	equ	 20h	; allow paged output with [more] prompt (all exc. P, T)
    24                              <2> 				; paged output is by default on if the output device is StdOut, else off
    25                              <2> hexrn		equ	 40h	; display raw hexadecimal content of FPU registers (RN)
    26                              <2> ;novdd		equ	 80h	; don't use a registered NTVDM VDD (L, W)
    27                              <2> nondospaging	equ	100h	; paging: don't use DOS for input when waiting for a key
    28                              <2> opt1_86mnohlt	equ	200h	; (86 Mode:) HLT doesn't work, don't use it
    29                              <2> biosidles	equ	400h	; don't idle with HLT or Int2F.1680, only call BIOS Int16.00
    30                              <2> opt_usegetinput	equ	800h	; use getinput for int 21h interactive input
    31                              <2> use_si_units	equ    1000h	; in disp_*_size use SI units (kB = 1000, etc)
    32                              <2> use_jedec_units	equ    2000h	; in disp_*_size use JEDEC units (kB = 1024)
    33                              <2> enable_serial	equ    4000h	; enable serial I/O (preferred over DOS or BIOS terminal)
    34                              <2> int8_disable_serial equ	   8000h	; disable serial I/O when breaking due to intr8
    35                              <2> gg_do_not_skip_bp equ	 1_0000h	; gg: do not skip a breakpoint (bb or gg)
    36                              <2> gg_no_autorepeat equ	 2_0000h	; gg: do not auto-repeat
    37                              <2> tp_do_not_skip_bp equ	 4_0000h	; T/TP/P: do not skip a (bb) breakpoint
    38                              <2> gg_bb_hit_no_repeat equ	 8_0000h	; gg: do not auto-repeat after bb hit
    39                              <2> tp_bb_hit_no_repeat equ	10_0000h	; T/TP/P: do not auto-repeat after bb hit
    40                              <2> gg_unexpected_no_repeat equ 20_0000h	; gg: do not auto-repeat after unexpectedinterrupt
    41                              <2> tp_unexpected_no_repeat equ 40_0000h	; T/TP/P
    42                              <2> ss_no_dump:		equ 80_0000h
    43                              <2> %if _SYMBOLIC
    44                              <2> dd_no_blanks_sym:	equ 100_0000h
    45                              <2> zz_no_pm_xms:		equ 200_0000h
    46                              <2> %endif
    47                              <2> rr_disasm_no_rept:	equ 1000_0000h
    48                              <2> rr_disasm_no_show:	equ 2000_0000h
    49                              <2> opt_cmdline_quiet_input:equ 4000_0000h
    50                              <2> opt_cmdline_quiet_output:equ 8000_0000h
    51                              <2> %if _SYMBOLIC
    52                              <2> DEFAULTOPTIONS	equ zz_no_pm_xms
    53                              <2> %else
    54                              <2> DEFAULTOPTIONS	equ 0
    55                              <2> %endif
    56                              <2> 
    57                              <2> 
    58                              <2> opt2_db_header:		equ 1
    59                              <2> opt2_db_trailer:	equ 2
    60                              <2> opt2_dw_header:		equ 10h
    61                              <2> opt2_dw_trailer:	equ 20h
    62                              <2> opt2_dd_header:		equ 100h
    63                              <2> opt2_dd_trailer:	equ 200h
    64                              <2> opt2_getinput_dpmi:	equ 800h
    65                              <2> opt2_hh_compat:		equ 1000h
    66                              <2> opt2_getc_idle:		equ 2000h
    67                              <2> opt2_getc_idle_dpmi:	equ 4000h
    68                              <2> opt2_re_cancel_tpg:	equ 8000h
    69                              <2> opt2_nn_compat:		equ 1_0000h
    70                              <2> opt2_nn_capitalise:	equ 2_0000h
    71                              <2> %if _MS_0RANGE_COMPAT
    72                              <2> opt2_0range_compat:	equ 4_0000h
    73                              <2> %endif
    74                              <2> opt2_rr16_compat:	equ 8_0000h
    75                              <2> opt2_r_prompt_compat:	equ 10_0000h
    76                              <2> opt2_r_separate:	equ 20_0000h
    77                              <2> opt2_r_linebreak_always:equ 40_0000h
    78                              <2> opt2_dpminohlt:		equ 8000_0000h	; DPMI doesn't like hlt
    79                              <2> DEFAULTOPTIONS2	equ opt2_dw_header | opt2_dd_header | opt2_getc_idle_dpmi | opt2_dpminohlt
    80                              <2> 
    81                              <2> 
    82                              <2> opt3_tt_no_paging:	equ 1
    83                              <2> opt3_tp_no_paging:	equ 2
    84                              <2> opt3_pp_no_paging:	equ 4
    85                              <2> opt3_gg_no_paging:	equ 8
    86                              <2> opt3_silence_paging_set:equ 100h
    87                              <2> opt3_silence_paging_on:	equ 200h
    88                              <2> opt3_paging_rc:		equ 1000h
    89                              <2> opt3_paging_yy:		equ 2000h
    90                              <2> opt3_paging_re:		equ 4000h
    91                              <2> opt3_r_highlight_diff:	equ 10000h
    92                              <2> opt3_r_highlight_dumb:	equ 20000h
    93                              <2> opt3_r_highlight_full:	equ 40000h
    94                              <2> opt3_r_highlight_eip:	equ 80000h
    95                              <2> %if _PM
    96                              <2> opt3_ss_b_bit_set:	equ   10_0000h
    97                              <2>  %if _BREAK_INSTALLDPMI
    98                              <2> opt3_break_installdpmi:	equ   20_0000h
    99                              <2>  %endif
   100                              <2> %endif
   101                              <2> %if _DHIGHLIGHT
   102                              <2> opt3_d_highlight:	equ   80_0000h
   103                              <2> %endif
   104                              <2> %if _GETLINEHIGHLIGHT
   105                              <2> opt3_getline_highlight:	equ  100_0000h
   106                              <2> %endif
   107                              <2> opt3_no_idle_2F:	equ  200_0000h
   108                              <2> %if _DELAY_BEFORE_BP
   109                              <2> opt3_delay_before_bp:	equ  400_0000h
   110                              <2> %endif
   111                              <2> opt3_no_call_amis:	equ  800_0000h
   112                              <2> opt3_disable_autorepeat:equ 1000_0000h
   113                              <2> opt3_check_ctrlc_keyb:	equ 2000_0000h
   114                              <2> opt3_check_ctrlc_0bh:	equ 4000_0000h
   115                              <2> opt3_tsr_quit_leave_tf:	equ 8000_0000h
   116                              <2> DEFAULTOPTIONS3	equ opt3_tt_no_paging | opt3_tp_no_paging 		| opt3_pp_no_paging | opt3_gg_no_paging 		| opt3_check_ctrlc_keyb | opt3_check_ctrlc_0bh
   119                              <2> 
   120                              <2> 
   121                              <2> opt4_int_2F_hook:	equ 2
   122                              <2> opt4_int_08_hook:	equ 4
   123                              <2> opt4_int_2D_hook:	equ 8
   124                              <2> %if _CATCHINTFAULTCOND
   125                              <2> opt4_int_fault_hook:	equ 10h
   126                              <2> %endif
   127                              <2> opt4_int_serial_force:	equ 1_0000h
   128                              <2> opt4_int_2F_force:	equ 2_0000h
   129                              <2> opt4_int_08_force:	equ 4_0000h
   130                              <2> opt4_int_2D_force:	equ 8_0000h
   131                              <2> %if _CATCHINT0D
   132                              <2> opt4_int_0D_force:	equ   10_0000h
   133                              <2> %endif
   134                              <2> %if _CATCHINT0C
   135                              <2> opt4_int_0C_force:	equ   20_0000h
   136                              <2> %endif
   137                              <2> opt4_int_00_force:	equ  100_0000h
   138                              <2> opt4_int_01_force:	equ  200_0000h
   139                              <2> opt4_int_03_force:	equ  400_0000h
   140                              <2> opt4_int_06_force:	equ  800_0000h
   141                              <2> opt4_int_18_force:	equ 1000_0000h
   142                              <2> opt4_int_19_force:	equ 2000_0000h
   143                              <2> opt4_int_09_force:	equ 4000_0000h	; not used at the same time as 15h
   144                              <2> opt4_int_15_force:	equ 4000_0000h	; not used at the same time as 09h
   145                              <2> opt4_int_07_force:	equ 8000_0000h
   146                              <2> DEFAULTOPTIONS4 equ opt4_int_2F_hook
   147                              <2> 
   148                              <2> 
   149                              <2> %if _VXCHG
   150                              <2> opt6_vv_mode:		equ 1
   151                              <2> opt6_vv_keep:		equ 2
   152                              <2> opt6_vv_int16:		equ 10h
   153                              <2>  %if _VXCHG_DEFAULT_ON
   154                              <2> DEFAULTOPTIONS6 equ opt6_share_serial_irq | opt6_vv_mode
   155                              <2>  %else
   156                              <2> DEFAULTOPTIONS6 equ opt6_share_serial_irq
   157                              <2>  %endif
   158                              <2> %else
   159                              <2> DEFAULTOPTIONS6 equ opt6_share_serial_irq
   160                              <2> %endif
   161                              <2> %if _DEBUG
   162                              <2> opt6_debug_exception_late:	equ  20h
   163                              <2> opt6_debug_exception_early:	equ  40h
   164                              <2>  %if _DEBUG_COND
   165                              <2> opt6_debug_exception:	equ  80h
   166                              <2> opt6_debug_mode:	equ 100h
   167                              <2>  %endif
   168                              <2> %endif
   169                              <2> opt6_bios_output:	equ 200h
   170                              <2> opt6_flat_binary:	equ 400h
   171                              <2> opt6_big_stack:		equ 800h
   172                              <2> opt6_40_columns:	equ 1000h
   173                              <2> opt6_40_indent_odd:	equ 2000h
   174                              <2> opt6_40_dash:		equ 4000h
   175                              <2> opt6_share_serial_irq:	equ 1_0000h
   176                              <2> opt6_serial_EOI_call:	equ 2_0000h
   177                              <2> %if _RH
   178                              <2> opt6_rh_mode:		equ 10_0000h
   179                              <2> %endif
   180                              <2> %if _DEBUG
   181                              <2> opt6_debug_putrunint_early:	equ  40_0000h
   182                              <2>  %if _DEBUG_COND
   183                              <2> opt6_debug_putrunint:		equ  80_0000h
   184                              <2>  %endif
   185                              <2> %endif
   186                              <2> opt6_bios_io:		equ 100_0000h
   187                              <2> opt6_immasm_display_uu:	equ 200_0000h
   188                              <2> opt6_immasm_debug:	equ 400_0000h
   189                              <2> opt6_immasm_flag:	equ 800_0000h
   190                              <2> opt6_immasm_nobranch:	equ 1000_0000h
   191                              <2> opt6_r_flags_style2:	equ 2000_0000h
   192                              <2> opt6_r_flags_style3:	equ 4000_0000h
   193                              <2> opt6_r_linebreak_conditional:	equ 8000_0000h
   194                              <2> 
   195                              <2> 
   196                              <2> DEFAULTOPTIONS7 equ opt7_no_tsr_ll
   197                              <2> opt7_no_free_oneshot_eld:	equ 1
   198                              <2> opt7_debug_optional_link:	equ 2
   199                              <2> opt7_quiet_install:		equ 4
   200                              <2> opt7_quick_run:			equ 8
   201                              <2> opt7_houdini:			equ 100h
   202                              <2> opt7_debug_run:			equ 200h
   203                              <2> opt7_no_ensure:			equ 1000h
   204                              <2> opt7_no_tsr_ll:			equ 2000h
   205                              <2> 
   206                              <2> 
   207                              <2> oldpacket	equ	  1	; Int25/Int26 packet method available (L, W)
   208                              <2> newpacket	equ	  2	; Int21.7305 packet method available (L, W)
   209                              <2> ntpacket	equ	  4	; VDD registered and usable (L, W)
   210                              <2> pagedcommand	equ	  8	; allows paging in puts
   211                              <2> notstdinput	equ	 10h	; DEBUG's StdIn isn't a device with StdIn bit (is file or other device)
   212                              <2> inputfile	equ	 20h	; DEBUG's StdIn is a file, notstdinput also set
   213                              <2> notstdoutput	equ	 40h	; DEBUG's StdOut isn't a device with StdOut bit (is file or other device)
   214                              <2> outputfile	equ	  80h	; DEBUG's StdOut is a file, notstdoutput also set
   215                              <2> hooked2F	equ	 100h	; Int2F hooked
   216                              <2> nohook2F	equ	 200h	; don't hook Int2F.1687 (required for Win9x, DosEmu?)
   217                              <2> unused_dif1_dpminohlt equ 400h	; DPMI doesn't like hlt
   218                              <2> protectedmode	equ	 800h	; in (DPMI) protected mode
   219                              <2> debuggeeA20	equ	1000h	; state of debuggee's A20
   220                              <2> debuggerA20	equ	2000h	; state of debugger's A20 (will be on if possible)
   221                              <2> nodosloaded	equ	4000h	; No DOS loaded currently (Boot loader mode)
   222                              <2> has386		equ	8000h	; CPU is a 386
   223                              <2> usecharcounter	equ    1_0000h	; don't reset charcounter between calls to puts
   224                              <2> runningnt	equ    2_0000h	; running in NTVDM
   225                              <2> canswitchmode	equ    4_0000h	; can switch modes (auxbuff large enough, DPMI mode switch set up)
   226                              <2> modeswitched	equ    8_0000h	; switched mode (now in the mode that we weren't entered in)
   227                              <2> promptwaiting	equ   10_0000h	; puts: any more output needs to display a prompt first
   228                              <2> switchbuffer	equ   20_0000h	; mode switch needs a buffer (auxbuff)
   229                              <2> tsrmode		equ   40_0000h	; in TSR mode; DPI and DPP not valid
   230                              <2> attachedterm	equ   80_0000h	; the attached process terminated
   231                              <2> runningdosemu	equ  100_0000h	; running in dosemu
   232                              <2> ; load_is_ldp	equ  200_0000h	; boot load: partition specified as "ldp"
   233                              <2> tt_while:	equ  400_0000h	; tt: while condition specified
   234                              <2> tt_p:		equ  800_0000h	; tt: proceed past repeated string instructions
   235                              <2> tt_silent_mode:	equ 1000_0000h	; tt: run should be silent (dump at end)
   236                              <2> tt_silence:	equ 2000_0000h	; tt: silent writing (write to auxbuff instead)
   237                              <2> tt_no_bb:	equ 4000_0000h	; tt: do not use bb breakpoints
   238                              <2> tt_no_bb_first:	equ 8000_0000h	; tt: do not use bb breakpoints at first
   239                              <2> 
   240                              <2> 
   241                              <2> dif2_gg_is_first:	equ   1
   242                              <2> dif2_gg_skip_non_cseip:	equ   2
   243                              <2> dif2_gg_skip_cseip:	equ   4
   244                              <2> dif2_gg_is_gg:		equ   8
   245                              <2> dif2_gg_first_detected:	equ  10h
   246                              <2> dif2_gg_again:		equ  20h
   247                              <2> dif2_tpg_proceed_bp_set:equ  40h
   248                              <2> dif2_tpg_keep_proceed_bp: equ 80h
   249                              <2> dif2_tpg_have_bp:	equ 100h
   250                              <2> dif2_tpg_adjusted_cseip:equ 200h
   251                              <2> dif2_tpg_do_not_adjust:	equ 400h
   252                              <2> dif2_bp_failure:	equ 800h
   253                              <2> dif2_is_pp:		equ 1000h
   254                              <2> %if _SYMBOLIC
   255                              <2> dif2_createdprocess:	equ 800_0000h	; created empty debuggee process
   256                              <2> dif2_sym_req_xms:	equ 2000h
   257                              <2> dif2_sym_req_86mm:	equ 4000h
   258                              <2> dif2_sym_req_mask equ dif2_sym_req_86mm | dif2_sym_req_xms
   259                              <2> dif2_no_pm_xms:		equ 1_0000h
   260                              <2> dif2_xms_detection_done:equ 2_0000h
   261                              <2> %endif
   262                              <2> %if _INPUT_FILE_HANDLES
   263                              <2> dif2_input_file:	equ 10_0000h
   264                              <2> dif2_closed_input_file:	equ 20_0000h
   265                              <2> %endif
   266                              <2> dif2_did_getline_file:	equ 40_0000h
   267                              <2> %if _SYMBOLIC
   268                              <2> dif2_poison:		equ 80_0000h
   269                              <2> %endif
   270                              <2> dif2_boot_loaded_kernel:equ 100_0000h
   271                              <2> %if _INPUT_FILE_BOOT
   272                              <2> dif2_input_file_boot:	equ 200_0000h
   273                              <2> dif2_closed_input_file_boot:	equ 400_0000h
   274                              <2> %endif
   275                              <2> dif2_in_silence_dump:	equ 1000_0000h
   276                              <2> dif2_int31_segment:	equ 2000_0000h
   277                              <2> dif2_nn_compat:		equ 4000_0000h
   278                              <2> dif2_nn_capitalise:	equ 8000_0000h
   279                              <2> 
   280                              <2> 
   281                              <2> dif3_load_is_ldp:	equ 1	; boot load: partition specified as "ldp"
   282                              <2> dif3_load_is_sdp:	equ 2	; boot load: partition specified as "sdp"
   283                              <2> dif3_load_is_ydp:	equ 4	; boot load: partition specified as "ydp"
   284                              <2> dif3_load_is_dp:	equ dif3_load_is_ldp 				| dif3_load_is_sdp 				| dif3_load_is_ydp
   287                              <2> dif3_load_dir_dir:	equ 8
   288                              <2> dif3_input_terminal_override:	equ 10h
   289                              <2> dif3_input_serial_override:	equ 20h
   290                              <2> dif3_if_not:		equ 40h
   291                              <2> dif3_partition_changed:	equ 80h
   292                              <2> ;
   293                              <2> dif3_input_cmdline:	equ 100h; input reading from cmdline_buffer
   294                              <2> dif3_input_cmdline_closed: equ 200h
   295                              <2> dif3_at_line_end:	equ 400h
   296                              <2> dif3_quiet_input_single:equ 800h
   297                              <2> dif3_quiet_output:	equ 1000h
   298                              <2> dif3_unquiet_error:	equ 2000h
   299                              <2> dif3_unquiet_prompt:	equ 4000h
   300                              <2> dif3_unquiet:		equ dif3_unquiet_error | dif3_unquiet_prompt
   301                              <2> dif3_return_eof:	equ 8000h
   302                              <2> dif3_highlighting:	equ 1_0000h
   303                              <2> dif3_do_not_highlight:	equ 2_0000h
   304                              <2> dif3_int10_highlight:	equ 2_0000h
   305                              <2> dif3_nosymbols_1:	equ 4_0000h
   306                              <2> dif3_nosymbols_2:	equ 8_0000h
   307                              <2> %if _PM
   308                              <2> dif3_ss_b_bit_set:	equ  10_0000h
   309                              <2> %endif
   310                              <2> dif3_gotint19:		equ  20_0000h
   311                              <2> dif3_prior_pm:		equ  40_0000h
   312                              <2> %if _DELAY_BEFORE_BP
   313                              <2> dif3_delayed		equ  80_0000h
   314                              <2> %endif
   315                              <2> dif3_input_re:		equ 100_0000h	; input reading from re_buffer
   316                              <2> dif3_input_re_closed:	equ 200_0000h
   317                              <2> dif3_accept_getrange_0:	equ 400_0000h
   318                              <2> %if _INPUT_FILE_HANDLES || _INPUT_FILE_BOOT
   319                              <2> dif3_in_if:		equ 800_0000h
   320                              <2> %endif
   321                              <2> dif3_auxbuff_guarded_1:	equ 1000_0000h
   322                              <2> dif3_auxbuff_guarded_2:	equ 2000_0000h
   323                              <2> dif3_auxbuff_guarded_3:	equ 4000_0000h
   324                              <2> dif3_sss_is_reverse:	equ 8000_0000h
   325                              <2> 
   326                              <2> 
   327                              <2> dif4_int_serial_hooked:	equ 1
   328                              <2> dif4_int_2F_hooked:	equ 2
   329                              <2> dif4_int_08_hooked:	equ 4
   330                              <2> dif4_int_2D_hooked:	equ 8
   331                              <2> %if _CATCHINTFAULTCOND && _CATCHINT0D
   332                              <2> dif4_int_0D_hooked:	equ 10h
   333                              <2> %endif
   334                              <2> %if _CATCHINTFAULTCOND && _CATCHINT0C
   335                              <2> dif4_int_0C_hooked:	equ 20h
   336                              <2> %endif
   337                              <2> %if _LOADER
   338                              <2> dif4_int_18_hooked:	equ 1000h
   339                              <2> dif4_int_19_hooked:	equ 2000h
   340                              <2> %endif
   341                              <2> 
   342                              <2> 
   343                              <2> %if _VXCHG
   344                              <2> dif6_vv_mode:		equ 1
   345                              <2> %endif
   346                              <2> dif6_in_hook2F:		equ 2
   347                              <2> dif6_in_amis_hook2F:	equ 4
   348                              <2> dif6_debug_mode:	equ 100h
   349                              <2> dif6_locked:		equ 200h
   350                              <2> dif6_mcp:		equ 400h
   351                              <2> %if _RH
   352                              <2> dif6_rh_mode_was:	equ  8_0000h
   353                              <2> dif6_rh_mode:		equ 10_0000h
   354                              <2> dif6_rh_mode_2:		equ 20_0000h
   355                              <2> %endif
   356                              <2> dif6_device_mode:	equ 40_0000h
   357                              <2> dif6_cpdepchars:	equ 80_0000h
   358                              <2> %if _IMMASM
   359                              <2> dif6_immasm_no_output:	equ 100_0000h
   360                              <2> dif6_immasm:		equ 200_0000h
   361                              <2> dif6_immasm_rel8:	equ 400_0000h
   362                              <2> %endif
   363                              <2> 
   364                              <2> 
   365                              <2> disasm_lowercase	equ 1
   366                              <2> disasm_commablank	equ 2
   367                              <2> disasm_nasm		equ 4
   368                              <2> disasm_lowercase_refmem:equ 8
   369                              <2> disasm_show_short:	equ 10h
   370                              <2> disasm_show_near:	equ 20h
   371                              <2> disasm_show_far:	equ 40h
   372                              <2> disasm_nec:		equ 80h
   373                              <2> disasm_40_columns:	equ 100h
   374                              <2> disasm_no_indent:	equ 200h
   375                              <2> disasm_msdebug_mnemonofs: equ 400h
   376                              <2> disasm_a16_memref:	equ 1000h
   377                              <2> disasm_a32_memref:	equ 2000h
   378                              <2> disasm_a16_string:	equ 4000h
   379                              <2> disasm_a32_string:	equ 8000h
   380                              <2> disasm_hide_modrm:	equ 10000h
   381                              <2> disasm_asize_loop_nasm:	equ 20000h
   382                              <2> disasm_modrm_always:	equ 40000h
   383                              <2> DEFAULTASMOPTIONS equ disasm_lowercase|disasm_commablank|disasm_nasm 	| disasm_a16_memref | disasm_a32_memref 	| disasm_a16_string | disasm_a32_string
   386                              <2> 
   387                              <2> 	; serial_flags values
   388                              <2> sf_init_done:	equ 1
   389                              <2> sf_ctrl_c:	equ 2
   390                              <2> sf_double_ctrl_c:	equ 4
   391                              <2> sf_built_in_fifo:	equ 8
   392                              <2> sf_use_serial:		equ 10h
    40                              <1> 
    41                              <1> %include "iniload.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> lDebug iniload/boot interfacing structs and macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-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> 
    16                              <2> 	struc BS
    17 00000000 ??????              <2> bsJump:	resb 3
    18 00000003 ????????????????    <2> bsOEM:	resb 8
    19                              <2> bsBPB:
    20                              <2> 	endstruc
    21                              <2> 
    22                              <2> 	struc EBPB		;        BPB sec
    23 00000000 ????                <2> bpbBytesPerSector:	resw 1	; offset 00h 0Bh
    24 00000002 ??                  <2> bpbSectorsPerCluster:	resb 1	; offset 02h 0Dh
    25 00000003 ????                <2> bpbReservedSectors:	resw 1	; offset 03h 0Eh
    26 00000005 ??                  <2> bpbNumFATs:		resb 1	; offset 05h 10h
    27 00000006 ????                <2> bpbNumRootDirEnts:	resw 1	; offset 06h 11h -- 0 for FAT32
    28 00000008 ????                <2> bpbTotalSectors:	resw 1	; offset 08h 13h
    29 0000000A ??                  <2> bpbMediaID:		resb 1	; offset 0Ah 15h
    30 0000000B ????                <2> bpbSectorsPerFAT:	resw 1	; offset 0Bh 16h -- 0 for FAT32
    31 0000000D ????                <2> bpbCHSSectors:		resw 1	; offset 0Dh 18h
    32 0000000F ????                <2> bpbCHSHeads:		resw 1	; offset 0Fh 1Ah
    33 00000011 ????????            <2> bpbHiddenSectors:	resd 1	; offset 11h 1Ch
    34 00000015 ????????            <2> bpbTotalSectorsLarge:	resd 1	; offset 15h 20h
    35                              <2> bpbNew:				; offset 19h 24h
    36                              <2> 
    37 00000019 ????????            <2> ebpbSectorsPerFATLarge:	resd 1	; offset 19h 24h
    38 0000001D ????                <2> ebpbFSFlags:		resw 1	; offset 1Dh 28h
    39 0000001F ????                <2> ebpbFSVersion:		resw 1	; offset 1Fh 2Ah
    40 00000021 ????????            <2> ebpbRootCluster:	resd 1	; offset 21h 2Ch
    41 00000025 ????                <2> ebpbFSINFOSector:	resw 1	; offset 25h 30h
    42 00000027 ????                <2> ebpbBackupSector:	resw 1	; offset 27h 32h
    43 00000029 <res Ch>            <2> ebpbReserved:		resb 12	; offset 29h 34h
    44                              <2> ebpbNew:			; offset 35h 40h
    45                              <2> 	endstruc
    46                              <2> 
    47                              <2> 	struc BPBN		; ofs B16 S16 B32 S32
    48 00000000 ??                  <2> bpbnBootUnit:		resb 1	; 00h 19h 24h 35h 40h
    49 00000001 ??                  <2> 			resb 1	; 01h 1Ah 25h 36h 41h
    50 00000002 ??                  <2> bpbnExtBPBSignature:	resb 1	; 02h 1Bh 26h 37h 42h -- 29h for valid BPBN
    51 00000003 ????????            <2> bpbnSerialNumber:	resd 1	; 03h 1Ch 27h 38h 43h
    52 00000007 <res Bh>            <2> bpbnVolumeLabel:	resb 11	; 07h 20h 2Bh 3Ch 47h
    53 00000012 ????????????????    <2> bpbnFilesystemID:	resb 8	; 12h 2Bh 36h 47h 52h
    54                              <2> 	endstruc		; 1Ah 33h 3Eh 4Fh 5Ah
    55                              <2> 
    56                              <2> 	struc DIRENTRY
    57 00000000 ????????????????    <2> deName:		resb 8
    58 00000008 ??????              <2> deExt:		resb 3
    59 0000000B ??                  <2> deAttrib:	resb 1
    60 0000000C ??                  <2> dePlusSize:	resb 1
    61 0000000D ??????????????      <2> 		resb 7
    62 00000014 ????                <2> deClusterHigh:	resw 1
    63 00000016 ????                <2> deTime:		resw 1
    64 00000018 ????                <2> deDate:		resw 1
    65 0000001A ????                <2> deClusterLow:	resw 1
    66 0000001C ????????            <2> deSize:		resd 1
    67                              <2> 	endstruc
    68                              <2> 
    69                              <2> ATTR_READONLY	equ 1
    70                              <2> ATTR_HIDDEN	equ 2
    71                              <2> ATTR_SYSTEM	equ 4
    72                              <2> ATTR_VOLLABEL	equ 8
    73                              <2> ATTR_DIRECTORY	equ 10h
    74                              <2> ATTR_ARCHIVE	equ 20h
    75                              <2> 
    76                              <2> lsvclSignature		equ "CL"
    77                              <2> lsvclBufferLength	equ 256
    78                              <2> 
    79                              <2> 	struc LOADSTACKVARS, -10h
    80 FFFFFFF0 ????????            <2> lsvFirstCluster:	resd 1
    81 FFFFFFF4 ????????            <2> lsvFATSector:		resd 1
    82 FFFFFFF8 ????                <2> lsvFATSeg:		resw 1
    83 FFFFFFFA ????                <2> lsvLoadSeg:		resw 1
    84 FFFFFFFC ????????            <2> lsvDataStart:		resd 1
    85                              <2> 	endstruc
    86                              <2> 
    87                              <2> 	struc LOADDATA, LOADSTACKVARS - 10h
    88 FFFFFFE0 ????                <2> ldMemoryTop:	resw 1
    89 FFFFFFE2 ????                <2> ldLoadTop:	resw 1
    90 FFFFFFE4 ????                <2> ldSectorSeg:	resw 1
    91 FFFFFFE6 ??                  <2> ldFATType:	resb 1
    92                              <2> ldFlags:
    93 FFFFFFE7 ??                  <2> ldHasLBA:	resb 1
    94 FFFFFFE8 ????                <2> ldClusterSize:	resw 1
    95 FFFFFFEA ????                <2> ldParaPerSector:resw 1
    96                              <2> ldDirCluster:			; dword
    97                              <2> ldLoadingSeg:		; word
    98                              <2> ldQueryPatchValue:	; word
    99                              <2> lsvCommandLine:		; word
   100                              <2> .start:		equ $ - lsvclBufferLength
   101 FFFFFFEC ????                <2> .signature:	resw 1
   102                              <2> ldLoadUntilSeg:		; word
   103                              <2> lsvExtra:		; word
   104 FFFFFFEE ??                  <2> .partition:	resb 1	; byte
   105 FFFFFFEF ??                  <2> .flags:		resb 1	; byte
   106                              <2> 	endstruc
   107                              <2> 
   108                              <2> ldhlfPreserveLoader	equ 4
   109                              <2> 
   110                              <2> lsvefNoDataStart	equ 1
   111                              <2> lsvefPartitionNumber	equ 2
   112                              <2> lsvefPreserveLoader	equ 4
   113                              <2> 
   114                              <2> %if lsvefPreserveLoader != ldhlfPreserveLoader
   115                              <2>  %error Unexpected flag values
   116                              <2> %endif
   117                              <2> 
   118                              <2> 	struc LOADCMDLINE, LOADDATA - lsvclBufferLength
   119                              <2> ldCommandLine:
   120 FFFFFEE0 <res 100h>          <2> .start:		resb lsvclBufferLength
   121                              <2> 	endstruc
   122                              <2> 
   123                              <2> ldfHasLBA:	equ 1
   124                              <2> ldfFATInvalid:	equ 2
   125                              <2> ldfFATBuffered:	equ 4
   126                              <2> ldfDataBuffered: equ 8
   127                              <2> 
   128                              <2> 	struc LOADDATA2, LOADDATA - 10h
   129 FFFFFFD0 ????????            <2> ldRootSector:		resd 1
   130 FFFFFFD4 ????                <2> ldEntriesPerSector:	resw 1
   131                              <2> ldDataSegment:		; word
   132 FFFFFFD6 ????                <2> ldLastAvailableSector:	resw 1
   133                              <2> ldDataSector:		; dword
   134 FFFFFFD8 ????                <2> ldParasLeft:		resw 1
   135 FFFFFFDA ????                <2> ldParasDone:		resw 1
   136                              <2> 	endstruc
   137                              <2> 
   138                              <2> 	struc LOADDATA3, LOADDATA2 - 10h
   139 FFFFFFC0 ????????            <2> ldMaxCluster:		resd 1
   140 FFFFFFC4 ????????            <2> ldFileSize:		resd 1
   141 FFFFFFC8 ????????            <2> ldCurrentCluster:	resd 1
   142 FFFFFFCC ????????            <2> ldCurrentSeek:		resd 1
   143                              <2> 	endstruc
   144                              <2> 
   145                              <2> 	struc LOADERIMAGEIDENT
   146 00000000 ????????            <2> liiSignature:		resb 4		; "NLDR"
   147 00000004 ????                <2> liiVersion:		resb 2		; "00"
   148 00000006 ????                <2> liiChecksum:		resw 1		; word sum of first 8 words = 0
   149 00000008 ????                <2> liiAmountParagraphs:	resw 1
   150 0000000A ????????????        <2> liiReserved:		resw 3
   151 00000010 ????                <2> liiEntryQuerySize:	resw 1		; 0 if not supported
   152                              <2> 		; INP:	cs => NLDR image ident
   153                              <2> 		;	ip = this word field content
   154                              <2> 		;	ax = 60h
   155                              <2> 		; OUT:	ax => behind memory requested (should be >= 60h)
   156                              <2> 		; CHG:	es, ds, di, si, bx, cx, dx
   157                              <2> 		; STT:	far called, UP, EI
   158 00000012 ????                <2> liiEntryRelocate:	resw 1		; 0 if not supported
   159                              <2> 		; INP:	cs => NLDR image ident
   160                              <2> 		;	ip = this word field content
   161                              <2> 		;	ax = 60h
   162                              <2> 		; OUT:	ax => relocated NLDR segment (usually 60h)
   163                              <2> 		; CHG:	es, ds, di, si, bx, cx, dx
   164                              <2> 		; STT:	far called, UP, EI
   165 00000014 ????                <2> liiEntryDebug:		resw 1		; 0 if not supported
   166                              <2> 		; INP:	es = ds = cs = ss => relocated NLDR
   167                              <2> 		;	ip = this word field content
   168                              <2> 		;	sp = next word field content
   169                              <2> 		; STT:	running as debuggee, UP, EI
   170 00000016 ????                <2> liiStackPointer:	resw 1
   171                              <2> 	endstruc
   172                              <2> 
   173                              <2> 	struc LBAPACKET
   174 00000000 ????                <2> lpSize:		resw 1
   175 00000002 ????                <2> lpCount:	resw 1
   176 00000004 ????????            <2> lpBuffer:	resd 1
   177 00000008 ????????????????    <2> lpSector:	resq 1
   178                              <2> 	endstruc
   179                              <2> 
   180                              <2> 	struc PARTINFO
   181 00000000 ??                  <2> piBoot:		resb 1
   182 00000001 ??????              <2> piStartCHS:	resb 3
   183 00000004 ??                  <2> piType:		resb 1
   184 00000005 ??????              <2> piEndCHS:	resb 3
   185 00000008 ????????            <2> piStart:	resd 1
   186 0000000C ????????            <2> piLength:	resd 1
   187                              <2> 	endstruc
   188                              <2> 
   189                              <2> ptEmpty:		equ 0
   190                              <2> ptFAT12:		equ 1
   191                              <2> ptFAT16_16BIT_CHS:	equ 4
   192                              <2> ptExtendedCHS:		equ 5
   193                              <2> ptFAT16_CHS:		equ 6
   194                              <2> ptFAT32_CHS:		equ 0Bh
   195                              <2> ptFAT32:		equ 0Ch
   196                              <2> ptFAT16:		equ 0Eh
   197                              <2> ptExtended:		equ 0Fh
   198                              <2> ptLinux:		equ 83h
   199                              <2> ptExtendedLinux:	equ 85h
   200                              <2> 
   201                              <2> 
   202                              <2> 		; Flags of load_unit_flags
   203                              <2> lufForceCHS:		equ 1
   204                              <2> lufForceLBA:		equ 2
   205                              <2> lufForceGeometry:	equ 4
   206                              <2> luf_mask_writable equ lufForceCHS | lufForceLBA | lufForceGeometry
    42                              <1> 
    43                              <1> 	numdef XLD
    44                              <1> 
    45                              <1> %ifn _COMPRESSLIB
    46                              <1> 	cpu 8086
    47                              <1> 
    48                              <1> 	addsection RELOCATEDDATA, nobits vstart=_ELD_RELOC_VSTART
    49                              <1> relocateddata:
    50                              <1> 
    51                              <1> 	addsection HEADER, start=0
    52                              <1> 
    53                              <1> 	istruc ELD_HEADERX
    54                              <1> at eldhxHeader
    55                              <1> 		; ELD executable header
    56                              <1> 	istruc ELD_HEADER
    57 00000000 454C4431            <1> at eldhSignature,	db "ELD1"
    58 00000004 000000              <1> 			db 0,0,0
    59 00000007 1A                  <1> 			db 26
    60 00000008 50000000            <1> at eldhCodeOffset,	dd CODEOFFSET
    61 0000000C 5012                <1> at eldhCodeImageLength,	dw code_size
    62 0000000E 0000                <1> at eldhCodeAllocLength,	dw 0
    63 00000010 A0120000            <1> at eldhDataOffset,	dd DATAOFFSET
    64 00000014 B005                <1> at eldhDataImageLength,	dw data_size
    65 00000016 2014                <1> at eldhDataAllocLength,	dw total_data_size - data_size
    66 00000018 4009                <1> at eldhCodeEntrypoint,	dw linker - code
    67                              <1> at eldhReserved
    68 0000001A 00<rep 4h>2C00      <1> at eldhExtensionSize,	dw header_extension_end - $$
    69                              <1> 	iend
    70 00000020 [30000000]          <1> at eldhxDescriptionOffset,	dd description
    71 00000024 4D170000            <1> at eldhxHelpOffset,		dd DATAOFFSET + msg.help - datastart
    72 00000028 A0120000            <1> at eldhxLibTable,		dd DATAOFFSET + libtable - datastart
    73                              <1> PUT_ELDHX_DATETIME_OFFSET
    74                              <1> header_extension_end:
    75 0000002C 00<rep 4h>          <1> 	iend
    76                              <1> 
    77                              <1> description:
    78                              <1> %if _MCP
    79                              <1> 	db "MCP "
    80                              <1> %endif
    81 00000030 455854204C49423A20- <1> 	asciz "EXT LIB: library of ELDs."
    81 00000039 6C696272617279206F- <1>
    81 00000042 6620454C44732E00    <1>
    82                              <1> 
    83                              <1> 
    84 0000004A 00<rep 6h>          <1> 	align 16, db 0
    85                              <1> 
    86                              <1> CODEOFFSET equ $ - $$
    87                              <1> 	addsection CODE, follows=HEADER vstart=_ELD_CODE_VSTART
    88                              <1> %define CODEFIXUP - code + 0
    89                              <1> code:
    90                              <1> 		; ELD instance header
    91                              <1> 	istruc ELD_INSTANCE
    92                              <1> at eldiStartCode
    93 00000000 00<rep 2h>          <1> at eldiEndCode
    94 00000002 00<rep 2h>          <1> at eldiStartData
    95 00000004 00<rep 2h>          <1> at eldiEndData
    96 00000006 00<rep 2h>4558544C- <1> at eldiIdentifier,	fill 8, 32, db "EXTLIB"
    96 0000000C 494220<rep 2h>      <1>
    97 00000010 00<rep 2h>65787470- <1> at eldiListing,		asciz _ELD_LISTING
    97 00000016 616B2E6C737400      <1>
    98 0000001D 00<rep 3h>          <1> 	iend
    99                              <1> 
   100                              <1> 
   101                              <1> load:
   102 00000020 E88705              <1> 	call get_es_ext
   103 00000023 BF[0000]            <1> 	mov di, code
   104                              <1> internalcoderelocation
   105 00000026 268B4502            <1> 	mov ax, word [es:di + eldiEndCode]
   106 0000002A 2D[1006]            <1> 	sub ax, strict word endload + code
   107                              <1> internalcoderelocation
   108 0000002D 26C74502[1006]      <1> 	mov word [es:di + eldiEndCode], endload + code
   109                              <1> internalcoderelocation
   110 00000033 2906[0000]          <1> 	sub word [relocateddata], ax
   111                              <1> linkdatarelocation extseg_used
   112 00000037 16                  <1> 	push ss
   113 00000038 07                  <1> 	pop es
   114                              <1> 
   115                              <1> %assign _BOOTLDR 1
   116                              <1> %assign _APPLICATION 1
   117                              <1> %assign _DEVICE 1
   118                              <1> %assign _PM 1
   119                              <1> %define relocated(address) relocateddata
   120                              <1> %define doscall extcallcall _doscall
   121                              <1> %assign ELD 1
   122                              <1> %assign _DOSORBOOTIO 1
   123                              <1> 
   124                              <1> %include "loadeld.asm"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> lDebug load Extensions for lDebug
     5                              <2> 
     6                              <2> Copyright (C) 2008-2025 E. C. Masloch
     7                              <2> 
     8                              <2> Usage of the works is permitted provided that this
     9                              <2> instrument is retained with the works, so that any entity
    10                              <2> that uses the works is notified of this instrument.
    11                              <2> 
    12                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                              <2> 
    14                              <2> %endif
    15                              <2> 
    16                              <2> %if ELD
    17                              <2> %assign _ELDTRAILER 0
    18                              <2> 		numdef DOSORBOOTIO, 0
    19                              <2> 		numdef ELDCOMPRESSED, 0
    20                              <2> %else
    21                              <2> %assign _DOSORBOOTIO 0
    22                              <2> %assign _ELDCOMPRESSED 0
    23                              <2> 	push bp
    24                              <2> %endif
    25                              <2> 
    26                              <2> %if _ELDTRAILER
    27                              <2> 	xor ax, ax
    28                              <2> 	mov word [eldheader], ax
    29                              <2> internaldatarelocation
    30                              <2> 	mov word [eldheader + 2], ax
    31                              <2> internaldatarelocation
    32                              <2> 
    33                              <2> 	xchg cx, ax
    34                              <2> 	mov ax, 4202h
    35                              <2> 	xor dx, dx
    36                              <2> %if _BOOTLDR
    37                              <2>  %if _APPLICATION || _DEVICE
    38                              <2> 	testopt [relocated(internalflags)], nodosloaded
    39                              <2> linkdatarelocation internalflags, -3
    40                              <2> 	jz @F
    41                              <2>  %endif
    42                              <2> 	extcallcall yy_boot_seek_start.bx
    43                              <2> 	mov cx, word [load_data - LOADDATA2 + ldFileSize + 2]
    44                              <2> internaldatarelocation
    45                              <2> 	mov dx, word [load_data - LOADDATA2 + ldFileSize]
    46                              <2> internaldatarelocation
    47                              <2> 	extcallcall yy_boot_seek_current.bx
    48                              <2> 	mov dx, word [load_data - LOADDATA2 + ldCurrentSeek + 2]
    49                              <2> internaldatarelocation
    50                              <2> 	mov ax, word [load_data - LOADDATA2 + ldCurrentSeek]
    51                              <2> internaldatarelocation
    52                              <2>  %if _APPLICATION || _DEVICE
    53                              <2> 	jmp @FF
    54                              <2>  %endif
    55                              <2> %endif
    56                              <2> 
    57                              <2> @@:
    58                              <2> %if _APPLICATION || _DEVICE
    59                              <2> 	doscall
    60                              <2> %endif
    61                              <2> @@:
    62                              <2> 	jc .io_error
    63                              <2> 
    64                              <2> 	test dx, dx
    65                              <2> 	jnz @F
    66                              <2> 	cmp ax, ELD_HEADER_size + ELD_TRAILER_HEADER_size
    67                              <2> 	jb .no_trailer
    68                              <2> @@:
    69                              <2> 
    70                              <2> 	mov ax, 4201h
    71                              <2> 	mov cx, -1
    72                              <2> 	mov dx, - ELD_TRAILER_HEADER_size
    73                              <2> %if _BOOTLDR
    74                              <2>  %if _APPLICATION || _DEVICE
    75                              <2> 	testopt [relocated(internalflags)], nodosloaded
    76                              <2> linkdatarelocation internalflags, -3
    77                              <2> 	jz @F
    78                              <2>  %endif
    79                              <2> 	extcallcall yy_boot_seek_current.bx
    80                              <2> 	mov dx, word [load_data - LOADDATA2 + ldCurrentSeek + 2]
    81                              <2> internaldatarelocation
    82                              <2> 	mov ax, word [load_data - LOADDATA2 + ldCurrentSeek]
    83                              <2> internaldatarelocation
    84                              <2>  %if _APPLICATION || _DEVICE
    85                              <2> 	jmp @FF
    86                              <2>  %endif
    87                              <2> %endif
    88                              <2> 
    89                              <2> @@:
    90                              <2> %if _APPLICATION || _DEVICE
    91                              <2> 	doscall
    92                              <2> %endif
    93                              <2> @@:
    94                              <2> 	jc .io_error
    95                              <2> 
    96                              <2> 	push dx
    97                              <2> 	push ax
    98                              <2> 
    99                              <2> 	mov cx, fromwords(ELD_TRAILER_HEADER_size_w)
   100                              <2> 	sub sp, cx
   101                              <2> 	mov dx, sp
   102                              <2> 
   103                              <2> 	mov ah, 3Fh
   104                              <2> %if _BOOTLDR
   105                              <2>  %if _APPLICATION || _DEVICE
   106                              <2> 	testopt [relocated(internalflags)], nodosloaded
   107                              <2> linkdatarelocation internalflags, -3
   108                              <2> 	jz @F
   109                              <2>  %endif
   110                              <2> 	extcallcall yy_boot_read.bx
   111                              <2>  %if _APPLICATION || _DEVICE
   112                              <2> 	jmp @FF
   113                              <2>  %endif
   114                              <2> %endif
   115                              <2> 
   116                              <2> @@:
   117                              <2> %if _APPLICATION || _DEVICE
   118                              <2> 	doscall
   119                              <2> %endif
   120                              <2> @@:
   121                              <2> 	jc .io_error
   122                              <2> 	mov di, sp
   123                              <2> 	mov si, sp
   124                              <2> 
   125                              <2> 	cmp ax, cx
   126                              <2> 	jne .no_trailer_pop
   127                              <2> 
   128                              <2> 	xor dx, dx
   129                              <2> 	shr cx, 1
   130                              <2> @@:
   131                              <2> 	lodsw
   132                              <2> 	add dx, ax
   133                              <2> 	loop @B
   134                              <2> 	jnz .no_trailer_pop
   135                              <2> 
   136                              <2> 	pop ax
   137                              <2> 	cmp ax, "EL"
   138                              <2> 	jne .no_trailer_pop
   139                              <2> 	pop ax
   140                              <2> 	cmp ax, "D1"
   141                              <2> 	jne .no_trailer_pop
   142                              <2> 	pop ax
   143                              <2> 	cmp ax, "TA"
   144                              <2> 	jne .no_trailer_pop
   145                              <2> 	pop ax
   146                              <2> 	cmp ax, "IL"
   147                              <2> 	jne .no_trailer_pop
   148                              <2> 
   149                              <2> 	pop si
   150                              <2> 	pop cx			; cx:si = displacement to subtract
   151                              <2> 	pop ax			; reserved
   152                              <2> 	pop ax			; checksum
   153                              <2> 
   154                              <2> 	pop ax
   155                              <2> 	pop dx			; dx:ax = offset of trailer header
   156                              <2> 	add ax, si
   157                              <2> 	adc dx, cx		; dx:ax = offset of header
   158                              <2> 	jnc .io_error
   159                              <2> 
   160                              <2> 	mov word [eldheader], ax
   161                              <2> internaldatarelocation
   162                              <2> 	mov word [eldheader + 2], dx
   163                              <2> internaldatarelocation
   164                              <2> 
   165                              <2> .no_trailer_pop:
   166                              <2> 	lea sp, [di + fromwords(ELD_TRAILER_HEADER_size_w) + 4]
   167                              <2> 
   168                              <2> .no_trailer:
   169                              <2> 	mov ax, 4200h
   170                              <2> 	mov dx, word [eldheader]
   171                              <2> internaldatarelocation
   172                              <2> 	mov cx, word [eldheader + 2]
   173                              <2> internaldatarelocation
   174                              <2> 
   175                              <2> %if _BOOTLDR
   176                              <2>  %if _APPLICATION || _DEVICE
   177                              <2> 	testopt [relocated(internalflags)], nodosloaded
   178                              <2> linkdatarelocation internalflags, -3
   179                              <2> 	jz @F
   180                              <2>  %endif
   181                              <2> 	extcallcall yy_boot_seek_start.bx
   182                              <2> 	extcallcall yy_boot_seek_current.bx
   183                              <2>  %if _APPLICATION || _DEVICE
   184                              <2> 	jmp @FF
   185                              <2>  %endif
   186                              <2> %endif
   187                              <2> 
   188                              <2> @@:
   189                              <2> %if _APPLICATION || _DEVICE
   190                              <2> 	doscall
   191                              <2> %endif
   192                              <2> @@:
   193                              <2> 	jc .io_error
   194                              <2> %endif
   195                              <2> 
   196 00000039 B92000              <2> 	mov cx, fromwords(ELD_HEADER_size_w)
   197 0000003C 29CC                <2> 	sub sp, cx
   198 0000003E 89E2                <2> 	mov dx, sp		; es:dx and ds:dx
   199                              <2> %if _ELDCOMPRESSED
   200 00000040 FF36[AA05]          <2> 	push word [eldheader + 2]
   201                              <2> internaldatarelocation
   202 00000044 FF36[A805]          <2> 	push word [eldheader]
   203                              <2> internaldatarelocation
   204 00000048 8F06[AC05]          <2> 	pop word [depackskip]
   205                              <2> internaldatarelocation
   206 0000004C 8F06[AE05]          <2> 	pop word [depackskip + 2]
   207                              <2> internaldatarelocation
   208                              <2> 
   209 00000050 E8BB03              <2> 	call read_and_depack
   210                              <2> %elif _DOSORBOOTIO
   211                              <2> 	mov ax, 3F00h
   212                              <2> 	call dos_or_boot_io
   213                              <2> %else
   214                              <2> 	mov ah, 3Fh
   215                              <2> %if _BOOTLDR
   216                              <2>  %if _APPLICATION || _DEVICE
   217                              <2> 	testopt [relocated(internalflags)], nodosloaded
   218                              <2> linkdatarelocation internalflags, -3
   219                              <2> 	jz @F
   220                              <2>  %endif
   221                              <2> 	extcallcall yy_boot_read.bx
   222                              <2>  %if _APPLICATION || _DEVICE
   223                              <2> 	jmp @FF
   224                              <2>  %endif
   225                              <2> %endif
   226                              <2> 
   227                              <2> @@:
   228                              <2> %if _APPLICATION || _DEVICE
   229                              <2> 	doscall
   230                              <2> %endif
   231                              <2> @@:
   232                              <2> %endif
   233 00000053 7303E9BC01          <2> 	jc .io_error
   234 00000058 39C8                <2> 	cmp ax, cx
   235 0000005A 7403E9BA01          <2> 	jne .invalid
   236                              <2> 
   237 0000005F 89E7                <2> 	mov di, sp
   238                              <2> 
   239 00000061 58                  <2> 	pop ax
   240 00000062 3D454C              <2> 	cmp ax, "EL"
   241 00000065 7403E9AF01          <2> 	jne .invalid
   242 0000006A 58                  <2> 	pop ax
   243 0000006B 3D4431              <2> 	cmp ax, "D1"
   244 0000006E 7403E9A601          <2> 	jne .invalid
   245 00000073 58                  <2> 	pop ax
   246 00000074 58                  <2> 	pop ax
   247 00000075 80FC1A              <2> 	cmp ah, 26
   248 00000078 7403E99C01          <2> 	jne .invalid
   249                              <2> 
   250                              <2> %ifn ELD
   251                              <2> 	testopt [internalflags3], dif3_in_if
   252                              <2> 	jnz if_exists_found_ext_open
   253                              <2> %endif
   254                              <2> 
   255 0000007D A1[0000]            <2> 	mov ax, word [relocated(extseg_size)]
   256                              <2> linkdatarelocation extseg_size
   257 00000080 2B06[0000]          <2> 	sub ax, word [relocated(extseg_used)]
   258                              <2> linkdatarelocation extseg_used
   259 00000084 7303E98601          <2> 	jc .error_internal
   260                              <2> %if ELD
   261 00000089 83E840              <2> 	sub ax, fromparas(relocator_size_p)
   262 0000008C 7303E97E01          <2> 	jc .error_internal
   263                              <2> %endif
   264                              <2> 
   265 00000091 8B4D0C              <2> 	mov cx, word [di + eldhCodeImageLength]
   266                              <2> %if ELD
   267 00000094 39C8                <2> 	cmp ax, cx
   268 00000096 7303E98301          <2> 	jb .oom
   269                              <2> %endif
   270 0000009B 034D0E              <2> 	add cx, word [di + eldhCodeAllocLength]
   271 0000009E 7238                <2> 	jc .invalid_CY
   272 000000A0 83C10F              <2> 	add cx, 15
   273 000000A3 7233                <2> 	jc .invalid_CY
   274 000000A5 80E1F0              <2> 	and cl, ~ 15
   275                              <2> 
   276                              <2> %if ELD
   277 000000A8 2E0306[0200]        <2> 	add ax, word [cs:code + eldiEndCode]
   278                              <2> internalcoderelocation
   279 000000AD 2E2B06[0000]        <2> 	sub ax, word [cs:code + eldiStartCode]
   280                              <2> internalcoderelocation
   281                              <2> %endif
   282 000000B2 39C8                <2> 	cmp ax, cx
   283 000000B4 7303E96501          <2> 	jb .oom
   284                              <2> 
   285 000000B9 8B16[0000]          <2> 	mov dx, word [relocated(extdata_size)]
   286                              <2> linkdatarelocation extdata_size
   287 000000BD 2B16[0000]          <2> 	sub dx, word [relocated(extdata_used)]
   288                              <2> linkdatarelocation extdata_used
   289 000000C1 7303E94901          <2> 	jc .error_internal
   290                              <2> 
   291 000000C6 8B7514              <2> 	mov si, word [di + eldhDataImageLength]
   292                              <2> %if ELD
   293 000000C9 39F2                <2> 	cmp dx, si
   294 000000CB 7303E94E01          <2> 	jb .oom
   295                              <2> %endif
   296 000000D0 037516              <2> 	add si, word [di + eldhDataAllocLength]
   297 000000D3 7203                <2> 	jc .invalid_CY
   298 000000D5 83C60F              <2> 	add si, 15
   299                              <2> .invalid_CY:
   300 000000D8 7303E93C01          <2> 	jc .invalid
   301 000000DD 83E6F0              <2> 	and si, ~ 15
   302                              <2> 
   303                              <2> %if ELD
   304 000000E0 2E0316[0600]        <2> 	add dx, word [cs:code + eldiEndData]
   305                              <2> internalcoderelocation
   306 000000E5 2E2B16[0400]        <2> 	sub dx, word [cs:code + eldiStartData]
   307                              <2> internalcoderelocation
   308                              <2> %endif
   309 000000EA 39F2                <2> 	cmp dx, si
   310 000000EC 7303E92D01          <2> 	jb .oom
   311                              <2> 
   312 000000F1 56                  <2> 	push si
   313 000000F2 51                  <2> 	push cx
   314                              <2> 
   315 000000F3 B80042              <2> 	mov ax, 4200h
   316 000000F6 8B4D0A              <2> 	mov cx, word [di + eldhCodeOffset + 2]
   317 000000F9 8B5508              <2> 	mov dx, word [di + eldhCodeOffset]
   318                              <2> %if ELD || _ELDTRAILER
   319 000000FC 0316[A805]          <2> 	add dx, word [eldheader]
   320                              <2> internaldatarelocation
   321 00000100 130E[AA05]          <2> 	adc cx, word [eldheader + 2]
   322                              <2> internaldatarelocation
   323                              <2> %else
   324                              <2> 		; ELD header is at seek 0
   325                              <2> %endif
   326                              <2> %if _ELDCOMPRESSED
   327 00000104 8916[AC05]          <2> 	mov word [depackskip], dx
   328                              <2> internaldatarelocation
   329 00000108 890E[AE05]          <2> 	mov word [depackskip + 2], cx
   330                              <2> internaldatarelocation
   331                              <2> %elif _DOSORBOOTIO
   332                              <2> 	call dos_or_boot_io
   333                              <2> %else
   334                              <2> %if _BOOTLDR
   335                              <2>  %if _APPLICATION || _DEVICE
   336                              <2> 	testopt [relocated(internalflags)], nodosloaded
   337                              <2> linkdatarelocation internalflags, -3
   338                              <2> 	jz @F
   339                              <2>  %endif
   340                              <2> 	extcallcall yy_boot_seek_start.bx
   341                              <2> 	extcallcall yy_boot_seek_current.bx
   342                              <2>  %if _APPLICATION || _DEVICE
   343                              <2> 	jmp @FF
   344                              <2>  %endif
   345                              <2> %endif
   346                              <2> 
   347                              <2> @@:
   348                              <2> %if _APPLICATION || _DEVICE
   349                              <2> 	doscall
   350                              <2> %endif
   351                              <2> @@:
   352                              <2> %endif
   353 0000010C 7303E90301          <2> 	jc .io_error
   354                              <2> 
   355 00000111 8B16[0000]          <2> 	mov dx, word [relocated(extseg_used)]
   356                              <2> linkdatarelocation extseg_used
   357                              <2> %if _PM
   358 00000115 E8D804              <2> 	extcallcall ispm
   359 00000118 7506                <2> 	jnz @F
   360 0000011A 8E1E[0000]          <2> 	mov ds, word [relocated(extdssel)]
   361                              <2> linkdatarelocation extdssel
   362 0000011E EB04                <2> 	jmp @FF
   363                              <2> 
   364                              <2> @@:
   365                              <2> %endif
   366 00000120 8E1E[0000]          <2> 	mov ds, word [relocated(extseg)]
   367                              <2> linkdatarelocation extseg
   368                              <2> @@:
   369 00000124 368B4D0C            <2> 	mov cx, word [ss:di + eldhCodeImageLength]
   370                              <2> %if _ELDCOMPRESSED
   371 00000128 1E                  <2> 	push ds
   372 00000129 07                  <2> 	pop es
   373 0000012A 16                  <2> 	push ss
   374 0000012B 1F                  <2> 	pop ds
   375 0000012C E8DF02              <2> 	call read_and_depack
   376 0000012F 16                  <2> 	push ss
   377 00000130 07                  <2> 	pop es
   378                              <2> %elif _DOSORBOOTIO
   379                              <2> 	mov ax, 3FFFh
   380                              <2> 	call dos_or_boot_io
   381                              <2> %else
   382                              <2> 	mov ah, 3Fh
   383                              <2> %if _BOOTLDR
   384                              <2>  %if _APPLICATION || _DEVICE
   385                              <2> 	testopt [ss:relocated(internalflags)], nodosloaded
   386                              <2> linkdatarelocation internalflags, -3
   387                              <2> 	jz @F
   388                              <2>  %endif
   389                              <2> 	push ds
   390                              <2> 	pop es
   391                              <2> 	push ss
   392                              <2> 	pop ds
   393                              <2> 	extcallcall yy_boot_read.bx
   394                              <2> 	push ss
   395                              <2> 	pop es
   396                              <2>  %if _APPLICATION || _DEVICE
   397                              <2> 	jmp @FF
   398                              <2>  %endif
   399                              <2> %endif
   400                              <2> 
   401                              <2> @@:
   402                              <2> %if _APPLICATION || _DEVICE
   403                              <2> %if _PM
   404                              <2> 	extcallcall doscall_extseg
   405                              <2> %else
   406                              <2> 	doscall
   407                              <2> %endif
   408                              <2> %endif
   409                              <2> @@:
   410                              <2> %endif
   411 00000131 16                  <2> 	 push ss
   412 00000132 1F                  <2> 	 pop ds
   413 00000133 7303E9DC00          <2> 	jc .io_error
   414 00000138 39C1                <2> 	cmp cx, ax
   415 0000013A 7403E9D500          <2> 	jne .io_error
   416                              <2> 
   417 0000013F B80042              <2> 	mov ax, 4200h
   418 00000142 8B4D12              <2> 	mov cx, word [di + eldhDataOffset + 2]
   419 00000145 8B5510              <2> 	mov dx, word [di + eldhDataOffset]
   420                              <2> %if ELD || _ELDTRAILER
   421 00000148 0316[A805]          <2> 	add dx, word [eldheader]
   422                              <2> internaldatarelocation
   423 0000014C 130E[AA05]          <2> 	adc cx, word [eldheader + 2]
   424                              <2> internaldatarelocation
   425                              <2> %else
   426                              <2> 		; ELD header is at seek 0
   427                              <2> %endif
   428                              <2> 
   429                              <2> %if _ELDCOMPRESSED
   430 00000150 8916[AC05]          <2> 	mov word [depackskip], dx
   431                              <2> internaldatarelocation
   432 00000154 890E[AE05]          <2> 	mov word [depackskip + 2], cx
   433                              <2> internaldatarelocation
   434                              <2> %elif _DOSORBOOTIO
   435                              <2> 	call dos_or_boot_io
   436                              <2> %else
   437                              <2> %if _BOOTLDR
   438                              <2>  %if _APPLICATION || _DEVICE
   439                              <2> 	testopt [relocated(internalflags)], nodosloaded
   440                              <2> linkdatarelocation internalflags, -3
   441                              <2> 	jz @F
   442                              <2>  %endif
   443                              <2> 	extcallcall yy_boot_seek_start.bx
   444                              <2> 	extcallcall yy_boot_seek_current.bx
   445                              <2>  %if _APPLICATION || _DEVICE
   446                              <2> 	jmp @FF
   447                              <2>  %endif
   448                              <2> %endif
   449                              <2> 
   450                              <2> @@:
   451                              <2> %if _APPLICATION || _DEVICE
   452                              <2> 	doscall
   453                              <2> %endif
   454                              <2> @@:
   455                              <2> %endif
   456 00000158 7303E9B700          <2> 	jc .io_error
   457                              <2> 
   458                              <2> %if ELD
   459 0000015D 8B16[0000]          <2> 	mov dx, word [relocateddata]
   460                              <2> linkdatarelocation extdata
   461                              <2> %else
   462                              <2> 	mov dx, ext_data_area
   463                              <2> %endif
   464 00000161 0316[0000]          <2> 	add dx, word [relocated(extdata_used)]
   465                              <2> linkdatarelocation extdata_used
   466 00000165 8B4D14              <2> 	mov cx, word [di + eldhDataImageLength]
   467                              <2> %if _ELDCOMPRESSED
   468 00000168 E8A302              <2> 	call read_and_depack
   469                              <2> %elif _DOSORBOOTIO
   470                              <2> 	mov ax, 3F00h
   471                              <2> 	call dos_or_boot_io
   472                              <2> %else
   473                              <2> 	mov ah, 3Fh
   474                              <2> %if _BOOTLDR
   475                              <2>  %if _APPLICATION || _DEVICE
   476                              <2> 	testopt [relocated(internalflags)], nodosloaded
   477                              <2> linkdatarelocation internalflags, -3
   478                              <2> 	jz @F
   479                              <2>  %endif
   480                              <2> 	extcallcall yy_boot_read.bx
   481                              <2>  %if _APPLICATION || _DEVICE
   482                              <2> 	jmp @FF
   483                              <2>  %endif
   484                              <2> %endif
   485                              <2> 
   486                              <2> @@:
   487                              <2> %if _APPLICATION || _DEVICE
   488                              <2> 	doscall
   489                              <2> %endif
   490                              <2> @@:
   491                              <2> %endif
   492 0000016B 7303E9A400          <2> 	jc .io_error
   493 00000170 39C1                <2> 	cmp cx, ax
   494 00000172 7403E99D00          <2> 	jne .io_error
   495                              <2> 		; seek now -> behind data image.
   496                              <2> 		; this is expected by library ELDs to find their
   497                              <2> 		;  library images within the file, even if the
   498                              <2> 		;  library ELD was appended using eldapend.
   499                              <2> 
   500                              <2> %if _PM
   501 00000177 E83004              <2> 	call get_es_ext
   502                              <2> %else
   503                              <2> 	mov es, word [extseg]
   504                              <2> %endif
   505                              <2> 
   506                              <2> %if ELD
   507 0000017A 8B1E[0000]          <2> 	mov bx, word [relocateddata]
   508                              <2> linkdatarelocation extseg_used		; es:bx -> where we loaded code
   509                              <2> 
   510 0000017E 8B4518              <2> 	mov ax, [di + eldhCodeEntrypoint]
   511 00000181 05[0000]            <2> 	add ax, strict word code	; -> entry destination
   512                              <2> internalcoderelocation
   513 00000184 26A3[E605]          <2> 	mov word [es:relocator.entry], ax
   514                              <2> internalcoderelocation
   515                              <2> 
   516 00000188 8B450C              <2> 	mov ax, word [di + eldhCodeImageLength]
   517 0000018B 26A3[BF05]          <2> 	mov word [es:relocator.codelength], ax
   518                              <2> internalcoderelocation
   519                              <2> 
   520 0000018F 8B4514              <2> 	mov ax, word [di + eldhDataImageLength]
   521 00000192 26A3[CE05]          <2> 	mov word [es:relocator.datalength], ax
   522                              <2> internalcoderelocation
   523                              <2> 
   524 00000196 58                  <2> 	pop ax
   525                              <2> 
   526 00000197 26C707[0000]        <2> 	mov word [es:bx + eldiStartCode], code
   527                              <2> internalcoderelocation			; fix its start
   528                              <2> 
   529 0000019C 89C7                <2> 	mov di, ax
   530 0000019E 033E[0000]          <2> 	add di, word [relocateddata]
   531                              <2> linkdatarelocation extseg_used		; di -> relocator destination
   532 000001A2 50                  <2> 	push ax
   533 000001A3 83C040              <2> 	add ax, fromparas(relocator_size_p)
   534 000001A6 260106[0200]        <2> 	add word [es:code + eldiEndCode], ax
   535                              <2> internalcoderelocation			; grow our allocation
   536 000001AB 0106[0000]          <2> 	add word [relocateddata], ax
   537                              <2> linkdatarelocation extseg_used		; ditto
   538 000001AF 58                  <2> 	pop ax
   539                              <2> 
   540 000001B0 26891E[C205]        <2> 	mov word [es:relocator.codesource], bx
   541                              <2> internalcoderelocation			; -> start
   542 000001B5 05[0000]            <2> 	add ax, strict word code
   543                              <2> internalcoderelocation
   544 000001B8 26894702            <2> 	mov word [es:bx + eldiEndCode], ax
   545                              <2> 					; -> past destination
   546 000001BC 26A3[DD05]          <2> 	mov word [es:relocator.extseg_used], ax
   547                              <2> internalcoderelocation			; new extseg_used
   548                              <2> 
   549 000001C0 58                  <2> 	pop ax
   550                              <2> 
   551 000001C1 8B16[0000]          <2> 	mov dx, word [relocateddata]
   552                              <2> linkdatarelocation extdata_used
   553 000001C5 0316[0000]          <2> 	add dx, word [relocateddata]
   554                              <2> linkdatarelocation extdata
   555                              <2> 
   556 000001C9 268916[D105]        <2> 	mov word [es:relocator.datasource], dx
   557                              <2> internalcoderelocation
   558                              <2> 
   559                              <2> 	houdini
   560 000001CE BA[0000]            <2> 	mov dx, datastart
   561                              <2> internaldatarelocation
   562 000001D1 26895704            <2> 	mov word [es:bx + eldiStartData], dx
   563 000001D5 01D0                <2> 	add ax, dx
   564 000001D7 26894706            <2> 	mov word [es:bx + eldiEndData], ax
   565                              <2> 
   566 000001DB 2B06[0000]          <2> 	sub ax, word [relocateddata]
   567                              <2> linkdatarelocation extdata
   568 000001DF 26A3[E305]          <2> 	mov word [es:relocator.extdata_used], ax
   569                              <2> internalcoderelocation			; new extdata_used
   570                              <2> 
   571 000001E3 BA[0000]            <2> 	mov dx, code
   572                              <2> internalcoderelocation			; es:dx -> ELD code instance (dest)
   573 000001E6 BB[0000]            <2> 	mov bx, datastart
   574                              <2> internaldatarelocation
   575                              <2> 
   576 000001E9 BE[B805]            <2> 	mov si, relocator
   577                              <2> internalcoderelocation
   578 000001EC B91B00              <2> 	mov cx, relocator_size_w
   579 000001EF 06                  <2> 	 push es
   580 000001F0 1F                  <2> 	 pop ds
   581 000001F1 57                  <2> 	push di
   582 000001F2 F3A5                <2> 	rep movsw
   583 000001F4 59                  <2> 	pop cx				; -> relocator entry
   584 000001F5 16                  <2> 	push ss
   585 000001F6 1F                  <2> 	pop ds
   586                              <2> %else
   587                              <2> 	pop ax				; allocated code size
   588                              <2> 	mov dx, word [extseg_used]
   589                              <2> 	mov bp, dx
   590                              <2> 	mov word [es:bp+eldiStartCode], dx
   591                              <2> 					; -> loaded code
   592                              <2> 	add ax, word [extseg_used]
   593                              <2> 	mov word [extseg_used], ax	; -> behind
   594                              <2> 	mov word [es:bp+eldiEndCode], ax; -> behind
   595                              <2> 
   596                              <2> 	pop ax				; allocated data size
   597                              <2> 	mov bx, word [extdata_used]
   598                              <2> 	add bx, ext_data_area		; -> loaded data
   599                              <2> 	mov word [es:bp+eldiStartData], bx
   600                              <2> 	add word [extdata_used], ax	; = amount new used
   601                              <2> 	add ax, bx			; -> behind
   602                              <2> 	mov word [es:bp+eldiEndData], ax
   603                              <2> 
   604                              <2> 	mov cx, [di + eldhCodeEntrypoint]
   605                              <2> 	add cx, dx
   606                              <2> %endif
   607 000001F7 83C418              <2> 	add sp, ELD_HEADER_size - 8
   608                              <2> 
   609                              <2> %if ELD
   610 000001FA 5E                  <2> 	pop si
   611 000001FB A1[0000]            <2> 	mov ax, word [relocateddata]
   612                              <2> linkdatarelocation linksel
   613 000001FE E8EF03              <2> 	extcallcall ispm
   614 00000201 7403                <2> 	jz @F
   615 00000203 A1[0000]            <2> 	mov ax, word [relocateddata]
   616                              <2> linkdatarelocation linkseg
   617                              <2> @@:
   618                              <2> 
   619 00000206 BF[0000]            <2> 	mov di, relocateddata
   620                              <2> linkdatarelocation linkinfoaddress
   621 00000209 8B3D                <2> 	mov di, [di]
   622 0000020B 8ED8                <2> 	mov ds, ax
   623                              <2> 
   624 0000020D FFE1                <2> 	jmp cx
   625                              <2> 		; INP:	es:dx -> loaded initial ELD image
   626                              <2> 		;	 ELD instance structure filled
   627                              <2> 		;	es => ELD code area
   628                              <2> 		;	ds:di -> link info
   629                              <2> 		;	ss:bx -> loaded initial data
   630                              <2> 		;	ss:si -> command line tail
   631                              <2> 		;	cs:ip -> entrypoint
   632                              <2> 		;	ss:sp -> far return address for current mode
   633                              <2> 		; STT:	UP, EI
   634                              <2> 		; REM:	if loaded as an ELD by an uncompressed library ELD,
   635                              <2> 		;	 file seek -> behind data image just loaded
   636                              <2> 		;	file seek is not meaningful when loaded as an ELD
   637                              <2> 		;	 by a compressed library ELD
   638                              <2> %else
   639                              <2> ext_finish.bp_is_set equ $
   640                              <2> 	pop bp
   641                              <2> 
   642                              <2> 	mov si, word [ext_cmdline]
   643                              <2> 
   644                              <2> %if _MESSAGESEGMENT
   645                              <2>  %if _PM
   646                              <2> 	call get_messagesegsel
   647                              <2>  %else
   648                              <2>  	mov ds, word [ss:messageseg]
   649                              <2>  %endif
   650                              <2> %endif
   651                              <2> 	mov di, linkinfo
   652                              <2> 
   653                              <2> 	push cs
   654                              <2> 	call .transfer
   655                              <2> 		; INP:	es:dx -> loaded initial ELD image
   656                              <2> 		;	 ELD instance structure filled
   657                              <2> 		;	es => ELD code area
   658                              <2> 		;	ds:di -> link info
   659                              <2> 		;	ss:bx -> loaded initial data
   660                              <2> 		;	ss:si -> command line tail
   661                              <2> 		;	cs:ip -> entrypoint
   662                              <2> 		;	ss:sp -> far return address for current mode
   663                              <2> 		; STT:	UP, EI
   664                              <2> 		; REM:	file seek -> behind data image just loaded
   665                              <2> %endif
   125                              <1> 
   126                              <1> .error_internal:
   127 0000020F BE[0F03]            <1> 	mov si, msg.ext_error_internal
   128                              <1> internaldatarelocation
   129 00000212 EB0D                <1> 	jmp specificerror
   130                              <1> 
   131                              <1> .io_error:
   132 00000214 BE[3503]            <1> 	mov si, msg.ext_error_io
   133                              <1> internaldatarelocation
   134 00000217 EB08                <1> 	jmp specificerror
   135                              <1> 
   136                              <1> .invalid:
   137 00000219 BE[5703]            <1> 	mov si, msg.ext_error_invalid
   138                              <1> internaldatarelocation
   139 0000021C EB03                <1> 	jmp specificerror
   140                              <1> 
   141                              <1> .oom:
   142 0000021E BE[8E03]            <1> 	mov si, msg.ext_error_oom
   143                              <1> internaldatarelocation
   144                              <1> 	; jmp specificerror
   145                              <1> 
   146                              <1> specificerror:
   147 00000221 16                  <1> 	push ss
   148 00000222 1F                  <1> 	pop ds
   149 00000223 16                  <1> 	push ss
   150 00000224 07                  <1> 	pop es
   151 00000225 B40E                <1> 	mov ah, 0Eh
   152 00000227 AC                  <1> 	lodsb
   153 00000228 E8[0000]EB020000    <1> 	extcall setrc
   154 0000022F 89F2                <1> 	mov dx, si
   155 00000231 E8C403              <1> 	extcallcall putsz
   156                              <1> zero_and_cmd3:
   157                              <1> %if _ELD_ZERO_OFFSETS
   158                              <1> 	call zerooffsets
   159                              <1> %endif
   160 00000234 E8C903              <1> 	extcallcall cmd3
   161                              <1> 
   162                              <1> 
   163                              <1> 
   164                              <1> dos_or_boot_io:
   165                              <1> %if _BOOTLDR
   166 00000237 36F606[0100]40      <1> reloc	testopt [ss:relocateddata], nodosloaded
   167                              <1> linkdatarelocation internalflags, -3
   168 0000023D 7515                <1> 	jnz .boot
   169                              <1> %endif
   170                              <1> .dos:
   171 0000023F 3DFF3F              <1> 	cmp ax, 3FFFh
   172 00000242 7408                <1> 	je @F
   173 00000244 E8[0000]EB020000    <1> 	extcall _doscall
   174 0000024B C3                  <1> 	retn
   175                              <1> 
   176                              <1> @@:
   177 0000024C E8[0000]EB020000    <1> 	extcall doscall_extseg
   178 00000253 C3                  <1> 	retn
   179                              <1> 
   180                              <1> %if _BOOTLDR
   181                              <1> .boot:
   182 00000254 80FC3F              <1> 	cmp ah, 3Fh
   183 00000257 7512                <1> 	jne @F
   184 00000259 3CFF                <1> 	cmp al, 0FFh
   185 0000025B 7504                <1> 	jne .bootread
   186                              <1> .bootread_ext:
   187 0000025D 1E                  <1> 	push ds
   188 0000025E 07                  <1> 	pop es
   189 0000025F 16                  <1> 	push ss
   190 00000260 1F                  <1> 	pop ds
   191                              <1> .bootread:
   192 00000261 E8[0000]EB020000    <1> 	extcall yy_boot_read.bx
   193 00000268 16                  <1> 	push ss
   194 00000269 07                  <1> 	pop es
   195 0000026A C3                  <1> 	retn
   196                              <1> 
   197                              <1> @@:
   198 0000026B 3D0042              <1> 	cmp ax, 4200h
   199 0000026E 7517                <1> 	jne @F
   200 00000270 2B16[FCFF]          <1> 	sub dx, word [relocateddata - LOADDATA2 + ldCurrentSeek]
   201                              <1> linkdatarelocation load_data
   202 00000274 1B0E[FEFF]          <1> 	sbb cx, word [relocateddata - LOADDATA2 + ldCurrentSeek + 2]
   203                              <1> linkdatarelocation load_data
   204                              <1> 
   205                              <1> .boot_seek_current:
   206 00000278 E8[0000]EB020000    <1> 	extcall yy_boot_seek_current.bx
   207 0000027F A1[FCFF]            <1> 	mov ax, word [relocateddata - LOADDATA2 + ldCurrentSeek]
   208                              <1> linkdatarelocation load_data
   209 00000282 8B16[FEFF]          <1> 	mov dx, word [relocateddata - LOADDATA2 + ldCurrentSeek + 2]
   210                              <1> linkdatarelocation load_data
   211 00000286 C3                  <1> 	retn
   212                              <1> 
   213                              <1> @@:
   214 00000287 3D0142              <1> 	cmp ax, 4201h
   215 0000028A 74EC                <1> 	je .boot_seek_current
   216 0000028C E87903              <1> 	extcallcall error
   217                              <1> %endif
   218                              <1> 
   219                              <1> 
   220                              <1> %if _COMPRESSED
   221                              <1> %assign _STANDALONE 0
   222                              <1>  %ifn _ELD_TEST_DESCRIBEX
   223                              <1>   %define ELD_OMIT_PARTIALDEPACK
   224                              <1>  %endif
   225                              <1>  %include "depack.asm"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> lDebug heatshrink/lzexedat depacker
     4                              <2> 
     5                              <2> Copyright (C) 2008-2026 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %include "lmacros3.mac"
     1                              <3> [list -]
    16                              <2> 
    17                              <2> 
    18                              <2> 	numdef LZEXEDAT,	0
    19                              <2> 	numdef DEPACKINLINELITERAL,	1
    20                              <2> 	numdef DXTAG,		1
    21                              <2> 	numdef LONGLITERAL,	0
    22                              <2> 	numdef MULTI,		0
    23                              <2> 	numdef STANDALONE,	1
    24                              <2> 	numdef DATEXE,		0
    25                              <2> 
    26                              <2> %ifn _STANDALONE
    27                              <2> 	overridedef DEBUG0,	0
    28                              <2> 	overridedef COUNTER,	0
    29                              <2> %else
    30                              <2>  %ifn _DATEXE
    31                              <2> 	overridedef MULTI,	0
    32                              <2>  %endif
    33                              <2> 	numdef DEBUG0,		0
    34                              <2> 	numdef COUNTER,		0, 32
    35                              <2> %if (_COUNTER - 1) & _COUNTER
    36                              <2>  %error COUNTER must be a power of two
    37                              <2> %endif
    38                              <2> 	numdef OUTBUFFER,	1
    39                              <2> 
    40                              <2> 
    41                              <2> %ifn _DATEXE
    42                              <2> 	cpu 8086
    43                              <2> 	org 256
    44                              <2> 	addsection CODE, start=256
    45                              <2> testprogram:
    46                              <2> 	mov si, 81h
    47                              <2> 
    48                              <2> 	cmp sp, stack.top
    49                              <2> 	jae @F
    50                              <2> error:
    51                              <2> 	mov dx, msg.error
    52                              <2> 	mov ah, 09h
    53                              <2> 	int 21h
    54                              <2> 	mov ax, 4CFFh
    55                              <2> 	int 21h
    56                              <2> 	int 20h
    57                              <2> 
    58                              <2> @@:
    59                              <2> 	lodsb
    60                              <2> 	cmp al, 9
    61                              <2> 	je @B
    62                              <2> 	cmp al, 32
    63                              <2> 	je @B
    64                              <2> 	cmp al, 13
    65                              <2> 	je error
    66                              <2> 	mov dx, si
    67                              <2> 	dec dx
    68                              <2> 
    69                              <2> @@:
    70                              <2> 	lodsb
    71                              <2> 	cmp al, 9
    72                              <2> 	je @F
    73                              <2> 	cmp al, 32
    74                              <2> 	je @F
    75                              <2> 	cmp al, 13
    76                              <2> 	jne @B
    77                              <2> @@:
    78                              <2> 	mov byte [si - 1], 0
    79                              <2> 
    80                              <2> 	mov ax, 3D00h | 1_010_0_000b	; RO, DENY WRITE, No inherit
    81                              <2> 	int 21h
    82                              <2> 	jc error
    83                              <2> 	mov word [handle], ax
    84                              <2> 
    85                              <2> 	xchg bx, ax
    86                              <2> 	mov ax, 4202h
    87                              <2> 	xor cx, cx
    88                              <2> 	xor dx, dx
    89                              <2> 	int 21h
    90                              <2> 	jc error
    91                              <2> 
    92                              <2> 	push dx
    93                              <2> 	push ax
    94                              <2> 	mov ax, 4200h
    95                              <2> 	xor cx, cx
    96                              <2> 	xor dx, dx
    97                              <2> 	int 21h
    98                              <2> 	jc error
    99                              <2> 
   100                              <2> 	mov ax, 3C00h
   101                              <2> 	xor cx, cx
   102                              <2> 	mov dx, msg.outname
   103                              <2> 	int 21h
   104                              <2> 	jc error
   105                              <2> 	mov word [handle2], ax
   106                              <2> 
   107                              <2> 	pop dx
   108                              <2> 	pop cx				; = file size
   109                              <2> %else	; _DATEXE
   110                              <2> 	usesection CODE
   111                              <2> datexe_depack:
   112                              <2> 	mov cx, word [insize + 2]
   113                              <2> 	mov dx, word [insize]
   114                              <2> %endif
   115                              <2> 	mov word [filebuffer.next], filebuffer
   116                              <2> 	mov word [filebuffer.tail], filebuffer
   117                              <2> %if _OUTBUFFER
   118                              <2> 	mov word [outbuffer.next], outbuffer
   119                              <2> %endif
   120                              <2> 
   121                              <2> %if _DATEXE
   122                              <2> 	mov ax, BUFFER
   123                              <2> 	mov es, ax
   124                              <2> %endif
   125                              <2> 	mov di, resultbuffer
   126                              <2> 	push di
   127                              <2> 	push cx
   128                              <2> 	mov ax, 0CCCCh
   129                              <2> 	mov cx, words(resultbuffer.end - resultbuffer)
   130                              <2> 	rep stosw
   131                              <2> 	pop cx
   132                              <2> 	pop di
   133                              <2> 	mov si, resultbuffer.end
   134                              <2> 
   135                              <2> %if _DATEXE
   136                              <2> 	mov ax, [format]
   137                              <2> ..@breakpoint_d:
   138                              <2> 	nop
   139                              <2> %endif
   140                              <2> 
   141                              <2> 	call depack
   142                              <2> %if _DATEXE
   143                              <2> 	mov dx, DATA
   144                              <2> 	mov ds, dx
   145                              <2> 
   146                              <2> 	sbb ax, ax
   147                              <2> 	jz @F
   148                              <2> 	mov dx, msg.decompresserror
   149                              <2> 	call disp_msg_counted
   150                              <2> 	mov ax, 4C0Bh
   151                              <2> 	int 21h
   152                              <2> @@:
   153                              <2> %if _OUTBUFFER
   154                              <2> 	mov di, [outbuffer.next]
   155                              <2> 	call dump_outbuffer
   156                              <2> %endif
   157                              <2> 
   158                              <2> 	mov bx, word [outhandle]
   159                              <2> 	mov ax, 4202h
   160                              <2> 	xor cx, cx
   161                              <2> 	xor dx, dx
   162                              <2> 	int 21h
   163                              <2> 	jc openoutfile.error
   164                              <2> 	mov word [outsize], ax
   165                              <2> 	mov word [outsize + 2], dx
   166                              <2> 
   167                              <2> 	rol byte [verbose], 1
   168                              <2> 	jc display_table_d
   169                              <2> display_short_d:
   170                              <2> 	mov dx, msg.short.1
   171                              <2> 	call disp_msg_counted
   172                              <2> 	mov ax, word [insize]
   173                              <2> 	mov dx, word [insize + 2]
   174                              <2> 	call disp_dxax_dec
   175                              <2> 	mov dx, msg.short.2
   176                              <2> 	call disp_msg_counted
   177                              <2> 	mov ax, word [outsize]
   178                              <2> 	mov dx, word [outsize + 2]
   179                              <2> 	call disp_dxax_dec
   180                              <2> 	mov dx, msg.short.3
   181                              <2> 	call disp_msg_counted
   182                              <2> 	call disp_percentage_swapped
   183                              <2> 	mov ax, 4C00h
   184                              <2> 	int 21h
   185                              <2> 
   186                              <2> 
   187                              <2> display_table_d:
   188                              <2> 	mov si, table_d
   189                              <2> .loop:
   190                              <2> 	lodsw
   191                              <2> 	test ax, ax
   192                              <2> 	jz .done
   193                              <2> 	xchg dx, ax
   194                              <2> 	call disp_msg_counted
   195                              <2> 	lodsw
   196                              <2> 	xchg bx, ax
   197                              <2> 	mov cx, [bx]
   198                              <2> 	mov dx, [bx + 2]
   199                              <2> 	lodsw
   200                              <2> 	xchg cx, ax
   201                              <2> 	call cx
   202                              <2> 	xchg cx, ax
   203                              <2> 	mov al, 32
   204                              <2> 	call disp_al
   205                              <2> 	lodsw
   206                              <2> 	xchg cx, ax
   207                              <2> 	call cx
   208                              <2> 	mov dx, msg.linebreak
   209                              <2> 	call disp_msg_counted
   210                              <2> 	jmp .loop
   211                              <2> 
   212                              <2> .done:
   213                              <2> 	mov dx, msg.done.6
   214                              <2> 	call disp_msg_counted
   215                              <2> 	call disp_percentage_swapped
   216                              <2> 	mov dx, msg.done
   217                              <2> 	call disp_msg_counted
   218                              <2> 	mov ax, 4C00h
   219                              <2> 	int 21h
   220                              <2> %else	; _DATEXE
   221                              <2> 	jc error
   222                              <2> 
   223                              <2> %if _OUTBUFFER
   224                              <2> 	mov di, [outbuffer.next]
   225                              <2> 	call dump_outbuffer
   226                              <2> %endif
   227                              <2> 
   228                              <2> 	push ss
   229                              <2> 	pop ds
   230                              <2> 	push ss
   231                              <2> 	pop es
   232                              <2> 
   233                              <2> 	mov ah, 3Eh
   234                              <2> 	mov bx, [handle]
   235                              <2> 	int 21h
   236                              <2> 
   237                              <2> 	mov ah, 3Eh
   238                              <2> 	mov bx, [handle2]
   239                              <2> 	int 21h
   240                              <2> 
   241                              <2> 	mov ax, 4C00h
   242                              <2> 	int 21h
   243                              <2> 	int 20h
   244                              <2> 
   245                              <2> 
   246                              <2> %if _COUNTER
   247                              <2> disp_al:
   248                              <2> 	push dx
   249                              <2> 	push ax
   250                              <2> 	xchg ax, dx
   251                              <2> 	mov ah, 02h
   252                              <2> 	int 21h
   253                              <2> 	pop ax
   254                              <2> 	pop dx
   255                              <2> 	retn
   256                              <2> %endif
   257                              <2> %endif	; _DATEXE
   258                              <2> 
   259                              <2> 
   260                              <2> 		; INP:	-
   261                              <2> 		; OUT:	Does not return if error (in this example)
   262                              <2> 		;	CY if error
   263                              <2> 		;	NC if success,
   264                              <2> 		;	 al = byte read from file
   265                              <2> 		; CHG:	si
   266                              <2> 		; REM:	In this example program we assume ds = es = ss.
   267                              <2> get_file_byte:
   268                              <2> %if _DATEXE
   269                              <2> 	push ds
   270                              <2> 	mov si, DATA
   271                              <2> 	mov ds, si
   272                              <2> %endif
   273                              <2> 	mov si, [filebuffer.next]
   274                              <2> 	cmp si, [filebuffer.tail]
   275                              <2> 	jb .buffered
   276                              <2> 
   277                              <2> 	push ax
   278                              <2> 	push bx
   279                              <2> 	push cx
   280                              <2> 	push dx
   281                              <2> 	mov dx, filebuffer
   282                              <2> 	mov [filebuffer.next], dx
   283                              <2> 	mov [filebuffer.tail], dx
   284                              <2> 	mov ah, 3Fh
   285                              <2> 	mov bx, [handle]
   286                              <2>         mov cx, filebuffer.end - filebuffer
   287                              <2> 
   288                              <2> 	int 21h
   289                              <2> %if _DATEXE
   290                              <2> 	jc getbuf.errorread
   291                              <2> 	test ax, ax
   292                              <2> 	jz getbuf.shortread
   293                              <2> %else
   294                              <2> 	jc error
   295                              <2> 	test ax, ax
   296                              <2> 	jz error
   297                              <2> %endif
   298                              <2> 	add ax, dx
   299                              <2> 	mov word [filebuffer.tail], ax
   300                              <2>         mov si, dx
   301                              <2> 	pop dx
   302                              <2> 	pop cx
   303                              <2> 	pop bx
   304                              <2> 	pop ax
   305                              <2> 
   306                              <2> .buffered:
   307                              <2> 	lodsb
   308                              <2> 	mov [filebuffer.next], si
   309                              <2> 	clc
   310                              <2> %if _DATEXE
   311                              <2> 	pop ds
   312                              <2> %endif
   313                              <2> 	retn
   314                              <2> 
   315                              <2> 
   316                              <2> %if _OUTBUFFER
   317                              <2> 		; INP:	ds:si -> data to write
   318                              <2> 		;	cx = length of data (may be zero)
   319                              <2> 		; OUT:	Does not return if error
   320                              <2> 		; CHG:	-
   321                              <2> 		; REM:	In this example program we assume ds = es = ss.
   322                              <2> put_file_data:
   323                              <2> 	push ax
   324                              <2> 	push bx
   325                              <2> 	push dx
   326                              <2> 	push di
   327                              <2> 	push si
   328                              <2> 	push cx
   329                              <2> %if _DATEXE
   330                              <2> 	push es
   331                              <2> 	mov di, DATA
   332                              <2> 	mov es, di
   333                              <2> 	es
   334                              <2> %endif
   335                              <2> 	mov di, [outbuffer.next]
   336                              <2> 	jcxz .end
   337                              <2> @@:
   338                              <2> 	cmp di, outbuffer.end
   339                              <2> 	jne @F
   340                              <2> 
   341                              <2> 	call dump_outbuffer
   342                              <2> 
   343                              <2> @@:
   344                              <2> 	movsb
   345                              <2> 	loop @BB
   346                              <2> %if _DATEXE
   347                              <2> 	es
   348                              <2> %endif
   349                              <2> 	mov [outbuffer.next], di
   350                              <2> .end:
   351                              <2> %if _DATEXE
   352                              <2> 	pop es
   353                              <2> %endif
   354                              <2> 	pop cx
   355                              <2> 	pop si
   356                              <2> 	pop di
   357                              <2> 	pop dx
   358                              <2> 	pop bx
   359                              <2> 	pop ax
   360                              <2> 	retn
   361                              <2> 
   362                              <2> dump_outbuffer:
   363                              <2> 	push cx
   364                              <2> %if _DATEXE
   365                              <2> 	push ds
   366                              <2> 	mov cx, DATA
   367                              <2> 	mov ds, cx
   368                              <2> %endif
   369                              <2> 	mov cx, di
   370                              <2> 	mov dx, outbuffer
   371                              <2> 	sub cx, dx
   372                              <2> 	jz @F
   373                              <2> 	mov bx, word [handle2]
   374                              <2> 	mov ah, 40h
   375                              <2> 	int 21h
   376                              <2> %if _DATEXE
   377                              <2> 	jc putbuf.errorwrite
   378                              <2> 	cmp ax, cx
   379                              <2> 	jne putbuf.shortwrite
   380                              <2> %else
   381                              <2> 	jc error
   382                              <2> 	cmp ax, cx
   383                              <2> 	jne error
   384                              <2> %endif
   385                              <2> @@:
   386                              <2> 	mov di, dx
   387                              <2> %if _DATEXE
   388                              <2> 	pop ds
   389                              <2> %endif
   390                              <2> 	pop cx
   391                              <2> 	retn
   392                              <2> %else
   393                              <2> 		; INP:	ds:si -> data to write
   394                              <2> 		;	cx = length of data (may be zero)
   395                              <2> 		; OUT:	Does not return if error
   396                              <2> 		; CHG:	-
   397                              <2> 		; REM:	In this example program we assume ds = es = ss.
   398                              <2> put_file_data:
   399                              <2> 	push ax
   400                              <2> 	push bx
   401                              <2> 	push dx
   402                              <2> 	mov dx, si
   403                              <2> 	mov ah, 40h
   404                              <2> %if _DATEXE
   405                              <2> 	push ds
   406                              <2> 	mov di, DATA
   407                              <2> 	mov ds, di
   408                              <2> %endif
   409                              <2> 	mov bx, [handle2]
   410                              <2> %if _DATEXE
   411                              <2> 	pop ds
   412                              <2> %endif
   413                              <2> 	jcxz @F
   414                              <2> 	int 21h
   415                              <2> %if _DATEXE
   416                              <2> 	jc putbuf.errorwrite
   417                              <2> 	cmp ax, cx
   418                              <2> 	jne putbuf.shortwrite
   419                              <2> %else
   420                              <2> 	jc error
   421                              <2> 	cmp ax, cx
   422                              <2> 	jne error
   423                              <2> %endif
   424                              <2> @@:
   425                              <2> 	pop dx
   426                              <2> 	pop bx
   427                              <2> 	pop ax
   428                              <2> 	retn
   429                              <2> %endif
   430                              <2> 
   431                              <2> 
   432                              <2> %ifn _DATEXE
   433                              <2> 	addsection DATA, align=1 follows=CODE
   434                              <2> msg:
   435                              <2> .error:		ascic "Error!",13,10
   436                              <2> .outname:	asciz "output.bin"
   437                              <2> 
   438                              <2> 
   439                              <2> 	addsection BSSDATA, align=16 nobits follows=DATA
   440                              <2> 	alignb 16
   441                              <2> resultbuffer:
   442                              <2> .size equ 4096
   443                              <2> 		resb .size
   444                              <2> .end:
   445                              <2> 
   446                              <2> %else
   447                              <2> 	usesection DATA
   448                              <2> %endif
   449                              <2> 	alignb 2
   450                              <2> filebuffer:	resb 256
   451                              <2> .end:
   452                              <2> 	alignb 2
   453                              <2> .next:		resw 1
   454                              <2> .tail:		resw 1
   455                              <2> %if _DATEXE
   456                              <2> handle equ inhandle
   457                              <2> handle2 equ outhandle
   458                              <2> %else
   459                              <2> handle:		resw 1
   460                              <2> handle2:	resw 1
   461                              <2> %endif
   462                              <2> 
   463                              <2> %if _OUTBUFFER
   464                              <2> outbuffer:	resb 256
   465                              <2> .end:
   466                              <2> .next:		resw 1
   467                              <2> %endif
   468                              <2> 
   469                              <2> %ifn _DATEXE
   470                              <2> stack:		resb 512
   471                              <2> .top:
   472                              <2> %endif
   473                              <2> 
   474                              <2> 
   475                              <2> 	usesection CODE
   476                              <2> %endif	; _STANDALONE
   477                              <2> 
   478                              <2> %if _MULTI
   479                              <2> 	overridedef LZEXEDAT, 1
   480                              <2> 	overridedef LONGLITERAL, 1
   481                              <2> %endif
   482                              <2> 
   483                              <2> 		; INP:	cx:dx = length of source
   484                              <2> 		;	es:di -> destination
   485                              <2> 		;	si -> behind end of destination (si > di)
   486                              <2> 		;	(al = format, 2 = heatshrink, 3 = lzexedat -4)
   487                              <2> 		;	(ah = 0FFh for switch4k on, 00h for off)
   488                              <2> 		; OUT:	NC if success
   489                              <2> 		;	CY if error,
   490                              <2> 		;	 bx = ?errordata (if _DEBUG0)
   491                              <2> 		; CHG:	ax, (bx), cx, dx, es, ds, si, di
   492                              <2> 		; STT:	UP
   493                              <2> depack:
   494                              <2> 	lframe near
   495 0000028F 5589E5              <2> 	lenter
   496                              <2>  %if _DEBUG0 || _COUNTER
   497                              <2> 	xor bx, bx
   498                              <2>  %endif
   499                              <2>  %if _DEBUG0
   500                              <2> 	lvar word,	errordata
   501                              <2> 	 push bx
   502                              <2>  %endif
   503                              <2> %if _MULTI
   504                              <2> 	mov bl, al
   505                              <2> %endif
   506                              <2> %if _COUNTER || _MULTI
   507                              <2> 	lvar word,	format_and_counter
   508                              <2> 	lequ ?format_and_counter + 1, counter
   509                              <2> 	lequ ?format_and_counter, format
   510                              <2> 	 push bx		; initialise counter (high byte) to zero
   511                              <2> 				; and format (low byte)
   512                              <2> %endif
   513                              <2> %if _DATEXE
   514                              <2> 	lvar word,	empty_and_switch4k
   515                              <2> 	lequ ?empty_and_switch4k + 1, switch4k
   516                              <2> 	 push ax
   517                              <2> %endif
   518                              <2> 
   519                              <2> 	lvar dword,	original_dst
   520 00000292 06                  <2> 	 push es
   521 00000293 57                  <2> 	 push di
   522                              <2> 	lvar dword,	dst
   523 00000294 06                  <2> 	 push es
   524 00000295 57                  <2> 	 push di
   525                              <2> 	lvar dword,	src_remaining
   526 00000296 51                  <2> 	 push cx
   527 00000297 52                  <2> 	 push dx
   528                              <2> 
   529 00000298 89F1                <2> 	mov cx, si
   530 0000029A 29F9                <2> 	sub cx, di		; same flags as cmp si, di
   531 0000029C 7703E98F00          <2> 	jbe .error
   532                              <2> 
   533                              <2> %if _DXTAG
   534                              <2> 	lvar word,	dst_end
   535 000002A1 56                  <2> 	 push si		; push into [bp + ?dst_end]
   536                              <2> %else
   537                              <2> 	mov dx, si
   538                              <2> %endif
   539                              <2> 
   540 000002A2 31C0                <2> 	xor ax, ax
   541 000002A4 F3AA                <2> 	rep stosb		; prepare for matches before first data byte
   542                              <2> %if _LZEXEDAT || _MULTI
   543 000002A6 40                  <2> 	inc ax			; = 1
   544                              <2> %endif
   545                              <2> %if _MULTI
   546                              <2> 	lvar word,	word1
   547                              <2> 	lvar word,	word2
   548                              <2> 	lvar word,	word3
   549                              <2> 
   550                              <2> 	cmp byte [bp + ?format], 2
   551                              <2> 	jb .error
   552                              <2> 	sub byte [bp + ?format], 3
   553                              <2> 		; -1 = heatshrink, 0 = lzexedat -4, 1 = lzexedat -4 -l
   554                              <2> 	jb .hs_init
   555                              <2> 	cmp byte [bp + ?format], al
   556                              <2> 	ja .error
   557                              <2> %endif
   558                              <2> %if _LZEXEDAT
   559                              <2> .lze_init:
   560                              <2> %if _MULTI
   561                              <2> 	lequ ?word1,	tagbitscycle
   562                              <2> %else
   563                              <2> 	lvar word,	tagbitscycle
   564                              <2> %endif
   565 000002A7 50                  <2> 	 push ax		; = 1
   566                              <2> 
   567                              <2> %ifn _DXTAG
   568                              <2>  %if _MULTI
   569                              <2> 	lequ ?word2,	tagword
   570                              <2>  %else
   571                              <2> 	lvar word,	tagword
   572                              <2>  %endif
   573                              <2> 	 push ax
   574                              <2> %endif
   575 000002A8 E82801              <2> 	call get_bit			; ?tagbitscycle init to 1, ror sets CY
   576                              <2> 					;  (bogus result in CF is ignored)
   577                              <2> 
   578 000002AB EB23                <2> 	jmp .lze_loop
   579                              <2> 
   580                              <2> .lze_literal:
   581                              <2> %if _LONGLITERAL
   582 000002AD 41                  <2> 	inc cx
   583                              <2> .loop_literal:
   584                              <2> %endif
   585                              <2> 
   586 000002AE E83C01              <2> 	call load_byte
   587                              <2> %if _LONGLITERAL
   588 000002B1 51                  <2> 	push cx
   589                              <2> %endif
   590                              <2> %if _DEPACKINLINELITERAL
   591                              <2> %if _LONGLITERAL
   592 000002B2 B90100              <2> 	mov cx, 1
   593                              <2> %else
   594                              <2> 	inc cx				; cx = 1
   595                              <2> %endif
   596 000002B5 C47EF8              <2> 	les di, [bp + ?dst]		; -> destination
   597                              <2> %if _DXTAG
   598 000002B8 3B7EF2              <2> 	cmp di, [bp + ?dst_end]		; at end of circular buffer ?
   599                              <2> %else
   600                              <2> 	cmp di, dx
   601                              <2> %endif
   602 000002BB 7773                <2> 	ja .error			; invalid -->
   603 000002BD 7203                <2> 	jb @F				; no -->
   604 000002BF 8B7EFC              <2> 	mov di, word [bp + ?original_dst]	; yes, reset
   605                              <2> @@:
   606 000002C2 06                  <2> 	push es
   607 000002C3 1F                  <2> 	pop ds
   608 000002C4 89FE                <2> 	mov si, di			; ds:si -> where to store
   609 000002C6 AA                  <2> 	stosb				; store it
   610 000002C7 897EF8              <2> 	mov word [bp + ?dst], di	; update ?dst
   611 000002CA E85202              <2> 	call put_file_data		; ds:si ->, length cx
   612                              <2> %else
   613                              <2> 	push ax				; on stack: the literal
   614                              <2> 	 push ss
   615                              <2> 	 pop ds
   616                              <2> 	mov si, sp			; ds:si -> data on stack
   617                              <2> %if _LONGLITERAL
   618                              <2> 	xor ax, ax
   619                              <2> %else
   620                              <2> 	xchg ax, cx			; ax = 0
   621                              <2> %endif
   622                              <2> 	inc ax				; length = 1
   623                              <2> 	mov bx, ax			; bx NZ
   624                              <2> 	call copy_data.bx
   625                              <2> 	pop ax				; (discard)
   626                              <2> d0	mov byte [bp + ?errordata], 75h
   627                              <2> 	jc .error
   628                              <2> %endif
   629                              <2> 
   630                              <2> %if _LONGLITERAL
   631 000002CD 59                  <2> 	pop cx
   632 000002CE E2DE                <2> 	loop .loop_literal
   633                              <2> %endif
   634                              <2> 
   635                              <2> %assign LENGTHOFLITERAL $ - .lze_literal
   636                              <2> %warning length of lze literal = LENGTHOFLITERAL
   636          ******************  <2>  warning: length of lze literal = 35 [-w+user]
   637                              <2> 
   638                              <2> .lze_loop:
   639 000002D0 31C9                <2> 	xor cx, cx			; ! ch = 0, cx = 0
   640 000002D2 E8FE00              <2> 	call get_bit
   641 000002D5 72D6                <2> 	jc .lze_literal
   642                              <2> 
   643                              <2> .lze_notliteral:
   644                              <2> %if _COUNTER
   645                              <2> 	inc byte [bp + ?counter]
   646                              <2> 	test byte [bp + ?counter], _COUNTER - 1
   647                              <2> 	jnz @F
   648                              <2> 	mov al, '.'
   649                              <2> 	call disp_al_counter
   650                              <2> @@:
   651                              <2> %endif
   652                              <2> 
   653 000002D7 E8F900              <2> 	call get_bit
   654 000002DA 7218                <2> 	jc .lze_combined
   655                              <2> 
   656                              <2> .lze_shortmatch:
   657                              <2> 		; cx = 0
   658 000002DC E8F400              <2> 	call get_bit
   659 000002DF D1D1                <2> 	rcl cx, 1
   660 000002E1 E8EF00              <2> 	call get_bit
   661 000002E4 D1D1                <2> 	rcl cx, 1			; cx = 0..3
   662                              <2> 
   663 000002E6 E80401              <2> 	call load_byte			; load displacement
   664                              <2> 
   665 000002E9 B4FF                <2> 	mov ah, -1			; sign extend for negative number
   666 000002EB 93                  <2> 	xchg bx, ax			; bx = displacement (-1 to -256)
   667                              <2> 
   668                              <2> .lze_match_cx_plus_2:
   669 000002EC 41                  <2> 	inc cx
   670                              <2> .lze_match_cx_plus_1:
   671 000002ED 41                  <2> 	inc cx
   672                              <2> 
   673                              <2> 		; INP:	bx = match displacement (-1 to -4096)
   674                              <2> 		;	cx = match count (2 to 256)
   675 000002EE 93                  <2> 	xchg ax, bx			; ax = displacement, cx = count
   676 000002EF 91                  <2> 	xchg ax, cx			; cx = displacement, ax = length of match
   677 000002F0 F7D9                <2> 	neg cx				; cx = index
   678 000002F2 EB41                <2> 	jmp .lze_match
   679                              <2> .lze_loop_j1: equ .lze_loop
   680                              <2> 
   681                              <2> .lze_combined:
   682 000002F4 E8EB00              <2> 	call load_word			; load combined word
   683                              <2> 
   684 000002F7 89C3                <2> 	mov bx, ax
   685 000002F9 F9                  <2> 	stc				; CY
   686 000002FA D0DF                <2> 	rcr bh, 1			; rotate in a 1
   687 000002FC D0FF                <2> 	sar bh, 1
   688 000002FE D0FF                <2> 	sar bh, 1			; fill top three bits with 1s
   689                              <2> %if _DATEXE
   690                              <2> 	rol byte [bp + ?switch4k], 1
   691                              <2> 	jnc .8k
   692                              <2> .4k:
   693                              <2> 	sar bh, 1			; fill top *four* bits with 1s
   694                              <2> 	and ah, 15
   695                              <2> 	jmp @F
   696                              <2> .8k:
   697                              <2> 	and ah, 7
   698                              <2> @@:
   699                              <2> %else
   700                              <2>  %if 1	; _4
   701 00000300 D0FF                <2> 	sar bh, 1			; fill top *four* bits with 1s
   702 00000302 80E40F              <2> 	and ah, 15
   703                              <2>  %else
   704                              <2> 	and ah, 7
   705                              <2>  %endif
   706                              <2> %endif
   707 00000305 88E1                <2> 	mov cl, ah			; ch already = 0
   708 00000307 75E3                <2> 	jnz .lze_match_cx_plus_2	; length = cx + 2, bx = displacement
   709                              <2> 
   710                              <2> .lze_escape:
   711 00000309 E8E100              <2> 	call load_byte			; ah = 0
   712 0000030C 3C01                <2> 	cmp al, 1
   713 0000030E 7213                <2> 	jb .end_check
   714 00000310 91                  <2> 	xchg cx, ax			; cx = length
   715 00000311 77DA                <2> 	ja .lze_match_cx_plus_1		; length = cx + 1, bx = displacement
   716                              <2> 
   717                              <2> %if _LONGLITERAL
   718                              <2>  %if _MULTI
   719                              <2> 	cmp byte [bp + ?format], 1
   720                              <2> 	jne .lze_normalise		; not lzexedat -4 -l -->
   721                              <2>  %endif
   722 00000313 87CB                <2> 	xchg cx, bx			; cx = displacement, top 4 or 3 bits sets
   723                              <2>  %if _DATEXE
   724                              <2> 	and ch, ~ 1110_0000b		; isolate 13-bit displacement
   725                              <2> 	rol byte [bp + ?switch4k], 1
   726                              <2> 	jnc @F
   727                              <2> 	and ch, ~ 1111_0000b		; isolate 12-bit displacement
   728                              <2> @@:
   729                              <2>  %else
   730                              <2>   %if 1 ; _4
   731 00000315 80E50F              <2> 	and ch, ~ 1111_0000b		; isolate 12-bit displacement
   732                              <2>   %else
   733                              <2> 	and ch, ~ 1110_0000b		; isolate 13-bit displacement
   734                              <2>   %endif
   735                              <2>  %endif
   736 00000318 E307                <2>  	jcxz .lze_normalise		; displacement 0 means segment change -->
   737 0000031A 83F91A              <2>  	cmp cx, 26			; long literals command needs >= 26 bytes
   738 0000031D 7211                <2>  	jb .error			; (reserved for future expansion)
   739 0000031F EB8D                <2>  	jmp .loop_literal		; process the literals -->
   740                              <2> %endif
   741                              <2> .lze_normalise:
   742 00000321 EBAD                <2> 	jmp .lze_loop_j1
   743                              <2> 
   744                              <2> %if !_MULTI
   745                              <2> .end_check:
   746                              <2> d0	mov byte [bp + ?errordata], 7Dh
   747 00000323 31C9                <2> 	xor cx, cx
   748 00000325 394EF6              <2> 	cmp word [bp + ?src_remaining + 2], cx
   749 00000328 7506                <2> 	jne .error
   750 0000032A 394EF4              <2> 	cmp word [bp + ?src_remaining], cx
   751 0000032D 7501                <2> 	jne .error
   752                              <2> 
   753                              <2> .end:
   754 0000032F A8                  <2> 	db __TEST_IMM8			; (NC)
   755                              <2> .error:
   756 00000330 F9                  <2> 	stc
   757                              <2> 
   758                              <2> %if _COUNTER
   759                              <2> 	lahf
   760                              <2> 	mov al, 13
   761                              <2> 	call disp_al_for_progress
   762                              <2> 	mov al, 10
   763                              <2> 	call disp_al_for_progress
   764                              <2> 	sahf
   765                              <2> %endif
   766                              <2> d0	mov bx, word [bp + ?errordata]
   767 00000331 89EC5D              <2> 	lleave code
   768 00000334 C3                  <2> 	lret
   769                              <2> %endif
   770                              <2> %endif
   771                              <2> 
   772                              <2> %if _MULTI || !_LZEXEDAT
   773                              <2> .hs_init:
   774                              <2> @@:
   775                              <2> 	call read_byte
   776                              <2> d0	mov byte [bp + ?errordata], 70h
   777                              <2> 	jc .error
   778                              <2> 
   779                              <2> 	mov ah, 0
   780                              <2> 	test ax, ax
   781                              <2> d0	mov byte [bp + ?errordata], 71h
   782                              <2> 	jz .error
   783                              <2> 	cmp al, 15
   784                              <2> 	ja .error
   785                              <2> 
   786                              <2> %if _MULTI
   787                              <2> 	lequ ?word1,	window_size_bits
   788                              <2> %else
   789                              <2> 	lvar word,	window_size_bits
   790                              <2> %endif
   791                              <2> 	 push ax
   792                              <2> 
   793                              <2> 	xchg cx, ax
   794                              <2> 	mov ax, 1
   795                              <2> 	shl ax, cl
   796                              <2> 	cmp ax, resultbuffer.size
   797                              <2> 	ja .error
   798                              <2> 
   799                              <2> 	call read_byte
   800                              <2> d0	mov byte [bp + ?errordata], 72h
   801                              <2> 	jc .error
   802                              <2> 
   803                              <2> 	mov ah, 0
   804                              <2> 	test ax, ax
   805                              <2> d0	mov byte [bp + ?errordata], 73h
   806                              <2> 	jz .error
   807                              <2> 	cmp ax, word [bp + ?window_size_bits]
   808                              <2> 	jae .error
   809                              <2> 
   810                              <2> %if _MULTI
   811                              <2> 	lequ ?word2,	lookahead_size_bits
   812                              <2> %else
   813                              <2> 	lvar word,	lookahead_size_bits
   814                              <2> %endif
   815                              <2> 	 push ax
   816                              <2> 
   817                              <2> %if _DXTAG
   818                              <2> 	xor dx, dx			; dl = bit index, dh = current byte
   819                              <2> %else
   820                              <2> 	xor cx, cx
   821                              <2>  %if _MULTI
   822                              <2> 	lequ ?word3,	low_bit_index_and_high_current_byte
   823                              <2>  %else
   824                              <2> 	lvar word,	low_bit_index_and_high_current_byte
   825                              <2>  %endif
   826                              <2> 	 push cx
   827                              <2> %endif
   828                              <2> 
   829                              <2> .loop:
   830                              <2> %if _COUNTER
   831                              <2> 	inc byte [bp + ?counter]
   832                              <2> 	test byte [bp + ?counter], _COUNTER - 1
   833                              <2> 	jnz @F
   834                              <2> 	mov al, '.'
   835                              <2> 	call disp_al
   836                              <2> @@:
   837                              <2> %endif
   838                              <2> 
   839                              <2> 	mov cx, 1
   840                              <2> 	call get_bits
   841                              <2> 	jnc .notend			; (cx = 0 if jumping)
   842                              <2> 
   843                              <2> d0	mov byte [bp + ?errordata], 7Dh
   844                              <2> .end_check:
   845                              <2> 	xor ax, ax
   846                              <2> 	cmp word [bp + ?src_remaining], ax
   847                              <2> 	jne .error
   848                              <2> 	cmp word [bp + ?src_remaining + 2], ax
   849                              <2> 	jne .error
   850                              <2> 
   851                              <2> 	db __TEST_IMM8			; (NC)
   852                              <2> .error:
   853                              <2> 	stc
   854                              <2> 
   855                              <2> %if _COUNTER
   856                              <2> 	lahf
   857                              <2> 	mov al, 13
   858                              <2> 	call disp_al
   859                              <2> 	mov al, 10
   860                              <2> 	call disp_al
   861                              <2> 	sahf
   862                              <2> %endif
   863                              <2> d0	mov bx, word [bp + ?errordata]
   864                              <2> 	lleave code
   865                              <2> 	lret
   866                              <2> 
   867                              <2> .notend:				; (cx = 0)
   868                              <2> 	test al, al
   869                              <2> 	jz .notliteral
   870                              <2> 
   871                              <2> .hs_literal:
   872                              <2> 	mov cl, 8
   873                              <2> 	call get_bits			; cx = 0
   874                              <2> d0	mov byte [bp + ?errordata], 74h
   875                              <2> 	jc .end_check
   876                              <2> %if _DEPACKINLINELITERAL
   877                              <2> 	inc cx				; cx = 1
   878                              <2> 	les di, [bp + ?dst]		; -> destination
   879                              <2> %if _DXTAG
   880                              <2> 	cmp di, [bp + ?dst_end]		; at end of circular buffer ?
   881                              <2> %else
   882                              <2> 	cmp di, dx
   883                              <2> %endif
   884                              <2> 	ja .error			; invalid -->
   885                              <2> 	jb @F				; no -->
   886                              <2> 	mov di, word [bp + ?original_dst]	; yes, reset
   887                              <2> @@:
   888                              <2> 	push es
   889                              <2> 	pop ds
   890                              <2> 	mov si, di			; ds:si -> where to store
   891                              <2> 	stosb				; store it
   892                              <2> 	mov word [bp + ?dst], di	; update ?dst
   893                              <2> 	call put_file_data		; ds:si ->, length cx
   894                              <2> %else
   895                              <2> 	push ax				; on stack: the literal
   896                              <2> 	 push ss
   897                              <2> 	 pop ds
   898                              <2> 	mov si, sp			; ds:si -> data on stack
   899                              <2> 	xchg ax, cx			; ax = 0
   900                              <2> 	inc ax				; length = 1
   901                              <2> 	mov bx, ax			; bx NZ
   902                              <2> 	call copy_data.bx
   903                              <2> 	pop ax				; (discard)
   904                              <2> d0	mov byte [bp + ?errordata], 75h
   905                              <2> 	jc .error
   906                              <2> %endif
   907                              <2> %assign LENGTHOFLITERAL $ - .hs_literal
   908                              <2> %warning length of hs literal = LENGTHOFLITERAL
   909                              <2> 	jmp .loop
   910                              <2> 
   911                              <2> .notliteral:				; (cx = 0)
   912                              <2> 
   913                              <2> 	mov cl, byte [bp + ?window_size_bits]
   914                              <2> 					; cx = -w parameter
   915                              <2> 	call get_bits
   916                              <2> d0	mov byte [bp + ?errordata], 76h
   917                              <2> 	jc .end_check
   918                              <2> 		; ax = output index
   919                              <2> 		; cx = 0
   920                              <2> 	xchg bx, ax
   921                              <2> 	mov cl, byte [bp + ?lookahead_size_bits]
   922                              <2> 					; cx = -l parameter
   923                              <2> 	call get_bits
   924                              <2> d0	mov byte [bp + ?errordata], 77h
   925                              <2> 	jc .end_check
   926                              <2> 		; bx = output index less 1
   927                              <2> 		; ax = output count less 1
   928                              <2> 	inc bx				; = output index
   929                              <2> d0	mov byte [bp + ?errordata], 78h
   930                              <2> 	jz .error
   931                              <2> 
   932                              <2> 					; ax = length of match less one
   933                              <2> 	inc ax				; = length of match
   934                              <2> 	jz .error
   935                              <2> 
   936                              <2> 	mov cx, bx			; 1 .. 65535
   937                              <2> %endif
   938                              <2> 
   939                              <2> %if _LZEXEDAT
   940                              <2> .lze_match:
   941                              <2> %endif
   942                              <2> 
   943                              <2> 		; cx = index, ax = length
   944 00000335 C576F8              <2> 	lds si, [bp + ?dst]
   945 00000338 8B5EFC              <2> 	mov bx, word [bp + ?original_dst]
   946 0000033B F7DB                <2> 	neg bx
   947 0000033D 01F3                <2> 	add bx, si			; dst - original = length at start
   948 0000033F 29CE                <2> 	sub si, cx			; -> into buffer (if branching)
   949 00000341 29CB                <2> 	sub bx, cx			; length start - match distance
   950 00000343 7323                <2> 	jae @F				; length start >= match distance -->
   951                              <2> 		; bx = negative length of matchable at end of buffer
   952                              <2> 
   953                              <2> %if _DXTAG
   954 00000345 8B76F2              <2> 	mov si, [bp + ?dst_end]
   955                              <2> %else
   956                              <2> 	mov si, dx
   957                              <2> %endif
   958 00000348 01DE                <2> 	add si, bx			; si -> match data
   959 0000034A 89F3                <2> 	mov bx, si
   960 0000034C 01C3                <2> 	add bx, ax			; -> behind match data (if fits)
   961 0000034E 7205                <2> 	jc .full			; if doesn't fit, copy full -->
   962                              <2> %if _DXTAG
   963 00000350 3B5EF2              <2> 	cmp bx, [bp + ?dst_end]		; -> behind is above-or-equal end ?
   964                              <2> %else
   965                              <2> 	cmp bx, dx
   966                              <2> %endif
   967                              <2> 	; jae .full			; yes -->
   968 00000353 7213                <2> 	jb .copy_data			; ax has full length from tail of buffer -->
   969                              <2> 
   970                              <2> 		; if we branch to here,
   971                              <2> 		;  si + ax >= (word [bp + ?dst_end] or dx)
   972                              <2> 		;  therefore  ax >= (word [bp + ?dst_end] or dx) - si
   973                              <2> .full:
   974 00000355 50                  <2> 	push ax				; save original length
   975                              <2> 		; calculate word [bp + ?dst_end] - si
   976                              <2> %if _DXTAG
   977 00000356 8B46F2              <2> 	mov ax, [bp + ?dst_end]
   978                              <2> %else
   979                              <2> 	mov ax, dx
   980                              <2> %endif
   981 00000359 29F0                <2> 	sub ax, si			; -> end minus -> match data
   982 0000035B 50                  <2> 	push ax				; save length
   983 0000035C E81100              <2> 	call copy_data
   984                              <2> d0	mov byte [bp + ?errordata], 1
   985 0000035F 72CF                <2> 	jc .error
   986 00000361 5B                  <2> 	pop bx				; = done length
   987 00000362 58                  <2> 	pop ax				; = entire length
   988 00000363 29D8                <2> 	sub ax, bx			; entire length minus done length
   989 00000365 8B76FC              <2> 	mov si, word [bp + ?original_dst]	; -> start of buffer
   990                              <2> @@:
   991                              <2> 
   992                              <2> .copy_data:
   993 00000368 E80500              <2> 	call copy_data			; give ?dst -> dest, ds:si -> source
   994                              <2> 		; returns: ?dst incremented, ds:si -> after match source
   995                              <2> d0	mov byte [bp + ?errordata], 7Bh
   996 0000036B 72C3                <2> 	jc .error
   997                              <2> 
   998                              <2> %if _MULTI
   999                              <2> 		; end of common code, dispatch back to main loop
  1000                              <2> 	cmp byte [bp + ?format], 1
  1001                              <2> 	je @F				; lzexedat -4 -l -->
  1002                              <2> 	rol byte [bp + ?format], 1
  1003                              <2> 	jc .loop
  1004                              <2> @@:
  1005                              <2> 	jmp .lze_loop
  1006                              <2> %elif _LZEXEDAT
  1007 0000036D E960FF              <2> 	jmp .lze_loop
  1008                              <2> %else
  1009                              <2> 	jmp .loop
  1010                              <2> %endif
  1011                              <2> 
  1012                              <2> 
  1013                              <2> 		; INP:	?dst -> destination,
  1014                              <2> 		;	 destination may overlap the circular buffer boundary.
  1015                              <2> 		;	ds:si -> source
  1016                              <2> 		;	ax = how long the data is (0 is valid),
  1017                              <2> 		;	 always 1 for literals.
  1018                              <2> 		;	 source must fit in circular buffer, except if
  1019                              <2> 		;	 source and destination overlap. in this case the
  1020                              <2> 		;	 source starts in the buffer but may extend past
  1021                              <2> 		;	 the circular buffer boundary.
  1022                              <2> 		;	word [?dst_end] or dx -> end of circular buffer
  1023                              <2> 		;	word [?original_dst] -> start of circular buffer
  1024                              <2> 		; OUT:	?dst incremented
  1025                              <2> 		;	CY if error (buffer too small)
  1026                              <2> 		;	NC if success
  1027                              <2> 		; CHG:	cx, bx, ax, es, di, ds, si
  1028                              <2> copy_data:
  1029                              <2> %ifn _DEPACKINLINELITERAL
  1030                              <2> 	xor bx, bx
  1031                              <2> .bx:
  1032                              <2> 		; bx = nonzero if literal
  1033                              <2> %endif
  1034                              <2> 
  1035                              <2> %if 0
  1036                              <2> 	push ax
  1037                              <2> 	push bx
  1038                              <2> 	push cx
  1039                              <2> 	push dx
  1040                              <2> 	mov ax, 4201h
  1041                              <2> 	mov cx, 0
  1042                              <2> 	mov dx, 0
  1043                              <2> 	mov bx, word [handle2]
  1044                              <2> 	int 21h
  1045                              <2> 	nop
  1046                              <2> 	pop dx
  1047                              <2> 	pop cx
  1048                              <2> 	pop bx
  1049                              <2> 	pop ax
  1050                              <2> %endif
  1051                              <2> 
  1052                              <2> d0	inc byte [bp + ?errordata + 1]
  1053                              <2> 
  1054 00000370 C47EF8              <2> 	les di, [bp + ?dst]
  1055                              <2> 
  1056 00000373 91                  <2> 	xchg cx, ax			; cx = remaining length
  1057 00000374 E344                <2> 	jcxz .end
  1058                              <2> 
  1059                              <2> %if _DXTAG
  1060 00000376 3B7EF2              <2> 	cmp di, [bp + ?dst_end]
  1061                              <2> %else
  1062                              <2> 	cmp di, dx
  1063                              <2> %endif
  1064 00000379 7744                <2> 	ja .ret_CY			; error
  1065                              <2> 		; literals may branch to .start_maybe_part
  1066 0000037B 741D                <2> 	je .start_maybe_part		; ?dst -> at end (put whole data at start)
  1067 0000037D 01CF                <2> 	add di, cx			; -> behind data chunk (if fits)
  1068 0000037F 720A                <2> 	jc .fill			; doesn't fit -->
  1069                              <2> %if _DXTAG
  1070 00000381 3B7EF2              <2> 	cmp di, [bp + ?dst_end]		; fits ?
  1071                              <2> %else
  1072                              <2> 	cmp di, dx
  1073                              <2> %endif
  1074                              <2> 		; literals never branch to .fill
  1075 00000384 7705                <2> 	ja .fill			; doesn't fit -->
  1076 00000386 8B7EF8              <2> 	mov di, word [bp + ?dst]	; restore -> destination
  1077                              <2> 		; ds:si l cx fits in circular buffer
  1078 00000389 EB2C                <2> 	jmp .mov			; store full up to below-or-equal -> end
  1079                              <2> 
  1080                              <2> .fill:
  1081 0000038B 8B7EF8              <2> 	mov di, word [bp + ?dst]	; restore -> destination
  1082                              <2> %if _DXTAG
  1083 0000038E 8B46F2              <2> 	mov ax, [bp + ?dst_end]		; -> behind buffer
  1084                              <2> %else
  1085                              <2> 	mov ax, dx
  1086                              <2> %endif
  1087 00000391 29F8                <2> 	sub ax, di			; -> behind buffer minus -> destination
  1088                              <2> 					; = length fitting at end
  1089 00000393 29C1                <2> 	sub cx, ax			; cx -= length fitting at end
  1090                              <2> 					; = remaining length to store at start
  1091 00000395 91                  <2> 	xchg cx, ax			; cx = length fitting at end
  1092 00000396 E82800              <2> 	call .mov_and_put		; store at end
  1093 00000399 91                  <2> 	xchg cx, ax			; cx = remaining length to store at start
  1094                              <2> 
  1095                              <2> .start_maybe_part:
  1096 0000039A 8B7EFC              <2> 	mov di, word [bp + ?original_dst]
  1097                              <2> %ifn _DEPACKINLINELITERAL
  1098                              <2> 	test bx, bx			; literal ?
  1099                              <2> 	jnz .mov			; yes -->
  1100                              <2> %endif
  1101                              <2> 		; literals never go here
  1102                              <2> 		; the following handles source overlapping destination
  1103                              <2> 		;  s.t. source crosses the circular buffer boundary.
  1104 0000039D 89F0                <2> 	mov ax, si
  1105 0000039F 01C8                <2> 	add ax, cx			; -> behind source
  1106 000003A1 7205                <2> 	jc .part			; CY, must copy part -->
  1107                              <2> %if _DXTAG
  1108 000003A3 3B46F2              <2> 	cmp ax, [bp + ?dst_end]		; below-or-equal end of buffer ?
  1109                              <2> %else
  1110                              <2> 	cmp ax, dx
  1111                              <2> %endif
  1112 000003A6 760F                <2> 	jbe .mov			; yes -->
  1113                              <2> .part:
  1114                              <2> %if _DXTAG
  1115 000003A8 8B46F2              <2> 	mov ax, [bp + ?dst_end]
  1116                              <2> %else
  1117                              <2> 	mov ax, dx
  1118                              <2> %endif
  1119 000003AB 29F0                <2> 	sub ax, si			; ax = how much source data remains
  1120 000003AD 29C1                <2> 	sub cx, ax			; cx = how much to copy after
  1121 000003AF 91                  <2> 	xchg cx, ax			; cx = part length (source data remains)
  1122 000003B0 E80E00              <2> 	call .mov_and_put		; put from end
  1123 000003B3 91                  <2> 	xchg cx, ax			; cx = how much to copy from buffer start
  1124 000003B4 8B76FC              <2> 	mov si, word [bp + ?original_dst]	; -> start of buffer
  1125                              <2> 					; continue with di -> near start of buffer
  1126                              <2> .mov:
  1127 000003B7 E80700              <2> 	call .mov_and_put
  1128                              <2> 
  1129                              <2> .end:
  1130 000003BA 897EF8              <2> 	mov word [bp + ?dst], di
  1131 000003BD F8                  <2> 	clc
  1132                              <2> .ret:
  1133 000003BE C3                  <2> 	retn
  1134                              <2> 
  1135                              <2> .ret_CY:
  1136 000003BF F9                  <2> 	stc
  1137 000003C0 C3                  <2> 	retn
  1138                              <2> 
  1139                              <2> .mov_and_put:
  1140 000003C1 1E                  <2> 	 push ds
  1141 000003C2 56                  <2> 	 push si
  1142 000003C3 06                  <2> 	push es
  1143 000003C4 57                  <2> 	push di
  1144 000003C5 51                  <2> 	push cx
  1145 000003C6 F3A4                <2> 	rep movsb
  1146 000003C8 59                  <2> 	pop cx
  1147 000003C9 5E                  <2> 	pop si
  1148 000003CA 1F                  <2> 	pop ds
  1149 000003CB E85101              <2> 	call put_file_data
  1150 000003CE 5E                  <2> 	 pop si
  1151 000003CF 1F                  <2> 	 pop ds
  1152 000003D0 01CE                <2> 	add si, cx
  1153 000003D2 C3                  <2> 	retn
  1154                              <2> 
  1155                              <2> 
  1156                              <2> %if _LZEXEDAT
  1157                              <2> 		; INP:	?src_remaining
  1158                              <2> 		;	dx / word [?tagword] = tag word
  1159                              <2> 		;	word [?tagbitscycle] = circular tag bits indicator
  1160                              <2> 		;	 (there's always a single bit set in this word.
  1161                              <2> 		;	 if this word is equal to 1 on INP then the tag
  1162                              <2> 		;	 word must be reloaded, and the last bit shifted
  1163                              <2> 		;	 out of the INP prior tag word.)
  1164                              <2> 		; OUT:	NC if read a zero,
  1165                              <2> 		;	CY if read a one,
  1166                              <2> 		;	 ?src_remaining decremented
  1167                              <2> 		;	 dx / word [?tagword] updated
  1168                              <2> 		;	 word [?tagbitscycle] updated
  1169                              <2> 		;	branches to depack.error on error
  1170                              <2> 		; CHG:	ds, si, ax
  1171                              <2> get_bit:
  1172 000003D3 D14EF0              <2> 	ror word [bp + ?tagbitscycle], 1
  1173 000003D6 7307                <2> 	jnc .left
  1174                              <2> 		; after this branch not taken, the cycle word
  1175                              <2> 		;  wraps around to be equal to 8000h. this
  1176                              <2> 		;  will wrap around again after 15 more ror.
  1177 000003D8 E80700              <2> 	call load_word
  1178                              <2> %if _DXTAG
  1179 000003DB D1EA                <2> 	shr dx, 1
  1180 000003DD 92                  <2> 	xchg dx, ax
  1181 000003DE C3                  <2> 	retn
  1182                              <2> 
  1183                              <2> .left:
  1184 000003DF D1EA                <2> 	shr dx, 1
  1185 000003E1 C3                  <2> 	retn
  1186                              <2> %else
  1187                              <2> 	shr word [bp + ?tagword], 1
  1188                              <2> 	mov word [bp + ?tagword], ax
  1189                              <2> 	retn
  1190                              <2> 
  1191                              <2> .left:
  1192                              <2> 	shr word [bp + ?tagword], 1
  1193                              <2> 	retn
  1194                              <2> %endif
  1195                              <2> 
  1196                              <2> 		; lodsw with ?src_remaining check
  1197                              <2> load_word:
  1198 000003E2 E80800              <2> 	call load_byte
  1199 000003E5 86C4                <2> 	xchg al, ah
  1200 000003E7 E80300              <2> 	call load_byte
  1201 000003EA 86C4                <2> 	xchg al, ah
  1202 000003EC C3                  <2> 	retn
  1203                              <2> 
  1204                              <2> 		; lodsb with ?src_remaining check
  1205                              <2> load_byte:
  1206 000003ED E80600              <2> 	call read_byte
  1207                              <2> d0	mov byte [bp + ?errordata], 84h
  1208 000003F0 7303E93BFF          <2> 	jc depack.error
  1209 000003F5 C3                  <2> 	retn
  1210                              <2> %endif
  1211                              <2> 
  1212                              <2> %if _MULTI || !_LZEXEDAT
  1213                              <2> 		; INP:	cx = 0..15
  1214                              <2> 		;	dl = bit index, dh = current byte
  1215                              <2> 		; OUT:	NC if successful,
  1216                              <2> 		;	 ax = value read
  1217                              <2> 		;	 cx = 0
  1218                              <2> 		;	 dx updated
  1219                              <2> 		;	CY if error
  1220                              <2> 		; CHG:	ds, si
  1221                              <2> get_bits:
  1222                              <2> %ifn _DXTAG
  1223                              <2> 	push dx
  1224                              <2> 	mov dx, word [bp + ?low_bit_index_and_high_current_byte]
  1225                              <2> %endif
  1226                              <2> 	cmp cx, 15
  1227                              <2> 	ja .error
  1228                              <2> 	test cx, cx
  1229                              <2> 	jz .error
  1230                              <2> 	xor ax, ax
  1231                              <2> .loop:
  1232                              <2> 	test dl, dl
  1233                              <2> 	jnz .havebit
  1234                              <2> 	push ax
  1235                              <2> 	call read_byte
  1236                              <2> 	mov dh, al
  1237                              <2> 	mov dl, 80h
  1238                              <2> 	pop ax
  1239                              <2> 	jc .error
  1240                              <2> .havebit:
  1241                              <2> 	shl ax, 1
  1242                              <2> 	test dh, dl
  1243                              <2> 	jz @F
  1244                              <2> 	inc ax
  1245                              <2> @@:
  1246                              <2> 	shr dl, 1
  1247                              <2> 	loop .loop
  1248                              <2> .end:
  1249                              <2> 	db __TEST_IMM8		; skip stc, NC
  1250                              <2> .error:
  1251                              <2> 	stc
  1252                              <2> %ifn _DXTAG
  1253                              <2> 	mov word [bp + ?low_bit_index_and_high_current_byte], dx
  1254                              <2> 	pop dx
  1255                              <2> %endif
  1256                              <2> 	retn
  1257                              <2> %endif
  1258                              <2> 
  1259                              <2> 
  1260                              <2> 		; INP:	?src_remaining
  1261                              <2> 		; OUT:	NC if success,
  1262                              <2> 		;	 al = value read
  1263                              <2> 		;	 ?src_remaining decremented
  1264                              <2> 		;	CY if error (source buffer too small),
  1265                              <2> 		;	 ?src_remaining = 0
  1266                              <2> 		; CHG:	ds, si
  1267                              <2> read_byte:
  1268 000003F6 836EF401            <2> 	sub word [bp + ?src_remaining], 1
  1269 000003FA 835EF600            <2> 	sbb word [bp + ?src_remaining + 2], 0
  1270 000003FE 7204                <2> 	jb .empty
  1271                              <2> 
  1272 00000400 E8CF00              <2> 	call get_file_byte
  1273 00000403 C3                  <2> 	retn
  1274                              <2> 
  1275                              <2> .empty:
  1276 00000404 8366F400            <2> 	and word [bp + ?src_remaining], 0
  1277 00000408 8366F600            <2> 	and word [bp + ?src_remaining + 2], 0
  1278 0000040C F9                  <2> 	stc
  1279 0000040D C3                  <2> 	retn
  1280                              <2> 
  1281                              <2> 	lleave ctx
  1282                              <2> 
  1283                              <2> %if _MULTI
  1284                              <2> 	resetdef LONGLITERAL
  1285                              <2> 	resetdef LZEXEDAT
  1286                              <2> %endif
  1287                              <2> 
  1288                              <2> %ifn _STANDALONE
  1289                              <2> 	resetdef COUNTER
  1290                              <2> 	resetdef DEBUG0
  1291                              <2> 
  1292                              <2> 
  1293                              <2> read_and_depack:
  1294                              <2> 	houdini
  1295                              <2> 
  1296                              <2> 		; common setup for depacking
  1297 0000040E 891E[C407]          <2> reloc	mov word [handle], bx
  1298                              <2> internaldatarelocation
  1299                              <2> 
  1300 00000412 8916[B405]          <2> reloc	mov word [depacked_buffer], dx
  1301                              <2> internaldatarelocation
  1302 00000416 8C06[B605]          <2> reloc	mov word [depacked_buffer + 2], es
  1303                              <2> internaldatarelocation
  1304 0000041A 890E[BC05]          <2> reloc	mov word [depacked_length], cx
  1305                              <2> internaldatarelocation
  1306                              <2> 
  1307                              <2> %ifndef ELD_OMIT_PARTIALDEPACK
  1308                              <2> reloc	rol byte [partialdepack], 1
  1309                              <2> internaldatarelocation
  1310                              <2> 	jnc .new
  1311                              <2> %endif
  1312                              <2> 		; did we save a prior partial depack ?
  1313 0000041E 833E[0C03]FF        <2> reloc	cmp word [depack_saved_sp], strict byte 0FFFFh
  1314                              <2> internaldatarelocation -3
  1315 00000423 742E                <2> 	je .new				; no -->
  1316 00000425 A1[B205]            <2> reloc	mov ax, word [depackseek + 2]
  1317                              <2> internaldatarelocation
  1318 00000428 3B06[AE05]          <2> reloc	cmp ax, word [depackskip + 2]
  1319                              <2> internaldatarelocation
  1320 0000042C 7507                <2> 	jne @F
  1321 0000042E A1[B005]            <2> reloc	mov ax, word [depackseek]
  1322                              <2> internaldatarelocation
  1323 00000431 3B06[AC05]          <2> reloc	cmp ax, word [depackskip]
  1324                              <2> internaldatarelocation
  1325                              <2> @@:
  1326 00000435 771C                <2> 	ja .new				; seek is > skip, must rewind -->
  1327                              <2> 
  1328 00000437 A1[B005]            <2> reloc	mov ax, word [depackseek]
  1329                              <2> internaldatarelocation
  1330 0000043A 2906[AC05]          <2> reloc	sub word [depackskip], ax
  1331                              <2> internaldatarelocation
  1332 0000043E A1[B205]            <2> reloc	mov ax, word [depackseek + 2]
  1333                              <2> internaldatarelocation
  1334 00000441 1906[AE05]          <2> reloc	sbb word [depackskip + 2], ax	; skip -= seek
  1335                              <2> internaldatarelocation
  1336                              <2> 
  1337 00000445 52                  <2> 	push dx
  1338 00000446 53                  <2> 	push bx
  1339 00000447 57                  <2> 	push di
  1340 00000448 56                  <2> 	push si
  1341 00000449 06                  <2> 	push es
  1342 0000044A 55                  <2> 	push bp
  1343 0000044B 51                  <2> 	push cx				; stack frame must match what .read expects
  1344                              <2> 
  1345 0000044C 8926[BE05]          <2> reloc	mov word [depack_prior_sp], sp
  1346                              <2> internaldatarelocation			; store our sp
  1347 00000450 E92C01              <2> 	jmp put_file_data.entry		; continue depacking
  1348                              <2> 
  1349                              <2> 
  1350                              <2> .new:
  1351 00000453 52                  <2> 	push dx
  1352 00000454 51                  <2> 	push cx
  1353 00000455 06                  <2> 	push es
  1354 00000456 8B16[A405]          <2> reloc	mov dx, word [libseek]
  1355                              <2> internaldatarelocation
  1356 0000045A 8B0E[A605]          <2> reloc	mov cx, word [libseek + 2]
  1357                              <2> internaldatarelocation
  1358 0000045E B80042              <2> 	mov ax, 4200h
  1359 00000461 E8D3FD              <2> 	call dos_or_boot_io
  1360 00000464 07                  <2> 	pop es
  1361 00000465 7266                <2> 	jc .io_error
  1362                              <2> 
  1363 00000467 C706[C007][C005]    <2> reloc2	mov word [filebuffer.next], filebuffer
  1364                              <2> internaldatarelocation -4
  1365                              <2> internaldatarelocation
  1366 0000046D C706[C207][C005]    <2> reloc2	mov word [filebuffer.tail], filebuffer
  1367                              <2> internaldatarelocation -4
  1368                              <2> internaldatarelocation
  1369                              <2> 
  1370 00000473 59                  <2> 	pop cx
  1371 00000474 5A                  <2> 	pop dx
  1372                              <2> 
  1373 00000475 31C0                <2> 	xor ax, ax
  1374 00000477 A3[B005]            <2> reloc	mov word [depackseek], ax
  1375                              <2> internaldatarelocation
  1376 0000047A A3[B205]            <2> reloc	mov word [depackseek + 2], ax
  1377                              <2> internaldatarelocation
  1378                              <2> 
  1379 0000047D 52                  <2> 	push dx
  1380 0000047E 53                  <2> 	push bx
  1381 0000047F 57                  <2> 	push di
  1382 00000480 56                  <2> 	push si
  1383 00000481 06                  <2> 	push es
  1384 00000482 55                  <2> 	push bp
  1385 00000483 51                  <2> 	push cx
  1386 00000484 16                  <2> 	 push ss
  1387 00000485 07                  <2> 	 pop es
  1388 00000486 BF[D007]            <2> reloc	mov di, resultbuffer
  1389                              <2> internaldatarelocation
  1390 00000489 BE[D017]            <2> reloc	mov si, resultbuffer.end
  1391                              <2> internaldatarelocation
  1392                              <2> 
  1393 0000048C 8B0E[0A00]          <2> reloc	mov cx, word [libtab_compressed_length + 2]
  1394                              <2> internaldatarelocation
  1395 00000490 8B16[0800]          <2> reloc	mov dx, word [libtab_compressed_length]
  1396                              <2> internaldatarelocation
  1397                              <2> 
  1398 00000494 8926[BE05]          <2> reloc	mov word [depack_prior_sp], sp
  1399                              <2> internaldatarelocation
  1400 00000498 BC[5A05]            <2> reloc	mov sp, depack_stack.top
  1401                              <2> internaldatarelocation
  1402                              <2> %if _MULTI
  1403                              <2> reloc	mov al, byte [depack_format]
  1404                              <2> internaldatarelocation
  1405                              <2> %endif
  1406 0000049B E8F1FD              <2> 	call depack
  1407 0000049E C706[0C03]FFFF      <2> reloc	mov word [depack_saved_sp], 0FFFFh
  1408                              <2> internaldatarelocation -4
  1409                              <2> .read:
  1410 000004A4 16                  <2> 	 push ss
  1411 000004A5 1F                  <2> 	 pop ds
  1412                              <2> 
  1413 000004A6 FF36[B005]          <2> reloc	push word [depackseek]
  1414                              <2> internaldatarelocation
  1415 000004AA FF36[B205]          <2> reloc	push word [depackseek + 2]
  1416                              <2> internaldatarelocation
  1417 000004AE 8F06[AE05]          <2> reloc	pop word [depackskip + 2]
  1418                              <2> internaldatarelocation
  1419 000004B2 8F06[AC05]          <2> reloc	pop word [depackskip]
  1420                              <2> internaldatarelocation
  1421                              <2> 
  1422 000004B6 8B26[BE05]          <2> reloc	mov sp, word [depack_prior_sp]
  1423                              <2> internaldatarelocation
  1424 000004BA 7209                <2> 	jc @F
  1425 000004BC A1[BC05]            <2> reloc	mov ax, word [depacked_length]
  1426                              <2> internaldatarelocation
  1427 000004BF F7D8                <2> 	neg ax			; - remain
  1428 000004C1 59                  <2> 	pop cx
  1429 000004C2 01C8                <2> 	add ax, cx		; requested - remain = how much read
  1430 000004C4 A8                  <2> 	db __TEST_IMM8		; skip pop, NC
  1431                              <2> @@:
  1432 000004C5 59                  <2> 	pop cx
  1433 000004C6 5D                  <2> 	pop bp
  1434 000004C7 07                  <2> 	pop es
  1435 000004C8 5E                  <2> 	pop si
  1436 000004C9 5F                  <2> 	pop di
  1437 000004CA 5B                  <2> 	pop bx
  1438 000004CB 5A                  <2> 	pop dx
  1439 000004CC C3                  <2> 	retn
  1440                              <2> 
  1441                              <2> .io_error:
  1442 000004CD 83C404              <2> 	add sp, 4
  1443 000004D0 F9                  <2> 	stc
  1444 000004D1 C3                  <2> 	retn
  1445                              <2> 
  1446                              <2> 
  1447                              <2> get_file_byte:
  1448 000004D2 368B36[C007]        <2> reloc	mov si, [ss:filebuffer.next]
  1449                              <2> internaldatarelocation
  1450 000004D7 363B36[C207]        <2> reloc	cmp si, [ss:filebuffer.tail]
  1451                              <2> internaldatarelocation
  1452 000004DC 7238                <2> 	jb .buffered
  1453                              <2> 
  1454 000004DE 50                  <2> 	push ax
  1455 000004DF 53                  <2> 	push bx
  1456 000004E0 51                  <2> 	push cx
  1457 000004E1 52                  <2> 	push dx
  1458 000004E2 06                  <2> 	push es
  1459 000004E3 1E                  <2> 	push ds
  1460                              <2> 
  1461 000004E4 16                  <2> 	 push ss
  1462 000004E5 1F                  <2> 	 pop ds
  1463 000004E6 16                  <2> 	 push ss
  1464 000004E7 07                  <2> 	 pop es
  1465 000004E8 BA[C005]            <2> reloc	mov dx, filebuffer
  1466                              <2> internaldatarelocation
  1467 000004EB 8916[C007]          <2> reloc	mov [filebuffer.next], dx
  1468                              <2> internaldatarelocation
  1469 000004EF 8916[C207]          <2> reloc	mov [filebuffer.tail], dx
  1470                              <2> internaldatarelocation
  1471 000004F3 B8003F              <2> 	mov ax, 3F00h
  1472 000004F6 8B1E[C407]          <2> reloc	mov bx, [handle]
  1473                              <2> internaldatarelocation
  1474 000004FA B90002              <2> 	mov cx, filebuffer.end - filebuffer
  1475 000004FD E837FD              <2> 	call dos_or_boot_io
  1476 00000500 720C                <2> 	jc @F			; CY -->
  1477 00000502 85C0                <2> 	test ax, ax
  1478 00000504 F9                  <2> 	stc			; CY
  1479 00000505 7407                <2> 	jz @F
  1480 00000507 01D0                <2> 	add ax, dx		; NC
  1481 00000509 A3[C207]            <2> reloc	mov word [filebuffer.tail], ax
  1482                              <2> internaldatarelocation
  1483 0000050C 89D6                <2> 	mov si, dx
  1484                              <2> @@:
  1485 0000050E 1F                  <2> 	pop ds
  1486 0000050F 07                  <2> 	pop es
  1487 00000510 5A                  <2> 	pop dx
  1488 00000511 59                  <2> 	pop cx
  1489 00000512 5B                  <2> 	pop bx
  1490 00000513 58                  <2> 	pop ax
  1491 00000514 7208                <2> 	jc .ret
  1492                              <2> .buffered:
  1493 00000516 36AC                <2> 	ss lodsb
  1494 00000518 368936[C007]        <2> reloc	mov [ss:filebuffer.next], si
  1495                              <2> internaldatarelocation
  1496 0000051D F8                  <2> 	clc
  1497                              <2> .ret:
  1498 0000051E C3                  <2> 	retn
  1499                              <2> 
  1500                              <2> 
  1501                              <2> 		; INP:	ds:si -> data to write
  1502                              <2> 		;	cx = length of data (may be zero)
  1503                              <2> 		; OUT:	Does not return if error
  1504                              <2> 		; CHG:	-
  1505                              <2> put_file_data:
  1506 0000051F 50                  <2> 	push ax
  1507 00000520 53                  <2> 	push bx
  1508 00000521 51                  <2> 	push cx
  1509 00000522 52                  <2> 	push dx
  1510 00000523 1E                  <2> 	push ds
  1511 00000524 56                  <2> 	push si
  1512 00000525 06                  <2> 	push es
  1513 00000526 57                  <2> 	push di
  1514 00000527 16                  <2> 	 push ss
  1515 00000528 1F                  <2> 	 pop ds
  1516                              <2> .entry2:
  1517                              <2> %if 0
  1518                              <2> reloc	cmp word [depackseek], strict word 0AFh
  1519                              <2> internaldatarelocation -4
  1520                              <2> 	jne @F
  1521                              <2> reloc	cmp word [depackseek + 2], strict byte 0
  1522                              <2> internaldatarelocation -3
  1523                              <2> 	jne @F
  1524                              <2> 	houdini
  1525                              <2> @@:
  1526                              <2> %endif
  1527 00000529 51                  <2> 	push cx			; put data length, add to depackseek maybe
  1528 0000052A 833E[AE05]00        <2> reloc	cmp word [depackskip + 2], strict byte 0
  1529                              <2> internaldatarelocation -3
  1530 0000052F 755D                <2> 	jne .skip
  1531 00000531 390E[AC05]          <2> reloc	cmp word [depackskip], cx
  1532                              <2> internaldatarelocation
  1533 00000535 7357                <2> 	jae .skip		; still have to skip -->
  1534 00000537 31D2                <2> 	xor dx, dx
  1535 00000539 8716[AC05]          <2> reloc	xchg dx, word [depackskip]
  1536                              <2> internaldatarelocation		; how much to skip in this step
  1537                              <2> 				; dx = how many bytes skipped
  1538 0000053D 01D6                <2> 	add si, dx		; -> data to copy (part of put data)
  1539 0000053F 29D1                <2> 	sub cx, dx		; data - skip = length of data to copy, at least 1
  1540 00000541 7454                <2> 	jz .ret_cx		; (not needed ?)
  1541 00000543 51                  <2> 	push cx			; = how many bytes left at si
  1542 00000544 C43E[B405]          <2> reloc	les di, [depacked_buffer]
  1543                              <2> internaldatarelocation
  1544 00000548 A1[BC05]            <2> reloc	mov ax, word [depacked_length]
  1545                              <2> internaldatarelocation		; how much we want to read
  1546 0000054B 39C8                <2> 	cmp ax, cx
  1547 0000054D 7302                <2> 	jae @F
  1548 0000054F 89C1                <2> 	mov cx, ax		; cx = min(ax, cx) lesser of requested, available
  1549                              <2> @@:
  1550 00000551 89C8                <2> 	mov ax, cx		; how much we want to copy
  1551 00000553 F3A4                <2> 	rep movsb		; copy to user buffer, si -> data left if any
  1552                              <2> 
  1553 00000555 893E[B405]          <2> reloc	mov word [depacked_buffer], di
  1554                              <2> internaldatarelocation		; -> past copied data
  1555 00000559 2906[BC05]          <2> reloc	sub word [depacked_length], ax
  1556                              <2> internaldatarelocation		; decrement count of how much still wanted
  1557                              <2> 		; this is NZ only if available < requested
  1558 0000055D 59                  <2> 	pop cx			; = how many bytes left at prior si -> data just copied
  1559 0000055E 7537                <2> 	jnz .ret_cx		; go add full length of put data to depackseek
  1560 00000560 01C2                <2> 	add dx, ax		; how many bytes processed (skipped + copied)
  1561 00000562 0116[B005]          <2> reloc	add word [depackseek], dx
  1562                              <2> internaldatarelocation
  1563 00000566 8316[B205]00        <2> reloc	adc word [depackseek + 2], strict byte 0
  1564                              <2> internaldatarelocation -3	; add to seek the last bit processed
  1565 0000056B 5A                  <2> 	pop dx			; discard cx on stack
  1566 0000056C 29C1                <2> 	sub cx, ax		; = how many bytes left after new si ->
  1567 0000056E 890E[B805]          <2> reloc	mov word [depack_left_length], cx
  1568                              <2> internaldatarelocation		; = amount data left after new si ->
  1569 00000572 8936[BA05]          <2> reloc	mov word [depack_left_address], si
  1570                              <2> internaldatarelocation		; at current depackseek -> data left if any
  1571 00000576 55                  <2> 	push bp
  1572 00000577 8926[0C03]          <2> reloc	mov word [depack_saved_sp], sp
  1573                              <2> internaldatarelocation
  1574 0000057B F8                  <2> 	clc
  1575 0000057C E925FF              <2> 	jmp read_and_depack.read
  1576                              <2> 
  1577                              <2> .entry:
  1578 0000057F 8B26[0C03]          <2> reloc	mov sp, word [depack_saved_sp]
  1579                              <2> internaldatarelocation
  1580 00000583 5D                  <2> 	pop bp
  1581 00000584 8B0E[B805]          <2> reloc	mov cx, word [depack_left_length]
  1582                              <2> internaldatarelocation
  1583 00000588 8B36[BA05]          <2> reloc	mov si, word [depack_left_address]
  1584                              <2> internaldatarelocation
  1585 0000058C EB9B                <2> 	jmp .entry2
  1586                              <2> 
  1587                              <2> .skip:
  1588 0000058E 290E[AC05]          <2> reloc	sub word [depackskip], cx
  1589                              <2> internaldatarelocation
  1590 00000592 831E[AE05]00        <2> reloc	sbb word [depackskip + 2], strict byte 0
  1591                              <2> internaldatarelocation -3
  1592                              <2> 
  1593                              <2> .ret_cx:
  1594 00000597 59                  <2> 	pop cx
  1595 00000598 010E[B005]          <2> reloc	add word [depackseek], cx
  1596                              <2> internaldatarelocation
  1597 0000059C 8316[B205]00        <2> reloc	adc word [depackseek + 2], strict byte 0
  1598                              <2> internaldatarelocation -3
  1599                              <2> 
  1600                              <2> .ret:
  1601 000005A1 5F                  <2> 	pop di
  1602 000005A2 07                  <2> 	pop es
  1603 000005A3 5E                  <2> 	pop si
  1604 000005A4 1F                  <2> 	pop ds
  1605 000005A5 5A                  <2> 	pop dx
  1606 000005A6 59                  <2> 	pop cx
  1607 000005A7 5B                  <2> 	pop bx
  1608 000005A8 58                  <2> 	pop ax
  1609 000005A9 C3                  <2> 	retn
  1610                              <2> %endif
   226                              <1> %endif
   227                              <1> 
   228                              <1> 
   229                              <1> get_es_ext:
   230 000005AA 8E06[0000]          <1> reloc	mov es, word [relocateddata]
   231                              <1> linkdatarelocation extdssel
   232 000005AE E83F00              <1> 	extcallcall ispm
   233 000005B1 7404                <1> 	jz @F
   234 000005B3 8E06[0000]          <1> reloc	mov es, word [relocateddata]
   235                              <1> linkdatarelocation extseg
   236                              <1> @@:
   237 000005B7 C3                  <1> 	retn
   238                              <1> 
   239                              <1> 
   240                              <1> 	align 2
   241                              <1> relocator:
   242 000005B8 56                  <1> 	push si
   243 000005B9 57                  <1> 	push di
   244 000005BA 1E                  <1> 	push ds
   245 000005BB 06                  <1> 	push es
   246                              <1> 
   247 000005BC 06                  <1> 	 push es
   248 000005BD 1F                  <1> 	 pop ds
   249 000005BE B90000              <1> 	mov cx, 0
   250                              <1> .codelength equ $ - 2
   251 000005C1 BE0000              <1> 	mov si, 0
   252                              <1> .codesource equ $ - 2
   253 000005C4 BF[0000]            <1> 	mov di, code
   254                              <1> .codedestination equ $ - 2
   255                              <1> internalcoderelocation
   256 000005C7 F3A4                <1> 	rep movsb
   257                              <1> 
   258 000005C9 16                  <1> 	 push ss
   259 000005CA 07                  <1> 	 pop es
   260 000005CB 16                  <1> 	 push ss
   261 000005CC 1F                  <1> 	 pop ds
   262 000005CD B90000              <1> 	mov cx, 0
   263                              <1> .datalength equ $ - 2
   264 000005D0 BE0000              <1> 	mov si, 0
   265                              <1> .datasource equ $ - 2
   266 000005D3 BF[0000]            <1> 	mov di, datastart
   267                              <1> .datadestination equ $ - 2
   268                              <1> internaldatarelocation
   269 000005D6 F3A4                <1> 	rep movsb
   270                              <1> 
   271 000005D8 07                  <1> 	pop es
   272 000005D9 C706[0000]0000      <1> 	mov word [relocateddata], 0
   273                              <1> linkdatarelocation extseg_used, -4
   274                              <1> .extseg_used equ $ - 2
   275 000005DF C706[0000]0000      <1> 	mov word [relocateddata], 0
   276                              <1> linkdatarelocation extdata_used, -4
   277                              <1> .extdata_used equ $ - 2
   278                              <1> 
   279 000005E5 B90000              <1> 	mov cx, 0
   280                              <1> .entry equ $ - 2
   281 000005E8 1F                  <1> 	pop ds
   282 000005E9 5F                  <1> 	pop di
   283 000005EA 5E                  <1> 	pop si
   284 000005EB FFE1                <1> 	jmp cx
   285                              <1> 
   286 000005ED 90                  <1> 	align 2
   287                              <1> 	endarea relocator
   288                              <1> 
   289 000005EE 90<rep 2h>E8[0000]- <1> 	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   289 000005F3 EB020000C3E8[0000]- <1>
   289 000005FB EB020000C3E8[0000]- <1>
   289 00000603 EB020000C3E8[0000]- <1>
   289 0000060B EB020000C3          <1>
   290                              <1> 	eldcall_new_callcall
   291                              <1> 
   292                              <1> endload: equ ($ + _CURRENT_SECTION %+ FIXUP + 15) & ~15
   293                              <1> 
   294                              <1> 
   295                              <1> start:
   296 00000610 16                  <1> 	push ss
   297 00000611 07                  <1> 	pop es
   298                              <1> %if _DATABUFFER
   299 00000612 F606[0100]40        <1> reloc	testopt [relocateddata], nodosloaded
   300                              <1> linkdatarelocation internalflags, -3
   301 00000617 7420                <1> 	jz .skipdatabuffer
   302 00000619 B104                <1> 	mov cl, 4
   303 0000061B 8CD0                <1> 	mov ax, ss
   304 0000061D BB[D017]            <1> reloc	mov bx, databuffer
   305                              <1> internaldatarelocation
   306 00000620 F6C30F              <1> 	test bl, 15
   307 00000623 7514                <1> 	jnz .skipdatabuffer
   308 00000625 D3EB                <1> 	shr bx, cl
   309 00000627 01D8                <1> 	add ax, bx
   310 00000629 A3[0600]            <1> reloc	mov word [relocateddata - LOADDATA2 + ldDataSegment], ax
   311                              <1> linkdatarelocation load_data
   312 0000062C 31C0                <1> 	xor ax, ax
   313 0000062E A3[0A00]            <1> reloc	mov word [relocateddata - LOADDATA2 + ldDataSector + 2], ax
   314                              <1> linkdatarelocation load_data
   315 00000631 A3[0800]            <1> reloc	mov word [relocateddata - LOADDATA2 + ldDataSector], ax
   316                              <1> linkdatarelocation load_data
   317 00000634 800E[1700]08        <1> reloc	setopt [relocateddata - LOADDATA2 + ldFlags], ldfDataBuffered
   318                              <1> linkdatarelocation load_data, -3
   319                              <1> .skipdatabuffer:
   320                              <1> %endif
   321 00000639 E8BC02              <1> 	extcallcall skipcomma
   322 0000063C 8D5CFF              <1> 	lea bx, [si - 1]
   323 0000063F E8BE02              <1> 	extcallcall iseol?
   324 00000642 740D                <1> 	je help_dec
   325 00000644 4E                  <1> 	dec si
   326 00000645 BA[9A04]            <1> 	mov dx, msg.help_keyword
   327                              <1> internaldatarelocation
   328 00000648 E8BD02              <1> 	extcallcall isstring?
   329 0000064B 7405                <1> 	je help
   330                              <1> %if _COMPRESSED && _ELD_TEST_LIB
   331                              <1> 	mov dx, msg.test_keyword
   332                              <1> internaldatarelocation
   333                              <1> 	extcallcall isstring?
   334                              <1> 	je test
   335                              <1> %endif
   336 0000064D AC                  <1> 	lodsb
   337 0000064E E92201              <1> 	jmp getname
   338                              <1> 
   339                              <1> %if _COMPRESSED && _ELD_TEST_LIB
   340                              <1> test:
   341                              <1> 	call get_dxax_seek_lib_zero
   342                              <1> 	jc .io_error
   343                              <1> 	mov word [libseek], ax
   344                              <1> internaldatarelocation
   345                              <1> 	mov word [libseek + 2], dx
   346                              <1> internaldatarelocation
   347                              <1> 
   348                              <1> 	mov cx, ELD_HEADERX_size
   349                              <1> 	sub sp, cx
   350                              <1> 
   351                              <1> 	xor ax, ax
   352                              <1> 	mov word [depackskip], ax
   353                              <1> internaldatarelocation
   354                              <1> 	mov word [depackskip + 2], ax
   355                              <1> internaldatarelocation
   356                              <1> 
   357                              <1> 	mov dx, sp
   358                              <1> 	call read_and_depack
   359                              <1> 	houdini
   360                              <1> 
   361                              <1> 	mov ax, (library_end_skip - library_start_skip - 16) & 0FFFFh
   362                              <1> 	mov dx, (library_end_skip - library_start_skip - 16) >> 16
   363                              <1> 
   364                              <1> 	mov word [depackskip], ax
   365                              <1> internaldatarelocation
   366                              <1> 	mov word [depackskip + 2], dx
   367                              <1> internaldatarelocation
   368                              <1> 
   369                              <1> 	mov cx, ELD_HEADERX_size
   370                              <1> 	mov dx, sp
   371                              <1> 	call read_and_depack
   372                              <1> 	houdini
   373                              <1> 	jc .io_error
   374                              <1> 	cmp cx, ax
   375                              <1> 	jne .io_error
   376                              <1> .io_error:
   377                              <1> 	mov word [depackskip], 30h
   378                              <1> internaldatarelocation -4
   379                              <1> 	mov word [depackskip + 2], 0
   380                              <1> internaldatarelocation -4
   381                              <1> 
   382                              <1> 	mov cx, 32
   383                              <1> 	mov dx, sp
   384                              <1> 	call read_and_depack
   385                              <1> 	houdini
   386                              <1> 
   387                              <1> 	extcallcall cmd3
   388                              <1> %endif
   389                              <1> 
   390                              <1> help_dec:
   391 00000651 4E                  <1> 	dec si
   392                              <1> help:
   393 00000652 31C9                <1> 	xor cx, cx
   394 00000654 E8A102              <1> 	extcallcall skipcomma
   395 00000657 E8A602              <1> 	extcallcall iseol?
   396 0000065A 7419                <1> 	je .dispatch_eol
   397 0000065C 4E                  <1> 	dec si
   398 0000065D 41                  <1> 	inc cx
   399 0000065E BA[9F04]            <1> 	mov dx, msg.describe_keyword
   400                              <1> internaldatarelocation
   401 00000661 E8A402              <1> 	extcallcall isstring?
   402 00000664 740B                <1> 	je .dispatch
   403                              <1> %if _ELD_TEST_DESCRIBEX
   404                              <1> %if _COMPRESSED
   405                              <1> 	not byte [partialdepack]
   406                              <1> internaldatarelocation
   407                              <1> %endif
   408                              <1> 	mov dx, msg.describex_keyword
   409                              <1> internaldatarelocation
   410                              <1> 	extcallcall isstring?
   411                              <1> 	je .dispatch
   412                              <1> %endif
   413 00000666 41                  <1> 	inc cx
   414 00000667 BA[A804]            <1> 	mov dx, msg.wide_keyword
   415                              <1> internaldatarelocation
   416 0000066A E89B02              <1> 	extcallcall isstring?
   417 0000066D 7402                <1> 	je .dispatch
   418 0000066F EB97                <1> 	jmp error
   419                              <1> 
   420                              <1> .dispatch:
   421 00000671 AC                  <1> 	lodsb
   422 00000672 E89B02              <1> 	extcallcall chkeol
   423                              <1> .dispatch_eol:
   424 00000675 BA[AD04]            <1> 	mov dx, msg.help
   425                              <1> internaldatarelocation
   426 00000678 E87DFF              <1> 	extcallcall putsz
   427                              <1> 
   428 0000067B 49                  <1> 	dec cx
   429 0000067C 7903E9B3FB          <1> 	js zero_and_cmd3
   430 00000681 742D                <1> 	jz describe
   431                              <1> 
   432                              <1> wide:
   433 00000683 BA[8805]            <1> 	mov dx, msg.list
   434                              <1> internaldatarelocation
   435 00000686 E86FFF              <1> 	extcallcall putsz
   436                              <1> 
   437 00000689 BE[0C00]            <1> 	mov si, lib
   438                              <1> internaldatarelocation
   439 0000068C EB09                <1> 	jmp @F
   440                              <1> .loop:
   441 0000068E 81FF[4800]          <1> 	cmp di, relocateddata + 9 * 8
   442                              <1> linkdatarelocation line_out
   443 00000692 7206                <1> 	jb @FF
   444 00000694 E88102              <1> 	extcallcall trimputs
   445                              <1> @@:
   446 00000697 BF[0000]            <1> reloc	mov di, relocateddata
   447                              <1> linkdatarelocation line_out
   448                              <1> @@:
   449 0000069A AD                  <1> 	lodsw
   450 0000069B AD                  <1> 	lodsw			; si += 4
   451 0000069C B90800              <1> 	mov cx, 8
   452 0000069F F3A4                <1> 	rep movsb
   453 000006A1 B020                <1> 	mov al, 32
   454 000006A3 AA                  <1> 	stosb
   455                              <1> 
   456 000006A4 81FE[0C03]          <1> 	cmp si, strict word lib_end
   457                              <1> internaldatarelocation
   458 000006A8 72E4                <1> 	jb .loop
   459 000006AA E86B02              <1> 	extcallcall trimputs
   460                              <1> %if _ELD_ZERO_OFFSETS
   461                              <1> 	call zerooffsets
   462                              <1> %endif
   463 000006AD E850FF              <1> 	extcallcall cmd3
   464                              <1> 
   465                              <1> 
   466                              <1> describe:
   467 000006B0 BA[8805]            <1> 	mov dx, msg.list
   468                              <1> internaldatarelocation
   469 000006B3 E842FF              <1> 	extcallcall putsz
   470                              <1> 
   471 000006B6 E8FE01              <1> 	call get_dxax_seek_lib_zero
   472 000006B9 7303E956FB          <1> 	jc .io_error
   473 000006BE A3[A405]            <1> 	mov word [libseek], ax
   474                              <1> internaldatarelocation
   475 000006C1 8916[A605]          <1> 	mov word [libseek + 2], dx
   476                              <1> internaldatarelocation
   477                              <1> 
   478 000006C5 BE[0C00]            <1> 	mov si, lib
   479                              <1> internaldatarelocation
   480                              <1> .loop:
   481 000006C8 8D5404              <1> 	lea dx, [si + 4]
   482 000006CB B90800              <1> 	mov cx, 8
   483 000006CE 53                  <1> 	push bx
   484 000006CF E84E02              <1> 	extcallcall puts
   485 000006D2 5B                  <1> 	pop bx
   486 000006D3 BA[4404]            <1> 	mov dx, msg.between
   487                              <1> internaldatarelocation
   488 000006D6 E81FFF              <1> 	extcallcall putsz
   489                              <1> 
   490                              <1> %if _COMPRESSED
   491 000006D9 8B04                <1> 	mov ax, word [si]
   492 000006DB 8B5402              <1> 	mov dx, word [si + 2]
   493                              <1> 
   494 000006DE A3[A805]            <1> 	mov word [eldheader], ax
   495                              <1> internaldatarelocation
   496 000006E1 8916[AA05]          <1> 	mov word [eldheader + 2], dx
   497                              <1> internaldatarelocation
   498                              <1> 
   499 000006E5 A3[AC05]            <1> 	mov word [depackskip], ax
   500                              <1> internaldatarelocation
   501 000006E8 8916[AE05]          <1> 	mov word [depackskip + 2], dx
   502                              <1> internaldatarelocation
   503                              <1> %else
   504                              <1> 	mov dx, word [libseek]
   505                              <1> internaldatarelocation
   506                              <1> 	mov cx, word [libseek + 2]
   507                              <1> internaldatarelocation
   508                              <1> 
   509                              <1> 	add dx, word [si]
   510                              <1> 	adc cx, word [si + 2]
   511                              <1> 
   512                              <1> 	mov ax, 4200h
   513                              <1> 	call dos_or_boot_io
   514                              <1> 	jc .io_error
   515                              <1> 	mov word [eldheader], ax
   516                              <1> internaldatarelocation
   517                              <1> 	mov word [eldheader + 2], dx
   518                              <1> internaldatarelocation
   519                              <1> %endif
   520                              <1> 
   521 000006EC B93000              <1> 	mov cx, ELD_HEADERX_size
   522 000006EF 29CC                <1> 	sub sp, cx
   523 000006F1 89E2                <1> 	mov dx, sp
   524                              <1> %if _COMPRESSED
   525 000006F3 E818FD              <1> 	call read_and_depack
   526                              <1> %else
   527                              <1> 	mov ax, 3F00h
   528                              <1> 	call dos_or_boot_io
   529                              <1> %endif
   530 000006F6 7303E919FB          <1> 	jc .io_error
   531 000006FB 39C1                <1> 	cmp cx, ax
   532 000006FD 7403E912FB          <1> 	jne .io_error
   533                              <1> 
   534 00000702 89E7                <1> 	mov di, sp
   535 00000704 837D1E24            <1> 	cmp word [di + eldhExtensionSize], eldhxDescriptionOffset + 4
   536 00000708 723D                <1> 	jb .nodesc
   537 0000070A 8B4D22              <1> 	mov cx, word [di + eldhxDescriptionOffset + 2]
   538 0000070D 8B5520              <1> 	mov dx, word [di + eldhxDescriptionOffset]
   539 00000710 89C8                <1> 	mov ax, cx
   540 00000712 09D0                <1> 	or ax, dx
   541 00000714 7431                <1> 	jz .nodesc
   542                              <1> 
   543 00000716 B80042              <1> 	mov ax, 4200h
   544 00000719 0316[A805]          <1> 	add dx, word [eldheader]
   545                              <1> internaldatarelocation
   546 0000071D 130E[AA05]          <1> 	adc cx, word [eldheader + 2]
   547                              <1> internaldatarelocation
   548                              <1> %if _COMPRESSED
   549 00000721 8916[AC05]          <1> 	mov word [depackskip], dx
   550                              <1> internaldatarelocation
   551 00000725 890E[AE05]          <1> 	mov word [depackskip + 2], cx
   552                              <1> internaldatarelocation
   553                              <1> %else
   554                              <1> 	call dos_or_boot_io
   555                              <1> 	jc .io_error
   556                              <1> %endif
   557                              <1> 
   558 00000729 BF[0000]            <1> 	mov di, relocateddata
   559                              <1> linkdatarelocation line_out
   560 0000072C 89FA                <1> 	mov dx, di
   561 0000072E 31C0                <1> 	xor ax, ax
   562 00000730 B94000              <1> 	mov cx, words(128)
   563 00000733 F3AB                <1> 	rep stosw
   564 00000735 B17F                <1> 	mov cl, 127
   565                              <1> %if _COMPRESSED
   566 00000737 E8D4FC              <1> 	call read_and_depack
   567                              <1> %else
   568                              <1> 	mov ax, 3F00h
   569                              <1> 	call dos_or_boot_io
   570                              <1> %endif
   571 0000073A 7303E9D5FA          <1> 	jc .io_error
   572                              <1> 	; cmp cx, ax
   573                              <1> 	; jne .io_error
   574                              <1> 
   575 0000073F E8B6FE              <1> 	extcallcall putsz
   576 00000742 BA[5604]            <1> 	mov dx, msg.linebreak
   577                              <1> internaldatarelocation
   578 00000745 EB03                <1> 	jmp @F
   579                              <1> .nodesc:
   580 00000747 BA[4704]            <1> 	mov dx, msg.nodesc
   581                              <1> internaldatarelocation
   582                              <1> @@:
   583 0000074A E8ABFE              <1> 	extcallcall putsz
   584 0000074D 83C430              <1> 	add sp, ELD_HEADERX_size
   585 00000750 83C60C              <1> 	add si, 4 + 8
   586 00000753 81FE[0C03]          <1> 	cmp si, strict word lib_end
   587                              <1> internaldatarelocation
   588 00000757 7303E96CFF          <1> 	jb .loop
   589                              <1> 
   590                              <1> .io_error equ found.io_error
   591                              <1> %if _ELD_ZERO_OFFSETS
   592                              <1> 	call zerooffsets
   593                              <1> %endif
   594 0000075C E8A1FE              <1> 	extcallcall cmd3
   595                              <1> 
   596                              <1> 
   597                              <1> %if _ELD_ZERO_OFFSETS
   598                              <1> zerooffsets:
   599                              <1> 		; for debugging with eldcomp, zero the offsets
   600                              <1> 	xor ax, ax
   601                              <1> 	mov di, ..@eldltOffset
   602                              <1> internaldatarelocation
   603                              <1> 	stosw
   604                              <1> 	stosw			; clear eldltOffset
   605                              <1>  %if _COMPRESSED
   606                              <1> 	stosw
   607                              <1> 	stosw			; clear libtab_compressed_length
   608                              <1>  %endif
   609                              <1> .loop:
   610                              <1> 	stosw
   611                              <1> 	stosw
   612                              <1> 	add di, 8
   613                              <1> 	cmp di, strict word lib_end
   614                              <1> internaldatarelocation
   615                              <1> 	jb .loop
   616                              <1> 	retn
   617                              <1> %endif
   618                              <1> 
   619                              <1> 
   620                              <1> unquoted:
   621                              <1> .loop:
   622 0000075F AC                  <1> 	lodsb
   623                              <1> .first:
   624 00000760 3C20                <1> 	cmp al, 32
   625 00000762 7430                <1> 	je end
   626 00000764 3C09                <1> 	cmp al, 9
   627 00000766 742C                <1> 	je end
   628 00000768 3C2C                <1> 	cmp al, ','
   629 0000076A 7428                <1> 	je end
   630 0000076C E8B901              <1> 	extcallcall iseol?.notsemicolon
   631 0000076F 75EE                <1> 	jne .loop
   632 00000771 EB21                <1> 	jmp end
   633                              <1> 
   634                              <1> getname:
   635 00000773 3C22                <1> 	cmp al, '"'
   636 00000775 7404                <1> 	je quoted
   637 00000777 3C27                <1> 	cmp al, "'"
   638 00000779 75E5                <1> 	jne unquoted.first
   639                              <1> quoted:
   640 0000077B 43                  <1> 	inc bx
   641 0000077C 88C4                <1> 	mov ah, al
   642                              <1> .loop:
   643 0000077E AC                  <1> 	lodsb
   644 0000077F 38E0                <1> 	cmp al, ah
   645 00000781 740B                <1> 	je end_quoted
   646 00000783 E8A201              <1> 	extcallcall iseol?.notsemicolon
   647 00000786 75F6                <1> 	jne .loop
   648                              <1> unexpected_eol:
   649 00000788 BE[5904]            <1> 	mov si, msg.unexpected_eol
   650                              <1> internaldatarelocation
   651 0000078B E993FA              <1> 	jmp specificerror
   652                              <1> 
   653                              <1> end_quoted:
   654 0000078E 8D4CFF              <1> 	lea cx, [si - 1]
   655 00000791 AC                  <1> 	lodsb
   656 00000792 EB03                <1> 	jmp @F
   657                              <1> 
   658                              <1> end:
   659 00000794 8D4CFF              <1> 	lea cx, [si - 1]
   660                              <1> @@:
   661 00000797 E89601              <1> 	extcallcall skipcomm0
   662 0000079A 4E                  <1> 	dec si
   663                              <1> 
   664 0000079B 56                  <1> 	push si
   665 0000079C 29D9                <1> 	sub cx, bx
   666 0000079E 7503E9F800          <1> 	jz notfound_invalid
   667                              <1> 
   668 000007A3 80F904              <1> 	cmp cl, 4
   669 000007A6 7226                <1> 	jb .notext
   670 000007A8 8D77FC              <1> 	lea si, [bx - 4]
   671 000007AB 01CE                <1> 	add si, cx
   672 000007AD AC                  <1> 	lodsb
   673 000007AE 3C2E                <1> 	cmp al, '.'
   674 000007B0 751C                <1> 	jne .notext
   675 000007B2 AC                  <1> 	lodsb
   676 000007B3 24DF                <1> 	and al, ~20h
   677 000007B5 3C45                <1> 	cmp al, 'E'
   678 000007B7 7404                <1> 	je @F
   679 000007B9 3C58                <1> 	cmp al, 'X'
   680 000007BB 7511                <1> 	jne .notext
   681                              <1> @@:
   682 000007BD AD                  <1> 	lodsw
   683 000007BE 25DFDF              <1> 	and ax, ~2020h
   684 000007C1 3D4C44              <1> 	cmp ax, "LD"
   685 000007C4 7508                <1> 	jne .notext
   686                              <1> .ext:
   687 000007C6 80E904              <1> 	sub cl, 4
   688 000007C9 7503E9CD00          <1> 	jz notfound_invalid
   689                              <1> .notext:
   690                              <1> 
   691 000007CE 80F908              <1> 	cmp cl, 8
   692 000007D1 7603E9C500          <1> 	ja notfound_invalid
   693 000007D6 89DE                <1> 	mov si, bx
   694 000007D8 BF[0F04]            <1> 	mov di, msg.namebuffer
   695                              <1> internaldatarelocation
   696                              <1> @@:
   697 000007DB AC                  <1> 	lodsb
   698 000007DC E85901              <1> 	extcallcall uppercase
   699 000007DF AA                  <1> 	stosb
   700 000007E0 E2F9                <1> 	loop @B
   701                              <1> 
   702                              <1> search_filename:
   703 000007E2 BE[1000]            <1> 	mov si, lib + 4
   704                              <1> internaldatarelocation
   705                              <1> .loop:
   706 000007E5 E8B900              <1> 	call comparenamebuffer
   707 000007E8 7503E98F00          <1> 	je found
   708 000007ED 83C60C              <1> 	add si, 8 + 4
   709 000007F0 81FE[0C03]          <1> 	cmp si, strict word lib_end
   710                              <1> internaldatarelocation
   711 000007F4 72EF                <1> 	jb .loop
   712                              <1> 
   713                              <1> search_instancename:
   714 000007F6 E8BE00              <1> 	call get_dxax_seek_lib_zero
   715 000007F9 7303E916FA          <1> 	jc .io_error
   716 000007FE A3[A405]            <1> 	mov word [libseek], ax
   717                              <1> internaldatarelocation
   718 00000801 8916[A605]          <1> 	mov word [libseek + 2], dx
   719                              <1> internaldatarelocation
   720                              <1> 
   721 00000805 BE[1000]            <1> 	mov si, lib + 4
   722                              <1> internaldatarelocation
   723                              <1> 
   724                              <1> .loop:
   725                              <1> %if _COMPRESSED
   726 00000808 8B44FC              <1> 	mov ax, word [si - 4]
   727 0000080B 8B54FE              <1> 	mov dx, word [si - 4 + 2]
   728                              <1> 
   729 0000080E A3[AC05]            <1> 	mov word [depackskip], ax
   730                              <1> internaldatarelocation
   731 00000811 8916[AE05]          <1> 	mov word [depackskip + 2], dx
   732                              <1> internaldatarelocation
   733                              <1> %else
   734                              <1> 	mov cx, word [si - 4 + 2]
   735                              <1> 	mov dx, word [si - 4]		; cx:dx = offset within lib section
   736                              <1> 	add dx, word [libseek]
   737                              <1> internaldatarelocation
   738                              <1> 	adc cx, word [libseek + 2]
   739                              <1> internaldatarelocation
   740                              <1> 	mov ax, 4200h
   741                              <1> 	call dos_or_boot_io
   742                              <1> 	jc .io_error
   743                              <1> %endif
   744                              <1> 
   745 00000815 A3[A805]            <1> 	mov word [eldheader], ax
   746                              <1> internaldatarelocation
   747 00000818 8916[AA05]          <1> 	mov word [eldheader + 2], dx
   748                              <1> internaldatarelocation
   749                              <1> 
   750 0000081C B92000              <1> 	mov cx, ELD_HEADER_size
   751 0000081F 29CC                <1> 	sub sp, cx
   752 00000821 89E2                <1> 	mov dx, sp
   753                              <1> %if _COMPRESSED
   754 00000823 E8E8FB              <1> 	call read_and_depack
   755                              <1> %else
   756                              <1> 	mov ax, 3F00h
   757                              <1> 	call dos_or_boot_io
   758                              <1> %endif
   759 00000826 7303E9E9F9          <1> 	jc .io_error
   760 0000082B 39C1                <1> 	cmp cx, ax
   761 0000082D 7403E9E2F9          <1> 	jne .io_error
   762                              <1> 
   763 00000832 89E7                <1> 	mov di, sp
   764 00000834 8B4D0A              <1> 	mov cx, word [di + eldhCodeOffset + 2]
   765 00000837 8B5508              <1> 	mov dx, word [di + eldhCodeOffset] ; cx:dx = offset within ELD
   766 0000083A 0316[A805]          <1> 	add dx, word [eldheader]
   767                              <1> internaldatarelocation
   768 0000083E 130E[AA05]          <1> 	adc cx, word [eldheader + 2]
   769                              <1> internaldatarelocation
   770                              <1> %if _COMPRESSED
   771 00000842 8916[AC05]          <1> 	mov word [depackskip], dx
   772                              <1> internaldatarelocation
   773 00000846 890E[AE05]          <1> 	mov word [depackskip + 2], cx
   774                              <1> internaldatarelocation
   775                              <1> %else
   776                              <1> 	mov ax, 4200h
   777                              <1> 	call dos_or_boot_io
   778                              <1> 	jc .io_error
   779                              <1> %endif
   780                              <1> 
   781 0000084A 89E2                <1> 	mov dx, sp
   782 0000084C B91000              <1> 	mov cx, eldiIdentifier + 8
   783                              <1> %if (eldiIdentifier + 8) > ELD_HEADER_size
   784                              <1>  %error Expected shorter instance header
   785                              <1> %endif
   786                              <1> %if _COMPRESSED
   787 0000084F E8BCFB              <1> 	call read_and_depack
   788                              <1> %else
   789                              <1> 	mov ax, 3F00h
   790                              <1> 	call dos_or_boot_io
   791                              <1> %endif
   792 00000852 7303E9BDF9          <1> 	jc .io_error
   793 00000857 39C1                <1> 	cmp cx, ax
   794 00000859 7403E9B6F9          <1> 	jne .io_error
   795                              <1> 
   796 0000085E 8D4D08              <1> 	lea cx, [di + eldiIdentifier]
   797 00000861 E83F00              <1> 	call comparenamebuffer.cx
   798 00000864 7411                <1> 	je .found
   799 00000866 83C420              <1> 	add sp, ELD_HEADER_size
   800                              <1> 
   801 00000869 83C60C              <1> 	add si, 8 + 4
   802 0000086C 81FE[0C03]          <1> 	cmp si, strict word lib_end
   803                              <1> internaldatarelocation
   804 00000870 7296                <1> 	jb .loop
   805                              <1> 	; jmp notfound
   806 00000872 BE[EB03]            <1> 	mov si, msg.notfound
   807                              <1> internaldatarelocation
   808 00000875 EB27                <1> 	jmp specificerror_j
   809                              <1> 
   810                              <1> .found:
   811 00000877 83C420              <1> 	add sp, ELD_HEADER_size
   812                              <1> 
   813                              <1> %ifn _COMPRESSED
   814                              <1> 	mov dx, word [eldheader]
   815                              <1> internaldatarelocation
   816                              <1> 	mov cx, word [eldheader + 2]
   817                              <1> internaldatarelocation
   818                              <1> 	mov ax, 4200h
   819                              <1> 	call dos_or_boot_io
   820                              <1> 	jc .io_error
   821                              <1> %endif
   822                              <1> 		; get_dxax_seek_lib_* already called
   823 0000087A EB1C                <1> 	jmp found.header_variable
   824                              <1> 
   825                              <1> .io_error equ found.io_error
   826                              <1> 
   827                              <1> 
   828                              <1> found:
   829                              <1> 		; get_dxax_seek_lib_* not yet called
   830                              <1> %if 0
   831                              <1> 	xor ax, ax
   832                              <1> 	retf
   833                              <1> %endif
   834                              <1> 
   835                              <1> %if _COMPRESSED
   836 0000087C E83800              <1> 	call get_dxax_seek_lib_zero
   837 0000087F 7303E990F9          <1> 	jc .io_error
   838 00000884 A3[A405]            <1> 	mov word [libseek], ax
   839                              <1> internaldatarelocation
   840 00000887 8916[A605]          <1> 	mov word [libseek + 2], dx
   841                              <1> internaldatarelocation
   842                              <1> 
   843 0000088B 8B54FE              <1> 	mov dx, word [si - 4 + 2]
   844 0000088E 8B44FC              <1> 	mov ax, word [si - 4]		; dx:ax = offset within lib section
   845                              <1> %else
   846                              <1> 	mov cx, word [si - 4 + 2]
   847                              <1> 	mov dx, word [si - 4]		; cx:dx = offset within lib section
   848                              <1> 
   849                              <1> 	call get_dxax_seek_lib_plus_cxdx
   850                              <1> 	jc .io_error
   851                              <1> %endif
   852 00000891 A3[A805]            <1> 	mov word [eldheader], ax
   853                              <1> internaldatarelocation
   854 00000894 8916[AA05]          <1> 	mov word [eldheader + 2], dx
   855                              <1> internaldatarelocation
   856                              <1> 		; get_dxax_seek_lib_* already called
   857                              <1> .header_variable:
   858 00000898 E985F7              <1> 	jmp load
   859                              <1> 
   860                              <1> .io_error equ load.io_error
   861                              <1> 
   862                              <1> 
   863                              <1> notfound_invalid:
   864 0000089B BE[1C04]            <1> 	mov si, msg.notfound.invalid
   865                              <1> internaldatarelocation
   866                              <1> specificerror_j:
   867 0000089E E980F9              <1> 	jmp specificerror
   868                              <1> 
   869                              <1> 
   870                              <1> comparenamebuffer:
   871 000008A1 89F1                <1> 	mov cx, si
   872                              <1> .cx:
   873 000008A3 56                  <1> 	push si
   874 000008A4 89CE                <1> 	mov si, cx
   875 000008A6 BF[0F04]            <1> 	mov di, msg.namebuffer
   876                              <1> internaldatarelocation
   877 000008A9 B90800              <1> 	mov cx, 8
   878                              <1> @@:
   879 000008AC AC                  <1> 	lodsb
   880 000008AD E88800              <1> 	extcallcall uppercase
   881 000008B0 AE                  <1> 	scasb
   882 000008B1 E1F9                <1> 	loope @B
   883 000008B3 5E                  <1> 	pop si
   884 000008B4 C3                  <1> 	retn
   885                              <1> 
   886 000008B5 [0000]              <1> 	dw relocateddata		; link only for checking support
   887                              <1> linkdatarelocation ext_finish.bp_is_set
   888                              <1> 
   889                              <1> 		; This must be called exactly once, if at all.
   890                              <1> 		;  It expects that the current file seek is as
   891                              <1> 		;  left over from our ELD instance having been
   892                              <1> 		;  loaded, ie it -> behind our data section.
   893                              <1> 		; This seeks once to the library image plus the
   894                              <1> 		;  displacement given by cxdx.
   895                              <1> get_dxax_seek_lib_zero:
   896 000008B7 31C9                <1> 	xor cx, cx
   897 000008B9 31D2                <1> 	xor dx, dx
   898                              <1> get_dxax_seek_lib_plus_cxdx:
   899 000008BB BB[0000]            <1> 	mov bx, relocateddata
   900                              <1> linkdatarelocation load_data_lowest	; make yy_boot_get and yy_boot_update no-ops
   901 000008BE F606[0100]40        <1> 	testopt [relocateddata], nodosloaded
   902                              <1> linkdatarelocation internalflags, -3
   903 000008C3 7510                <1> 	jnz @F
   904 000008C5 8B1E[0000]          <1> 	mov bx, [relocateddata]
   905                              <1> linkdatarelocation ext_handle
   906 000008C9 E8[0000]EB020000    <1> 	extcall InDOS
   907 000008D0 7403                <1> 	jz @F
   908 000008D2 E833FD              <1> 	extcallcall error
   909                              <1> @@:
   910 000008D5 B80142              <1> 	mov ax, 4201h
   911                              <1> lib_displacement equ LIBOFFSET - (DATAOFFSET + data_size)
   912                              <1> %if lib_displacement
   913 000008D8 81C2B001            <1> 	add dx, lib_displacement & 0FFFFh
   914 000008DC 83D100              <1> 	adc cx, (lib_displacement >> 16) & 0FFFFh
   915                              <1> %endif
   916 000008DF D006[0E03]          <1> 	rol byte [got_seek_lib], 1
   917                              <1> internaldatarelocation
   918 000008E3 7306                <1> 	jnc @F
   919 000008E5 BE[B303]            <1> 	mov si, msg.error_seek_lib
   920                              <1> internaldatarelocation
   921 000008E8 E936F9              <1> 	jmp specificerror
   922                              <1> @@:
   923 000008EB F616[0E03]          <1> 	not byte [got_seek_lib]
   924                              <1> internaldatarelocation
   925 000008EF E945F9              <1> 	jmp dos_or_boot_io
   926                              <1> 
   927                              <1> 
   928                              <1> DATAOFFSET equ CODEOFFSET + code_size
   929                              <1> 	addsection DATA, follows=CODE vstart=_ELD_DATA_VSTART
   930                              <1> datastart:
   931                              <1> PUT_ELD_DATETIME
   932                              <1> 
   933                              <1> %define INCBINLIST db ""
   934                              <1> 
   935                              <1> 	%imacro libeld 1-2.nolist
   936                              <1> %strcat %%label "lib_", %1
   937                              <1> %deftok %%token %%label
   938                              <1> %if _XLD
   939                              <1>  %strcat %%filename %1,".xld"
   940                              <1> %else
   941                              <1>  %strcat %%filename %1,".eld"
   942                              <1> %endif
   943                              <1> %xdefine INCBINLIST INCBINLIST, {align 16, db 0}, %%token:, incbin %%filename
   944                              <1> 	dd %%token
   945                              <1> 	fill 8, 32, db %1
   946                              <1> 	%endmacro
   947                              <1> 
   948                              <1> 	%imacro dump_incbin 1-*.nolist
   949                              <1> %rep %0
   950                              <1> 	%1
   951                              <1>  %rotate 1
   952                              <1> %endrep
   953                              <1> 	%endmacro
   954                              <1> 
   955                              <1> %ifn _COMPRESSED
   956                              <1> 	overridedef LZEXEDAT, 0
   957                              <1> %endif
   958                              <1> %ifn _LZEXEDAT
   959                              <1> 	overridedef LONGLITERAL, 0
   960                              <1> %endif
   961                              <1> 
   962                              <1> 	align 4, db 0
   963                              <1> libtable:
   964                              <1>  istruc ELD_LIBTABLE
   965 00000000 0400                <1> at eldltFormat,		dw 2 * !!_COMPRESSED + !!_LZEXEDAT + !!_LONGLITERAL
   966                              <1> 	; 0 = uncompressed
   967                              <1> 	; 1 = legacy heatshrink format (no libtab compressed length)
   968                              <1> 	; 2 = heatshrink format (prepended with -w and -l bytes)
   969                              <1> 	; 3 = lzexedat -4 format (current revision starts with a 1 bit)
   970                              <1> 	; 4 = lzexedat -4 -l format (current revision starts with a 1 bit)
   971 00000002 4000                <1> at eldltAmount,		dw (lib_end - lib) / 12
   972                              <1> at eldltOffset
   973 00000004 001A0000            <1> ..@eldltOffset:		dd LIBOFFSET
   974                              <1>  iend
   975                              <1>  %if _COMPRESSED
   976                              <1> libtab_compressed_length:
   977 00000008 9A5F0200            <1> 			dd (lib_compressed_end - lib_start)
   978                              <1>  %endif
   979                              <1> %else
   980                              <1> 		; Collect the binaries and compress them solidly.
   981                              <1> 	%imacro libeld 1-2.nolist
   982                              <1> %strcat %%label "lib_", %1
   983                              <1> %deftok %%token %%label
   984                              <1> %if _XLD
   985                              <1>  %strcat %%filename %1,".xld"
   986                              <1> %else
   987                              <1>  %strcat %%filename %1,".eld"
   988                              <1> %endif
   989                              <1> 	align 16, db 0
   990                              <1> %%token:
   991                              <1> 	incbin %%filename
   992                              <1> 	%endmacro
   993                              <1> %endif
   994                              <1> 
   995                              <1> 	numdef ELD_DEBUG_LIB, 0
   996                              <1> lib:
   997                              <1> %if _ELD_DEBUG_LIB
   998                              <1> libeld "eldteste"
   999                              <1> libeld "eldtestf"
  1000                              <1> %else
  1001 0000000C [00000000]61666F72- <1> libeld "aformat"
  1001 00000014 6D617420            <1>
  1002 00000018 [A00C0000]616C6961- <1> libeld "alias"
  1002 00000020 7320<rep 3h>        <1>
  1003 00000024 [201D0000]616D6973- <1> libeld "amiscmd"
  1003 0000002C 636D6420            <1>
  1004 00000030 [70290000]616D6973- <1> libeld "amismsg"
  1004 00000038 6D736720            <1>
  1005 0000003C [60350000]616D6973- <1> libeld "amisoth"
  1005 00000044 6F746820            <1>
  1006 00000048 [10400000]616D6974- <1> libeld "amitsrs"
  1006 00000050 73727320            <1>
  1007 00000054 [D0580000]616D6F75- <1> libeld "amount"
  1007 0000005C 6E7420<rep 2h>      <1>
  1008 00000060 [20640000]62617365- <1> libeld "bases"
  1008 00000068 7320<rep 3h>        <1>
  1009 0000006C [20710000]626F6F74- <1> libeld "bootdir"
  1009 00000074 64697220            <1>
  1010 00000078 [40880000]63686563- <1> libeld "checksum"
  1010 00000080 6B73756D            <1>
  1011 00000084 [80940000]63687374- <1> libeld "chstool"
  1011 0000008C 6F6F6C20            <1>
  1012 00000090 [D0AE0000]636F20-   <1> libeld "co"
  1012 00000090 <rep 6h>            <1>
  1013 0000009C [70C20000]636F6E66- <1> libeld "config"
  1013 000000A4 696720<rep 2h>      <1>
  1014 000000A8 [30CC0000]64626974- <1> libeld "dbitmap"
  1014 000000B0 6D617020            <1>
  1015 000000B4 [30DF0000]64657669- <1> libeld "devices"
  1015 000000BC 63657320            <1>
  1016 000000C0 [30ED0000]64686D20- <1> libeld "dhm"
  1016 000000C0 <rep 5h>            <1>
  1017 000000CC [30FB0000]646920-   <1> libeld "di"
  1017 000000CC <rep 6h>            <1>
  1018 000000D8 [C00E0100]646D20-   <1> libeld "dm"
  1018 000000D8 <rep 6h>            <1>
  1019 000000E4 [F01F0100]646F7363- <1> libeld "doscd"
  1019 000000EC 6420<rep 3h>        <1>
  1020 000000F0 [F0270100]646F7364- <1> libeld "dosdir"
  1020 000000F8 697220<rep 2h>      <1>
  1021 000000FC [C03E0100]646F7364- <1> libeld "dosdrive"
  1021 00000104 72697665            <1>
  1022 00000108 [C0460100]646F7370- <1> libeld "dospwd"
  1022 00000110 776420<rep 2h>      <1>
  1023 00000114 [604E0100]646F7373- <1> libeld "dosseek"
  1023 0000011C 65656B20            <1>
  1024 00000120 [C05A0100]646F7373- <1> libeld "dosspace"
  1024 00000128 70616365            <1>
  1025 0000012C [006D0100]646F7373- <1> libeld "dosstrat"
  1025 00000134 74726174            <1>
  1026 00000138 [A0770100]64706220- <1> libeld "dpb"
  1026 00000138 <rep 5h>            <1>
  1027 00000144 [008E0100]64746164- <1> libeld "dtadisp"
  1027 0000014C 69737020            <1>
  1028 00000150 [70950100]647820-   <1> libeld "dx"
  1028 00000150 <rep 6h>            <1>
  1029 0000015C [E0A30100]656E616D- <1> libeld "enamelib"
  1029 00000164 656C6962            <1>
  1030 00000168 [50B30100]65727266- <1> libeld "errfix"
  1030 00000170 697820<rep 2h>      <1>
  1031 00000174 [50C10100]6578746E- <1> libeld "extname"
  1031 0000017C 616D6520            <1>
  1032                              <1> %if _MCP
  1033                              <1> libeld "fdbplace"
  1034                              <1> %endif
  1035 00000180 [60D90100]68696E74- <1> libeld "hint"
  1035 00000188 20<rep 4h>          <1>
  1036 0000018C [50E60100]68696E74- <1> libeld "hintoth"
  1036 00000194 6F746820            <1>
  1037 00000198 [70F30100]68697374- <1> libeld "history"
  1037 000001A0 6F727920            <1>
  1038 000001A4 [70FF0100]69666578- <1> libeld "ifext"
  1038 000001AC 7420<rep 3h>        <1>
  1039 000001B0 [000D0200]696E6A65- <1> libeld "inject"
  1039 000001B8 637420<rep 2h>      <1>
  1040 000001BC [20190200]696E7374- <1> libeld "instnoth"
  1040 000001C4 6E6F7468            <1>
  1041 000001C8 [90270200]696E7374- <1> libeld "instnoun"
  1041 000001D0 6E6F756E            <1>
  1042 000001D4 [10340200]6B636D64- <1> libeld "kcmdline"
  1042 000001DC 6C696E65            <1>
  1043 000001E0 [F03F0200]6B646973- <1> libeld "kdisplay"
  1043 000001E8 706C6179            <1>
  1044 000001EC [F0480200]6C646D65- <1> libeld "ldmem"
  1044 000001F4 6D20<rep 3h>        <1>
  1045 000001F8 [70730200]6C646D65- <1> libeld "ldmemoth"
  1045 00000200 6D6F7468            <1>
  1046 00000204 [40A10200]6C696E66- <1> libeld "linfo"
  1046 0000020C 6F20<rep 3h>        <1>
  1047 00000210 [F0B10200]6C697374- <1> libeld "list"
  1047 00000218 20<rep 4h>          <1>
  1048                              <1> %if _MCP
  1049                              <1> libeld "nreserve"
  1050                              <1> %endif
  1051 0000021C [A0D50200]70617463- <1> libeld "patchqry"
  1051 00000224 68717279            <1>
  1052 00000228 [80E70200]70617468- <1> libeld "path"
  1052 00000230 20<rep 4h>          <1>
  1053 00000234 [10F90200]7072696E- <1> libeld "printf"
  1053 0000023C 746620<rep 2h>      <1>
  1054 00000240 [A00C0300]71756965- <1> libeld "quiet"
  1054 00000248 7420<rep 3h>        <1>
  1055 0000024C [B0170300]71756974- <1> libeld "quit"
  1055 00000254 20<rep 4h>          <1>
  1056 00000258 [B0230300]72636578- <1> libeld "rcexec"
  1056 00000260 656320<rep 2h>      <1>
  1057 00000264 [A02E0300]7264756D- <1> libeld "rdumpidx"
  1057 0000026C 70696478            <1>
  1058 00000270 [E03A0300]7264756D- <1> libeld "rdumpstr"
  1058 00000278 70737472            <1>
  1059 0000027C [00470300]7265636C- <1> libeld "reclaim"
  1059 00000284 61696D20            <1>
  1060 00000288 [F04D0300]72657365- <1> libeld "reserve"
  1060 00000290 72766520            <1>
  1061 00000294 [E0630300]726D20-   <1> libeld "rm"
  1061 00000294 <rep 6h>            <1>
  1062 000002A0 [F06D0300]726E20-   <1> libeld "rn"
  1062 000002A0 <rep 6h>            <1>
  1063 000002AC [007D0300]7320-     <1> libeld "s"
  1063 000002AC <rep 7h>            <1>
  1064 000002B8 [90920300]73627261- <1> libeld "sbranch"
  1064 000002C0 6E636820            <1>
  1065 000002C4 [909E0300]73657420- <1> libeld "set"
  1065 000002C4 <rep 5h>            <1>
  1066 000002D0 [20B10300]74736320- <1> libeld "tsc"
  1066 000002D0 <rep 5h>            <1>
  1067 000002DC [E0C00300]75736570- <1> libeld "useparat"
  1067 000002E4 61726174            <1>
  1068 000002E8 [90CF0300]76617269- <1> libeld "variable"
  1068 000002F0 61626C65            <1>
  1069 000002F4 [40DF0300]77697468- <1> libeld "withhdr"
  1069 000002FC 68647220            <1>
  1070 00000300 [70EC0300]7820-     <1> libeld "x"
  1070 00000300 <rep 7h>            <1>
  1071                              <1> %endif
  1072                              <1> lib_end:
  1073                              <1> 
  1074                              <1> %ifn _COMPRESSLIB
  1075                              <1> %if _COMPRESSED
  1076                              <1> 	align 2, db 0
  1077 0000030C FFFF                <1> depack_saved_sp:	dw 0FFFFh
  1078                              <1>  %if _ELD_TEST_DESCRIBEX
  1079                              <1> partialdepack:		db 0FFh
  1080                              <1>  %endif
  1081                              <1> %endif
  1082                              <1> 
  1083 0000030E 00                  <1> got_seek_lib:		db 0
  1084                              <1> 
  1085                              <1> msg:
  1086 0000030F 39496E7465726E616C- <1> .ext_error_internal:	asciz 39h,"Internal error in EXT LIB command.",13,10
  1086 00000318 206572726F7220696E- <1>
  1086 00000321 20455854204C494220- <1>
  1086 0000032A 636F6D6D616E642E0D- <1>
  1086 00000333 0A00                <1>
  1087 00000335 3A455854204C494220- <1> .ext_error_io:		asciz 3Ah,"EXT LIB command got I/O error.",13,10
  1087 0000033E 636F6D6D616E642067- <1>
  1087 00000347 6F7420492F4F206572- <1>
  1087 00000350 726F722E0D0A00      <1>
  1088 00000357 3B455854204C49423A- <1> .ext_error_invalid:	asciz 3Bh,"EXT LIB: No or invalid Extension for lDebug header.",13,10
  1088 00000360 204E6F206F7220696E- <1>
  1088 00000369 76616C696420457874- <1>
  1088 00000372 656E73696F6E20666F- <1>
  1088 0000037B 72206C446562756720- <1>
  1088 00000384 6865616465722E0D0A- <1>
  1088 0000038D 00                  <1>
  1089 0000038E 3C4F7574206F66206D- <1> .ext_error_oom:		asciz 3Ch,"Out of memory in EXT LIB command.",13,10
  1089 00000397 656D6F727920696E20- <1>
  1089 000003A0 455854204C49422063- <1>
  1089 000003A9 6F6D6D616E642E0D0A- <1>
  1089 000003B2 00                  <1>
  1090 000003B3 7F496E7465726E616C- <1> .error_seek_lib:	asciz 7Fh,"Internal error in EXT LIB, multiple seek to library.",13,10
  1090 000003BC 206572726F7220696E- <1>
  1090 000003C5 20455854204C49422C- <1>
  1090 000003CE 206D756C7469706C65- <1>
  1090 000003D7 207365656B20746F20- <1>
  1090 000003E0 6C6962726172792E0D- <1>
  1090 000003E9 0A00                <1>
  1091 000003EB 37455854204C49423A- <1> .notfound:		db 37h,'EXT LIB: No ELD found by the name "'
  1091 000003F4 204E6F20454C442066- <1>
  1091 000003FD 6F756E642062792074- <1>
  1091 00000406 6865206E616D652022  <1>
  1092 0000040F 20<rep 8h>          <1> .namebuffer:		times 8 db 32
  1093 00000417 22210D0A00          <1> 			asciz '"!',13,10
  1094 0000041C 38455854204C49423A- <1> .notfound.invalid:	asciz 38h,"EXT LIB: No ELD found, invalid name!",13,10
  1094 00000425 204E6F20454C442066- <1>
  1094 0000042E 6F756E642C20696E76- <1>
  1094 00000437 616C6964206E616D65- <1>
  1094 00000440 210D0A00            <1>
  1095 00000444 202000              <1> .between:		asciz "  "
  1096 00000447 4E6F20646573637269- <1> .nodesc:		db "No description."
  1096 00000450 7074696F6E2E        <1>
  1097 00000456 0D0A00              <1> .linebreak:		asciz 13,10
  1098                              <1> 
  1099                              <1> depack_stack: equ $
  1100                              <1> 
  1101 00000459 36455854204C49423A- <1> .unexpected_eol:	asciz 36h,"EXT LIB: Unexpected End Of Line, expected closing quote mark!",13,10
  1101 00000462 20556E657870656374- <1>
  1101 0000046B 656420456E64204F66- <1>
  1101 00000474 204C696E652C206578- <1>
  1101 0000047D 70656374656420636C- <1>
  1101 00000486 6F73696E672071756F- <1>
  1101 0000048F 7465206D61726B210D- <1>
  1101 00000498 0A00                <1>
  1102 0000049A 48454C5000          <1> .help_keyword:		asciz "HELP"
  1103 0000049F 444553435249424500  <1> .describe_keyword:	asciz "DESCRIBE"
  1104                              <1> %if _ELD_TEST_DESCRIBEX
  1105                              <1> .describex_keyword:	asciz "DESCRIBEX"
  1106                              <1> %endif
  1107                              <1> %if _COMPRESSED && _ELD_TEST_LIB
  1108                              <1> .test_keyword:		asciz "TEST"
  1109                              <1> %endif
  1110 000004A8 5749444500          <1> .wide_keyword:		asciz "WIDE"
  1111                              <1> .help:
  1112                              <1> %if _MCP
  1113                              <1> 			db "MCP "
  1114                              <1> %endif
  1115 000004AD 455854204C49422063- <1> 			db "EXT LIB command. This ELD is a library of other ELDs.",13,10
  1115 000004B6 6F6D6D616E642E2054- <1>
  1115 000004BF 68697320454C442069- <1>
  1115 000004C8 732061206C69627261- <1>
  1115 000004D1 7279206F66206F7468- <1>
  1115 000004DA 657220454C44732E0D- <1>
  1115 000004E3 0A                  <1>
  1116 000004E4 52756E207769746820- <1> 			db "Run with an ELD instance name to run another ELD.",13,10
  1116 000004ED 616E20454C4420696E- <1>
  1116 000004F6 7374616E6365206E61- <1>
  1116 000004FF 6D6520746F2072756E- <1>
  1116 00000508 20616E6F7468657220- <1>
  1116 00000511 454C442E0D0A        <1>
  1117 00000517 52756E207769746820- <1> 			db "Run with HELP DESCRIBE to dump descriptions (slow)",13,10
  1117 00000520 48454C502044455343- <1>
  1117 00000529 5249424520746F2064- <1>
  1117 00000532 756D70206465736372- <1>
  1117 0000053B 697074696F6E732028- <1>
  1117 00000544 736C6F77290D0A      <1>
  1118 0000054B 206F72207769746820- <1> 			db " or with HELP WIDE to display only known ELD names (fast).",13,10
  1118 00000554 48454C502057494445- <1>
  1118 0000055D 20746F20646973706C- <1>
  1118 00000566 6179206F6E6C79206B- <1>
  1118 0000056F 6E6F776E20454C4420- <1>
  1118 00000578 6E616D657320286661- <1>
  1118 00000581 7374292E0D0A        <1>
  1119 00000587 00                  <1> 			asciz
  1120 00000588 0D0A                <1> .list:			db 13,10
  1121 0000058A 4C697374206F662063- <1> 			asciz "List of contained ELDs:",13,10
  1121 00000593 6F6E7461696E656420- <1>
  1121 0000059C 454C44733A0D0A00    <1>
  1122                              <1> 
  1123                              <1> uinit_data: equ $
  1124                              <1> 
  1125 000005A4 00<rep Ch>          <1> 	align 16, db 0
  1126                              <1> init_data_end:
  1127                              <1> data_size equ $ - datastart
  1128                              <1> transient_data_size equ data_size
  1129                              <1> 
  1130                              <1> %if _COMPRESSED
  1131                              <1> 	absolute depack_stack
  1132 00000459 ??                  <1> 	alignb 2
  1133 0000045A <res 100h>          <1> 		resb 256
  1134                              <1> depack_stack.top:
  1135                              <1> 
  1136                              <1>  %if uinit_data > depack_stack.top
  1137                              <1> 	absolute uinit_data
  1138                              <1>  %endif
  1139                              <1> %else
  1140                              <1> 	absolute uinit_data
  1141                              <1> %endif
  1142                              <1> 
  1143                              <1> 	alignb 2
  1144 000005A4 ????????            <1> libseek:	resd 1
  1145 000005A8 ????????            <1> eldheader:	resd 1
  1146                              <1> 
  1147                              <1> %if _COMPRESSED
  1148 000005AC ????????            <1> depackskip:	resd 1
  1149 000005B0 ????????            <1> depackseek:	resd 1
  1150 000005B4 ????????            <1> depacked_buffer:resd 1
  1151 000005B8 ????                <1> depack_left_length:	resw 1
  1152 000005BA ????                <1> depack_left_address:	resw 1
  1153 000005BC ????                <1> depacked_length:resw 1
  1154 000005BE ????                <1> depack_prior_sp:resw 1
  1155                              <1> 	alignb 2
  1156                              <1> filebuffer:
  1157                              <1> %if _ALIGNPAGE
  1158 000005C0 <res 200h>          <1> 	resb 512
  1159                              <1> %else
  1160                              <1> 	resb 256
  1161                              <1> %endif
  1162                              <1> .end:
  1163                              <1> 	alignb 2
  1164 000007C0 ????                <1> .next:		resw 1
  1165 000007C2 ????                <1> .tail:		resw 1
  1166 000007C4 ????                <1> handle:		resw 1
  1167                              <1> 
  1168 000007C6 <res Ah>            <1> 	alignb 16
  1169                              <1> resultbuffer:
  1170                              <1> .size equ 4096
  1171 000007D0 <res 1000h>         <1> 		resb .size
  1172                              <1> .end:
  1173                              <1> %endif
  1174                              <1> 
  1175                              <1> %if _DATABUFFER
  1176                              <1> 	alignb 16
  1177                              <1> databuffer:
  1178 000017D0 <res 200h>          <1> 	resb 512
  1179                              <1> %endif
  1180                              <1> 
  1181                              <1> 	alignb 16
  1182                              <1> uinit_data_end:
  1183                              <1> 
  1184                              <1> %if uinit_data_end >= init_data_end
  1185                              <1>  total_data_size equ $ - datastart
  1186                              <1> %else
  1187                              <1>  total_data_size equ init_data_end - datastart
  1188                              <1> %endif
  1189                              <1> %assign _DATA_SIZE total_data_size
  1190                              <1> 
  1191                              <1> 	usesection CODE
  1192                              <1> 
  1193                              <1> %include "eldlink.asm"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug linker
     4                              <2> 
     5                              <2> Copyright (C) 2008-2025 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %include "lmacros3.mac"
     1                              <3> [list -]
    16                              <2> %include "eld.mac"
     1                              <3> %if 0
     2                              <3> 
     3                              <3> Extensions for lDebug macros
     4                              <3> 
     5                              <3> Copyright (C) 2008-2025 E. C. Masloch
     6                              <3> 
     7                              <3> Usage of the works is permitted provided that this
     8                              <3> instrument is retained with the works, so that any entity
     9                              <3> that uses the works is notified of this instrument.
    10                              <3> 
    11                              <3> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <3> 
    13                              <3> %endif
    14                              <3> 
    15                              <3> %ifndef ELD_MAC
    16                              <3> %define ELD_MAC 1
    17                              <3> 
    18                              <3> %include "lmacros3.mac"
    19                              <3> 
    20                              <3> 		; ELD executable header
    21                              <3> 	struc ELD_HEADER
    22                              <3> eldhSignature:		resb 4	; "ELD1"
    23                              <3> 			resb 3	; reserved
    24                              <3> 			resb 1	; 26 (Ctrl-Z)
    25                              <3> eldhCodeOffset:		resd 1	; position displacement from eldhSignature
    26                              <3> eldhCodeImageLength:	resw 1	; amount bytes, at least 32
    27                              <3> eldhCodeAllocLength:	resw 1	; amount bytes, added to prior. sum < 64 KiB
    28                              <3> eldhDataOffset:		resd 1
    29                              <3> eldhDataImageLength:	resw 1	; (zero allowed)
    30                              <3> eldhDataAllocLength:	resw 1	; (zero allowed)
    31                              <3> eldhCodeEntrypoint:	resw 1	; within code section, used as displacement
    32                              <3> eldhReserved:		resb 4	; reserved
    33                              <3> eldhExtensionSize:	resw 1	; from eldhSignature, -> past eldhx fields in use
    34                              <3> 	endstruc
    35                              <3> 	endarea ELD_HEADER, 1
    36                              <3> 
    37                              <3> 	struc ELD_HEADERX
    38                              <3> eldhxHeader:		resb ELD_HEADER_size
    39                              <3> eldhxDescriptionOffset:	resd 1	; zero if none, from eldhxHeader. <= 128 Bytes
    40                              <3> eldhxHelpOffset:	resd 1	; zero if none, from eldhxHeader
    41                              <3> eldhxLibTable:		resd 1	; zero if none, from eldhxHeader
    42                              <3> eldhxDateTimeOffset:	resd 1	; zero if none, from eldhxHeader
    43                              <3> 	alignb 16
    44                              <3> 	endstruc
    45                              <3> 
    46                              <3> 	struc ELD_TRAILER_HEADER
    47                              <3> eldthSignature:		resb 8	; "ELD1TAIL"
    48                              <3> eldthHeaderOffset:	resd 1	; negative displacement from eldthSignature,
    49                              <3> 				;  add this dword to the seek offset
    50                              <3> eldthReserved:		resw 1	; reserved, must be initialised to zero
    51                              <3> eldthChecksum:		resw 1	; sum of all words in trailer header = 0
    52                              <3> 	endstruc
    53                              <3> 	endarea ELD_TRAILER_HEADER, 1
    54                              <3> 
    55                              <3> 	struc ELD_LIBTABLE
    56                              <3> eldltFormat:		resw 1
    57                              <3> 	; 0 = uncompressed
    58                              <3> 	; 2 = heatshrink compressed
    59                              <3> 	; 3 = lzexedat -4 compressed
    60                              <3> 	; 4 = lzexedat -4 -l compressed
    61                              <3> eldltAmount:		resw 1
    62                              <3> eldltOffset:		resd 1	; from eldhxHeader
    63                              <3> eldltCompressedLength:		; (dword, only present if format 2, 3, or 4)
    64                              <3> 	endstruc
    65                              <3> 	endarea ELD_LIBTABLE, 1
    66                              <3> 
    67                              <3> 		; ELD instance header
    68                              <3> 	struc ELD_INSTANCE
    69                              <3> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    70                              <3> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    71                              <3> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    72                              <3> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    73                              <3> eldiIdentifier:		resb 8	; blank-filled text
    74                              <3> eldiFlags:		resw 1	; flags
    75                              <3> eldiListing_size equ 14
    76                              <3> eldiListing:		resb eldiListing_size
    77                              <3> 				; ASCIZ listing file name
    78                              <3> 	endstruc
    79                              <3> 		; flags for eldiFlags:
    80                              <3> eldifResident:		equ 1
    81                              <3> 
    82                              <3> 		; ELD link info header
    83                              <3> 	struc ELD_LINKINFO
    84                              <3> eldlSignature:		resw 1	; 0E1D1h
    85                              <3> eldlReserved:		resw 2
    86                              <3> eldlUseLinkHash:	resw 1
    87                              <3> eldlDataAmount:		resw 1
    88                              <3> eldlDataPrefixes:	resw 1
    89                              <3> eldlDataEntries:	resw 1
    90                              <3> eldlDataAddresses:	resw 1
    91                              <3> eldlCodeAmount:		resw 1
    92                              <3> eldlCodePrefixes:	resw 1
    93                              <3> eldlCodeEntries:	resw 1
    94                              <3> eldlCodeAddresses:	resw 1
    95                              <3> 	endstruc
    96                              <3> 
    97                              <3> 	numdef ELD_CODE_VSTART, 9001h
    98                              <3> 	numdef ELD_DATA_VSTART, 8000h
    99                              <3> 	numdef ELD_RELOC_VSTART, 8000h
   100                              <3> 
   101                              <3> 	numdef ELD_RECLAIM_HINT, 0
   102                              <3> 	strdef ELD_LISTING, ""
   103                              <3> 	numdef ELD_DATETIME, 0
   104                              <3> 
   105                              <3> %if _ELD_DATETIME
   106                              <3>  %define PUT_ELDHX_DATETIME_OFFSET at eldhxDateTimeOffset, dd DATAOFFSET + datetime - datastart
   107                              <3>  %macro PUT_ELD_DATETIME 0.nolist
   108                              <3> datetime:	asciz __UTC_DATE__,'T',__UTC_TIME__,'Z'
   109                              <3> 		asciz		; for future extension
   110                              <3>  %endmacro
   111                              <3> %else
   112                              <3>  %define PUT_ELDHX_DATETIME_OFFSET
   113                              <3>  %define PUT_ELD_DATETIME
   114                              <3> %endif
   115                              <3> 
   116                              <3> %endif
    17                              <2> 
    18                              <2> 	cpu 8086
    19                              <2> 
    20                              <2> %if ELDSTRICT
    21                              <2>  %if ELDSTRICTCOUNTER
    22                              <2>   %error Missing relocation
    23                              <2>  %endif
    24                              <2> %endif
    25                              <2> 	eldstrict off		; linker does some relocations
    26                              <2> 
    27                              <2> %ifn ELDCALLCALL_DUMPED
    28 000008F2 90<rep 6h>E8[0000]- <2> 	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
    28 000008FB EB020000C3E8[0000]- <2>
    28 00000903 EB020000C3E8[0000]- <2>
    28 0000090B EB020000C3E8[0000]- <2>
    28 00000913 EB020000C3E8[0000]- <2>
    28 0000091B EB020000C3E8[0000]- <2>
    28 00000923 EB020000C3E8[0000]- <2>
    28 0000092B EB020000C3E8[0000]- <2>
    28 00000933 EB020000C3E8[0000]- <2>
    28 0000093B EB020000C3          <2>
    29                              <2> %endif
    30                              <2> 
    31                              <2> 	numdef ELD_IDENTICALISE, 0
    32                              <2> 	numdef ELD_DEBUG, 0
    33                              <2> 	numdef ELD_LINKER_PASSES, 1
    34                              <2> 	strdef LISTING, _ELD_LISTING
    35                              <2> 	numdef ELDCALL_OPTIONAL, ELDCALL_OPTIONAL_STATUS
    36                              <2> 	numdef ELDDATA_OPTIONAL, ELDDATA_OPTIONAL_STATUS
    37                              <2> 	numdef ELDDATA_NEXT, ELDDATA_NEXT_STATUS
    38                              <2> 	numdef ELDCALL_NEXT, ELDCALL_NEXT_STATUS
    39                              <2> %if _ELD_IDENTICALISE
    40                              <2>  ;%assign _ELDCALL_OPTIONAL 1
    41                              <2> %endif
    42                              <2> %ifn _ELDCALL_OPTIONAL
    43                              <2> %assign ELDCALL_OPTIONAL_STATUS 2		; not allowed
    44                              <2> %endif
    45                              <2> ;%ifn _ELDDATA_OPTIONAL
    46                              <2> ;%assign ELDDATA_OPTIONAL_STATUS 2		; not allowed
    47                              <2> ;%endif
    48                              <2> 	gendef MAP, ""
    49                              <2> 
    50                              <2> %ifnidni _MAP, ""
    51                              <2>  [map all _MAP]
    52                              <2> %endif
    53                              <2> 
    54                              <2> 
    55                              <2> endresident: equ ($ + _CURRENT_SECTION %+ FIXUP + 15) & ~15
    56                              <2> 
    57                              <2> %if _ELD_LINKER_PASSES
    58                              <2> %assign ELDLINKER 1
    59                              <2> 
    60                              <2> 	struc LINKTABLE
    61 00000000 ????????            <2> ltCodeToCode:	resw 2
    62 00000004 ????????            <2> ltCodeToData:	resw 2
    63 00000008 ????????            <2> ltDataToCode:	resw 2
    64 0000000C ????????            <2> ltDataToData:	resw 2
    65 00000010 ????????            <2> ltLinkData:	resw 2
    66 00000014 ????????            <2> ltLinkCode:	resw 2
    67                              <2> 	endstruc
    68                              <2> %endif
    69                              <2> 
    70                              <2> 
    71                              <2> 		; INP:	es:dx -> loaded initial ELD image
    72                              <2> 		;	 ELD instance structure filled
    73                              <2> 		;	es => ELD code area
    74                              <2> 		;	ds:di -> link info
    75                              <2> 		;	ss:bx -> loaded initial data
    76                              <2> 		;	ss:si -> command line tail
    77                              <2> 		;	cs:ip -> entrypoint
    78                              <2> 		;	ss:sp -> far return address for current mode
    79                              <2> 		; STT:	UP, EI
    80                              <2> linker:
    81                              <2> 		; The first 15 Bytes of the linker should be
    82                              <2> 		;  the same regardless of the linker options
    83                              <2> 		;  used (debug, passes, vstart). This allows
    84                              <2> 		;  the eldcomp ELD to match even if up to 15
    85                              <2> 		;  Bytes of the linker are trailing in the
    86                              <2> 		;  resident part of the ELD.
    87                              <2> 	lframe
    88                              <2>  %if ELDOTHER
    89                              <2> 	lvar dword, linkinfo_other
    90                              <2> 	lvar word, use_hash_other
    91                              <2>  %endif
    92 00000940 5589E5              <2> 	lenter
    93                              <2> 	lvar dword, instance
    94 00000943 06                  <2> 	 push es
    95 00000944 52                  <2> 	 push dx		; -> start of where we're loaded in ELD cs
    96                              <2> 	lvar word, targetsection_low_optional_high
    97 00000945 50                  <2> 	 push ax		; placeholder
    98                              <2> 	lequ ?targetsection_low_optional_high, targetsection
    99                              <2> 	lequ ?targetsection_low_optional_high + 1, optional
   100                              <2> 	lvar dword, linkinfo
   101 00000946 1E                  <2> 	 push ds
   102 00000947 57                  <2> 	 push di		; -> link info (in debugger ss or message seg)
   103                              <2> 	lvar dword, nextreloc
   104 00000948 06                  <2> 	 push es		; => ELD cs
   105 00000949 52                  <2> 	 push dx		; placeholder
   106                              <2> 	lvar dword, entry
   107 0000094A 06                  <2> 	 push es		; => ELD cs
   108 0000094B 50                  <2> 	 push ax		; placeholder
   109 0000094C 31C0                <2> 	xor ax, ax
   110 0000094E 813DD1E1            <2> 	cmp word [di + eldlSignature], 0E1D1h
   111                              <2> %if ($ - linker) < 16
   112                              <2>  %error Expected invariant first paragraph of linker
   113                              <2> %endif
   114 00000952 7403                <2> 	je @F
   115                              <2> .error_j1:
   116 00000954 E9C602              <2> 	jmp .error		; signature mismatch -->
   117                              <2> @@:
   118 00000957 837D0601            <2> 	cmp word [di + eldlUseLinkHash], 1
   119 0000095B 77F7                <2> 	ja .error_j1		; unknown use link hash number -->
   120 0000095D 7201                <2> 	jb @F
   121                              <2> %if _ELDDATA_NEXT || _ELDCALL_NEXT
   122                              <2> 	dec al			; = -1 if hash used
   123                              <2> %else
   124 0000095F 48                  <2> 	dec ax
   125                              <2> %endif
   126                              <2> @@:
   127                              <2> 	lvar word, use_hash_low_skip_last_high
   128 00000960 50                  <2> 	 push ax		; = -1 if hash used, else 0
   129                              <2> 	lequ ?use_hash_low_skip_last_high, use_hash
   130                              <2> 	lequ ?use_hash_low_skip_last_high + 1, skip_last
   131                              <2> %if _ELD_IDENTICALISE && _ELD_LINKER_PASSES
   132                              <2> 	mov ax, linktable - code
   133                              <2> 	lvar word, lt
   134                              <2> 	 push ax		; -> link tables (a single reference)
   135                              <2> %endif
   136                              <2> %if _ELD_LINKER_PASSES || ELDOTHER || _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   137 00000961 31C0                <2> 	xor ax, ax
   138                              <2>  %if _ELD_LINKER_PASSES
   139                              <2> 	lvar word, pass
   140 00000963 50                  <2> 	 push ax		; = 0 for linker itself, = 2 for application
   141                              <2> 	lvar word, amounterrors
   142 00000964 50                  <2> 	 push ax		; how many distinct errors encountered in pass 2
   143                              <2>  %endif
   144                              <2>  %if _ELD_LINKER_PASSES || _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   145                              <2> 	lvar word, name
   146 00000965 50                  <2> 	 push ax		; -> name currently being sought (in our table)
   147                              <2>  %endif
   148                              <2>  %if ELDOTHER
   149                              <2> 	lvar word, other
   150                              <2> 	 push ax		; byte: 0 = own data links, -1 = other data links
   151                              <2>  %endif
   152                              <2>  %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   153                              <2> 	lvar word, optionalmissing
   154                              <2> 	 push ax
   155                              <2>  %endif
   156                              <2> %endif
   157 00000966 56                  <2> 	push si			; -> command line tail
   158 00000967 53                  <2> 	push bx			; -> data block in ELD data area (segment ss)
   159                              <2> 
   160                              <2> 			; simple: add instance base (dx) to code
   161 00000968 06                  <2> 	push es
   162 00000969 1F                  <2> 	pop ds			; ds = es => ELD cs
   163                              <2> %if _ELD_LINKER_PASSES
   164                              <2> .pass:
   165 0000096A 8B5EEA              <2> 	mov bx, word [bp + ?pass]	; 0 or 2
   166 0000096D 01D3                <2> 	add bx, dx		; -> start of the ELD instance in cs, +0 or +2
   167                              <2>  %if _ELD_IDENTICALISE
   168                              <2> 	add bx, word [bp + ?lt]	; add in single reference to linktable
   169                              <2> 	mov si, word [ltCodeToCode + bx]
   170                              <2>  %else
   171 0000096F 8BB7D40C            <2> 	mov si, word [linktable - code + ltCodeToCode + bx]
   172                              <2>  %endif
   173                              <2> %else
   174                              <2> 	mov si, internalcodetocoderelocations - code
   175                              <2> %endif		 		; si -> table for code to code (linker or app)
   176 00000973 01D6                <2> 	add si, dx		; relocate the table pointer itself
   177                              <2> @@:
   178 00000975 AD                  <2> 	lodsw
   179 00000976 85C0                <2> 	test ax, ax		; was last ?
   180 00000978 740B                <2> 	jz @F			; yes -->
   181 0000097A 93                  <2> 	xchg bx, ax		; bx = entry
   182 0000097B 01D3                <2> 	add bx, dx		; relocate the entry itself
   183                              <2> %if _ELD_CODE_VSTART
   184 0000097D 812F[0000]          <2> 	sub word [bx], code	; undo adjustment
   185                              <2> %endif
   186 00000981 0117                <2> 	add word [bx], dx	; relocate word referenced by entry
   187 00000983 EBF0                <2> 	jmp @B
   188                              <2> 
   189                              <2> @@:
   190                              <2> 			; next, add heap data base (on stack) to code
   191                              <2> %if _ELD_LINKER_PASSES
   192 00000985 8B5EEA              <2> 	mov bx, word [bp + ?pass]	; 0 or 2
   193 00000988 01D3                <2> 	add bx, dx		; -> start of the ELD instance in cs, +0 or +2
   194                              <2>  %if _ELD_IDENTICALISE
   195                              <2> 	add bx, word [bp + ?lt]	; add in single reference to linktable
   196                              <2> 	mov si, word [ltCodeToData + bx]
   197                              <2>  %else
   198 0000098A 8BB7D80C            <2> 	mov si, word [linktable - code + ltCodeToData + bx]
   199                              <2>  %endif
   200                              <2> %else
   201                              <2> 	mov si, internalcodetodatarelocations - code
   202                              <2> %endif				; si -> table for code to data (linker or app)
   203 0000098E 01D6                <2> 	add si, dx		; relocate the table pointer itself
   204                              <2> @@:
   205 00000990 AD                  <2> 	lodsw
   206 00000991 85C0                <2> 	test ax, ax		; was last ?
   207 00000993 740C                <2> 	jz @F			; yes -->
   208 00000995 93                  <2> 	xchg bx, ax		; bx = entry
   209 00000996 01D3                <2> 	add bx, dx		; relocate the entry itself
   210                              <2> 		; ! access the offset of the data area block, topmost on stack
   211 00000998 58                  <2> 	pop ax			; ax -> heap data
   212 00000999 50                  <2> 	push ax
   213                              <2> %if _ELD_DATA_VSTART
   214 0000099A 2D[0000]            <2> 	sub ax, datastart	; undo adjustment
   215                              <2> %endif
   216 0000099D 0107                <2> 	add word [bx], ax	; relocate word referenced by entry
   217 0000099F EBEF                <2> 	jmp @B
   218                              <2> 
   219                              <2> @@:
   220                              <2> 
   221                              <2> 			; add instance base (dx) to data
   222                              <2> %if _ELD_LINKER_PASSES
   223 000009A1 8B5EEA              <2> 	mov bx, word [bp + ?pass]
   224 000009A4 01D3                <2> 	add bx, dx
   225                              <2>  %if _ELD_IDENTICALISE
   226                              <2> 	add bx, word [bp + ?lt]
   227                              <2> 	mov si, word [ltDataToCode + bx]
   228                              <2>  %else
   229 000009A6 8BB7DC0C            <2> 	mov si, word [linktable - code + ltDataToCode + bx]
   230                              <2>  %endif
   231                              <2> %else
   232                              <2> 	mov si, internaldatatocoderelocations - code
   233                              <2> %endif
   234 000009AA 01D6                <2> 	add si, dx
   235                              <2> @@:
   236 000009AC AD                  <2> 	lodsw
   237 000009AD 83F8FF              <2> 	cmp ax, -1		; was last ?
   238 000009B0 740F                <2> 	je @F			; yes -->
   239 000009B2 93                  <2> 	xchg bx, ax		; bx = entry
   240                              <2> 		; ! access the offset of the data area block, topmost on stack
   241 000009B3 58                  <2> 	pop ax
   242 000009B4 50                  <2> 	push ax
   243 000009B5 01C3                <2> 	add bx, ax		; relocate the entry itself
   244                              <2> %if _ELD_CODE_VSTART
   245 000009B7 36812F[0000]        <2> 	sub word [ss:bx], code	; undo adjustment
   246                              <2> %endif
   247 000009BC 360117              <2> 	add word [ss:bx], dx	; relocate word referenced by entry
   248 000009BF EBEB                <2> 	jmp @B
   249                              <2> 
   250                              <2> @@:
   251                              <2> 			; next, add heap data base (on stack) to data
   252                              <2> %if _ELD_LINKER_PASSES
   253 000009C1 8B5EEA              <2> 	mov bx, word [bp + ?pass]
   254 000009C4 01D3                <2> 	add bx, dx
   255                              <2>  %if _ELD_IDENTICALISE
   256                              <2> 	add bx, word [bp + ?lt]
   257                              <2> 	mov si, word [ltDataToData + bx]
   258                              <2>  %else
   259 000009C6 8BB7E00C            <2> 	mov si, word [linktable - code + ltDataToData + bx]
   260                              <2>  %endif
   261                              <2> %else
   262                              <2> 	mov si, internaldatatodatarelocations - code
   263                              <2> %endif
   264 000009CA 01D6                <2> 	add si, dx
   265                              <2> @@:
   266 000009CC AD                  <2> 	lodsw
   267 000009CD 83F8FF              <2> 	cmp ax, -1		; was last ?
   268 000009D0 740D                <2> 	je @F			; yes -->
   269 000009D2 93                  <2> 	xchg bx, ax		; bx = entry
   270                              <2> 		; ! access the offset of the data area block, topmost on stack
   271 000009D3 58                  <2> 	pop ax			; ax -> heap data
   272 000009D4 50                  <2> 	push ax
   273 000009D5 01C3                <2> 	add bx, ax		; relocate the entry itself
   274                              <2> %if _ELD_DATA_VSTART
   275 000009D7 2D[0000]            <2> 	sub ax, datastart	; undo adjustment
   276                              <2> %endif
   277 000009DA 360107              <2> 	add word [ss:bx], ax	; relocate word referenced by entry
   278 000009DD EBED                <2> 	jmp @B
   279                              <2> 
   280                              <2> @@:
   281 000009DF 8B56FC              <2> 	mov dx, word [bp + ?instance]
   282                              <2> 				; reset (why??) -> ELD instance in ELD cs
   283                              <2> %if _ELD_LINKER_PASSES
   284 000009E2 8B5EEA              <2> 	mov bx, word [bp + ?pass]
   285 000009E5 01D3                <2> 	add bx, dx
   286                              <2>  %if _ELD_IDENTICALISE
   287                              <2> 	add bx, word [bp + ?lt]
   288                              <2> 	add dx, word [ltLinkData + bx]
   289                              <2>  %else
   290 000009E7 0397E40C            <2> 	add dx, word [linktable - code + ltLinkData + bx]
   291                              <2>  %endif
   292                              <2> %else
   293                              <2> 	add dx, linkerdatarelocations - code
   294                              <2> %endif
   295                              <2> .otherloop:
   296 000009EB 8956F2              <2> 	mov word [bp + ?nextreloc], dx
   297                              <2> 				; -> data link relocation table
   298                              <2> 
   299                              <2> .datarelocloop:		; must be done before further relocs
   300 000009EE C576F2              <2> 	lds si, [bp + ?nextreloc]
   301 000009F1 AD                  <2> 	lodsw			; ax = section indicator
   302 000009F2 85C0                <2> 	test ax, ax		; end of table ?
   303 000009F4 7503E90401          <2> 	jz .donedatareloc
   304 000009F9 48                  <2> 	dec ax			; al = 1 if data, 0 if code (NB ah may != 0)
   305                              <2> 		; ! access the offset of the data area block, topmost on stack
   306 000009FA 5B                  <2> 	pop bx
   307 000009FB 53                  <2> 	push bx			; bx -> ELD data block
   308 000009FC 8946FA              <2> 	mov word [bp + ?targetsection_low_optional_high], ax
   309 000009FF 84C0                <2> 	test al, al		; data ?
   310 00000A01 AD                  <2> 	lodsw
   311 00000A02 7504                <2> 	jnz @F			; yes -->
   312 00000A04 0346FC              <2> 	add ax, word [bp + ?instance]
   313                              <2> 				; relocate entry into code
   314 00000A07 A9                  <2> 	db __TEST_IMM16		; (skip add)
   315                              <2> @@:
   316 00000A08 01D8                <2> 	add ax, bx		; relocate entry into data
   317 00000A0A 8946EE              <2> 	mov word [bp + ?entry], ax
   318                              <2> 				; save away -> where to patch
   319 00000A0D AD                  <2> 	lodsw			; get unrelocated -> name
   320 00000A0E 8976F2              <2> 	mov word [bp + ?nextreloc], si
   321                              <2> 				; update -> behind relocation table entry
   322                              <2> %if _ELDDATA_NEXT
   323                              <2> 	rol byte [bp + ?skip_last], 1	; skipping ?
   324                              <2> 	jnc @F				; no -->
   325                              <2> 	test byte [bp + ?optional], 8	; is it a last relocation ?
   326                              <2> 	jz .datarelocloop		; no, leave skip_last set -->
   327                              <2> 	not byte [bp + ?skip_last]	; disable skip_last
   328                              <2> 	jmp .datarelocloop
   329                              <2> @@:
   330                              <2> %endif
   331 00000A11 E8BD00              <2> 	call .build_match	; get ax = scan value, si -> counted string,
   332                              <2> 				;  dl = original value at byte [si]
   333                              <2> 				; NC if symbol already not found before
   334                              <2> 				; CY if to search for the symbol
   335                              <2> %if _ELD_LINKER_PASSES
   336 00000A14 73D8                <2> 	jnc .datarelocloop	; if duplicate of a not found symbol -->
   337                              <2> %endif
   338 00000A16 C45EF6              <2> 	les bx, [bp + ?linkinfo]
   339                              <2> %if ELDOTHER
   340                              <2> 	rol byte [bp + ?other], 1
   341                              <2> 	jnc @F
   342                              <2> 	les bx, [bp + ?linkinfo_other]
   343                              <2> @@:
   344                              <2> %endif				; es:bx -> link info table of the ELD host
   345 00000A19 268B4F08            <2> 	mov cx, word [es:bx + eldlDataAmount]	; amount data link info
   346 00000A1D 268B7F0A            <2> 	mov di, word [es:bx + eldlDataPrefixes]	; -> prefixes or hashes
   347                              <2> .datarelocfind:
   348 00000A21 83F901              <2> 	cmp cx, 1			; NZ if cx == 0
   349 00000A24 F2AF                <2> 	repne scasw			; scan initial
   350                              <2> %if _ELDDATA_OPTIONAL
   351                              <2> 	jne .datanotfound_may_be_optional
   352                              <2> %else
   353 00000A26 7541                <2> 	jne .datanotfound
   354                              <2> %endif
   355 00000A28 57                  <2> 	push di
   356 00000A29 51                  <2> 	push cx
   357 00000A2A 56                  <2> 	push si
   358 00000A2B 262B7F0A            <2> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   359 00000A2F 4F                  <2> 	dec di
   360 00000A30 4F                  <2> 	dec di				; 0-based
   361 00000A31 26037F0C            <2> 	add di, word [es:bx + eldlDataEntries]	; -> entry
   362 00000A35 268B3D              <2> 	mov di, [es:di]			; -> counted suffix/string
   363 00000A38 B500                <2> 	mov ch, 0
   364 00000A3A 8A0C                <2> 	mov cl, byte [si]		; cx = length
   365 00000A3C 41                  <2> 	inc cx
   366                              <2> 	; cmp al, al			; ZR if length is zero
   367 00000A3D F3A6                <2> 	repe cmpsb			; match ?
   368 00000A3F 5E                  <2> 	pop si
   369 00000A40 59                  <2> 	pop cx
   370 00000A41 5F                  <2> 	pop di
   371 00000A42 75DD                <2> 	jne .datarelocfind		; if not found this time,
   372                              <2> 					;  scan for next initial -->
   373 00000A44 8814                <2> 	mov byte [si], dl		; restore the original byte at counter
   374 00000A46 262B7F0A            <2> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   375 00000A4A 4F                  <2> 	dec di
   376 00000A4B 4F                  <2> 	dec di				; 0-based
   377 00000A4C 26037F0E            <2> 	add di, word [es:bx + eldlDataAddresses]	; -> address (offset)
   378 00000A50 268B05              <2> 	mov ax, word [es:di]		; get link data from the table
   379 00000A53 E80700              <2> 	call .address_data_reloc
   380                              <2> %if _ELD_RELOC_VSTART
   381 00000A56 2D[0000]            <2> 	sub ax, relocateddata		; *not* a relocation
   382                              <2> %endif
   383 00000A59 0104                <2> 	add word [si], ax		; relocate
   384                              <2> %if _ELDDATA_NEXT
   385                              <2> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   386                              <2> 	jz .datarelocloop
   387                              <2> 	mov byte [bp + ?skip_last], -1	; skip subsequent next/last relocs
   388                              <2> %endif
   389 00000A5B EB91                <2> 	jmp .datarelocloop
   390                              <2> 
   391                              <2> .address_data_reloc:
   392 00000A5D C576EE              <2> 	lds si, [bp + ?entry]		; -> entry if in ELD code instance
   393 00000A60 807EFA00            <2> 	cmp byte [bp + ?targetsection], 0
   394                              <2> 					; relocation in code ?
   395 00000A64 7402                <2> 	je @F				; yes -->
   396 00000A66 16                  <2> 	push ss
   397 00000A67 1F                  <2> 	pop ds				; => our ELD data block
   398                              <2> @@:
   399 00000A68 C3                  <2> 	retn
   400                              <2> 
   401                              <2> %if _ELDDATA_OPTIONAL
   402                              <2> .datanotfound_may_be_optional:
   403                              <2> 	mov byte [si], dl		; restore the original byte at counter
   404                              <2> %if _ELDDATA_NEXT
   405                              <2> 	test byte [bp + ?optional], 3	; is it an optional relocation ?
   406                              <2> %else
   407                              <2> 	cmp byte [bp + ?optional], 0	; is it an optional relocation ?
   408                              <2> %endif
   409                              <2> %if _ELD_DEBUG
   410                              <2> 	jnz @F
   411                              <2>  %ifn _ELD_LINKER_PASSES
   412                              <2> 	mov si, 0			; (invalid link)
   413                              <2> linkdatarelocation internalflags6
   414                              <2> 	test si, si
   415                              <2> 	jz .datanotfound
   416                              <2> 	mov si, 0			; (invalid link)
   417                              <2> linkdatarelocation options7
   418                              <2> 	test si, si
   419                              <2> 	jz .datanotfound
   420                              <2>  %else
   421                              <2> 	cmp byte [bp + ?pass], 0
   422                              <2> 	je .datanotfound
   423                              <2>  %endif
   424                              <2> 	houdini				; (the above conditions are for this)
   425                              <2> 	jmp .datanotfound
   426                              <2> @@:
   427                              <2> %else
   428                              <2> 	jz .datanotfound		; no, handle as an error -->
   429                              <2> %endif
   430                              <2> 
   431                              <2> %if ELDDATA_PMREQUIRED_STATUS
   432                              <2> 	mov si, relocateddata
   433                              <2> linkdatarelocation build_option_PM
   434                              <2> 	test si, si			; is it a PM build ?
   435                              <2> 	jz @F				; no --> (treat PM required as optional)
   436                              <2> 	test byte [bp + ?optional], 2	; optional status is PM required ?
   437                              <2> 	jnz .datanotfound		; yes, handle as an error -->
   438                              <2> @@:
   439                              <2> %endif
   440                              <2> 
   441                              <2> %if _ELD_LINKER_PASSES
   442                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   443                              <2> 	rol byte [bp + ?optionalmissing], 1
   444                              <2> 	jnc .optionaldatamissingmsg
   445                              <2> 	mov si, [bp + ?name]
   446                              <2> 	or byte [si], 80h
   447                              <2> 	not byte [bp + ?optionalmissing]
   448                              <2> 	jmp @F
   449                              <2> .optionaldatamissingmsg:
   450                              <2> %endif
   451                              <2> 	testopt [ss:relocateddata], 2	; debug optional link ?
   452                              <2> linkdatarelocation options7, -3
   453                              <2> 	jz @F				; no -->
   454                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   455                              <2> 	mov byte [bp + ?optionalmissing + 1], -1
   456                              <2> %endif
   457                              <2> 	mov si, lmsg.warning_data_optional
   458                              <2> internalcoderelocation
   459                              <2> 	call .notfound			; display a warning
   460                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   461                              <2> 	not byte [bp + ?optionalmissing + 1]
   462                              <2> %endif
   463                              <2> @@:
   464                              <2> %endif
   465                              <2> %if _ELDDATA_NEXT
   466                              <2> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   467                              <2> 	jnz .datarelocloop
   468                              <2> %endif
   469                              <2> 	call .address_data_reloc
   470                              <2> 	and word [si], 0		; indicate optional data link failed
   471                              <2> 	jmp .datarelocloop
   472                              <2> %endif
   473                              <2> 
   474                              <2> 
   475                              <2> %if _ELDCALL_OPTIONAL
   476                              <2> .codenotfound_may_be_optional:
   477                              <2> 	mov byte [si], dl		; restore the original byte at counter
   478                              <2> %if _ELDCALL_NEXT
   479                              <2> 	test byte [bp + ?optional], 3	; is it an optional relocation ?
   480                              <2> %else
   481                              <2> 	cmp byte [bp + ?optional], 0	; is it an optional relocation ?
   482                              <2> %endif
   483                              <2> %if _ELD_DEBUG
   484                              <2> 	jnz @F
   485                              <2>  %ifn _ELD_LINKER_PASSES
   486                              <2> 	mov si, 0			; (invalid link)
   487                              <2> linkdatarelocation internalflags6
   488                              <2> 	test si, si
   489                              <2> 	jz .codenotfound
   490                              <2> 	mov si, 0			; (invalid link)
   491                              <2> linkdatarelocation options7
   492                              <2> 	test si, si
   493                              <2> 	jz .codenotfound
   494                              <2>  %else
   495                              <2> 	cmp byte [bp + ?pass], 0
   496                              <2> 	je .codenotfound
   497                              <2>  %endif
   498                              <2> 	houdini				; (the above conditions are for this)
   499                              <2> 	jmp .codenotfound
   500                              <2> @@:
   501                              <2> %else
   502                              <2> 	jz .codenotfound		; no, handle as an error -->
   503                              <2> %endif
   504                              <2> 
   505                              <2> %if ELDCALL_PMREQUIRED_STATUS
   506                              <2>  %if _ELD_LINKER_PASSES
   507                              <2>   %assign ELDLINKER 0
   508                              <2>  %endif
   509                              <2> 	mov si, relocateddata
   510                              <2> linkdatarelocation build_option_PM
   511                              <2>  %if _ELD_LINKER_PASSES
   512                              <2>   %assign ELDLINKER 1
   513                              <2>  %endif
   514                              <2> 	test si, si			; is it a PM build ?
   515                              <2> 	jz @F				; no --> (treat PM required as optional)
   516                              <2> 	test byte [bp + ?optional], 2	; optional status is PM required ?
   517                              <2> 	jnz .codenotfound		; yes, handle as an error -->
   518                              <2> @@:
   519                              <2> %endif
   520                              <2> 
   521                              <2> %if _ELD_LINKER_PASSES
   522                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   523                              <2> 	rol byte [bp + ?optionalmissing], 1
   524                              <2> 	jnc .optionalcodemissingmsg
   525                              <2> 	mov si, [bp + ?name]
   526                              <2> 	or byte [si], 80h
   527                              <2> 	not byte [bp + ?optionalmissing]
   528                              <2> 	jmp @F
   529                              <2> .optionalcodemissingmsg:
   530                              <2> %endif
   531                              <2> 	testopt [ss:relocateddata], 2	; debug optional link ?
   532                              <2> linkdatarelocation options7, -3
   533                              <2> 	jz @F				; no -->
   534                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   535                              <2> 	mov byte [bp + ?optionalmissing + 1], -1
   536                              <2> %endif
   537                              <2> 	mov si, lmsg.warning_code_optional
   538                              <2> internalcoderelocation
   539                              <2> 	call .notfound			; display a warning
   540                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   541                              <2> 	not byte [bp + ?optionalmissing + 1]
   542                              <2> %endif
   543                              <2> @@:
   544                              <2> %endif
   545                              <2> %if _ELDCALL_NEXT
   546                              <2> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   547                              <2> 	jnz .coderelocloop
   548                              <2> %endif
   549                              <2> 	lds si, [bp + ?entry]		; -> code site (must be in ELD cs)
   550                              <2> 	mov word [si], 9090h
   551                              <2> 	mov byte [si + 2], 90h		; indicate optional code link failed
   552                              <2> 					;  (NOP out the 3-byte call near imm)
   553                              <2> 	jmp .coderelocloop
   554                              <2> %endif
   555                              <2> 
   556                              <2> 
   557                              <2> %if _ELD_LINKER_PASSES
   558                              <2> .datanotfound:
   559 00000A69 BE[0512]            <2> 	mov si, lmsg.error_data
   560                              <2> internalcoderelocation
   561 00000A6C E81900              <2> 	call .notfound			; display error
   562 00000A6F 7306                <2> 	jnc .error_j3			; NC if in pass 0, error out now -->
   563 00000A71 FF46E8              <2> 	inc word [bp + ?amounterrors]	; count the amount of errors
   564 00000A74 E977FF              <2> 	jmp .datarelocloop		; go to next relocation entry -->
   565                              <2> 
   566                              <2> .error_j3:
   567 00000A77 E9A301              <2> 	jmp .error
   568                              <2> 
   569                              <2> .codenotfound:
   570 00000A7A BE[1E12]            <2> 	mov si, lmsg.error_code
   571                              <2> internalcoderelocation
   572 00000A7D E80800              <2> 	call .notfound			; display error
   573 00000A80 73F5                <2> 	jnc .error_j3			; NC if in pass 0 -->
   574 00000A82 FF46E8              <2> 	inc word [bp + ?amounterrors]	; count the amount of errors
   575 00000A85 E98400              <2> 	jmp .coderelocloop		; go to next -->
   576                              <2> 
   577                              <2> .notfound:
   578 00000A88 807EEA00            <2> 	cmp byte [bp + ?pass], 0	; pass 0 ?
   579 00000A8C 743A                <2> 	je .notfound.retn		; yes, do not try displaying --> (NC)
   580 00000A8E 16                  <2> 	 push ss
   581 00000A8F 07                  <2> 	 pop es
   582 00000A90 BF[0000]            <2> 	mov di, relocateddata
   583                              <2> linkdatarelocation line_out		; es:di -> line_out buffer
   584 00000A93 E83300              <2> 	call .copy			; copy prefix message
   585 00000A96 8B76E6              <2> 	mov si, word [bp + ?name]
   586 00000A99 AD                  <2> 	lodsw				; = hash
   587 00000A9A E8[0000]EB020000    <2> 	extcall hexword			; display the hash in hex
   588 00000AA1 56                  <2> 	push si
   589 00000AA2 BE[3712]            <2> 	mov si, lmsg.error.2
   590                              <2> internalcoderelocation
   591 00000AA5 E82100              <2> 	call .copy			; display message fragment
   592 00000AA8 5E                  <2> 	pop si
   593                              <2> %if _ELD_LINKER_PASSES
   594 00000AA9 56                  <2> 	push si
   595 00000AAA E81C00              <2> 	call .copy			; copy over the full name
   596 00000AAD 5E                  <2> 	pop si
   597                              <2>  %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   598                              <2> 	or byte [si], 80h		; mark as failed optional link
   599                              <2> 	rol byte [bp + ?optionalmissing + 1], 1
   600                              <2> 					; was it optional ?
   601                              <2> 	jc @F				; yes -->
   602                              <2>  %endif
   603 00000AAE C60400              <2> 	mov byte [si], 0		; mark as failed (counter byte = 0)
   604                              <2> @@:
   605                              <2> %else
   606                              <2> 	call .copy
   607                              <2> %endif
   608 00000AB1 B022                <2> 	mov al, '"'
   609 00000AB3 AA                  <2> 	stosb				; end message with a closing quote mark
   610 00000AB4 16                  <2> 	 push ss
   611 00000AB5 1F                  <2> 	 pop ds
   612 00000AB6 E8[0000]EB020000    <2> 	extcall putsline_crlf		; display diagnostic line
   613 00000ABD B8350E              <2> 	mov ax, 0E35h
   614 00000AC0 E8[0000]EB020000    <2> 	extcall setrc
   615 00000AC7 F9                  <2> 	stc				; CY, diagnostic displayed
   616                              <2> .notfound.retn:
   617 00000AC8 C3                  <2> 	retn
   618                              <2> 
   619                              <2> .copy:		; (cannot use extcallcall here)
   620 00000AC9 E8[0000]EB020000    <2> 	extcall copy_single_counted_string
   621 00000AD0 C3                  <2> 	retn
   622                              <2> %else
   623                              <2> .datanotfound: equ .error
   624                              <2> .codenotfound: equ .error
   625                              <2> %endif
   626                              <2> 
   627                              <2> .build_match:
   628                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   629                              <2> 	mov byte [bp + ?optionalmissing], 0
   630                              <2> 		; This is needed for eldtestj.asm with debugoptlink.
   631                              <2> 		;  The optional data link sets flag 80h, then the
   632                              <2> 		;  required data link to the same symbol sets this
   633                              <2> 		;  flag but doesn't reset it. So the first optional
   634                              <2> 		;  code link still had this set. Reset here to fix.
   635                              <2> %endif
   636                              <2> %if _ELD_CODE_VSTART
   637 00000AD1 2D[0000]            <2> 	sub ax, code			; revert adjustment (= displacement)
   638                              <2> %endif
   639 00000AD4 0346FC              <2> 	add ax, word [bp + ?instance]	; make displacement into -> name string
   640 00000AD7 96                  <2> 	xchg si, ax			; si -> hash word, counted name string
   641                              <2> %if _ELD_LINKER_PASSES || _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   642 00000AD8 8976E6              <2> 	mov word [bp + ?name], si	; save away for diagnostics
   643                              <2> %endif
   644 00000ADB AD                  <2> 	lodsw			; = hash, si -> counted string
   645 00000ADC 8A14                <2> 	mov dl, byte [si]	; dl = original start byte of match
   646                              <2> %if _ELD_LINKER_PASSES
   647 00000ADE 84D2                <2> 	test dl, dl		; marked as already failed ?
   648                              <2> 				;  (80h = optional, 0 = required)
   649 00000AE0 750A                <2> 	jnz @F			; no -->
   650 00000AE2 837EE800            <2> 	cmp word [bp + ?amounterrors], 0
   651                              <2> 				; validate error status
   652 00000AE6 7503E9A500          <2> 	je .error_j		; no error known ?! cancel quickly -->
   653 00000AEB C3                  <2> 	retn			; (NC)
   654                              <2> 
   655                              <2> @@:
   656                              <2> %else
   657                              <2> 	test dl, dl
   658                              <2> %endif
   659                              <2> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   660                              <2> 	jns @F
   661                              <2> 	and dl, 7Fh
   662                              <2> 	mov byte [si], dl
   663                              <2> 	mov byte [bp + ?optionalmissing], -1
   664                              <2> @@:
   665                              <2> %endif
   666                              <2> %if ELDOTHER
   667                              <2> 	rol byte [bp + ?other], 1
   668                              <2> 	jnc @F
   669                              <2> 	rol byte [bp + ?use_hash_other], 1
   670                              <2> 	jmp @FF
   671                              <2> 
   672                              <2> @@:
   673                              <2> %endif
   674 00000AEC D046EC              <2> 	rol byte [bp + ?use_hash], 1
   675                              <2> @@:
   676                              <2> 		; If to use the hash, then ax = hash and si ->
   677                              <2> 		;  the entire symbol name as a counted string.
   678 00000AEF 720A                <2> 	jc @F			; if to use hash, return now -->
   679 00000AF1 AC                  <2> 	lodsb			; al = length
   680 00000AF2 91                  <2> 	xchg cx, ax		; cl = length
   681 00000AF3 AD                  <2> 	lodsw			; ax = prefix
   682 00000AF4 49                  <2> 	dec cx
   683 00000AF5 49                  <2> 	dec cx			; cl = adjusted length
   684 00000AF6 4E                  <2> 	dec si			; -> second byte of prefix
   685 00000AF7 8A14                <2> 	mov dl, byte [si]	; dl = original start byte of match
   686 00000AF9 880C                <2> 	mov byte [si], cl	; si -> counted string suffix
   687                              <2> 		; (this name entry has been edited to provide the
   688                              <2> 		;  name suffix as a counted string, as required by
   689                              <2> 		;  the old-style non-hash link info tables.
   690                              <2> 		; it will be reset later by writing dl to si -> the
   691                              <2> 		;  first byte of the match string.)
   692                              <2> @@:
   693                              <2> %if _ELD_LINKER_PASSES
   694 00000AFB F9                  <2> 	stc			; CY
   695                              <2> %endif
   696 00000AFC C3                  <2> 	retn
   697                              <2> 
   698                              <2> 
   699                              <2> .donedatareloc:
   700                              <2> %if ELDOTHER
   701                              <2> 	rol byte [bp + ?other], 1
   702                              <2> 	jc .otherdone		; other link only has data links,
   703                              <2> 				;  so at this point we're done -->
   704                              <2> %endif
   705                              <2> 
   706 00000AFD 8B56FC              <2> 	mov dx, word [bp + ?instance]
   707                              <2> %if _ELD_LINKER_PASSES
   708 00000B00 8B5EEA              <2> 	mov bx, word [bp + ?pass]
   709 00000B03 01D3                <2> 	add bx, dx
   710                              <2>  %if _ELD_IDENTICALISE
   711                              <2> 	add bx, word [bp + ?lt]
   712                              <2> 	add dx, word [ltLinkCode + bx]
   713                              <2>  %else
   714 00000B05 0397E80C            <2> 	add dx, word [linktable - code + ltLinkCode + bx]
   715                              <2>  %endif
   716                              <2> %else
   717                              <2> 	add dx, linkercoderelocations - code
   718                              <2> %endif
   719 00000B09 8956F2              <2> 	mov word [bp + ?nextreloc], dx
   720                              <2> 
   721                              <2> .coderelocloop:
   722 00000B0C C576F2              <2> 	lds si, [bp + ?nextreloc]
   723 00000B0F AD                  <2> 	lodsw
   724                              <2> %if _ELDCALL_OPTIONAL || _ELDCALL_NEXT
   725                              <2> 	dec ax				; optional word is 1-based, get 0-based
   726                              <2> 	js .donecodereloc
   727                              <2> 	mov word [bp + ?targetsection_low_optional_high], ax
   728                              <2> 	lodsw
   729                              <2> %endif
   730 00000B10 0346FC              <2> 	add ax, word [bp + ?instance]
   731 00000B13 8946EE              <2> 	mov word [bp + ?entry], ax
   732 00000B16 AD                  <2> 	lodsw
   733 00000B17 8976F2              <2> 	mov word [bp + ?nextreloc], si
   734                              <2> %ifn _ELDCALL_OPTIONAL || _ELDCALL_NEXT
   735 00000B1A 85C0                <2> 	test ax, ax			; if no optional word, check -> match
   736 00000B1C 7503E98100          <2> 	jz .donecodereloc
   737                              <2> %endif
   738                              <2> %if _ELDCALL_NEXT
   739                              <2> 	rol byte [bp + ?skip_last], 1	; skipping ?
   740                              <2> 	jnc @F				; no -->
   741                              <2> 	test byte [bp + ?optional], 8	; is it a last relocation ?
   742                              <2> 	jz .coderelocloop		; no, leave skip_last set -->
   743                              <2> 	not byte [bp + ?skip_last]	; disable skip_last
   744                              <2> 	jmp .coderelocloop
   745                              <2> @@:
   746                              <2> %endif
   747 00000B21 E8ADFF              <2> 	call .build_match
   748                              <2> %if _ELD_LINKER_PASSES
   749 00000B24 73E6                <2> 	jnc .coderelocloop
   750                              <2> %endif
   751 00000B26 C45EF6              <2> 	les bx, [bp + ?linkinfo]
   752 00000B29 268B4F10            <2> 	mov cx, word [es:bx + eldlCodeAmount]	; amount code link info
   753 00000B2D 268B7F12            <2> 	mov di, word [es:bx + eldlCodePrefixes]	; -> prefixes or hashes
   754                              <2> .coderelocfind:
   755 00000B31 83F901              <2> 	cmp cx, 1			; NZ if cx == 0
   756 00000B34 F2AF                <2> 	repne scasw			; scan initial
   757                              <2> %if _ELDCALL_OPTIONAL
   758                              <2> 	jne .codenotfound_may_be_optional
   759                              <2> %else
   760                              <2>  %if _ELD_DEBUG
   761                              <2> 	je @F
   762                              <2> 	houdini
   763                              <2> 	jmp .codenotfound
   764                              <2> @@:
   765                              <2>  %else
   766 00000B36 7403E93FFF          <2> 	jne .codenotfound
   767                              <2>  %endif
   768                              <2> %endif
   769 00000B3B 57                  <2> 	push di
   770 00000B3C 51                  <2> 	push cx
   771 00000B3D 56                  <2> 	push si
   772 00000B3E 262B7F12            <2> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   773 00000B42 4F                  <2> 	dec di
   774 00000B43 4F                  <2> 	dec di				; 0-based
   775 00000B44 26037F14            <2> 	add di, word [es:bx + eldlCodeEntries]	; -> entry
   776 00000B48 268B3D              <2> 	mov di, [es:di]			; -> counted suffix/string
   777 00000B4B B500                <2> 	mov ch, 0
   778 00000B4D 8A0C                <2> 	mov cl, byte [si]		; cx = length
   779 00000B4F 41                  <2> 	inc cx
   780                              <2> 	; cmp al, al			; ZR if length is zero
   781 00000B50 F3A6                <2> 	repe cmpsb			; match ?
   782 00000B52 5E                  <2> 	pop si
   783 00000B53 59                  <2> 	pop cx
   784 00000B54 5F                  <2> 	pop di
   785 00000B55 75DA                <2> 	jne .coderelocfind
   786 00000B57 8814                <2> 	mov byte [si], dl
   787 00000B59 262B7F12            <2> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   788 00000B5D 4F                  <2> 	dec di
   789 00000B5E 4F                  <2> 	dec di				; 0-based
   790 00000B5F 01FF                <2> 	add di, di			; quadruple index
   791 00000B61 26037F16            <2> 	add di, word [es:bx + eldlCodeAddresses]	; -> address (offset, segment)
   792 00000B65 26FF35              <2> 	push word [es:di]
   793 00000B68 C576EE              <2> 	lds si, [bp + ?entry]
   794 00000B6B 8F4405              <2> 	pop word [si + 3 + 2]		; call near imm (3), jmp short (2)
   795                              <2> 					;  patch the destination address
   796 00000B6E 803CE8              <2> 	cmp byte [si], 0E8h		; is it as expected ?
   797 00000B71 751D                <2> 	jne .error_j
   798 00000B73 268B7D02            <2> 	mov di, word [es:di + 2]
   799 00000B77 BB[0000]            <2> 	mov bx, relocateddata
   800                              <2> linkdatarelocation linkcall_table	; ss:bx -> link call table
   801 00000B7A 36833F01            <2> 	cmp word [ss:bx], 1		; is it initialised to format 1 ?
   802 00000B7E 7510                <2> 	jne .error_j			; no -->
   803 00000B80 368B4F02            <2> 	mov cx, word [ss:bx + 2]	; get amount of segments
   804 00000B84 E30A                <2> 	jcxz .error_j			; none -->
   805                              <2> @@:
   806 00000B86 83C304              <2> 	add bx, 4			; -> next segment
   807 00000B89 36393F              <2> 	cmp word [ss:bx], di		; value matches ?
   808 00000B8C 7405                <2> 	je @F				; yes, found -->
   809 00000B8E E2F6                <2> 	loop @B				; try remaining segments
   810                              <2> .error_j:
   811 00000B90 E98A00              <2> 	jmp .error
   812                              <2> 
   813                              <2> @@:
   814 00000B93 368B5F02            <2> 	mov bx, word [ss:bx + 2]	; -> call destination offset
   815                              <2> 		; si + 3 + delta = bx
   816                              <2> 		; delta = bx - si - 3
   817 00000B97 29F3                <2> 	sub bx, si
   818 00000B99 83EB03              <2> 	sub bx, 3
   819 00000B9C 895C01              <2> 	mov word [si + 1], bx		; patch the call instruction
   820                              <2> %if _ELDCALL_NEXT
   821                              <2> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   822                              <2> 	jz .coderelocloop
   823                              <2> 	mov byte [bp + ?skip_last], -1	; skip subsequent next/last relocs
   824                              <2> %endif
   825 00000B9F E96AFF              <2> 	jmp .coderelocloop
   826                              <2> 
   827                              <2> .donecodereloc:
   828                              <2> %if _ELD_LINKER_PASSES
   829 00000BA2 8B46E8              <2> 	mov ax, word [bp + ?amounterrors]
   830 00000BA5 85C0                <2> 	test ax, ax
   831 00000BA7 75E7                <2> 	jnz .error_j
   832 00000BA9 8B5EEA              <2> 	mov bx, word [bp + ?pass]
   833 00000BAC 85DB                <2> 	test bx, bx
   834 00000BAE 750B                <2> 	jnz @F
   835 00000BB0 43                  <2> 	inc bx
   836 00000BB1 43                  <2> 	inc bx
   837 00000BB2 895EEA              <2> 	mov word [bp + ?pass], bx
   838 00000BB5 8B56FC              <2> 	mov dx, word [bp + ?instance]
   839 00000BB8 E9AFFD              <2> 	jmp .pass
   840                              <2> 
   841                              <2> @@:
   842                              <2> %endif
   843                              <2> 
   844                              <2> %ifnidni _LISTING, ""
   845                              <2> %assign ELDLINKER 0
   846                              <2> .hint:
   847 00000BBB 16                  <2> 	push ss
   848 00000BBC 1F                  <2> 	pop ds
   849 00000BBD B02D                <2> 	mov al, 2Dh
   850 00000BBF E8[0000]EB020000    <2> 	extcall intchk			; ZR if offset = -1 or segment = 0
   851                              <2> 					; CHG: ax, dx, bx
   852 00000BC6 7437                <2> 	jz .no_hint
   853                              <2> 
   854                              <2> %if ELDOTHER
   855                              <2> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
   856                              <2> internalcoderelocation
   857                              <2> %endif
   858                              <2> 
   859 00000BC8 8A26[0000]          <2> 	mov ah, byte [relocateddata]
   860                              <2> linkdatarelocation try_debugger_amis_multiplex_number
   861 00000BCC E85500              <2> 	call plex_check
   862 00000BCF 7305                <2> 	jnc @F
   863                              <2> 
   864 00000BD1 B4FF                <2> 	mov ah, 0FFh		; start with multiplex number 0FFh
   865                              <2> .loop_hint:
   866 00000BD3 E84E00              <2> 	call plex_check
   867                              <2> @@:
   868 00000BD6 7307                <2> 	jnc .end_hint		; if found --> (NC)
   869 00000BD8 80EC01              <2> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   870 00000BDB 73F6                <2> 	jnc .loop_hint		; try next if we didn't check all yet -->
   871 00000BDD EB20                <2> 	jmp .no_hint
   872                              <2> 
   873                              <2> .end_hint:
   874 00000BDF 50                  <2> 	push ax
   875 00000BE0 C446FC              <2> 	les ax, [bp + ?instance]
   876 00000BE3 BF[8A0F]            <2> 	mov di, listmsg.hint.offset
   877                              <2> internalcoderelocation
   878 00000BE6 E8[0000]EB020000    <2> 	extcall hexword
   879 00000BED BB[6A0F]            <2> 	mov bx, listmsg.hint
   880                              <2> internalcoderelocation
   881 00000BF0 368B16[0000]        <2> 	mov dx, [ss:relocateddata]
   882                              <2> linkdatarelocation extseg	; must be 86 Mode segment even in PM
   883 00000BF5 58                  <2> 	pop ax
   884 00000BF6 B040                <2> 	mov al, 40h		; AMIS message display service
   885 00000BF8 E8[0000]EB020000    <2> 	extcall call_int2D
   886                              <2> .no_hint:
   887                              <2> %endif
   888                              <2> 
   889                              <2> %if ELDOTHER
   890                              <2> %assign ELDLINKER 0
   891                              <2> 	not byte [bp + ?other]
   892                              <2> 
   893                              <2> 	push ss
   894                              <2> 	pop ds
   895                              <2> 	mov al, 2Dh
   896                              <2> 	extcall intchk			; ZR if offset = -1 or segment = 0
   897                              <2> 					; CHG: ax, dx, bx
   898                              <2> 	jz .no_other
   899                              <2> 
   900                              <2> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
   901                              <2> internalcoderelocation
   902                              <2> 
   903                              <2> 	mov ah, byte [relocateddata]
   904                              <2> linkdatarelocation try_debugger_amis_multiplex_number
   905                              <2> 	call plex_check
   906                              <2> 	jnc @F
   907                              <2> 
   908                              <2> 	mov ah, 0FFh		; start with multiplex number 0FFh
   909                              <2> .loop_other_debug:
   910                              <2> 	call plex_check
   911                              <2> @@:
   912                              <2> 	jnc .end_other		; if found --> (NC)
   913                              <2> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   914                              <2> 	jnc .loop_other_debug	; try next if we didn't check all yet -->
   915                              <2> 
   916                              <2> 	mov si, loaderamissig	; ds:si -> our AMIS name strings
   917                              <2> internalcoderelocation
   918                              <2> 
   919                              <2> 	mov ah, byte [relocateddata]
   920                              <2> linkdatarelocation try_debugger_amis_multiplex_number
   921                              <2> 	call plex_check
   922                              <2> 	jnc @F
   923                              <2> 
   924                              <2> 	mov ah, 0FFh		; start with multiplex number 0FFh
   925                              <2> .loop_other_loader:
   926                              <2> 	call plex_check
   927                              <2> @@:
   928                              <2> 	jnc .end_other		; if found --> (NC)
   929                              <2> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   930                              <2> 	jnc .loop_other_loader	; try next if we didn't check all yet -->
   931                              <2> 
   932                              <2> 	jmp .no_other
   933                              <2> 
   934                              <2> .end_other:
   935                              <2> 	mov al, 42h		; AMIS get other link info service
   936                              <2> 	extcall call_int2D
   937                              <2> 	cmp al, 0FFh
   938                              <2> 	jne .no_other
   939                              <2> 
   940                              <2> 	mov ax, si		; selector => PSP
   941                              <2> 	extcall ispm
   942                              <2> 	jz @F
   943                              <2> 	mov ax, dx		; segment => PSP
   944                              <2> @@:
   945                              <2> 	 push ss
   946                              <2> 	 pop ds
   947                              <2> 	mov word [otherds], ax
   948                              <2> internaldatarelocation		; current mode sel/seg
   949                              <2> 	mov word [otherseg], dx
   950                              <2> internaldatarelocation		; remember segment
   951                              <2> 
   952                              <2> 	mov ax, cx		; selector => link info
   953                              <2> 	extcall ispm
   954                              <2> 	jz @F
   955                              <2> 	mov ax, bx		; segment => link info
   956                              <2> @@:
   957                              <2> 	mov word [bp + ?linkinfo_other], di
   958                              <2> 	mov word [bp + ?linkinfo_other + 2], ax
   959                              <2> 
   960                              <2> 	mov ds, ax		; => link info
   961                              <2> 	xor ax, ax
   962                              <2> 	cmp word [di + eldlSignature], 0E1D1h
   963                              <2> 	jne .error_other
   964                              <2> 	cmp word [di + eldlUseLinkHash], 1
   965                              <2> 	ja .error_other
   966                              <2> 	jb @F
   967                              <2> 	dec ax
   968                              <2> @@:
   969                              <2> 	mov word [bp + ?use_hash_other], ax
   970                              <2> 
   971                              <2> 	mov dx, word [bp + ?instance]
   972                              <2> 	add dx, linkerotherdatarelocations - code
   973                              <2> 	jmp .otherloop
   974                              <2> 
   975                              <2> .error_other:
   976                              <2> 	push cs
   977                              <2> 	pop ds
   978                              <2> 	mov ax, 0E33h
   979                              <2> 	extcall setrc
   980                              <2> 	mov dx, lmsg.error_other
   981                              <2> internalcoderelocation
   982                              <2> 	jmp @F
   983                              <2> 
   984                              <2> .no_other:
   985                              <2> 	push cs
   986                              <2> 	pop ds
   987                              <2> 	mov ax, 0E34h
   988                              <2> 	extcall setrc
   989                              <2> 	mov dx, lmsg.no_other
   990                              <2> internalcoderelocation
   991                              <2> @@:
   992                              <2> 	extcall putsz
   993                              <2> .error_j2:
   994                              <2> 	jmp .error
   995                              <2> 
   996                              <2> .otherdone:
   997                              <2>  %if _ELD_LINKER_PASSES
   998                              <2> 	mov ax, word [bp + ?amounterrors]
   999                              <2> 	test ax, ax
  1000                              <2> 	jnz .error_j2
  1001                              <2>  %endif
  1002                              <2> %endif
  1003                              <2> 
  1004 00000BFF 5B                  <2> 	pop bx				; -> our heap data
  1005 00000C00 5E                  <2> 	pop si				; -> our command line tail
  1006 00000C01 16                  <2> 	 push ss
  1007 00000C02 1F                  <2> 	 pop ds
  1008 00000C03 C47EFC              <2> 	les di, [bp + ?instance]
  1009 00000C06 268B4502            <2> 	mov ax, word [es:di + eldiEndCode]
  1010                              <2> houdini
  1011 00000C0A 2D[4009]            <2> 	sub ax, strict word endresident + code
  1012                              <2> internalcoderelocation
  1013 00000C0D 26C74502[4009]      <2> 	mov word [es:di + eldiEndCode], endresident + code
  1014                              <2> internalcoderelocation
  1015 00000C13 2906[0000]          <2> 	sub word [relocateddata], ax
  1016                              <2> linkdatarelocation extseg_used
  1017                              <2> %if _DATA_SIZE == 0
  1018                              <2> 	xor ax, ax
  1019                              <2> 	mov word [es:di + eldiStartData], ax
  1020                              <2> 	mov word [es:di + eldiEndData], ax
  1021                              <2> %endif
  1022 00000C17 89EC5D              <2> 	lleave code
  1023                              <2> 		; INP:	es => ELD code segment
  1024                              <2> 		;	ds:si -> command line tail
  1025                              <2> 		;	ds:bx -> ELD data block
  1026                              <2> 		;	ss:sp -> far return address for current mode
  1027                              <2> 		; STT:	ds = ss, UP, EI
  1028 00000C1A E9F3F9              <2> 	jmp start
  1029                              <2> 
  1030                              <2> .error:
  1031 00000C1D 89EC5D              <2> 	lleave
  1032 00000C20 B8FFFF              <2> 	mov ax, -1
  1033 00000C23 CB                  <2> 	retf
  1034                              <2> 
  1035                              <2> 
  1036                              <2> %ifnidni _LISTING, ""
  1037                              <2>  %assign ELDHINT 1
  1038                              <2> %else
  1039                              <2>  %assign ELDHINT 0
  1040                              <2> %endif
  1041                              <2> 
  1042                              <2> %if ELDOTHER || ELDHINT
  1043                              <2> 		; INP:	ah = multiplex number to check
  1044                              <2> 		;	(if ELDOTHER:)
  1045                              <2> 		;	 cs:si -> 16-byte AMIS signature to check
  1046                              <2> 		; OUT:	CY if multiplex number unused or no signature match,
  1047                              <2> 		;	 bp, ah, ds unmodified
  1048                              <2> 		;	NC if match found,
  1049                              <2> 		;	 ah = multiplex number (unmodified)
  1050                              <2> 		; CHG:	di, es, cx, dx
  1051                              <2> 		;	(if ELDOTHER:) bx
  1052                              <2> 		;	(if not ELDOTHER:) si
  1053                              <2> plex_check:
  1054 00000C24 16                  <2> 	push ss
  1055 00000C25 1F                  <2> 	pop ds
  1056 00000C26 F606[0000]08        <2> 	testopt [relocateddata], 8
  1057                              <2> linkdatarelocation internalflags4, -3
  1058 00000C2B 740B                <2> 	jz @F
  1059                              <2> %if ELDOTHER
  1060                              <2> 	mov bx, relocateddata
  1061                              <2> linkdatarelocation amis_multiplex_number, -2, optional
  1062                              <2> 	test bx, bx
  1063                              <2> 	jz @F
  1064                              <2> 	cmp ah, byte [bx]
  1065                              <2> 	je .notfound		; do not use our own multiplexer -->
  1066                              <2> %else
  1067 00000C2D BE[0000]            <2> 	mov si, relocateddata
  1068                              <2> linkdatarelocation amis_multiplex_number, -2, optional
  1069 00000C30 85F6                <2> 	test si, si
  1070 00000C32 7404                <2> 	jz @F
  1071 00000C34 3A24                <2> 	cmp ah, byte [si]
  1072 00000C36 7420                <2> 	je .notfound		; do not use our own multiplexer -->
  1073                              <2> %endif
  1074                              <2> @@:
  1075 00000C38 B000                <2> 	mov al, 00h		; AMIS installation check
  1076 00000C3A E8[0000]EB020000    <2> 	extcall call_int2D	; AMIS (or "DOS reserved" = iret if no AMIS present)
  1077 00000C41 3CFF                <2> 	cmp al, 0FFh
  1078 00000C43 7513                <2> 	jne .notfound
  1079 00000C45 0E                  <2> 	push cs
  1080 00000C46 1F                  <2> 	pop ds
  1081                              <2> %if ELDOTHER
  1082                              <2> 	push si
  1083                              <2> 	extcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
  1084                              <2> 	mov cx, 8		; Ignore description, only compare vendor and program name
  1085                              <2> 	repe cmpsw
  1086                              <2> 	pop si
  1087                              <2> %else
  1088 00000C47 BE[5A0F]            <2> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
  1089                              <2> internalcoderelocation
  1090 00000C4A E8[0000]EB020000    <2> 	extcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
  1091 00000C51 B90800              <2> 	mov cx, 8		; Ignore description, only compare vendor and program name
  1092 00000C54 F3A7                <2> 	repe cmpsw
  1093                              <2> %endif
  1094 00000C56 7401                <2> 	je .checkret		; ZR, NC = match -->
  1095                              <2> .notfound:
  1096 00000C58 F9                  <2> 	stc			; CY no match
  1097                              <2> .checkret:
  1098 00000C59 C3                  <2> 	retn
  1099                              <2> %endif
  1100                              <2> 
  1101                              <2> 
  1102 00000C5A 00<rep 2h>          <2> 	align 4, db 0
  1103                              <2> linkercoderelocations:
  1104                              <2> %if _ELDCALL_OPTIONAL || _ELDCALL_NEXT
  1105                              <2> 	dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
  1106                              <2> %else
  1107 00000C5C 2802[920F]4402-     <2> 	dw ELDCALL_CODE_RELOCATIONS, 0, 0
  1107 00000C62 [9A0F]4C02[A50F]61- <2>
  1107 00000C69 02[B60F]7802[C80F]- <2>
  1107 00000C70 F005[E20F]F805-     <2>
  1107 00000C76 [E90F]0006[F10F]08- <2>
  1107 00000C7D 06[F80F]C908[0010]- <2>
  1107 00000C84 F808[0810]0009-     <2>
  1107 00000C8A [1410]0809[1D10]10- <2>
  1107 00000C91 09[2910]1809[3210]- <2>
  1107 00000C98 2009[3D10]2809-     <2>
  1107 00000C9E [4410]3009[5A10]38- <2>
  1107 00000CA5 09[6610]BF0B[A910]- <2>
  1107 00000CAC E60B[7210]F80B-     <2>
  1107 00000CB2 [B210]3A0C[B210]4A- <2>
  1107 00000CB9 0C[BF10]00000000    <2>
  1108                              <2> %endif
  1109                              <2> 
  1110                              <2> %if _ELD_LINKER_PASSES
  1111                              <2> linkerlinkercoderelocations:
  1112                              <2> %if _ELDCALL_OPTIONAL || _ELDCALL_NEXT
  1113                              <2> 	dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
  1114                              <2> %else
  1115 00000CC0 9A0A[7210]B60A-     <2> 	dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
  1115 00000CC6 [7C10]C00A[920F]C9- <2>
  1115 00000CCD 0A[8C10]00000000    <2>
  1116                              <2> %endif
  1117                              <2> 
  1118                              <2> 	align 2, db 0
  1119                              <2> linktable:
  1120                              <2> 	istruc LINKTABLE
  1121                              <2> at ltCodeToCode
  1122 00000CD4 4C0F                <2> 	dw internallinkercodetocoderelocations - code
  1123 00000CD6 FC0D                <2> 	dw internalcodetocoderelocations - code
  1124                              <2> at ltCodeToData
  1125 00000CD8 540F                <2> 	dw internallinkercodetodatarelocations - code
  1126 00000CDA 320E                <2> 	dw internalcodetodatarelocations - code
  1127                              <2> at ltDataToCode
  1128 00000CDC 560F                <2> 	dw internallinkerdatatocoderelocations - code
  1129 00000CDE 3A0F                <2> 	dw internaldatatocoderelocations - code
  1130                              <2> at ltDataToData
  1131 00000CE0 580F                <2> 	dw internallinkerdatatodatarelocations - code
  1132 00000CE2 3C0F                <2> 	dw internaldatatodatarelocations - code
  1133                              <2> at ltLinkData
  1134 00000CE4 3E0F                <2> 	dw linkerlinkerdatarelocations - code
  1135 00000CE6 EC0C                <2> 	dw linkerdatarelocations - code
  1136                              <2> at ltLinkCode
  1137 00000CE8 C00C                <2> 	dw linkerlinkercoderelocations - code
  1138 00000CEA 5C0C                <2> 	dw linkercoderelocations - code
  1139                              <2> 	iend
  1140                              <2> %endif
  1141                              <2> 
  1142                              <2> 	align 2, db 0
  1143                              <2> linkerdatarelocations:
  1144 00000CEC 01003500[CA10]0100- <2> 	dw LINK_DATA_RELOCATIONS, 0
  1144 00000CF4 7E00[D810]01008200- <2>
  1144 00000CFC [CA10]0100BB00-     <2>
  1144 00000D02 [E610]0100BF00-     <2>
  1144 00000D08 [F510]01001301-     <2>
  1144 00000D0E [CA10]01001C01-     <2>
  1144 00000D14 [0411]01002201-     <2>
  1144 00000D1A [0F11]01005F01-     <2>
  1144 00000D20 [1811]01006301-     <2>
  1144 00000D26 [F510]01007C01-     <2>
  1144 00000D2C [CA10]0100A001-     <2>
  1144 00000D32 [CA10]0100AD01-     <2>
  1144 00000D38 [CA10]0100C301-     <2>
  1144 00000D3E [F510]0100C701-     <2>
  1144 00000D44 [1811]0100DD01-     <2>
  1144 00000D4A [1811]0100FC01-     <2>
  1144 00000D50 [2211]01000402-     <2>
  1144 00000D56 [2C11]01000702-     <2>
  1144 00000D5C [3611]01003A02-     <2>
  1144 00000D62 [4811]01007202-     <2>
  1144 00000D68 [5811]01007602-     <2>
  1144 00000D6E [5811]01008002-     <2>
  1144 00000D74 [5811]01008402-     <2>
  1144 00000D7A [5811]0100AC05-     <2>
  1144 00000D80 [0411]0100B505-     <2>
  1144 00000D86 [0F11]0100DB05-     <2>
  1144 00000D8C [CA10]0100E105-     <2>
  1144 00000D92 [F510]01001406-     <2>
  1144 00000D98 [4811]01002A06-     <2>
  1144 00000D9E [5811]01002F06-     <2>
  1144 00000DA4 [5811]01003206-     <2>
  1144 00000DAA [5811]01003606-     <2>
  1144 00000DB0 [5811]01009006-     <2>
  1144 00000DB6 [6411]01009806-     <2>
  1144 00000DBC [6411]01002A07-     <2>
  1144 00000DC2 [6411]0100B508-     <2>
  1144 00000DC8 [6F11]0100BC08-     <2>
  1144 00000DCE [8611]0100C008-     <2>
  1144 00000DD4 [4811]0100C708-     <2>
  1144 00000DDA [9911]0100CA0B-     <2>
  1144 00000DE0 [B711]0100F30B-     <2>
  1144 00000DE6 [0F11]0100150C-     <2>
  1144 00000DEC [CA10]0100280C-     <2>
  1144 00000DF2 [DC11]01012E0C-     <2>
  1144 00000DF8 [ED11]0000          <2>
  1145                              <2> 
  1146                              <2> 	align 2, db 0
  1147                              <2> internalcodetocoderelocations:
  1148 00000DFC 24002B003100AB00B0- <2> 	dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
  1148 00000E05 00E300E80082018601- <2>
  1148 00000E0E 8D0194019A01A901B3- <2>
  1148 00000E17 01B601BE01CC01E101- <2>
  1148 00000E20 E401EA01C505E40BEE- <2>
  1148 00000E29 0B0B0C110C480C0000  <2>
  1149                              <2> 
  1150                              <2> 	align 2, db 0
  1151                              <2> internalcodetodatarelocations:
  1152 00000E32 420046004A004E00FE- <2> 	dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
  1152 00000E3B 00020106010A014A01- <2>
  1152 00000E44 4E0152015601CF01E7- <2>
  1152 00000E4D 01100215021A021F02- <2>
  1152 00000E56 1004140418041C0420- <2>
  1152 00000E5F 0426042A042F043304- <2>
  1152 00000E68 38043C043F0443044E- <2>
  1152 00000E71 0458045C0469046B04- <2>
  1152 00000E7A 6F04710478047B0487- <2>
  1152 00000E83 048A048E0492049604- <2>
  1152 00000E8C 9904A004A804AC04B0- <2>
  1152 00000E95 04B404B804BD04D504- <2>
  1152 00000E9E DA04E904ED04F104F8- <2>
  1152 00000EA7 040A051B052C053305- <2>
  1152 00000EB0 3B054605490557055B- <2>
  1152 00000EB9 056405680570057405- <2>
  1152 00000EC2 7905810586058A0590- <2>
  1152 00000ECB 0594059A059E05D405- <2>
  1152 00000ED4 1E0646065F06680676- <2>
  1152 00000EDD 0684068A06A606B106- <2>
  1152 00000EE6 BF06C306C606D406DF- <2>
  1152 00000EEF 06E306E606EA061B07- <2>
  1152 00000EF8 1F0723072707430748- <2>
  1152 00000F01 0755078907D907E307- <2>
  1152 00000F0A F207FF07030806080F- <2>
  1152 00000F13 08130816081A083C08- <2>
  1152 00000F1C 4008440848086E0873- <2>
  1152 00000F25 088508890892089608- <2>
  1152 00000F2E 9C08A708E108E608ED- <2>
  1152 00000F37 080000              <2>
  1153                              <2> 
  1154                              <2> 	align 2, db 0
  1155                              <2> internaldatatocoderelocations:
  1156 00000F3A FFFF                <2> 	dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
  1157                              <2> 
  1158                              <2> 	align 2, db 0
  1159                              <2> internaldatatodatarelocations:
  1160 00000F3C FFFF                <2> 	dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
  1161                              <2> 
  1162                              <2> %if _ELD_LINKER_PASSES
  1163                              <2> 	align 2, db 0
  1164                              <2> linkerlinkerdatarelocations:
  1165 00000F3E 0100910A[6411]0100- <2> 	dw LINK_LINKER_DATA_RELOCATIONS, 0
  1165 00000F46 780B[A611]0000      <2>
  1166                              <2> 
  1167                              <2> 	align 2, db 0
  1168                              <2> internallinkercodetocoderelocations:
  1169 00000F4C 6A0A7B0AA30A0000    <2> 	dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
  1170                              <2> 
  1171                              <2> 	align 2, db 0
  1172                              <2> internallinkercodetodatarelocations:
  1173 00000F54 0000                <2> 	dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
  1174                              <2> 
  1175                              <2> 	align 2, db 0
  1176                              <2> internallinkerdatatocoderelocations:
  1177 00000F56 FFFF                <2> 	dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
  1178                              <2> 
  1179                              <2> 	align 2, db 0
  1180                              <2> internallinkerdatatodatarelocations:
  1181 00000F58 FFFF                <2> 	dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
  1182                              <2> %endif
  1183                              <2> 
  1184                              <2> %if ELDOTHER
  1185                              <2> 	align 2, db 0
  1186                              <2> linkerotherdatarelocations:
  1187                              <2> 	dw LINK_OTHER_DATA_RELOCATIONS, 0
  1188                              <2> 
  1189                              <2>  %ifnidn LINK_OTHER_LINKER_DATA_RELOCATIONS, ""
  1190                              <2>   %error Other linker data links not supported
  1191                              <2>  %endif
  1192                              <2> %endif
  1193                              <2> 
  1194                              <2> %if ELDOTHER || ELDHINT
  1195                              <2> 	align 2, db 0
  1196                              <2> debuggeramissig:
  1197 00000F5A 65636D20<rep 5h>    <2> 		fill 8, 32, db "ecm"
  1198 00000F62 6C446562756720-     <2> 		fill 8, 32, db "lDebug"
  1198 00000F62 <rep 2h>            <2>
  1199                              <2> %endif
  1200                              <2> 
  1201                              <2> %if ELDOTHER
  1202                              <2> 	align 2, db 0
  1203                              <2> loaderamissig:
  1204                              <2> 		fill 8, 32, db "ecm"
  1205                              <2> 		fill 8, 32, db "Loader"
  1206                              <2> %endif
  1207                              <2> 
  1208                              <2> %ifnidni _LISTING, ""
  1209                              <2> listmsg:
  1210 00000F6A 547261634C6973742D- <2> .hint:		db "TracList-add-offset=",_LISTING,"::"
  1210 00000F73 6164642D6F66667365- <2>
  1210 00000F7C 743D65787470616B2E- <2>
  1210 00000F85 6C73743A3A          <2>
  1211 00000F8A 2D2D2D2D680D0A00    <2> .hint.offset:	asciz "----h",13,10
  1212                              <2> %endif
  1213                              <2> 
  1214 00000F92 B21205736574726368- <2> 	eldcall_dump_names ELDCALL_CODE_NAMES
  1214 00000F9B 31085F646F7363616C- <2>
  1214 00000FA4 6C8EF70E646F736361- <2>
  1214 00000FAD 6C6C5F657874736567- <2>
  1214 00000FB6 FF8B0F79795F626F6F- <2>
  1214 00000FBF 745F726561642E6278- <2>
  1214 00000FC8 63E41779795F626F6F- <2>
  1214 00000FD1 745F7365656B5F6375- <2>
  1214 00000FDA 7272656E742E627828- <2>
  1214 00000FE3 90046973706D551205- <2>
  1214 00000FEC 707574737ABABD0463- <2>
  1214 00000FF5 6D6433A7AA05657272- <2>
  1214 00000FFE 6F72629605496E444F- <2>
  1214 00001007 53D55509736B697063- <2>
  1214 00001010 6F6D6D61E83A066973- <2>
  1214 00001019 656F6C3F03C3096973- <2>
  1214 00001022 737472696E673FDDB9- <2>
  1214 0000102B 0663686B656F6C67B1- <2>
  1214 00001034 087472696D70757473- <2>
  1214 0000103D C5C604707574738490- <2>
  1214 00001046 136973656F6C3F2E6E- <2>
  1214 0000104F 6F7473656D69636F6C- <2>
  1214 00001058 6F6EA45509736B6970- <2>
  1214 00001061 636F6D6D30F1230975- <2>
  1214 0000106A 707065726361736584- <2>
  1214 00001073 8107686578776F7264- <2>
  1214 0000107C 6FA20D707574736C69- <2>
  1214 00001085 6E655F63726C66D0BB- <2>
  1214 0000108E 1A636F70795F73696E- <2>
  1214 00001097 676C655F636F756E74- <2>
  1214 000010A0 65645F737472696E67- <2>
  1214 000010A9 986906696E7463686B- <2>
  1214 000010B2 21300A63616C6C5F69- <2>
  1214 000010BB 6E743244B774087365- <2>
  1214 000010C4 746573326478        <2>
  1215 000010CA E7D30B657874736567- <2> 	link_data_dump_names LINK_DATA_NAMES
  1215 000010D3 5F757365642BC80B65- <2>
  1215 000010DC 78747365675F73697A- <2>
  1215 000010E5 65F6340C6578746461- <2>
  1215 000010EE 74615F73697A65B240- <2>
  1215 000010F7 0C657874646174615F- <2>
  1215 00001100 75736564EB42086578- <2>
  1215 00001109 74647373656CD52D06- <2>
  1215 00001112 6578747365672AAE07- <2>
  1215 0000111B 65787464617461FF7E- <2>
  1215 00001124 076C696E6B73656CFA- <2>
  1215 0000112D 7E076C696E6B736567- <2>
  1215 00001136 2B850F6C696E6B696E- <2>
  1215 0000113F 666F61646472657373- <2>
  1215 00001148 899F0D696E7465726E- <2>
  1215 00001151 616C666C6167738274- <2>
  1215 0000115A 096C6F61645F646174- <2>
  1215 00001163 6184E3086C696E655F- <2>
  1215 0000116C 6F7574222914657874- <2>
  1215 00001175 5F66696E6973682E62- <2>
  1215 0000117E 705F69735F7365740F- <2>
  1215 00001187 08106C6F61645F6461- <2>
  1215 00001190 74615F6C6F77657374- <2>
  1215 00001199 C71C0A6578745F6861- <2>
  1215 000011A2 6E646C6568440E6C69- <2>
  1215 000011AB 6E6B63616C6C5F7461- <2>
  1215 000011B4 626C65F09E22747279- <2>
  1215 000011BD 5F6465627567676572- <2>
  1215 000011C6 5F616D69735F6D756C- <2>
  1215 000011CF 7469706C65785F6E75- <2>
  1215 000011D8 6D626572CB510E696E- <2>
  1215 000011E1 7465726E616C666C61- <2>
  1215 000011EA 677334688C15616D69- <2>
  1215 000011F3 735F6D756C7469706C- <2>
  1215 000011FC 65785F6E756D626572  <2>
  1216                              <2> %if ELDOTHER
  1217                              <2> 	link_data_dump_names LINK_OTHER_DATA_NAMES
  1218                              <2> %endif
  1219                              <2> 
  1220                              <2> lmsg:
  1221                              <2> %if _ELD_LINKER_PASSES
  1222                              <2> %if _ELDCALL_OPTIONAL
  1223                              <2> .warning_code_optional:		counted "Optional code link missing, hash="
  1224                              <2> %endif
  1225                              <2> %if _ELDDATA_OPTIONAL
  1226                              <2> .warning_data_optional:		counted "Optional data link missing, hash="
  1227                              <2> %endif
  1228 00001205 1844617461206C696E- <2> .error_data:			counted "Data link missing, hash="
  1228 0000120E 6B206D697373696E67- <2>
  1228 00001217 2C20686173683D      <2>
  1229 0000121E 18436F6465206C696E- <2> .error_code:			counted "Code link missing, hash="
  1229 00001227 6B206D697373696E67- <2>
  1229 00001230 2C20686173683D      <2>
  1230 00001237 0A682C206C6162656C- <2> .error.2:			counted "h, label ",'"'
  1230 00001240 2022                <2>
  1231                              <2> %endif
  1232                              <2> %if ELDOTHER
  1233                              <2> .no_other:		asciz "ELD linker: No other link info found!",13,10
  1234                              <2> .error_other:		asciz "ELD linker: Other link info unknown format!",13,10
  1235                              <2> %endif
  1236                              <2> 
  1237 00001242 00<rep Eh>          <2> 	align 16, db 0
  1194                              <1> 
  1195                              <1> 	align 16
  1196                              <1> code_size equ $ - code
  1197                              <1> 
  1198                              <1> %if _ALIGNPAGE
  1199                              <1> LIBOFFSETUNALIGNED equ DATAOFFSET + data_size
  1200                              <1> 	addsection ALIGNED, follows=DATA vstart=0
  1201                              <1> aligned:
  1202 00000000 00<rep 1B0h>        <1> 	times (((512) - ((LIBOFFSETUNALIGNED) % (512))) % (512)) db 0
  1203                              <1> 	endarea aligned
  1204                              <1> 
  1205                              <1> LIBOFFSET equ LIBOFFSETUNALIGNED + aligned_size
  1206                              <1> 	addsection LIB, follows=ALIGNED vstart=0
  1207                              <1> %else
  1208                              <1> LIBOFFSET equ DATAOFFSET + data_size
  1209                              <1> 	addsection LIB, follows=DATA vstart=0
  1210                              <1> %endif
  1211                              <1> lib_start:
  1212                              <1> 
  1213                              <1>  %if _COMPRESSED
  1214                              <1>   %if _XLD
  1215                              <1>    %if _LZEXEDAT
  1216                              <1> 	incbin "packlibx.lz"
  1217                              <1>    %else
  1218                              <1> 	incbin "packlibx.hs"
  1219                              <1>    %endif
  1220                              <1>   %else
  1221                              <1>    %if _LZEXEDAT
  1222 00000000 <bin 25F9Ah>        <1> 	incbin "packlibe.lz"
  1223                              <1>    %else
  1224                              <1> 	incbin "packlibe.hs"
  1225                              <1>    %endif
  1226                              <1>   %endif
  1227                              <1> lib_compressed_end:
  1228                              <1> 
  1229 00025F9A 00<rep 6h>          <1> 	align 16, db 0
  1230                              <1> length_to_truncate equ $ - lib_start + LIBOFFSET
  1231                              <1> 
  1232                              <1> 	addsection LIBDEPACKED, follows=LIB vstart=0
  1233                              <1> library_start_skip:
  1234                              <1>  %endif
  1235                              <1> 
  1236 00000CA0 <bin CA0h>-         <1> dump_incbin INCBINLIST
  1236 00001D20 <bin 1080h>-        <1>
  1236 00002970 <bin C50h>-         <1>
  1236 00003560 <bin BF0h>-         <1>
  1236 00004010 <bin AB0h>-         <1>
  1236 000058D0 <bin 18C0h>-        <1>
  1236 00006420 <bin B50h>-         <1>
  1236 00007120 <bin D00h>-         <1>
  1236 00008840 <bin 1720h>-        <1>
  1236 00009480 <bin C40h>-         <1>
  1236 0000AED0 <bin 1A50h>-        <1>
  1236 0000C270 <bin 13A0h>-        <1>
  1236 0000CC30 <bin 9C0h>-         <1>
  1236 0000DF30 <bin 1300h>-        <1>
  1236 0000ED30 <bin E00h>-         <1>
  1236 0000FB30 <bin E00h>-         <1>
  1236 00010EC0 <bin 1390h>-        <1>
  1236 00011FF0 <bin 1130h>-        <1>
  1236 000127F0 <bin 800h>-         <1>
  1236 00013EC0 <bin 16D0h>-        <1>
  1236 000146C0 <bin 800h>-         <1>
  1236 00014E60 <bin 7A0h>-         <1>
  1236 00015AC0 <bin C60h>-         <1>
  1236 00016D00 <bin 1240h>-        <1>
  1236 000177A0 <bin AA0h>-         <1>
  1236 00018E00 <bin 1660h>-        <1>
  1236 00019570 <bin 770h>-         <1>
  1236 0001A3E0 <bin E70h>-         <1>
  1236 0001B350 <bin F70h>-         <1>
  1236 0001C150 <bin E00h>-         <1>
  1236 0001D960 <bin 1810h>-        <1>
  1236 0001E650 <bin CF0h>-         <1>
  1236 0001F370 <bin D20h>-         <1>
  1236 0001FF70 <bin C00h>-         <1>
  1236 00020D00 <bin D90h>-         <1>
  1236 00021920 <bin C20h>-         <1>
  1236 00022790 <bin E70h>-         <1>
  1236 00023410 <bin C80h>-         <1>
  1236 00023FF0 <bin BE0h>-         <1>
  1236 000248F0 <bin 900h>-         <1>
  1236 00027370 <bin 2A80h>-        <1>
  1236 0002A140 <bin 2DD0h>-        <1>
  1236 0002B1F0 <bin 10B0h>-        <1>
  1236 0002D5A0 <bin 23B0h>-        <1>
  1236 0002E780 <bin 11E0h>-        <1>
  1236 0002F910 <bin 1190h>-        <1>
  1236 00030CA0 <bin 1390h>-        <1>
  1236 000317B0 <bin B10h>-         <1>
  1236 000323B0 <bin C00h>-         <1>
  1236 00032EA0 <bin AF0h>-         <1>
  1236 00033AE0 <bin C40h>-         <1>
  1236 00034700 <bin C20h>-         <1>
  1236 00034DF0 <bin 6F0h>-         <1>
  1236 000363E0 <bin 15F0h>-        <1>
  1236 00036DF0 <bin A10h>-         <1>
  1236 00037D00 <bin F10h>-         <1>
  1236 00039290 <bin 1590h>-        <1>
  1236 00039E90 <bin C00h>-         <1>
  1236 0003B120 <bin 1290h>-        <1>
  1236 0003C0E0 <bin FC0h>-         <1>
  1236 0003CF90 <bin EB0h>-         <1>
  1236 0003DF40 <bin FB0h>-         <1>
  1236 0003EC70 <bin D30h>-         <1>
  1236 0003EC70 <bin 12A0h>         <1>
  1237                              <1> library_end_skip:
  1238                              <1> 
  1239                              <1>  %if _COMPRESSED
  1240 0003FF10 A0790200            <1> 	dd length_to_truncate
  1241                              <1>  %endif
  1242                              <1> %endif
